From 9da3174bb7c1c2b6923ca5d0f6ba617d69492729 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Tue, 27 Oct 2026 16:45:52 -0400 Subject: [PATCH] solidcraft-smlib: a revolution goes to SMLib as its NURBS form alone A face on a placed revolution that carries its NURBS form (every STEP surface of revolution, read since b6a3b31ff) was written as two NURBS blocks: the revolution's own net, then the form, flagged FACE_NURBS_FORM on a NURBS face. SMLib reads one block per face, so the flat arrays did not add up and it refused the body (SM_ERR_INVALID_INPUT), in the main import and in the one-face sheets SMLib makes pcurves on. SMLib has no class for a revolution: the form is the face, its range and trims already in its parameters, so it now goes as that NURBS face with no form flag. A revolution the analytic pass recognises (a plane, cylinder, cone, sphere, ring torus) is unchanged. Test: surface_of_revolution_sense_follows_iso, which develop fails with the refusal, passes. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01LUXeKMoxpM7Vuv8Rb6E3K2 --- crates/smlib/src/import.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/smlib/src/import.rs b/crates/smlib/src/import.rs index 1e52d2898..bdd9b8630 100644 --- a/crates/smlib/src/import.rs +++ b/crates/smlib/src/import.rs @@ -185,8 +185,11 @@ fn laid_out(brep: &b::Brep, trusted: bool, analytic: bool, bare: &HashSet<(u32, a.i(flat::FACE_LOOP_COUNT).push(int(f.loops.len())?); a.i(flat::FACE_TRIM_TYPE).push(0); // A face with a NURBS form: what it is (its analytic entry), then the NURBS it is - // parameterised on, whose range and trims these are (FACE_NURBS_FORM). + // parameterised on, whose range and trims these are (FACE_NURBS_FORM). A revolution + // (SMLib has no class for one) is that form alone, a NURBS face. + let form_is_face = f.nurbs.is_some() && matches!(f.surface, b::Surface::PlacedRevolution { .. }); let spline = match &f.nurbs { + Some(n) if form_is_face => surface(&mut a, n, f.domain, analytic)?, Some(n) => { surface(&mut a, &f.surface, f.domain, analytic)?; nurbs_block(&mut a, n)?; @@ -195,7 +198,7 @@ fn laid_out(brep: &b::Brep, trusted: bool, analytic: bool, bare: &HashSet<(u32, None => surface(&mut a, &f.surface, f.domain, analytic)?, }; if any_form { - a.i(flat::FACE_NURBS_FORM).push(i64::from(f.nurbs.is_some())); + a.i(flat::FACE_NURBS_FORM).push(i64::from(f.nurbs.is_some() && !form_is_face)); } for (li, l) in f.loops.iter().enumerate() { match l {