@huukhanhnguyen/model / lanes/components/nodes
lanes/components/nodes
componentNodeOf()
componentNodeOf(
model,key):ChainNode<Component,ComponentBody>
Parameters
model
key
string
Returns
ChainNode<Component, ComponentBody>
componentScopeExtras()
componentScopeExtras(
model,consumer?):SharedIsolatedHooks& {resolvePlacedComponentBody: (key,argsOverride?) => {data:ObjectData;flat:boolean;opening:BrepData[]; }; }
Scope hooks a component's OWN isolated "component"-lane evaluation needs (evaluateComponent — full 3D grammar) — the 4 shared hooks above, PLUS resolvePlacedComponentBody (placeComponent's 3D-chain branch — raw, no flatness gate: a nested component placement inside another component's operations/opening is an ordinary 3D chain, same as the root scene[]). Deliberately NO resolvePlacedComponent (flat mode) and NO resolvePlacedNesting — a component's OWN scope never routes to placeComponent's flat branch (its owner.lane is "component", never "flat" — see DataNode's dispatch), and a whole-scene nesting scan here would risk the same self-reference cycle it risks at the root (this component's own placed output can itself join the very scene being scanned).
Parameters
model
consumer?
Returns
SharedIsolatedHooks & { resolvePlacedComponentBody: (key, argsOverride?) => { data: ObjectData; flat: boolean; opening: BrepData[]; }; }
evaluateComponent()
evaluateComponent(
model,key,argsOverride?):Resolved<ObjectData|undefined>
Flat-context public entry — envelope over the filtered data stream.
Parameters
model
key
string
argsOverride?
Record<string, string>
Returns
Resolved<ObjectData | undefined>
evaluateComponentGated()
evaluateComponentGated(
model,key,argsOverride?,consumer?):ObjectData|undefined
Shared by evaluateComponent (public, no consumer) and flatLaneExtras's resolvePlacedComponent (explicit consumer wiring) — resolves + returns the component's 2D content: the DECLARED representation (the whole body, when Component.flat is set — flat validates every node inside, forcing point args to z = 0 and force-flattening created documents, so the body is already 2D) else the inference fallback (gates on isFlat, throwing a named error otherwise). See evaluateComponent's own doc for the full contract.
Parameters
model
key
string
argsOverride?
Record<string, string>
consumer?
Returns
ObjectData | undefined
evaluatePart()
evaluatePart(
model,key,argsOverride?):Resolved<ObjectData|undefined>
Resolve + evaluate one components[] entry's FLAT PATTERN by key (see partPatternOf) — the 2D preview/nesting entry point. For the FOLDED 3D result, see the placePart producer (resolvePlacedPart below), which calls this internally.
Parameters
model
key
string
argsOverride?
Record<string, string>
Returns
Resolved<ObjectData | undefined>
partMetaOf()
partMetaOf(
model,component,argsOverride):PartMeta
Read one part component's fold metadata off its own parameters lane (the convention block above), with argsOverride applied. Unknown / wrongly-typed values fail soft to ABSENT (foldPart's own defaults apply) — only thickness is load-bearing, and foldPart itself throws the named error when it's missing.
Parameters
model
component
argsOverride
Record<string, string> | undefined
Returns
partPatternOf()
partPatternOf(
model,key,argsOverride,consumer?): {meta:PartMeta;pattern:ObjectData[]; }
One part component's resolved FLAT PATTERN (the pattern-marked pieces above, force-flattened to z=0, drafting-layer-stamped, grain arrow appended, edge bands validated — the same treatment the deleted _partNodeOf gave a PartJSON's pattern) plus its fold metadata. Throws a named error (fail-soft one level up, in DataNode) when the key names no components[] entry or the component has no pattern content.
Parameters
model
key
string
argsOverride
Record<string, string> | undefined
consumer?
Returns
{ meta: PartMeta; pattern: ObjectData[]; }
meta
meta:
PartMeta
pattern
pattern:
ObjectData[]
resolvePlacedComponentBody()
resolvePlacedComponentBody(
model,key,argsOverride?,consumer?): {data:ObjectData;flat:boolean;opening:BrepData[]; }
3D-mode placeComponent hook (wired at the ROOT scope in the constructor, and reused by componentScopeExtras for nested 3D placement) — raw (untransformed) body + opening volumes, NO flatness gate: a flat component is a perfectly valid 3D placement. flat (the component's own Component.flat) rides along so a flat-declared CHAIN in a 3D lane can splice the declared 2D representation (DataNode._resolvePlacedComponentFlat).
Parameters
model
key
string
argsOverride?
Record<string, string>
consumer?
Returns
{ data: ObjectData; flat: boolean; opening: BrepData[]; }
data
data:
ObjectData
flat
flat:
boolean
opening
opening:
BrepData[]
resolvePlacedPart()
resolvePlacedPart(
model,key,argsOverride?,angles?):ObjectData|undefined
placePart's root-scope hook (wired onto this.scope.resolvePlacedPart in the constructor — see nodes/DataNode.ts's _resolvePlacedPart for why this is root-scope, unlike every other flat-lane producer). Folds the part's evaluated flat pattern (nodeMethods/placePart.ts's foldPart, or nodeMethods/linearPart.ts's foldLinearPart when the component declares a section parameter) using the metadata convention above (partMetaOf — placement argsOverride wins over component parameter defaults), then wraps the folded result in ONE blockData stamped attributes.partKey = key (the ONLY bookkeeping nesting's whole-scene scan needs — see wholeScenePartCounts above). Non-fatal warnings (minFlange) are logged, never dropped silently.
Parameters
model
key
string
argsOverride?
Record<string, string>
angles?
Record<string, number>
Returns
ObjectData | undefined
wholeScenePartCounts()
wholeScenePartCounts(
model): {key:string;quantity:number; }[]
nesting's empty-parts-arg default (§1.5 — mirrors tableSource's own whole-scene scan exactly): tally blockData PLACEMENTS by attributes.partKey (stamped by resolvePlacedPart below) — the block boundary is the countable unit, not a fragment count, so array/mirror copies of a placePart are counted correctly.
Parameters
model
Returns
{ key: string; quantity: number; }[]