tolerance_stackup
Compute worst-case, RSS, or Monte Carlo tolerance stack-ups for assembly dimension chains. Derive chains from solid step faces or define manually with ISO 2768-1 tolerances.
Instructions
Stack a dimension chain. Each chain entry is {name, nominal, plus, minus} with plus/minus the signed upper/lower deviations (plus>=minus; symmetric shorthand {nominal, tol}); add direction:-1 for a subtractive/gap link. method: worstcase | rss | montecarlo (each adds a deeper block). Half-bands are read as 3-sigma; cpk/pct_in_spec use spec_min/spec_max if given, else the worst-case bounds. Returns {nominal, worstcase:{min,max,spread}, rss:{sigma,min_3s,max_3s}, montecarlo:{mean,std,cpk,pct_in_spec,spec}}.
Instead of a hand-built chain, pass a live handle (+ axis, '+z'/'-x'/… or
[x,y,z]) and the chain is derived off the solid: planar step faces
perpendicular to the axis become consecutive station-to-station links (the
stack a height gauge reads off a stepped part). Per-link tolerance:
default_tol (± mm), else the ISO 2768-1 general class ('f'|'m'|'c'|'v',
default 'm' — the drawing-note default for untoleranced dimensions). The
result then echoes the derived chain (+ axis, n_step_faces).
seed fixes the montecarlo draw (12345 default) so the same chain returns the
same cpk/pct_in_spec run to run — that determinism is a contract, so change it
only to check a result is not an artefact of one draw.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| axis | No | +z | |
| seed | No | ||
| chain | No | ||
| handle | No | ||
| method | No | worstcase | |
| general | No | m | |
| samples | No | ||
| spec_max | No | ||
| spec_min | No | ||
| default_tol | No |