Create a workplane perpendicular to a line #1596
-
I want to create a sweep along a line. So I create a line first as the path and then I want to create the section to be swept along the line. To do that, I have to calculate different angels and positions. Is it possible to add a workplane at the end of the path and perpendicular to the that path? path = (cq.Workplane("YZ")
.transformed(offset=(-200, -30, 340))
.lineTo(3896, 2310)
)
p = (path.edges().workplane()
.rect(40, 40)
)
show_object([path, p])
|
Beta Was this translation helpful? Give feedback.
Answered by
lorenzncode
May 28, 2024
Replies: 1 comment 1 reply
-
Here is an example (free function API in master branch): import cadquery as cq
from cadquery.occ_impl.shapes import *
pts = [(10, 10, 0), (20, 10, 10), (30, 10, -10), (30, 0, 0)]
path = spline(pts)
# create plane at start of path with normal tangent to path
plane = cq.Plane(origin=path.startPoint(), normal=path.tangentAt(0))
profile = cq.Workplane(plane).polygon(3, 1).val()
sweep = sweep(profile, path, True) In your case with the path Edge in Workplane: import cadquery as cq
path = (cq.Workplane("YZ")
.transformed(offset=(-200, -30, 340))
.lineTo(3896, 2310)
)
plane = cq.Plane(origin=path.val().endPoint(), normal=path.val().tangentAt(1))
p = cq.Workplane(plane).rect(40, 40)
res = p.sweep(path) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Jopie01
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is an example (free function API in master branch):
In your case with the path Edge in Workplane: