From 72a265e4fc6515d3cc30f6d1c88baab962beeede Mon Sep 17 00:00:00 2001 From: PaddleStroke Date: Sat, 31 Oct 2026 02:02:24 +0000 Subject: [PATCH] Nightly action matrix: a sketch on the sensor enclosure lid's top keeps its attachment (#9465) (#9670) * claim: #9465 Co-Authored-By: Claude Opus 5.5 * Face attachments: a piece of a face its certificate finds the other pieces of keeps that certificate (#9465) The nightly action matrix has refused a sketch and an offset plane on the sensor enclosure lid's underside (`examples/sensor_enclosure :: Lid/F2:top`) since #8278. The lid's lip, joined below it, parts the underside into a ring and a panel; the ring rests on the case and is named after the case's top, so the lid's cap certificate (via certified_pieces) finds only the panel. #8278 then refused the certificate because it doesn't find the picked face, and the history-name fallback can't take a name made by another body's feature. A face that is no pattern or mirror copy and lies on the same oriented plane as the pieces the certificate finds is another piece of that face: the certificate stands for it, as before #8278. Copies (the #8278 case) still fall back to their own history name. Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- crates/doc/src/face_anchor.rs | 10 +++++++- crates/engine/src/cmd/sketch_face_tests.rs | 29 ++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/crates/doc/src/face_anchor.rs b/crates/doc/src/face_anchor.rs index d32f962c1..4f502b1ae 100644 --- a/crates/doc/src/face_anchor.rs +++ b/crates/doc/src/face_anchor.rs @@ -211,8 +211,16 @@ impl Document { let indices = self.configuration_face_indices(body, &target)?; // A copy a pattern or mirror made on the same body carries its seed's certificate, // which finds the seed's face: the copy is attached by its own history name below. + // A face that is no copy, on the plane of the pieces the certificate finds, is + // another piece of that face (a piece a later join left bordering another body, + // and named after it): the certificate stands for it too (#9465). if !indices.contains(&index) { - return Err(DocError::Invalid("this face has no supported construction certificate; choose a fixed plane instead".into())); + let names = crate::naming::names(body); + let copy = names.faces.get(index).is_none_or(|name| crate::persistent_name::is_copy(name)); + let all: Vec = indices.iter().copied().chain([index]).collect(); + if copy || self.coplanar_pieces(body, &all, |_| true).is_err() { + return Err(DocError::Invalid("this face has no supported construction certificate; choose a fixed plane instead".into())); + } } self.coplanar_pieces(body, &indices, |_| true)?; Ok(target) diff --git a/crates/engine/src/cmd/sketch_face_tests.rs b/crates/engine/src/cmd/sketch_face_tests.rs index f6d195c99..4b8b2795b 100644 --- a/crates/engine/src/cmd/sketch_face_tests.rs +++ b/crates/engine/src/cmd/sketch_face_tests.rs @@ -792,3 +792,32 @@ fn a_sketch_on_the_mirrored_half_of_a_combined_body_sits_on_that_half() { assert!((plane.origin - point).dot(normal).abs() < 1e-6, "{name}: origin {:?}", plane.origin); } } +/// The sensor enclosure's lid rests on the case, and its lip, joined below it, parts its underside +/// into a ring and a panel. The ring is named after the case's top it rests on, so the lid's cap +/// certificate finds only the panel: the ring is another piece of the same face and takes a sketch +/// attached by that certificate, as it did before #8278 (#9465, nightly action matrix). +#[test] +fn a_sketch_on_the_ring_of_a_lid_underside_parted_by_its_lip_keeps_the_cap() { + let mut s = Session::default(); + let script: Value = serde_json::from_str(include_str!("../../../../examples/acceptance/sensor_enclosure.json")).unwrap(); + s.run_script(&script).unwrap(); + let world = s.world_state(); + let lid = world.body("Lid").unwrap(); + let names = solidcraft_doc::naming::face_names(lid); + let down: Vec = (0..names.len()) + .filter(|index| lid.body.planar_face(*index).is_some_and(|plane| plane.normal().dot(-Vec3::Z) > 0.999 && (plane.origin.z - 25.).abs() < 1e-6)) + .collect(); + assert!(down.len() > 1, "the lip parts the lid's underside: {down:?}"); + let ring = *down.iter().find(|index| names[**index] == "F2:top").unwrap_or_else(|| panic!("the ring, among {names:?}")); + let pick = json!({"body":"Lid","index":ring,"face":[12.0, 29.266_666_666_665, 25.0]}); + drop(world); + let id = run(&mut s, "sketch.create", json!({"name":"On ring","plane":pick,"project_edges":false}))["sketch"].as_u64().unwrap(); + run(&mut s, "sketch.finish", json!({})); + let plane = s.model.state().sketch(id).unwrap().plane; + assert!(plane.normal().dot(-Vec3::Z) > 0.999 && (plane.origin.z - 25.).abs() < 1e-6, "{plane:?}"); + // The attachment survives an edit that widens the lid. + run(&mut s, "parameters.change", json!({"name": "board_w", "expression": "(60 mm) * 1.1"})); + assert!(timeline_errors(&s).is_empty(), "{:?}", timeline_errors(&s)); + let plane = s.model.state().sketch(id).unwrap().plane; + assert!(plane.normal().dot(-Vec3::Z) > 0.999 && (plane.origin.z - 25.).abs() < 1e-6, "{plane:?}"); +}