Design builder
design(name) creates a DesignBuilder. It is an authoring scope that owns
parameters, materials, feature references, assemblies, configurations,
topology references, and outputs.
Builder references are intentionally scoped. Passing a SolidRef, PartRef,
MaterialRef, parameter, or topology reference from another builder throws at
authoring time. This prevents a document from silently containing unresolved
cross-document links.
Each ID is explicit and stable:
Design document
cad.build() emits the current DesignDocument version. A document is:
- plain JSON-compatible data
- deeply frozen after authoring or parsing
- validated against size, depth, expression, graph, and reference limits
- independent of a geometry backend
- explicit about its schema URI and protocol version
parseDocument() or parseDocumentValue() so the
runtime validates it before evaluation.
Expressions
Parameters and arithmetic produce immutable expression trees. Dimensions are tracked by TypeScript and checked again at runtime. Length plus length is valid; length plus angle is not. Multiplying or dividing by a scalar preserves the source dimension. Expressions are resolved only when a document is evaluated. A single document therefore describes a family of variants rather than one baked mesh.Evaluator
AnEvaluator orchestrates:
- document validation and migration boundary checks
- configuration and parameter resolution
- sketch constraint solving
- dependency-ordered feature evaluation
- topology query resolution
- kernel calls and native ownership
- output, measurement, mass, and BOM views
CadResult diagnostics. Expected modeling failures do not rely
on parsing exception messages.
Geometry kernel
TheGeometryKernel protocol is the boundary between the evaluator and a
geometry engine. A kernel advertises versioned capabilities before work begins.
The evaluator checks the capability required by each operation instead of
assuming a method happens to exist.
InvariantCAD ships two public kernel choices:
- Manifold for robust watertight mesh operations and the default experience
- OpenCascade for exact B-Rep operations and native STEP/BREP exchange
Evaluated results
A successful evaluation returns anEvaluatedDesign. It owns all native shapes
created for that run. Outputs are views into that ownership scope:
Topology intent
Transient face and edge indices are not durable design intent. InvariantCAD separates two kinds of topology selection:- Semantic queries select current topology using feature origin, roles, geometry, adjacency, logical set operations, and cardinality.
- Persistent references store bounded detached evidence and resolve it against a later compatible topology snapshot.
Determinism versus geometry identity
Deterministic serialization and feature hashing identify effective authored intent. They do not prove two kernels emitted byte-identical or geometrically identical native shapes. Likewise, persistent topology evidence identifies a unique compatible subshape; it is not a native shape cache. These layers are deliberately independent:
Read the architecture for the full invariants and protocol
boundaries.