fix: join merges every body the tool meets

A Join unioned its tools into the first target only, leaving other target
bodies the tool overlapped or touched as separate, interpenetrating bodies.
Each tool now merges with every target it meets (shared material or face
contact, tested on the operands' boundaries) into one body under the first
one's name; absorbed bodies are removed and their threads follow. A tool that
meets no target still joins the first target as a separate lump. Sheet metal
and mesh bodies are never absorbed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J53sR6gEaVt56soFDpTck8
This commit is contained in:
Iraklis KourtisandClaude Opus 5.5 committed 2026-10-11 10:41:48 -04:00
1 parent a094fa46b5
commit 8a38a7354c
4 files changed
+125 -7

No files matched your search

+9
View File
@@ -883,6 +883,15 @@ impl Body {
self.lumps_with_clearance(0.0)
}
/// Whether this body and `other` share material or touch (within a fine mesh tolerance).
pub fn meets(&self, other: &Body) -> Result<bool> {
self.require_brep("contact test")?;
other.require_brep("contact test")?;
let tol = (self.size().max(other.size()) * 1e-4).max(1e-6);
let (a, b) = (self.tessellate(tol)?, other.tessellate(tol)?);
shell_groups::meshes_meet(&a, &b, 2.0 * tol)
}
/// A boolean shortcut needs clearance larger than both shell mesh deflections.
pub(crate) fn separated_lumps(&self) -> Result<Vec<Body>> {
self.lumps_with_clearance(4.0 * (self.size() * 1e-3).max(1e-3))