Import rig: the horn torus quarter written to STEP and read back, as a case

The round trip's volume moves from the STEP unit test to an import rig case
(616.850, Pappus); the unit test keeps the writer's logic, the degenerate torus
written as one B-spline face and no toroidal surface or surface of revolution. The
case fails today where the revolve does (KNOWN_FAILING).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jyviko
2026-10-30 06:57:37 -04:00
committed by Irakli Kourtis
parent 24a58066cf
commit 51316b7ec7
4 changed files with 67 additions and 4 deletions
+2 -4
View File
@@ -1127,7 +1127,8 @@ fn surface_of_revolution_sense_follows_iso() {
/// A tube revolved about a line it touches (a horn torus, as a tight sweep makes) is written as
/// one rational B-spline face whose loop passes the pole twice, with no zero-length edge there:
/// no TOROIDAL_SURFACE (it would be degenerate) and no surface of revolution.
/// no TOROIDAL_SURFACE (it would be degenerate) and no surface of revolution. (Its volume, built
/// and read back, is the rig's import/cov-step-horn-torus-quarter-round-trip.)
#[test]
fn horn_torus_written_as_one_spline_face() {
let prof = Region2 { outer: Loop2::circle(Vec2::new(5.0, 0.0), 5.0), holes: vec![] };
@@ -1135,9 +1136,6 @@ fn horn_torus_written_as_one_spline_face() {
let text = step_export(&[&b], "t").unwrap();
assert!(!text.contains("TOROIDAL_SURFACE") && !text.contains("SURFACE_OF_REVOLUTION"));
assert_eq!(text.matches("ADVANCED_FACE(").count(), 3, "{text}");
let imp = round_trip(&b);
let v = std::f64::consts::PI * 25.0 * std::f64::consts::TAU * 5.0 / 4.0;
assert!(rel(measure(&imp.bodies[0].body).unwrap().volume, v) < 1e-3);
}
/// How a torus-capped cylinder ([`torus_capped_cylinder`]) ends.
+1
View File
@@ -2,3 +2,4 @@
# rig gate (.github/workflows/kernel-rig.yml) fails on a case that fails and is not listed here,
# and on a listed case that passes: a fix removes its line in the same pull request.
# Baseline: develop 5ada4fc8a with SMLib 90aabff (the run on 60b1c6a, aarch64 Linux).
cov-step-horn-torus-quarter-round-trip SMLib revolve status 1001 on a profile touching its axis (the part is never built)
@@ -0,0 +1,8 @@
{
"sources": [],
"what": "a quarter horn torus (a circle r5 touching its axis, revolved 90 deg) written to STEP and read back: the same solid",
"source": "analytic",
"method": "the disc r5 about (5, 0) on XZ touches the Z axis at the origin; Pappus, its centroid 5 from the axis: V = pi 25 x 2 pi 5 / 4 = 616.850275; read back into a new design, the same",
"body_count": 1,
"volume_mm3": 616.8502750680849
}
@@ -0,0 +1,56 @@
{
"commands": [
{
"command": "sketch.create",
"params": {
"plane": "XZ",
"name": "Tube"
}
},
{
"command": "sketch.circle.center",
"params": {
"center": [
5,
0
],
"radius": 5
}
},
{
"command": "sketch.finish",
"params": {}
},
{
"command": "solid.revolve",
"params": {
"sketch": "Tube",
"axis": "Z",
"angle": "90 deg",
"body_name": "Horn"
}
},
{
"command": "file.export",
"params": {
"path": "$OUT/kernel-case-horn-torus.step",
"format": "step",
"bodies": [
"Horn"
]
}
},
{
"command": "file.new",
"params": {
"name": "Reimported"
}
},
{
"command": "file.insert_step",
"params": {
"path": "$OUT/kernel-case-horn-torus.step"
}
}
]
}