Persistent naming: shell, draft, offset-face and replace-face faces and hole placements store their faces' names (Feature.face_names) and are moved onto the named face before evaluating (a split face: the nearest piece, with a warning; a vanished face: the picked point, with a warning)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AS5Tn3xieewUSg3uxrMVdL
This commit is contained in:
bherbruckandClaude Opus 5.5 committed 2026-10-08 11:37:33 +00:00
1 parent 99886594e7
commit e7aff4fef0
6 files changed
+114

No files matched your search

+15
View File
@@ -1325,4 +1325,19 @@ mod naming {
let sk = s.model.state().sketch(s.doc.find_feature("Top").map(|f| f.id).unwrap_or(0)).map(|x| x.plane.origin.z);
assert_eq!(sk.map(|z| (z * 1e6).round() / 1e6), Some(10.0));
}
#[test]
fn shell_and_hole_faces_follow_by_name() {
let mut s = Session::default();
run(&mut s, "PrimitiveBox", json!({"length": 40, "width": 30, "height": 20, "name": "Base"}));
run(&mut s, "FusionShellBodyCommand", json!({"faces": [[20, 15, 20]], "thickness": 2, "name": "Hollow"}));
let shell = |h: f64| 40.0 * 30.0 * h - 36.0 * 26.0 * (h - 2.0);
assert!((volume(&mut s) - shell(20.0)).abs() < 0.5, "{}", volume(&mut s));
// Taller: the picked point is 5 mm under the open face now; its name still finds it.
run(&mut s, "timeline.edit", json!({"feature": "Base", "set": {"height": "25"}}));
assert!((volume(&mut s) - shell(25.0)).abs() < 0.5, "{}", volume(&mut s));
assert_eq!(warning(&s, "Hollow"), None);
let h = s.doc.find_feature("Hollow").map(|f| f.face_names.clone()).unwrap_or_default();
assert_eq!(h, vec!["F1:+z".to_string()]);
}
}