@huukhanhnguyen/model / nodeMethods/placePart
nodeMethods/placePart
DEFAULT_COLLISION_TOLERANCE
constDEFAULT_COLLISION_TOLERANCE:0.5=0.5
mm — bbox-overlap slack for the post-fold collision check.
DEFAULT_K_FACTOR
constDEFAULT_K_FACTOR:0.4=0.4
ANSI air-bend K-factor midpoint (typical cited range 0.3–0.5).
bendAllowance()
bendAllowance(
angleDeg,radius,kFactor,thickness):number
Bend Allowance: the neutral-axis arc length that becomes curved material. Wood kerf bending forces kFactor=0 at the call site (see module doc) — this collapses to θ_rad × R, the outer/uncut face's own arc length.
Parameters
angleDeg
number
radius
number
kFactor
number
thickness
number
Returns
number
bendDeduction()
bendDeduction(
angleDeg,radius,kFactor,thickness):number
Bend Deduction — the textbook apex-referenced flat-length correction.
Parameters
angleDeg
number
radius
number
kFactor
number
thickness
number
Returns
number
foldPart()
foldPart(
flatData,options):FoldPartResult
Fold one part's evaluated flat pattern into a 3D solid + flat kerf groove markers. Throws named errors (fail-soft one level up, in DataNode) for every geometric contract violation the spec's §3 validation invariants describe; returns non-fatal warnings (minFlange) alongside the geometry.
Parameters
flatData
options
Returns
grainArrowData()
grainArrowData(
dataList,grain):ObjectData[]
A double-headed arrow marker along the part's grain axis (ABF/OneClick convention) — "length" = the outline's longer bbox dimension, "width" = the shorter. Display/marking only (attributes.grainArrow=true), centered on the outer boundary's own bbox center.
Parameters
dataList
grain
"length" | "width"
Returns
grainArrowFromOutline()
grainArrowFromOutline(
outer,grain):ObjectData[]
Same construction as grainArrowData, but from an ALREADY-EXTRACTED outer-boundary curve — nesting's compute needs this on a nested (transformed) copy of the outline, not the un-nested original.
Parameters
outer
grain
"length" | "width"
Returns
kerfCount()
kerfCount(
angleDeg,kerfWidth,thickness,remainingThickness):number
Number of kerf cuts needed to cover the bend angle exactly (rounded to the nearest whole cut — the derivation's own closure identity).
Parameters
angleDeg
number
kerfWidth
number
thickness
number
remainingThickness
number
Returns
number
kerfSpacing()
kerfSpacing(
radius,kerfWidth,thickness,remainingThickness):number
Kerf spacing formula (independently re-derived from a rigid-hinge model in the spec, cross-checked against the shop-floor formula): spacing = radius × kerfWidth / (thickness − remainingThickness).
Parameters
radius
number
kerfWidth
number
thickness
number
remainingThickness
number
Returns
number
outsideSetback()
outsideSetback(
angleDeg,radius,thickness):number
Outside Setback — tangent-to-apex distance. Not used as CONSTRUCTION input (see module doc) — exposed as the textbook cross-check invariant 5 needs, and as the exact geometric answer for invariant 3's degenerate R=0 bounding-box check.
Parameters
angleDeg
number
radius
number
thickness
number
Returns
number
partOutlineOf()
partOutlineOf(
dataList): {edgeBands:CurveData[];holes:CurveData[];outer:CurveData|undefined; }
The outline + its .cut interior holes + .edgeBand-tagged boundary segments, in one call — the shape nesting's compute needs per part.
Parameters
dataList
Returns
{ edgeBands: CurveData[]; holes: CurveData[]; outer: CurveData | undefined; }
edgeBands
edgeBands:
CurveData[]
holes
holes:
CurveData[]
outer
outer:
CurveData|undefined
stampDraftingLayers()
stampDraftingLayers(
dataList):ObjectData[]
Stamp .layer from the document's own feature-tag attribute (§7's DXF layer table) when the author hasn't already set one explicitly. An untagged closed curve (the outer boundary, per the flat-pattern contract in this module's doc) defaults to CUT — "the outer boundary curve is always .cut whether or not it's explicitly tagged". A grain-arrow marker (attributes.grainArrow) goes on its own GRAIN layer.
Parameters
dataList
Returns
validateEdgeBands()
validateEdgeBands(
dataList):void
Every .edgeBand-tagged curve must lie along the outer boundary — a named fail-soft error otherwise (banding an interior cut makes no physical sense).
Parameters
dataList
Returns
void