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 <noreply@anthropic.com> * 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 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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<usize> = 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)
|
||||
|
||||
@@ -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<usize> = (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:?}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user