Skip to main content
This walkthrough builds a plate with a parameterized rectangular outline and a circular hole. The same immutable document is evaluated first with the default Manifold backend for STL and then with stock OCCT for exact STEP export.

Run the complete workflow

The example is a complete executable module. build() returns a deeply frozen current-version document; builder references such as profile, solid, and part never enter the serialized data. Parameter override numbers use base units: millimetres for length, radians for angle, unitless scalar values, and kilograms per cubic millimetre for mass density.

Understand the ownership boundary

Each successful evaluate() call owns every native shape created for that evaluation, so its EvaluatedDesign is disposed in a finally block. Each evaluator is also disposed in finally. The exact path has one additional edge: createOcctKernel() returns a caller-owned kernel, while a successfully created evaluator adopts it. If createEvaluator({ kernel }) rejects before that transfer, the caller still disposes the kernel. The example’s evaluatorOwnsKernel guard covers both paths without relying on a partially created evaluator. Exports are detached JavaScript values. The returned STL and STEP Uint8Arrays remain usable after their evaluated designs and evaluators have been disposed.

Save the results

The runtime example deliberately performs no filesystem writes. A Node.js application can persist its detached values:
stringifyDocument() canonicalizes values according to the document protocol. Use parseDocument() when loading untrusted text; do not cast parsed JSON to a DesignDocument. Read kernels before assuming every feature or topology history guarantee is identical between Manifold, stock OCCT, and the optional owned facade.

What to learn next

Expressions and parameters

Build dimension-safe formulas and understand evaluation overrides.

Sketches and constraints

Author reusable profiles with explicit loops and holes.

Assemblies and BOMs

Define reusable parts, nested occurrences, materials, and quantities.

Diagnostics

Handle structured failures, cancellation, and resource limits.