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

FastenerAn 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.
StackFastener instances whose bounding boxes touch within a tolerance (pin and collar, bolt, washer and nut). A lone rivet is a stack of one.
FamilyStacks with the same part numbers in the same order along the fastener axis, read either way round.

The steps

WalkFrom 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.
StackUnion-find over a spatial grid: two instances join when their bounding boxes touch within touch_tolerance.
OrderThe 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.
SignA family signature is the ordered part-number list, the same whichever end it is read from.
ShowOne 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.

KeyDefaultMeaning
fastener_patternsHL, HR, HST, HLT, CCR, CR, NAS, NASM, MS2, AN, BACB, BACN, BACW, BACR, BACSRegexes matched against the instance name from the start.
touch_tolerance0.005Model units. 0.0 to 0.02 gave identical stacks on the wing flap.
size_fallbackfalseWhen true, unmatched parts at or below fastener_max_size are fasteners.
fastener_max_size2.0Largest bounding-box side, model units.
group_name_prefixStack groupName of each Vis group the tool creates.

Vis facts it relies on (EXERCISED)

Outputs

<model>_stacks.json and .csv plus an HTML report, in Documents\VisFastenerStacks by default.