fix: faces a sheet fold moves keep their names (#535) (#585)

Faces that a sheet fold or unfold moves keep their names: points on a moved panel are taken back through the panel they lie on to where the sheet held them before the feature, and named from the faces there. Un-ignores the #535 regression test. Fixes #535.

Co-authored-by: jonaswre <jonas.wrede@beyondit.gmbh>
This commit is contained in:
Jonas Wrede authored and GitHub committed 2026-10-13 04:28:27 -04:00
1 parent abff7a49bb
commit 9e2a1eb993
5 files changed
+71 -2

No files matched your search

+20
View File
@@ -31,6 +31,8 @@ pub struct NamingOrigin {
pub depth: usize,
/// Instance transforms of a pattern or mirror (its copies are named after their sources).
pub mats: Vec<crate::Mat>,
/// The sheet metal bodies after a sheet feature (their folds place moved faces).
pub sheets: Vec<crate::sheet::SheetBody>,
}
/// The lazily computed names of a body, shared by its clones.
@@ -334,6 +336,24 @@ fn geometric_from(b: &ModelBody, o: &NamingOrigin, nf: usize, names_of: fn(&Mode
names = got.into_iter().map(|n| n.map(|n| format!("{n}@F{fid}.{}", k + 1))).collect();
}
}
// A sheet feature that moved panels (a fold, an unfold): faces it carried along lie on the
// faces they were, taken back through the panel they are on.
if let (Some(after), Some(before), Some(input)) = (
o.sheets.iter().find(|s| s.body == b.name),
o.before.sheets.iter().find(|s| s.body == b.name),
inputs.iter().find(|(x, _, _)| x.name == b.name),
) {
let input = std::slice::from_ref(input);
for (name, ps) in names.iter_mut().zip(&pts) {
if name.is_some() {
continue;
}
let back: Option<Vec<Vec3>> = ps.iter().map(|p| after.point_before(before, *p)).collect();
if let Some(back) = back.filter(|b| !b.is_empty()) {
*name = vote(&back, input, tol, None);
}
}
}
let empty = Vec::new();
let names: Vec<String> = names
.into_iter()