-
Notifications
You must be signed in to change notification settings - Fork 291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Select edges after transformed() #443
Comments
Selectors work in world coordinates. You can specify arbitrary direction like so: |
I tried this to get the exact vector parallel to rotated X: pl = [(0, 0), (0.9900000000000002, 1.7147302994931883), (0.9033974596215564, 1.7647302994931884),
(0, 0.19999999999999996)]
gt = cq.Workplane('YZ').workplane(offset=-2).center(-1,-20.4).transformed(rotate=(-20,0,0)).polyline(pl)
.mirrorY().extrude(100)
sel = '|' + str((cos(-20),0,sin(-20)))
gt = gt.edges(sel).chamfer(0.5/6) but I get the error:
If there is no other way I will do it with an afterwards rotation as you suggest. |
That sounds like a bug in the parser. |
The parser doesn't seem to like the spaces in the tuple string. This gets past that error, but then still says edges must be selected. pl = [(0, 0), (0.9900000000000002, 1.7147302994931883), (0.9033974596215564, 1.7647302994931884),
(0, 0.19999999999999996)]
gt = (cq.Workplane('YZ').workplane(offset=-2).center(-1,-20.4).transformed(rotate=(-20,0,0)).polyline(pl)
.mirrorY().extrude(100))
log(str((cos(-20),0,sin(-20))))
#sel = '|' + str((cos(-20),0,sin(-20)))
sel = r"|(0.40808206181339196,0,-0.9129452507276277)"
gt = gt.edges(sel).chamfer(0.5/6) |
Here you can see the tangents of all the edges:
I don't see anything similar to the query value. |
I'm not sure on that, I just copied the value of pl = [(0, 0), (0.9900000000000002, 1.7147302994931883), (0.9033974596215564, 1.7647302994931884),
(0, 0.19999999999999996)]
gt = (cq.Workplane('YZ').workplane(offset=-2).center(-1,-20.4).transformed(rotate=(-20,0,0)).polyline(pl)
.mirrorY().extrude(100))
log(str((cos(-20),0,sin(-20))))
sel = '|' + str((cos(-20),0,sin(-20)))
sel = sel.replace(' ', '')
gt = gt.edges(sel).chamfer(0.5/6) |
What I mean is: To print all the tangents you can use the following code: for e in gt.edges().vals(): print(e.tangentAt()) |
@adam-urbanczyk @jmwright import cadquery as cq
from math import cos, sin ,pi
pl = [(0, 0), (0.9900000000000002, 1.7147302994931883), (0.9033974596215564, 1.7647302994931884), (0, 0.19999999999999996)]
gt = cq.Workplane('YZ').workplane(offset=-2).center(-1,-20.4).transformed(rotate=(-20,0,0)).polyline(pl).mirrorY().extrude(100)
for e in gt.edges().vals(): print(e.tangentAt())
sel = '|' + str((cos(20*pi/180), 0., sin(20*pi/180)))
sel = sel.replace(' ', '')
print("sel = ", sel)
gt = gt.edges(sel).chamfer(0.5/6)
show_object(gt) yields
so it is trying to do something |
Problem solved, the following code gives the expected result, there were rounding issues in import cadquery as cq
from math import cos, sin, tan, pi
A = 20
pl = [(0, 0), (1., 1.7147302994931883), (0.9033974596215564, 1.7647302994931884), (0, 0.2)]
gt = cq.Workplane('YZ').workplane(offset=-2).center(-1,-20.4).transformed(rotate=(-A,0,0)).polyline(pl).mirrorY().extrude(100)
sel = '|' + str((cos(A*pi/180), 0., sin(A*pi/180)))
sel = sel.replace(' ', '')
gt = gt.edges(sel).chamfer(0.1/2)
show_object(gt) |
I want to create a volume having champfered edges parallel to X in the transformed referential with
but it does not work, as if it was back in the non rotated workplane.
But I don't see how to do it. Any ideas?
The text was updated successfully, but these errors were encountered: