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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LUXeKMoxpM7Vuv8Rb6E3K2
This commit is contained in:
jyviko
2026-10-27 16:45:52 -04:00
committed by Irakli Kourtis
parent 21c64fb24c
commit 9da3174bb7
+5 -2
View File
@@ -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 {