awv-informatik / smlibpy
git clone https://github.com/awv-informatik/smlibpy.git
v0.3.5 · 5d ago
—
+3
stars, 24h · #8,403
+~28
stars, 7 days · #6,321
+192
stars, 30 days · #4,051
192
★ total · +17% this week
20
forks · 3 open issues
Star history (as recorded here)
LanguagePython
LicenseMIT
Created2026-10-12 (10d ago)
Last push1d ago
Watchers2
OwnerOrganization
Links
- GitHub: github.com/awv-informatik/smlibpy
- Homepage: https://smlibpy.classcad.ch
- Releases · Issues · Hacker News mentions
README excerpt
# smlibpy A Python library for 3D modeling on the SMLib NURBS kernel. The API follows the style of build123d's algebra mode and shares a few ideas with CadQuery, but not its method chains: shapes are plain values, and every operation returns a new one. It comes with an MCP server, so your agent can build parts too. And it runs in the browser: smlibwasm is the same library for JavaScript and TypeScript, on the kernel compiled to WebAssembly. **Website** · **Documentation** · **Getting started** · **API reference** · **For agents** · **JavaScript** [code] Parts are B-reps with exact surfaces: planes, cylinders, cones, spheres, tori and NURBS. Volumes, areas and inertia are integrated over those surfaces, and STEP files keep them as they are. You combine shapes with `+`, `-` and `&`, and every feature returns a new part. Faces and edges are picked by their geometry, for example `part.faces().top()` or `part.edges().parallel_to(Z).concave()`. The plate above builds in about 40 ms. The concepts explain shapes, planes, locations and selections. ## Features **Modeling** (parts, features) - Primitives: `Box`, `Cylinder`, `Cone`, `Sphere`, `Torus`, `Wedge` - Holes: `Hole`, `CounterBoreHole`, `CounterSinkHole`, placed with `Locations`, `GridLocations`, `PolarLocations`, `HexLocations` - Booleans: `fuse`, `cut`, `intersect`, which can also be written `+`, `-`, `&`; `merge` makes one part of several cells (as for several materials), `cells()` gives them back - Operations: `extrude` (also tapered), `revolve`, `loft`, `sweep` (also along helices), `shell`, `offset`, `thicken`, `draft`, `mirror`, `split`, `section` - Fillets: circular, variable radius, and curvature-continuous (G2/G3); chamfers **Sheet metal** - `fold` and `flange` with exact bends (radius and K-factor) - `unfold`, and `flat_pattern` with bend lines - `bends()`, `bend_allowance`, `bend_deduction`, `developed_length` **Deformation** - `twist`, `taper` and `bend` work on finished parts. A tapered cylinder becomes an exact cone. - Free-form deformation with a `Lattice` **Simplifying:** `remove_fillets` and `remove_faces` take out fillets, holes and bosses, also on imported parts. `faces().fillets()` finds the fillet faces. **Molding:** `draft` tilts walls, pockets and holes by a draft angle about a neutral plane. `draft_analysis` sorts each face for a pull direction into positive, insufficient, vertical or undercut. `parting_line` finds the parting line. **2D** (sketches) - `Profile` is a pen: it draws lines and tangent arcs, turns, and adds fillets and chamfers at corners as it goes. - Shapes: `Rectangle`, `RoundedRectangle`, `Circle`, `Ellipse`, `Polygon`, `RegularPolygon`, `Triangle`, `Trapezoid`, `Slot`, `ArcSlot`, `Hull`, and `Stroke` (a band along a path). The polygon shapes take `fillet=` and `chamfer=`. - Exact 2D Booleans, offsets, and corner fillets and chamfers. Sketches can be extruded, revolved and swept. - `Text` with exact font outlines (the Lato font is included) **Curves