Vis Automations · In-app tool, Automation Scripts menu
Fastener Stacks
Finds every fastener in an assembly, groups touching fasteners into stacks, groups identical stacks into families, and shows each family as a colored Vis group you can select.
Verification passing on Vis 2606.0 build 26134 + 2606.2610 · 2026-10-29 · repo tc-vis-automation 9f1b0af · Goals 1 to 6 verified from inside Vis and headless (16/16); the bonus goals are not started.
Definitions
| Fastener | An instance whose part number matches a fastener pattern in fastener_stacks.json (HL, HST, NAS, MS2, BACB and so on). An optional size fallback treats small unmatched parts as fasteners too; it is off by default. |
| Stack | Fastener instances whose bounding boxes touch within a tolerance (pin and collar, bolt, washer and nut). A lone rivet is a stack of one. |
| Family | Stacks with the same part numbers in the same order along the fastener axis, read either way round. |
The steps
| Walk | From the root: a fastener-named node is an instance (its bodies are not visited); any other node with children is descended into; a childless node is an instance itself. Walking every body instead cost about 29k COM calls and 288 s on the wing flap; walking instances brought it to 134 s. |
| Stack | Union-find over a spatial grid: two instances join when their bounding boxes touch within touch_tolerance. |
| Order | The stack axis is the line between the two farthest bounding-box centres; for a single instance, its local X axis (HL pins lie along local X). Members are ordered along it. |
| Sign | A family signature is the ordered part-number list, the same whichever end it is read from. |
| Show | One Vis group per family. Each family gets its own color from a golden-ratio hue walk in two lightness bands, so neighbors differ, set on every instance’s own material (about 0.1 s each). Group.Material reads back right but renders wrong across families, so it is not used. |
Rules, no code change needed
Edit inapp/fastener_stacks.json for another assembly.
| Key | Default | Meaning |
|---|---|---|
fastener_patterns | HL, HR, HST, HLT, CCR, CR, NAS, NASM, MS2, AN, BACB, BACN, BACW, BACR, BACS | Regexes matched against the instance name from the start. |
touch_tolerance | 0.005 | Model units. 0.0 to 0.02 gave identical stacks on the wing flap. |
size_fallback | false | When true, unmatched parts at or below fastener_max_size are fasteners. |
fastener_max_size | 2.0 | Largest bounding-box side, model units. |
group_name_prefix | Stack group | Name of each Vis group the tool creates. |
Vis facts it relies on (EXERCISED)
- Selection, visibility and color must target the instance (a body’s Parent). Selecting a body raises a modal “Selection/Visibility Error” that blocks every later COM call.
Node.Selected = Truereplaces the selection, so lists are built withAppendNodeon an emptySelectedNodeslist.GlobalTransformationis row-major with the translation in elements 12 to 14.
Outputs
<model>_stacks.json and .csv plus an HTML report, in Documents\VisFastenerStacks by default.