doc: a feature's face points are named on its own component's bodies first

Each component's bodies lie in its own coordinates in the state a feature's
points are named in, so a part inserted twice has a face at the same point in
each copy: a thread on the second copy was named after the first copy's face.
The points are named on the feature's own component's bodies first, then on
every body for a point that lies on none of them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jyviko
2026-10-30 12:12:26 -04:00
committed by jyviko
parent d62d248b76
commit 1b08d4b8b5
+10 -2
View File
@@ -7476,11 +7476,19 @@ pub fn face_point_state<'a>(doc: &Document, st: &'a ModelState, kind: &FeatureKi
/// The names of the faces a feature's face points lie on (empty where none), found in
/// [`face_point_state`]. A To / From point is named after the nearest face over every body, the
/// one `object_height` resolves it to, not the first body with a face within tolerance: a part
/// resting a hair from the picked face would otherwise take its name.
/// resting a hair from the picked face would otherwise take its name. Another feature's point is
/// named on the bodies of the feature's own component first: each component's bodies lie in its
/// own coordinates there, where a part inserted twice has a face at the same point in each.
pub fn face_point_names(doc: &Document, st: &ModelState, kind: &FeatureKind, comp: u64) -> Result<Vec<String>> {
let pts = kind.face_points();
if !matches!(kind, FeatureKind::Extrude { .. } | FeatureKind::Revolve { .. }) {
return Ok(crate::naming::face_names_at(st, &pts));
let own = ModelState { bodies: st.bodies.iter().filter(|b| doc.model_body_component(b) == comp).cloned().collect(), ..ModelState::default() };
let names = crate::naming::face_names_at(&own, &pts);
return Ok(names
.into_iter()
.zip(&pts)
.map(|(name, p)| if name.is_empty() { crate::naming::face_names_at(st, std::slice::from_ref(p)).pop().unwrap_or_default() } else { name })
.collect());
}
let fst = face_point_state(doc, st, kind, comp)?;
let normal = match kind {