FoundationPartsOperationsSweep

Sweeps

A Sweep drives a closed 2D profile along a 3D path. The path can be a Helix3D (use Thread for fasteners) or a Spline3D interpolated through 3D points. Use the frenet flag to control whether the profile rotates along the path; pass twist (in degrees) to add a continuous rotation around the path.

from cadbuildr.foundation import *


class SweepSpline(Part):
    def __init__(self):
        s = Sketch(self.xy())
        profile = Circle(s.origin, 3)
        path = Spline3D(
            points=[
                Point3D(0, 0, 0),
                Point3D(20, 10, 30),
                Point3D(40, -5, 60),
                Point3D(60, 15, 90),
            ]
        )
        self.add_operation(Sweep(profile=profile, path=path))


show(SweepSpline())

For a twisted prism along a straight line:

from cadbuildr.foundation import *


class SweepTwist(Part):
    def __init__(self):
        s = Sketch(self.xy())
        profile = Hexagon(s.origin, 8)
        path = Spline3D(points=[Point3D(0, 0, 0), Point3D(0, 0, 60)])
        self.add_operation(Sweep(profile=profile, path=path, twist=180.0))


show(SweepTwist())