Wave 224/509: STEP and IGES import: SMLib makes the pcurves that have no closed form (and 3 more)

4 commits, squashed; the originals stay reachable from tag archive/merge-main-develop.

- 306c7b75b jyviko: pcurve: a rim at a steady pace on a spline face, read from the edge itself
- 28e0eea80 jyviko: pcurve: each use's closed form or none, and a kernel's trims for the rest
- 1bf206259 jyviko: STEP and IGES import: SMLib makes the pcurves that have no closed form
- 879958721 jyviko: pcurves: a flat patch's are a plane's; SMLib's sheet loops read either way round

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DtL5M41G8Nua7HvuFPZkmJ
This commit is contained in:
jyviko
2026-10-23 22:22:32 -04:00
parent 9767f95c31
commit 06c2c6087b
8 changed files with 411 additions and 77 deletions
+1 -1
View File
@@ -866,7 +866,7 @@ impl Reader {
/// the file does not parse or has no solid the reader can read.
pub fn step_orientation_errors(text: &str) -> std::result::Result<Vec<String>, String> {
let ex = p21::parse(text)?;
let read = solidcraft_step::topology::read_solids(&ex);
let read = solidcraft_step::topology::read_solids_with(&ex, &solidcraft_smlib::pcurves::SmlibTrims);
if read.solids.is_empty() {
return Err(read.failures.first().map_or_else(|| "the file has no solids".into(), |f| format!("solid #{}: {}", f.item, f.message)));
}
+1 -1
View File
@@ -85,7 +85,7 @@ fn placed(body: &Body, m: &M4) -> crate::Result<Body> {
/// and brought back as a body: the part SMLib made of the file. A solid the reader or SMLib
/// refuses is not imported, with the reason.
pub(super) fn smlib_part(ex: &Exchange, item: u64, units: Units) -> std::result::Result<(Part, Vec<String>), Failure> {
let solid = solidcraft_step::topology::read_solid(ex, item, units).map_err(|msg| Failure { read: true, msg })?;
let solid = solidcraft_step::topology::read_solid_with(ex, item, units, &solidcraft_smlib::pcurves::SmlibTrims).map_err(|msg| Failure { read: true, msg })?;
let failed = |e: KernelError| Failure { read: false, msg: e.to_string().trim_start_matches("the operation failed: ").to_string() };
let (brep, smlib_order) = crate::native::smlib_record_ordered(&solid.brep).map_err(failed)?;
let (body, body_order) = crate::native::body_from_smlib_ordered(&brep).map_err(failed)?;
+1 -1
View File
@@ -1682,7 +1682,7 @@ fn step_conformance_parts_read_back_their_exact_shape() {
/// measured as the body of that record.
pub(super) fn schema_4_volume(text: &str) -> f64 {
let ex = solidcraft_step::p21::parse(text).unwrap();
let r = solidcraft_step::topology::read_solids(&ex);
let r = solidcraft_step::topology::read_solids_with(&ex, &solidcraft_smlib::pcurves::SmlibTrims);
assert!(r.failures.is_empty() && r.solids.len() == 1, "{:?}", r.failures);
measure(&Body::from_record(r.solids[0].brep.clone()).unwrap()).unwrap().volume
}