Skip to content

fix(kernel-adapter): let an extrusion join the body it was sketched on - #110

Merged
petergstfsn merged 1 commit into
mainfrom
claude/boss-off-face-union-e14af5
Aug 28, 2026
Merged

fix(kernel-adapter): let an extrusion join the body it was sketched on#110
petergstfsn merged 1 commit into
mainfrom
claude/boss-off-face-union-e14af5

Conversation

@petergstfsn

Copy link
Copy Markdown
Contributor

Closes the modeling gap I flagged when landing #100: a boss grown off a face landed as a disconnected second body instead of joining. Based on main.

The defect

A boss extruded away from the face it was sketched on meets its target exactly at that face. It shares no volume — tangency measures zero — so the stored-add rebuild threw Stored add extrusion no longer overlaps … and the inference fell back to new-body. Growing a boss is the commonest way to add material to a body, and it produced a coincident pair of solids.

The fix, in two layers

1. The rebuild guard (exact-feature-builders). It tested shared volume for both operations. Now:

  • cut — unchanged. With no shared material there is nothing to remove.
  • add — also accepts contact, via a new solidsShareMaterialOrTouch helper: exact solidToSolidDistance against the same numerical tolerance union-connectivity uses (EPSILON × scale × 128), which is deliberately far tighter than a modeling tolerance so touching joins and a real gap still refuses.

This also makes extrude-add agree with the Union feature, which has always accepted face contact — the two disagreed about what "joined" means.

2. The inference (extrudeInference). With the rebuild accepting it, the direction hint from #100 gets its mirror: a face-attached sketch grown away from its body stores an add, as one pushed into it already stores a cut. Tangency never reaches the candidate list (the bounds test rejects a zero-width overlap), so the target comes from the live bodies — and the exact rebuild still has the final say.

What the tests caught

My first attempt used the Union feature's detectCoincidentFaces(…).aabbOverlap fallback and broke three existing tests, including the decoy case that pins exactly this: two solids can share an overlapping bounding box while sitting well clear of each other. Exact distance is the honest signal; bounding boxes are not. A second self-inflicted break came from rewording the error message — isMeasuredZeroOverlap matches that sentence, so the wording stays, now with a comment saying why.

New tests: a boss joins as one body of the right volume with no warnings; an extrusion on a plane clear of the target is still refused.

Verification

  • pnpm typecheck ✓ · pnpm lint 0 errors · pnpm test:coverage 1988 passed (14/14 in extrude-operation, including the 3 pre-existing ones my first attempt broke)

🤖 Generated with Claude Code

A boss grown off a face meets its target exactly at that face and shares no
volume with it, so the stored-add rebuild refused it: the guard tested shared
volume alone, and tangency measures zero. Growing a boss is the commonest way
to add material to a body, and it landed as a disconnected second solid.

An add now also accepts contact, measured by exact solid distance against the
same numerical tolerance union connectivity uses, so touching joins and a real
gap still refuses. A cut is unchanged — with no shared material there is
nothing to remove. Bounding boxes deliberately do not decide this: two solids
can share an overlapping box while sitting well clear of each other, which is
exactly the decoy the inference tests already pin.

With the rebuild accepting it, the extrude inference can act on direction
again: a face-attached sketch grown away from its body stores an add, the
mirror of the cut it already stores for one pushed in. Tangency never reaches
the candidate list — the bounds test rejects a zero-width overlap — so the
target comes from the live bodies, and the exact rebuild still has the final
say on whether they meet.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
openzcad 19959ab Aug 27 2026, 08:56 PM

@petergstfsn
petergstfsn merged commit 502bf1d into main Aug 28, 2026
9 checks passed
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