construction.extrude

construction.extrude

Extrude a 2D profile into a solid SDF.

Functions

Name Description
extrude Extrude a 2D profile into a solid.

extrude

construction.extrude.extrude(
    profile,
    depth,
    material=None,
    draft=0.0,
    twist=0.0,
)

Extrude a 2D profile into a solid.

Generates an :class:~cadjoint.sdf.primitives.polygon.ExtrudedPolygon that shares the profile’s vertex parameters and is placed on the profile’s sketch plane. The solid spans ±depth/2 around the plane.

Parameters

Name Type Description Default
profile PolygonProfile PolygonProfile to extrude. required
depth float | Scalar Total extrusion depth. required
material Optional render material. None
draft float | Scalar Draft angle in degrees. Positive values taper the walls inward as local z increases; the profile is exact at the bottom cap. 0.0
twist float | Scalar Total twist in degrees over the full depth. Non-zero twist makes the field non-1-Lipschitz. 0.0

Returns

Name Type Description
SDF solid sharing parameter references with the construction tree, with its analytic faces bound on: solid.cap("+") and solid.cap("-") for the two ends, solid.side(i) for the wall swept by profile edge i, and solid.faces for all of them. A drafted or twisted extrusion declares none — see :func:cadjoint.construction.faces.extrusion_faces.

Example

profile = PolygonProfile([[0, 0], [2, 0], [2, 1], [0, 1]])
solid = extrude(profile, depth=0.5)
boss = PolygonProfile(SQUARE, plane=SketchPlane.on(solid.cap("+")))