Files
metabuilder/cadquerywrapper/examples/Ex025_Swept_Helix.py
johndoe6345789 a8144a5903 feat: Add CadQuery wrapper library for parametric CAD modeling
Python wrapper around CadQuery for simplified 3D CAD operations with
clean API for creating shapes, performing boolean operations, and
exporting to various formats.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 17:22:38 +00:00

21 lines
620 B
Python

import cadquery as cq
r = 0.5 # Radius of the helix
p = 0.4 # Pitch of the helix - vertical distance between loops
h = 2.4 # Height of the helix - total height
# Helix
wire = cq.Wire.makeHelix(pitch=p, height=h, radius=r)
helix = cq.Workplane(obj=wire)
# Final result: A 2D shape swept along a helix.
result = (
cq.Workplane("XZ") # helix is moving up the Z axis
.center(r, 0) # offset isosceles trapezoid
.polyline(((-0.15, 0.1), (0.0, 0.05), (0, 0.35), (-0.15, 0.3)))
.close() # make edges a wire
.sweep(helix, isFrenet=True) # Frenet keeps orientation as expected
)
show_object(result)