CM3D-007: build123d replaces OpenSCAD as design basis

Accepted · 2026-11-12 · @mathisloge

Context

CM3D-001 chose OpenSCAD with BOSL2 as the design basis. The next parts are a pod enclosure and a station with large rounded, ribbed panels, where exact geometry, real fillets and chamfers and strong tests pay off. A spike ported the pump lid to build123d (0.13, OpenCascade kernel) and compared it with the OpenSCAD lid. The numbers:

  • Parity: the exact volume is 67187.7 mm³. The STL at the export tolerance and the OpenSCAD STL are both 0.011 % below it, and the bounding boxes are equal to 0.001 mm.

  • Tests: 16 pytest tests ran in 3.5 s, against 11.7 s for the four collision variants of the OpenSCAD lid test, which build the whole pump each time. The Python tests count solids, select faces and report overlap volumes. They found a counterbore floor in the middle of a layer and a relief that the OpenSCAD constant had moved by 0.01 mm, both of which the OpenSCAD tests cannot see.

  • Export and picture: STL and 3MF in 4 s, a doc picture with pyvista in 5 s without a display.

  • Footprint: the Python environment is 947 MB (OCP, VTK), against one OpenSCAD installer.

  • Cost of moving the pump: an estimate of 8 to 14 working days to reach today’s state, with no new function for the machine.

  • Weak spots: no 3D hull, fillet errors that do not name the cause, builder-context leaks into helper functions, and API changes in 0.13.

The decision drivers after the spike are one toolchain without a mix of tools, a pump that is rebuilt improved and not 1:1, and a low number of different kinds of purchased parts.

Decision

Alternatives considered

  • Keep OpenSCAD and BOSL2 (CM3D-001): No migration cost, but weak tests, no real fillets and a second language next to the tooling.

  • Keep the pump in OpenSCAD and use build123d only for new parts: Avoids the migration now, but means two toolchains, two sets of conventions and parameters in two languages. Rejected, because the move is to be complete without a mix of tools.

  • CadQuery: The same kernel with a similar API, but build123d was chosen for its algebra style and because the spike showed that it works.

  • FreeCAD: GUI-centric, so parametrics and diffs in Git are harder to follow (as in CM3D-001).

Consequences

  • Good: Exact geometry, fillets and chamfers as operations on finished parts, and tests that say what collides, by how much and where.

  • Good: One language for parameters, tests, export, pictures and the bill of materials.

  • Good: No overlap tolerances in the model. Touching faces fuse cleanly.

  • Bad: The environment is about 1 GB, and every Python process pays about 3 s for the import.

  • Bad: Rebuilding the pump costs days, and until it is done the repository carries two toolchains.

  • Bad: The kernel has no 3D hull and gives little help when a fillet fails, so the repo skill lists these pitfalls.