Skip to content

Commit 53a76d4

Browse files
authored
Merge pull request #594 from daemacles/jay/add_helix_example
Add Ex025 for sweeping a wire along a helix from cq.Wire.makeHelix()
2 parents 4c77c87 + e483b04 commit 53a76d4

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

examples/Ex025_Swept_Helix.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import cadquery as cq
2+
3+
r = 0.5 # Radius of the helix
4+
p = 0.4 # Pitch of the helix - vertical distance between loops
5+
h = 2.4 # Height of the helix - total height
6+
7+
# Helix
8+
wire = cq.Wire.makeHelix(pitch=p, height=h, radius=r)
9+
helix = cq.Workplane(obj=wire)
10+
11+
# Final result: A 2D shape swept along a helix.
12+
result = (
13+
cq.Workplane("XZ") # helix is moving up the Z axis
14+
.center(r, 0) # offset isosceles trapezoid
15+
.polyline(((-0.15, 0.1), (0.0, 0.05), (0, 0.35), (-0.15, 0.3)))
16+
.close() # make edges a wire
17+
.sweep(helix, isFrenet=True) # Frenet keeps orientation as expected
18+
)
19+
20+
show_object(result)

0 commit comments

Comments
 (0)