Skip to main content

Creation and import

All Model construction methods return a new session-owned Shape. Inputs are ordinary Python numbers and sequences; coordinates are three-dimensional unless a sketch API explicitly uses 2D values.

Primitives

MethodParametersResult and constraints
box(width, depth, height)positive lengthsSolid based at the model origin and extending along positive axes
cylinder(radius, height)positive radius and heightSolid aligned with positive Z
sphere(radius)positive radiusClosed solid centered at the model origin
cone(radius1, radius2, height)non-negative radii, positive heightCone or frustum aligned with positive Z; both radii cannot define a degenerate solid
with cad.Model() as model:
plate = model.box(80.0, 50.0, 4.0)
boss = model.cylinder(8.0, 12.0)
body = model.union(plate, model.translate(boss, 40.0, 25.0, 4.0))

Polylines and profiles

polyline(points, closed=False) joins ordered points with straight segments. At least two distinct points are required for an open wire; a face requires a non-self-intersecting closed wire.

circle_profile(radius, center=(0, 0, 0), normal=(0, 0, 1)) returns a circular wire. The normal must be non-zero. arc(start, middle, end) constructs the arc passing through three non-collinear points.

interpolate(points, periodic=False, tolerance=1e-6) fits a curve through ordered points. periodic=True requests a closed periodic curve. helix(pitch, height, radius, center, direction) creates a helical curve along direction.

Exact B-splines

curve = model.bspline(
control_points=((0, 0, 0), (15, 5, 0), (30, 0, 0)),
degree=2,
knots=(0.0, 1.0),
multiplicities=(3, 3),
weights=None,
periodic=False,
)

Control-point count, degree, knot values, multiplicities, and optional weights must form a valid B-spline definition. Use interpolate when interpolation is the intent and exact knot control is unnecessary.

Faces and surfaces

MethodInputOutput
face(wire)closed planar wireplanar face
bezier_surface(points, weights=None)rectangular control gridBezier surface
fit_surface(points, tolerance=1e-3, degree_min=3, degree_max=8)rectangular sample gridfitted B-spline surface
ruled_surface(edge_a, edge_b)two compatible edgesruled face between edges
filling_surface(edges, tolerance=1e-6)ordered boundary edgesfilled face
gordon_surface(profiles, guides, tolerance=1e-6)intersecting profile/guide networksnetwork surface

Surface control and sample grids must be rectangular and finite. Network surfaces require mutually compatible curve families; native construction may reject disconnected or poorly conditioned boundaries.

Import

MethodFormatNotes
import_step(path)STEPExact CAD exchange geometry and assemblies reduced to a shape result
import_brep(path)OpenCascade BREPNative topology and geometry
import_stl(path)STLTessellated input; no exact analytic surface recovery is implied

Import methods read from disk and raise an I/O or native error for missing, unreadable, malformed, or unsupported files. Query kind, bbox, topology, and validate() before using imported geometry downstream.

Exact signatures: Model and the modeling catalog.