Geometry: partition a design's bodies by planes, with paired cut-face names

Design::partitioned cuts the bodies as opened by planes in order (SolidCraft's
split_by_plane, in memory). Cells are <body>/a and <body>/b by side of the plane;
the two faces of each cut are partition:<name>:a and :b, and every other face
inherits the name of the face it is a piece of (<name>#k when a cell holds
several pieces). A cut that misses or names an unknown body is reported as a
design error, not fatal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UhhZMBTviDQxZvwnyP89fo
This commit is contained in:
jyvikoandClaude Opus 5.5 authored and Irakli Kourtis committed 2026-10-14 19:37:37 -04:00
1 parent 4c91f9b731
commit 321add294b
3 files changed
+484 -1

No files matched your search

+5 -1
View File
@@ -23,6 +23,10 @@ pub struct Design {
/// Features that failed to rebuild. The design still opens with the bodies the rest made,
/// as it does in SolidCraft.
pub errors: Vec<FeatureError>,
/// The partitions applied ([`Design::partitioned`]), in order; empty for the design as opened.
pub cuts: Vec<crate::partition::CutReport>,
/// The bodies as opened, before any partition: what [`Design::partitioned`] starts from.
pub(crate) source: std::sync::Arc<Vec<Shape>>,
}
/// A feature of the design that failed to rebuild.
@@ -68,7 +72,7 @@ pub(crate) fn rebuild(doc: &Document) -> Result<Design> {
})?;
bodies.push(Shape { name: b.name.clone(), body: b.body.clone(), faces });
}
Ok(Design { name: doc.name.clone(), bodies, errors })
Ok(Design { name: doc.name.clone(), source: std::sync::Arc::new(bodies.clone()), bodies, errors, cuts: Vec::new() })
}
#[cfg(test)]