gumyr / build123d

A python CAD programming library
Apache License 2.0
579 stars 94 forks source link

Docs: Add a "spring" example #759

Open KilowattSynthesis opened 4 weeks ago

KilowattSynthesis commented 4 weeks ago

Would be awesome if you could add an example that shows how to make a spring part (a circle swept on a helix)

KilowattSynthesis commented 4 weeks ago

Update: The following example works:

def spring_demo() -> bd.Part:
    """Construct a "spring" using a helix sweep of a circle."""
    p = bd.Part()
    helix = bd.Helix(radius=2, pitch=1, height=10, cone_angle=0)
    p += bd.sweep(
        path=helix,
        sections=((helix ^ 0) * bd.Circle(radius=0.3)),
    )
    return p

show(spring_demo())

image