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
| Method | Parameters | Result and constraints |
|---|---|---|
box(width, depth, height) | positive lengths | Solid based at the model origin and extending along positive axes |
cylinder(radius, height) | positive radius and height | Solid aligned with positive Z |
sphere(radius) | positive radius | Closed solid centered at the model origin |
cone(radius1, radius2, height) | non-negative radii, positive height | Cone 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
| Method | Input | Output |
|---|---|---|
face(wire) | closed planar wire | planar face |
bezier_surface(points, weights=None) | rectangular control grid | Bezier surface |
fit_surface(points, tolerance=1e-3, degree_min=3, degree_max=8) | rectangular sample grid | fitted B-spline surface |
ruled_surface(edge_a, edge_b) | two compatible edges | ruled face between edges |
filling_surface(edges, tolerance=1e-6) | ordered boundary edges | filled face |
gordon_surface(profiles, guides, tolerance=1e-6) | intersecting profile/guide networks | network 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
| Method | Format | Notes |
|---|---|---|
import_step(path) | STEP | Exact CAD exchange geometry and assemblies reduced to a shape result |
import_brep(path) | OpenCascade BREP | Native topology and geometry |
import_stl(path) | STL | Tessellated 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.