solidcraft-step: each record face names its face in the file

Solid::face_origin lists the ADVANCED_FACE or FACE_SURFACE entity of each
of the record's faces, in the record's face order, so a body made from the
record (in another kernel) can trace its faces to the file, as the truck
import's face_origin does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brennen Herbruck
2026-10-21 11:25:39 -04:00
committed by jyviko
parent 82fe0e59e5
commit 7e208529cd
+6 -1
View File
@@ -90,6 +90,9 @@ pub struct Solid {
pub product: Option<String>,
/// In the coordinates of the item's own representation (assembly placements not applied).
pub brep: Brep,
/// The file's face entity (ADVANCED_FACE, FACE_SURFACE) of each of the record's faces, in
/// the record's face order.
pub face_origin: Vec<u64>,
/// No closed shell: a surface model of open shells only.
pub sheet: bool,
/// What was repaired or noted on the way (faces whose same_sense disagreed with their
@@ -837,8 +840,10 @@ impl<'b, 'a> Builder<'b, 'a> {
});
}
let mut faces = Vec::with_capacity(face_order.len());
let mut face_origin = Vec::with_capacity(face_order.len());
for &f in &face_order {
let face = self.faces.get(f as usize).ok_or("face reference")?;
face_origin.push(face.step);
let pc = pcs.get(f as usize).ok_or("face reference")?;
let mut loops = Vec::with_capacity(face.loops.len());
let mut edge_loop = 0;
@@ -881,7 +886,7 @@ impl<'b, 'a> Builder<'b, 'a> {
let brep = Brep { version: brep::VERSION, tolerance: self.tol, regions, shells: out_shells, faces, edges, vertices };
brep.validate().map_err(|e| format!("the record is invalid: {e}"))?;
brep.check_geometry().map_err(|e| format!("the record's geometry disagrees: {e}"))?;
Ok(Solid { item, name, product: None, brep, sheet, notes })
Ok(Solid { item, name, product: None, brep, face_origin, sheet, notes })
}
/// Every edge of the shell's faces used at least twice among them.