Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Validate runtime blocker and tighten ctc_02 regression expectations

Yuechen Lid7a83eaa849f
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242BSplineSurfaceWithKnotsTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242BSplineSurfaceWithKnotsTests.cs
index 56fdf5e2..e9a453ad 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242BSplineSurfaceWithKnotsTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242BSplineSurfaceWithKnotsTests.cs
@@ -67,7 +67,7 @@ public sealed class Step242BSplineSurfaceWithKnotsTests
}
[Theory]
- [InlineData("testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp", "exporter", "Face:47", "Unsupported surface kind 'Sphere'.")]
+ [InlineData("testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp", "exporter", "Face:74", "Unsupported surface kind 'BSplineSurfaceWithKnots'.")]
[InlineData("testdata/step242/nist/FTC/nist_ftc_07_asme1_ap242-e2.stp", "tessellator", "", "Face 20 curved tessellation supports repeated torus/revolved families with mixed line/circle loops; this topology family is still unsupported. Observed")]
[InlineData("testdata/step242/nist/STC/nist_stc_08_asme1_ap242-e3.stp", "tessellator", "", "Face 62 curved tessellation does not support this torus/revolved boundary topology yet. Observed")]
public void Step242_TrimmedSphereTargets_AdvancePastOldUntrimmedSphereBlocker_AndRemainDeterministic(
@@ -90,8 +90,16 @@ public sealed class Step242BSplineSurfaceWithKnotsTests
var second = Step242CorpusManifestRunner.RunOne(entry);
Assert.DoesNotContain("sphere tessellation supports only untrimmed sphere faces with zero loops.", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);
- Assert.Equal(expectedLayer, first.FirstFailureLayer);
- Assert.Equal(expectedSource, first.FirstDiagnostic.Source);
+ if (!string.IsNullOrEmpty(expectedLayer))
+ {
+ Assert.Equal(expectedLayer, first.FirstFailureLayer);
+ }
+
+ if (!string.IsNullOrEmpty(expectedSource))
+ {
+ Assert.Equal(expectedSource, first.FirstDiagnostic.Source);
+ }
+
if (!string.IsNullOrEmpty(expectedMessagePrefix))
{
Assert.StartsWith(expectedMessagePrefix, first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);
@@ -100,6 +108,7 @@ public sealed class Step242BSplineSurfaceWithKnotsTests
if (string.Equals(relativePath, "testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp", StringComparison.Ordinal))
{
Assert.DoesNotContain("unsupported surface kind 'BSplineSurfaceWithKnots'", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);
+ Assert.DoesNotContain("Unsupported surface kind 'Sphere'.", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);
}
Assert.Equal(first.FirstFailureLayer, second.FirstFailureLayer);
Assert.Equal(first.FirstDiagnostic.Source, second.FirstDiagnostic.Source);
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242ConicalSurfaceRegressionTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242ConicalSurfaceRegressionTests.cs
index 7914d3aa..9660bcd2 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242ConicalSurfaceRegressionTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242ConicalSurfaceRegressionTests.cs
@@ -32,7 +32,7 @@ public sealed class Step242ConicalSurfaceRegressionTests
[Theory]
[InlineData("testdata/step242/nist/CTC/nist_ctc_01_asme1_ap242-e1.stp", "", "Audit.None", "No diagnostics.")]
- [InlineData("testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp", "exporter", "Face:47", "Unsupported surface kind 'Sphere'.")]
+ [InlineData("testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp", "exporter", "Face:74", "Unsupported surface kind 'BSplineSurfaceWithKnots'.")]
[InlineData("testdata/step242/nist/CTC/nist_ctc_03_asme1_ap242-e2.stp", "", "", "")]
[InlineData("testdata/step242/nist/CTC/nist_ctc_04_asme1_ap242-e1.stp", "tessellator", "", "Face 1 curved tessellation supports repeated cone/revolved families with mixed line/circle loops; this topology family is still unsupported. Observed")]
[InlineData("testdata/step242/nist/FTC/nist_ftc_06_asme1_ap242-e2.stp", "tessellator", "", "Face 2 curved tessellation does not support this torus/revolved boundary topology yet. Observed")]
@@ -83,6 +83,7 @@ public sealed class Step242ConicalSurfaceRegressionTests
{
Assert.NotEqual("Viewer.Tessellation.PlanarCurveFlatteningUnsupported", first.FirstDiagnostic.Source);
Assert.DoesNotContain("planar curve flattening does not support curve kind 'BSpline3'", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);
+ Assert.DoesNotContain("Unsupported surface kind 'Sphere'.", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);
}
Assert.Equal(first.FirstFailureLayer, second.FirstFailureLayer);
@@ -95,8 +96,8 @@ public sealed class Step242ConicalSurfaceRegressionTests
[InlineData(
"testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp",
"exporter",
- "Face:47",
- "Unsupported surface kind 'Sphere'.")]
+ "Face:74",
+ "Unsupported surface kind 'BSplineSurfaceWithKnots'.")]
[InlineData(
"testdata/step242/nist/STC/nist_stc_10_asme1_ap242-e2.stp",
"importer-topology",
@@ -139,6 +140,7 @@ public sealed class Step242ConicalSurfaceRegressionTests
{
Assert.NotEqual("Viewer.Tessellation.PlanarCurveFlatteningUnsupported", first.FirstDiagnostic.Source);
Assert.DoesNotContain("planar curve flattening does not support curve kind 'BSpline3'", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);
+ Assert.DoesNotContain("Unsupported surface kind 'Sphere'.", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);
}
Assert.Equal(first.FirstFailureLayer, second.FirstFailureLayer);
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242EllipseEdgeRegressionTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242EllipseEdgeRegressionTests.cs
index 4c30fe5c..89b7953b 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242EllipseEdgeRegressionTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242EllipseEdgeRegressionTests.cs
@@ -5,7 +5,7 @@ namespace Aetheris.Kernel.Core.Tests.Step242;
public sealed class Step242EllipseEdgeRegressionTests
{
[Theory]
- [InlineData("testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp", "exporter", "Face:47", "Unsupported surface kind 'Sphere'.")]
+ [InlineData("testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp", "exporter", "Face:74", "Unsupported surface kind 'BSplineSurfaceWithKnots'.")]
public void Step242_NistEllipseTargets_AdvancePastUnsupportedEllipse_AndRemainDeterministic(string relativePath, string expectedLayer, string expectedSource, string expectedMessagePrefix)
{
var entry = new Step242CorpusManifestEntry(
@@ -22,7 +22,11 @@ public sealed class Step242EllipseEdgeRegressionTests
var second = Step242CorpusManifestRunner.RunOne(entry);
Assert.DoesNotContain("EDGE_CURVE geometry 'ELLIPSE' is unsupported.", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);
- Assert.Equal(expectedLayer, first.FirstFailureLayer);
+ if (!string.IsNullOrEmpty(expectedLayer))
+ {
+ Assert.Equal(expectedLayer, first.FirstFailureLayer);
+ }
+
if (!string.IsNullOrEmpty(expectedSource))
{
Assert.Equal(expectedSource, first.FirstDiagnostic.Source);
@@ -37,6 +41,7 @@ public sealed class Step242EllipseEdgeRegressionTests
{
Assert.NotEqual("Viewer.Tessellation.PlanarCurveFlatteningUnsupported", first.FirstDiagnostic.Source);
Assert.DoesNotContain("planar curve flattening does not support curve kind 'BSpline3'", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);
+ Assert.DoesNotContain("Unsupported surface kind 'Sphere'.", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);
}
Assert.Equal(first.FirstFailureLayer, second.FirstFailureLayer);
diff --git a/Aetheris.Kernel.Core/Step242/Step242Exporter.cs b/Aetheris.Kernel.Core/Step242/Step242Exporter.cs
index a53d4b3b..d4cb5308 100644
--- a/Aetheris.Kernel.Core/Step242/Step242Exporter.cs
+++ b/Aetheris.Kernel.Core/Step242/Step242Exporter.cs
@@ -160,6 +160,12 @@ public static class Step242Exporter
return writer.AddEntity("CONICAL_SURFACE", "$", Step242TextWriter.Ref(axisPlacementId), Step242TextWriter.Number(0d), Step242TextWriter.Number(cone.SemiAngleRadians));
}
+ private static string BuildSphere(Step242TextWriter writer, SphereSurface sphere)
+ {
+ var axisPlacementId = BuildAxisPlacement(writer, sphere.Center, sphere.Axis, sphere.XAxis);
+ return writer.AddEntity("SPHERICAL_SURFACE", "$", Step242TextWriter.Ref(axisPlacementId), Step242TextWriter.Number(sphere.Radius));
+ }
+
private static KernelResult<string> BuildSurface(Step242TextWriter writer, SurfaceGeometry surface, FaceId faceId)
{
return surface.Kind switch
@@ -167,6 +173,7 @@ public static class Step242Exporter
SurfaceGeometryKind.Plane when surface.Plane is PlaneSurface plane => KernelResult<string>.Success(BuildPlane(writer, plane)),
SurfaceGeometryKind.Cylinder when surface.Cylinder is CylinderSurface cylinder => KernelResult<string>.Success(BuildCylinder(writer, cylinder)),
SurfaceGeometryKind.Cone when surface.Cone is ConeSurface cone => KernelResult<string>.Success(BuildCone(writer, cone)),
+ SurfaceGeometryKind.Sphere when surface.Sphere is SphereSurface sphere => KernelResult<string>.Success(BuildSphere(writer, sphere)),
_ => Failure($"Unsupported surface kind '{surface.Kind}'.", $"Face:{faceId.Value}")
};
}
diff --git a/testdata/step242/manifests/nist.v0.report.json b/testdata/step242/manifests/nist.v0.report.json
index 08779f19..b269c7bb 100644
--- a/testdata/step242/manifests/nist.v0.report.json
+++ b/testdata/step242/manifests/nist.v0.report.json
@@ -31,8 +31,8 @@
"firstFailureLayer": "exporter",
"firstDiagnostic": {
"code": "NotImplemented",
- "source": "Face:47",
- "messagePrefix": "Unsupported surface kind \u0027Sphere\u0027."
+ "source": "Face:74",
+ "messagePrefix": "Unsupported surface kind \u0027BSplineSurfaceWithKnots\u0027."
},
"diagnosticCount": 1,
"exceptionEscaped": false,