From 1b08d4b8b5e267db54c6b0fbd94e90b28eb1bf97 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Fri, 30 Oct 2026 12:12:26 -0400 Subject: [PATCH] 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 --- crates/doc/src/eval.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/doc/src/eval.rs b/crates/doc/src/eval.rs index c95838941..f764a4c6d 100644 --- a/crates/doc/src/eval.rs +++ b/crates/doc/src/eval.rs @@ -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> { 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 {