Skip to content
Shapemetry

Model - Helpers

API reference for src/registry/helpers, src/nodeMethods/solid/helpers on @huukhanhnguyen/model, reachable from ., ./compute.

See the Guide for the ModelJSON / evaluate pipeline.

API reference

Signatures are generated from the live package .d.ts - not hand-written.

applyGeometry

function

Run a geometry op over the entity array: deep-clones so the op can mutate freely, re-stamps sourceKey so container-child attribution survives cardinality changes, and returns the next entity array.

Nested GROUP entities (copies / placed sub-models) pass through UNTOUCHED — a group is a structural wrapper, not geometry (dissolve it explicitly with blockExplode first to let the op reach the geometry inside). Exception: when the whole stream is leaf packs from array/mirror wrapAsBlocks (defs hold only raw leaves), dissolve first so curveFill / curveExtrude / booleans after array still work (wine-rack flow).

applyGeometry(state: ChainState, op: (entities: Entity[]) => unknown[], definitions?: DefinitionMap): ChainState

asFaces

function

Collect the Face faces from a value (single, array, or nested).

asFaces(input: unknown): ShellEntity[]

entityOp

function

Build a geometry op from a domain function + ordered arg values:

  • wholeArray fns get the ENTIRE entity array once: fn(entities, ...args) (solid ops need the whole face-set together).
  • per-entity fns run once per entity: fn(entity, ...args); an arg that evaluated to a function is resolved as an (entity, index) => value callback per entity — EXCEPT args declared "function"-typed, which pass through (predicates like edgeFilter).
entityOp(fn: (...a: unknown[]) => unknown, argValues: unknown[], argTypes: string[]): (entities: Entity[]) => unknown[]

explodeGroups

function

Dissolve nested blocks INSIDE the entity array into raw geometry (SketchUp Explode). nested = recursive; false = one level.

explodeGroups(state: ChainState, nested: boolean, definitions?: DefinitionMap): ChainState
Last updated: 📖 1 min readEdit on GitHub