Skip to content

fix(explode): explode mated components that do not reach the first part - #1386

Merged
w1ne merged 3 commits into
developfrom
fix/explode-mate-forest-20261113
Nov 13, 2026
Merged

w1ne merged 3 commits into
developfrom
fix/explode-mate-forest-20261113

Conversation

@w1ne

@w1ne w1ne commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

Mate-axis explode (explodedPoses, used by render_preview, kernelcad render and drawing export) built its mate tree only from the first part. If the first part has no mates, the tree was empty and explode fell back to the declaration-order chain. Mated children in any other component received no offset.

The fix continues the BFS from the first part (in requested order, then declaration order) of each mated component the walk does not reach. Assemblies whose first part reaches every mate give the same result as before. This PR does not depend on #1385; that PR changes the mate solver, while this PR fixes the existing explode pose handoff.

Reproduction (real part)

KernelCAD's kernelcad-kinematic cookbook 05-clamshell-hinge-swept declares the unmated table first. With mate-axis explode at factor 1:

Code Order base offset (mm) lid offset (mm)
develop declared (table first) [0, 0, 12] (moved off an unrelated part) [0, 200, 6] (declaration chord)
develop ['base','lid','table'] [0, 0, 0] [300, 0, 0] (hinge axis)
this PR declared (table first) [0, 0, 0] [300, 0, 0] (hinge axis)

Regression test

tests/unit/modeling/explodedPoses.test.ts adds an unmated table before a fastened three-part stack. It asserts that table and base stay at zero offset, mid moves 10 mm in Z, and top moves 20 mm in Z. The case failed on develop, where base moved 10 mm.

Demo bundle

The MP4 is a labeled schematic of the passing test's exact offsets, not a renderer capture. A local CLI render capture did not open a tab or produce an image: the Node process waited in filesystem I/O and was interrupted. Mechanism status is unverified; the video makes no simulation, deployment, or hardware acceptance claim.

Verification

  • npx vitest run tests/unit/modeling/explodedPoses.test.ts — 3/3 passed.
  • npx tsx scripts/typecheckExamples.ts examples/exploded/clamshell-table-first.kcad.ts — passed, 1 file.
  • Earlier local code checks recorded before the demo/docs commit: explodedPoses, renderCommand, and renderPreviewTool 52/52; tsc --noEmit clean; changed-source ESLint clean; quality ratchet 8/8. The original code-commit CI run passed all checks.
  • The docs/demo commit passed all checks in GitHub CI run 43496975484; the final verification-note update also passed all checks in run 43498209792. The additional local ESLint attempt blocked in Linux filesystem I/O (D, folio_wait_bit_common) and was stopped without a result; CI lint passed.

github-actions Bot and others added 3 commits November 13, 2026 19:22
Mate-axis explode built its mate tree only from the first part. When that
part has no mates, the tree was empty and explode fell back to the
declaration-order chain, so mates were ignored. Mated children in any
other component got no offset.

The kernelcad-kinematic cookbook 05-clamshell-hinge-swept declares an
unmated `table` first. Mate-axis explode (factor 1) moved `base` 12 mm
in Z off the table and `lid` [0, 200, 6] mm along declaration chords.
With `table` declared last, the same code gave `base` 0 and `lid`
[300, 0, 0] mm along the hinge axis.

Now the walk continues from the first part of each mated component that
it does not reach, as the mate solver does. The clamshell explodes as
it does with `base` first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: w1ne <41898282+w1ne@users.noreply.github.com>
Signed-off-by: w1ne <41898282+w1ne@users.noreply.github.com>
Signed-off-by: w1ne <41898282+w1ne@users.noreply.github.com>
@w1ne
w1ne merged commit cdcf94d into develop Nov 13, 2026
17 checks passed
@w1ne
w1ne deleted the fix/explode-mate-forest-20261113 branch November 13, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant