Supported dimensions
Arithmetic
Every expression exposes immutable arithmetic methods:addandsubrequire the same dimension.mulanddivaccept a scalar expression or finite number.negandabspreserve the dimension.expr.min,expr.max, and trigonometric helpers construct additional serializable operations.expr.minandexpr.maxrequire one dimension,expr.sin,expr.cos, andexpr.tantake an angle and return a scalar, andexpr.ratiodivides two values of the same dimension into a scalar.
TypeError for a wrong-dimensional expression from an untyped
caller. Document validation applies them again to documents received from
untyped or hostile sources.
Vectors
Use vector helpers to preserve component dimensions:vec2 and vec3 contain lengths. scalarVec3 is used for scale and directions;
angleVec3 is used for Euler rotations.
Evaluation overrides
Override values by parameter ID:width: 125 means 125 mm, even if the default was written as
inch(4.5), and taper: Math.PI / 36 means 5 degrees because angles are
stored in radians.
An override can also be an expression object of the parameter’s dimension:
EXPRESSION_DIMENSION_MISMATCH when they differ, for example deg(5) for
a length. A matching expression is evaluated like a configuration binding, so it
may also reference other parameters of the same document.
Prefer plain numbers when overrides arrive as data, such as JSON, CLI
arguments, or a worker message. Expression objects are authoring objects: a
serialized or structured-cloned copy is no longer an
Expression and fails
with EXPRESSION_INVALID.Configuration overrides
A named configuration can bind parameters inside the document:Parameter ownership
Parameters are bound to theDesignBuilder that created them. Cross-design use
throws immediately, including inside derived expressions, vectors, transform
operations, sketch entities, topology predicates, parameter defaults and
bounds, densities, configuration values, and assembly placements:
fromExpressionIR refers to parameters only by ID; the builder accepts it only
when that ID names a parameter it already defines, with the same dimension.
Raw IR must be plain JSON records and arrays whose fields are own enumerable
data properties. Accessors, inherited fields, and class instances throw
TypeError without running any accessor. A record may hold no symbol or
non-enumerable fields, and a min or max value array may hold nothing but
its operands, because the freeze would not reach such extra data.