CM3D-001: OpenSCAD and BOSL2 as design basis

Superseded by CM3D-007 · 2026-11-09 · @mathisloge

Context

The mechanical parts of the cocktail machine are 3D printed (Prusa Core One with INDX). The design should be fully parametric, versionable and reproducibly renderable without a GUI, so that e.g. a different tube only needs a new parameter set.

Decision

  • All printed parts are designed in OpenSCAD (Nightly, Manifold backend) with BOSL2 as the base library. Rendering always uses --backend=manifold.

  • NopSCADlib provides vitamin visuals (for example the 608 bearing in assembly views) and vitamin dimension data (for example BB608, from which the B608_* constants are derived). It never provides geometry of printed parts.

  • BOSL2 and NopSCADlib are Git submodules under lib/ at a fixed version, so the project renders reproducibly without a global installation.

  • A runner parses the OpenSCAD output for tests and STL export, because OpenSCAD exits with code 0 on failed assertions. It is described in CM3D-006: Project tooling: cm3d package, uv, pre-commit and an Antora preview.

This decision is superseded by CM3D-007: build123d replaces OpenSCAD as design basis: new and rebuilt parts are designed in build123d, and the OpenSCAD tree stays only until the pump is rebuilt.

Alternatives considered

  • FreeCAD: GUI-centric, so parametrics and diffs in Git are harder to follow.

  • CadQuery: Powerful, but needs an additional Python/OCC toolchain. No gain over OpenSCAD for the planned parts.

  • Global library installation: Not reproducible, because versions drift between machines.

Consequences

  • Good: Text-based, diffable, parametric design and a reproducible build.

  • Good: BOSL2 provides anchoring, rounding, chamfers and thread helpers.

  • Bad: Submodules must be fetched when cloning (git clone --recursive).

  • Bad: Requires the OpenSCAD Nightly build (Manifold backend).