Model - Unit
API reference for src/core/unit on @huukhanhnguyen/model, reachable from ..
See the Guide for the ModelJSON / evaluate pipeline.
API reference
Signatures are generated from the live package .d.ts - not hand-written.
convertLaneUnits
function
Convert unit literals in the RAW-JSON lanes — everything Model.nodes does NOT hold (materials, layers, styles, views, components, textures, tables, cameras, skeletons, animations). Without this a component body's 600 stayed millimetres while the root graph converted around it.
Arg value types come from the REGISTRY — the same declared type the live NodeCollection pass reads — so an arg typed length converts wherever it is authored, and one typed number is left alone (that is why a mm-valued arg must declare length, not number).
PAPER lanes (sheets) are excluded on purpose: paper millimetres are not the model's length dimension and never rescale with it.
convertLaneUnits(chains: LaneChain[], registry: Registry, unitType: string, currentUnit: string, newUnit: string, hostRefType: (name: string) => string | null): voidconvertModelUnit
function
Convert all unit-carrying literal values reachable from nodes from currentUnit to newUnit, then record newUnit on the unit config. Covers parameter inputs + select options (recursing into group entries) and every generator/modifier arg of an applicable type, with dimensional inference for expressions (a reference like width - 18 converts only the literal 18). Standalone (not a Model method) so a UI holding only the NodeCollection + the scope's unit record can run the ONE canonical conversion — Model.convertUnit delegates here.
convertModelUnit(nodes: NodeCollection<ChildNode>, unit: UnitConfig, unitType: string, currentUnit: string, newUnit: string): void