gumyr / build123d

A python CAD programming library
Apache License 2.0
521 stars 89 forks source link

sweeping along a helix twists the 2d shape #349

Closed yshui closed 1 year ago

yshui commented 1 year ago

code:

with BuildPart() as screw:
    with BuildLine():
        t = Helix(4, 30, 6.35)
    with BuildSketch(Plane(origin=t @ 0, z_dir = t % 0)):
        Rectangle(2, 2)
    sweep()

I expect the square to rotate around the axis of the helix, i.e. perpendicular to the helix. but instead the square also gets twisted around a axis that's tangential to the helix:

a

jdegenstein commented 1 year ago

I believe this is expected behavior, here is how you can "fix" it by adding is_frenet=True to sweep()

image

yshui commented 1 year ago

Thanks!

Can you explain a bit why it twists, and what frenet is?

jdegenstein commented 1 year ago

There is a good writeup on the FreeCAD docs (build123d uses the same OCCT CAD core as FreeCAD, so typically most of the same considerations apply) https://wiki.freecad.org/Part_Sweep#Frenet

yshui commented 1 year ago

Thank you!