Repository navigation
fix(explode): explode mated components that do not reach the first part - #1386
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Mate-axis explode (
explodedPoses, used byrender_preview,kernelcad renderand 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-kinematiccookbook05-clamshell-hinge-sweptdeclares the unmatedtablefirst. With mate-axis explode at factor 1:baseoffset (mm)lidoffset (mm)tablefirst)[0, 0, 12](moved off an unrelated part)[0, 200, 6](declaration chord)['base','lid','table'][0, 0, 0][300, 0, 0](hinge axis)tablefirst)[0, 0, 0][300, 0, 0](hinge axis)Regression test
tests/unit/modeling/explodedPoses.test.tsadds an unmatedtablebefore a fastened three-part stack. It asserts thattableandbasestay at zero offset,midmoves 10 mm in Z, andtopmoves 20 mm in Z. The case failed on develop, wherebasemoved 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.explodedPoses,renderCommand, andrenderPreviewTool52/52;tsc --noEmitclean; changed-source ESLint clean; quality ratchet 8/8. The original code-commit CI run passed all checks.D,folio_wait_bit_common) and was stopped without a result; CI lint passed.