smlibpy
A Python library for 3D modeling on the SMLib NURBS kernel. It comes with an MCP server, so your agent can build parts too.
from smlibpy import *
plate = Box(80, 60, 10)
plate = plate.fillet(plate.edges().parallel_to(Z), 8)
plate -= GridLocations(60, 40, 2, 2) * Cylinder(4, 10)
plate -= Rectangle(30, 20).on(plate.faces().top()).extrude(-4)
plate.export("plate.step")
show(plate)
Parts are B-reps with exact surfaces. You combine shapes with +, - and &, and every
feature returns a new part. Faces and edges are picked by their geometry, for example
part.edges().parallel_to(Z).concave(). Fillets can be circular, variable or G2/G3, and there
are shells, lofts, sweeps, direct edits of faces, freeform surfaces (also fitted to point clouds),
blends and bridges between surfaces, fills of holes and curve networks, parts of several cells,
sheet metal, deformations, stitching, intersections, rays and mass properties. STEP, USD,
OpenCASCADE .brep and DXF files are read and written with the exact geometry, IGES files read;
meshes go to glTF, OBJ and STL, and drawings with hidden lines to SVG and DXF.
Text comes from TrueType and OpenType fonts as exact outlines, ready to engrave or emboss.
- Getting started: install, a first part, the viewer.
- Concepts: shapes, planes, placement, patterns, selection.
- Sketches and parts: from 2D profiles to solids.
- Features: fillets, chamfers, shells, splits.
- Selecting: every way to pick faces and edges.
- Surfaces: freeform modeling and stitching.
- Measuring and files: mass properties, STEP, glTF.
- API: every call in Python; the same API on WebAssembly, in the browser and in Node (guide, reference), and with three.js objects (guide, reference); and for agents (MCP).
- Examples: brackets, flanges, gears, a bottle.
- The kernel: how smlibpy uses SMLib, accuracy and limits.