Skip to content
Shapemetry

@huukhanhnguyen/model / registry/helpers

registry/helpers

applyGeometry()

applyGeometry(state, op): ChainState

Run a geometry op over the *Data document. Nested BlockData passes through untouched, unless the stream is array/mirror leaf packs.

Parameters

state

ChainState

op

(data) => unknown

Returns

ChainState


dataOp()

dataOp(fn, argValues, argTypes): (data) => unknown

Parameters

fn

(...a) => unknown

argValues

unknown[]

argTypes

string[]

Returns

(data) => unknown


declaresCallback()

declaresCallback(type): boolean

Does this arg's declared type ACCEPT a callback? A union counts: an arg typed binary | function takes one, and testing for the exact string "function" silently CALLED every such callback instead of passing it through — which is how applyVisible((e, i) => …) became true.

Parameters

type

string | undefined

Returns

boolean


explodeGroups()

explodeGroups(state, _nested): ChainState

Dissolve nested blocks into the inner *Data (SketchUp Explode).

Through bakeBlock, so each PLACEMENT contributes its own leaf with its own matrix applied. Reading object.data directly instead dropped the placement: every array/mirror copy landed back on the original, and the weld then fused the duplicates into one body — a wrong answer that still looked like a valid solid.

Parameters

state

ChainState

_nested

boolean

Returns

ChainState


looseToBlocks()

looseToBlocks(state): ChainState

Cluster loose curves/faces into connected BlockData nests.

Parameters

state

ChainState

Returns

ChainState


makeBlock()

makeBlock(state): ChainState

Wrap the stream as one BlockData nest. Already a block passes through.

Parameters

state

ChainState

Returns

ChainState

Last updated: 📖 2 min readEdit on GitHub