Skip to main content

smlibpy

Parts modeled with smlibpy

Python CAD on SMLib, the NURBS solid modeling kernel NVIDIA released as open source.

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)

smlibpy models solids and surfaces with exact geometry, in a style that keeps scripts short and readable:

  • Shapes are values. +, - and & combine them; features return new shapes.

  • Selections read like sentences. part.edges().parallel_to(Z).concave().

  • The full kernel. Circular, variable and G2/G3 fillets, shells, lofts, sweeps, freeform surfaces, stitching, intersections, mass properties.

  • Exact files. STEP in and out with the exact geometry; meshes go to glTF and STL.

  • 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.

  • Examples: brackets, flanges, gears, a bottle.

  • The kernel: how smlibpy uses SMLib, accuracy and limits.