naming: make the reference lookups a rebuild uses public

The corpus naming test (next commit) records what every stored face and
edge name resolves to, and must find it exactly as a rebuild does. Three
lookups were crate-private: `locate_face_on_body` (a feature's face
points, tried on the body the feature names first), `blend_target` (the
body a fillet or chamfer rounds) and `Document::anchored_face_indices`
(the faces a face-attached sketch is on). Visibility only; no behaviour
changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QWhMwdqJYQKQq8RCLSL1LT
This commit is contained in:
jyviko
2026-10-20 23:05:44 -04:00
parent 02abecd52c
commit 7f1e85f71c
5 changed files with 11 additions and 14 deletions
+1 -1
View File
@@ -3910,7 +3910,7 @@ fn resolve_edges(b: &Body, pts: &[Vec3], refs: &[EdgeRef], warning: &mut Option<
}
/// The body a fillet/chamfer applies to: by name, or the one closest to the first edge point.
fn blend_target(state: &ModelState, body: &Option<crate::BodyName>, edges: &[Vec3]) -> Result<usize> {
pub fn blend_target(state: &ModelState, body: &Option<crate::BodyName>, edges: &[Vec3]) -> Result<usize> {
if let Some(n) = body {
return state.bodies.iter().position(|b| &b.name == n).ok_or_else(|| DocError::Unknown(format!("body `{n}`")));
}
+1 -6
View File
@@ -225,12 +225,7 @@ impl Document {
/// is not guessed). It never does while the exact cap is still on another body (profiles
/// reordered: the bodies swapped names). The note names what changed. Every other identity
/// stays exact.
pub(crate) fn anchored_face_indices(
&self,
state: &ModelState,
body: &ModelBody,
target: &ConfigFaceTarget,
) -> Result<(Vec<usize>, Option<String>)> {
pub fn anchored_face_indices(&self, state: &ModelState, body: &ModelBody, target: &ConfigFaceTarget) -> Result<(Vec<usize>, Option<String>)> {
let error = match self.configuration_face_indices(body, target) {
Ok(indices) => return Ok((indices, None)),
Err(error) => error,
+5 -5
View File
@@ -75,11 +75,11 @@ pub use assembly::{
pub use document::*;
pub use eval::KeptResults;
pub use eval::{
EdgeRef, FeatureResult, Model, ModelBody, ModelState, PlacedBodies, RevolveExtent, SavedModel, SolvedSketch, ThreadInfo, curve_pick_error,
edge_names_for, edge_refs, face_point_names, face_point_state, hole_direction_at, import_body_names, map_wire, metric_thread_sizes,
object_height, parse_metric_thread, pattern_matrices, revolve_extent, revolve_extent_with_convention, select_profiles, sketch_hole_direction,
sketch_line_plane, state_in_frame, state_in_frame_at, suggested_thread, tangent_face_chain, through_all_distance, world_state,
world_state_reusing,
EdgeRef, FeatureResult, Model, ModelBody, ModelState, PlacedBodies, RevolveExtent, SavedModel, SolvedSketch, ThreadInfo, blend_target,
curve_pick_error, edge_names_for, edge_refs, face_point_names, face_point_state, hole_direction_at, import_body_names, map_wire,
metric_thread_sizes, object_height, parse_metric_thread, pattern_matrices, revolve_extent, revolve_extent_with_convention, select_profiles,
sketch_hole_direction, sketch_line_plane, state_in_frame, state_in_frame_at, suggested_thread, tangent_face_chain, through_all_distance,
world_state, world_state_reusing,
};
pub use expr::Expr;
pub use names::{BodyName, FeatureId, FeatureName, SketchId, copy_name};
+1 -1
View File
@@ -277,7 +277,7 @@ pub fn locate_face(st: &ModelState, name: &str, p: Vec3) -> Option<FaceHit> {
/// Else as [`locate_face`], over every body: the name moved to another body (a combine took the
/// face), or on this body it names a piece of a split face or a merged one. The same face on
/// another body (a copy of this one) is not a piece of this body's face.
pub(crate) fn locate_face_on_body(st: &ModelState, body: Option<&str>, name: &str, p: Vec3) -> Option<FaceHit> {
pub fn locate_face_on_body(st: &ModelState, body: Option<&str>, name: &str, p: Vec3) -> Option<FaceHit> {
if crate::sheet::split_sheet_face_name(name).is_some() {
return sheet_locate(st, name, p);
}
+3 -1
View File
@@ -154,7 +154,9 @@ impl Drop for NameCell {
}
}
pub use crate::name_lookup::{EdgeHit, FaceHit, LEGACY_MARK, face_has_name, faces_with_stem, legacy_name, locate_edge, locate_face, locate_one};
pub use crate::name_lookup::{
EdgeHit, FaceHit, LEGACY_MARK, face_has_name, faces_with_stem, legacy_name, locate_edge, locate_face, locate_face_on_body, locate_one,
};
pub use crate::piece_names::parent_piece;
/// Deeper chains than this are named by position only (bounded work and stack).