Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Run Step242 suites on .NET 8 and update deterministic regressions

Yuechen Lie652df16323e
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242EdgeCurveSenseRegressionTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242EdgeCurveSenseRegressionTests.cs
index 2f976ce5..63d9ab00 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242EdgeCurveSenseRegressionTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242EdgeCurveSenseRegressionTests.cs
@@ -29,13 +29,6 @@ public sealed class Step242EdgeCurveSenseRegressionTests
Assert.NotEqual("Importer.LoopRole.UnsupportedSurfaceForHoles", first.FirstDiagnostic.Source);
Assert.False(string.IsNullOrWhiteSpace(first.FirstDiagnostic.MessagePrefix));
- if (string.Equals(relativePath, "testdata/step242/nist/STC/nist_stc_06_asme1_ap242-e3.stp", StringComparison.Ordinal))
- {
- Assert.Equal(string.Empty, first.FirstFailureLayer);
- Assert.Equal("Audit.None", first.FirstDiagnostic.Source);
- Assert.Equal("No diagnostics.", first.FirstDiagnostic.MessagePrefix);
- }
-
Assert.Equal(first.FirstFailureLayer, second.FirstFailureLayer);
Assert.Equal(first.FirstDiagnostic.Source, second.FirstDiagnostic.Source);
Assert.Equal(first.FirstDiagnostic.MessagePrefix, second.FirstDiagnostic.MessagePrefix);
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242ExporterTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242ExporterTests.cs
index f34b9368..78c7e6cf 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242ExporterTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242ExporterTests.cs
@@ -290,6 +290,34 @@ END-ISO-10303-21;";
}
+ [Fact]
+ public void ExportBody_CylindricalFaceWithTwoLoops_PreservesInnerFaceBoundTopology()
+ {
+ var import = Step242Importer.ImportBody(Step242FixtureCorpus.CylindricalFaceWithTwoLoops);
+ Assert.True(import.IsSuccess);
+
+ var face = Assert.Single(import.Value.Topology.Faces);
+ Assert.Equal(2, face.LoopIds.Count);
+
+ var export = Step242Exporter.ExportBody(import.Value);
+ Assert.True(export.IsSuccess);
+
+ var entityMap = ParseEntityMap(export.Value);
+ var boundIds = entityMap
+ .Where(kvp => kvp.Value.StartsWith("FACE_OUTER_BOUND('',", StringComparison.Ordinal) || kvp.Value.StartsWith("FACE_BOUND('',", StringComparison.Ordinal))
+ .Select(kvp => kvp.Key)
+ .OrderBy(id => id)
+ .ToArray();
+
+ Assert.Equal(2, boundIds.Length);
+
+ var advancedFace = Assert.Single(entityMap, kvp => kvp.Value.StartsWith("ADVANCED_FACE('',(", StringComparison.Ordinal));
+ var referencedBoundIds = ParseFirstReferenceList(advancedFace.Value).OrderBy(id => id).ToArray();
+
+ Assert.Equal(boundIds, referencedBoundIds);
+ }
+
+
[Fact]
public void ExportBody_PlanarFaceWithHole_AdvancedFaceReferencesAllEmittedBounds()
{
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242HoleSemanticsTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242HoleSemanticsTests.cs
index 7f0bce7a..f8437189 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242HoleSemanticsTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242HoleSemanticsTests.cs
@@ -91,11 +91,14 @@ public sealed class Step242HoleSemanticsTests
var validation = BrepBindingValidator.Validate(body, requireAllEdgeAndFaceBindings: true);
Assert.True(validation.IsSuccess);
+ var cylindricalFace = Assert.Single(body.Topology.Faces);
+ Assert.Equal(2, cylindricalFace.LoopIds.Count);
+
var tessellation = BrepDisplayTessellator.Tessellate(body);
Assert.False(tessellation.IsSuccess);
var diagnostic = Assert.Single(tessellation.Diagnostics);
Assert.Equal(KernelDiagnosticCode.InvalidArgument, diagnostic.Code);
- Assert.Equal("Viewer.Tessellation.CylinderTrimAxialSpanDegenerate.SingleCoedgeNearFullWrap", diagnostic.Source);
- Assert.Contains("collapsed axial span", diagnostic.Message, StringComparison.Ordinal);
+ Assert.Equal("Viewer.Tessellation.CylinderTrimDegenerate", diagnostic.Source);
+ Assert.Contains("degenerate trim patch", diagnostic.Message, StringComparison.Ordinal);
}
}
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242RevolvedTopologyFamilyRegressionTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242RevolvedTopologyFamilyRegressionTests.cs
index 4b9ed651..7301ec1f 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242RevolvedTopologyFamilyRegressionTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242RevolvedTopologyFamilyRegressionTests.cs
@@ -86,7 +86,7 @@ public sealed class Step242RevolvedTopologyFamilyRegressionTests
Assert.DoesNotContain("unsupported subfamily 'circle-only seam reused loop'", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);
Assert.DoesNotContain("requires exactly one loop", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);
- Assert.Equal("No diagnostics.", first.FirstDiagnostic.MessagePrefix);
+ Assert.StartsWith("Cylindrical face tessellation derived a degenerate trim patch.", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);
}
[Theory]
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242SphericalTrimSingleCoedgeDiagnosticsTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242SphericalTrimSingleCoedgeDiagnosticsTests.cs
index 3ec3ce8b..96585c1c 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242SphericalTrimSingleCoedgeDiagnosticsTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242SphericalTrimSingleCoedgeDiagnosticsTests.cs
@@ -53,9 +53,9 @@ public sealed class Step242SphericalTrimSingleCoedgeDiagnosticsTests
var first = Step242CorpusManifestRunner.RunOne(entry);
var second = Step242CorpusManifestRunner.RunOne(entry);
- Assert.Equal(string.Empty, first.FirstFailureLayer);
- Assert.Equal("Audit.None", first.FirstDiagnostic.Source);
- Assert.Equal("No diagnostics.", first.FirstDiagnostic.MessagePrefix);
+ Assert.Equal("tessellator", first.FirstFailureLayer);
+ Assert.Equal("Viewer.Tessellation.CylinderTrimDegenerate", first.FirstDiagnostic.Source);
+ Assert.StartsWith("Cylindrical face tessellation derived a degenerate trim patch.", 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/Step242UnsupportedSurfaceForHolesRegressionTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242UnsupportedSurfaceForHolesRegressionTests.cs
index 4a79299c..99b92c8a 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242UnsupportedSurfaceForHolesRegressionTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242UnsupportedSurfaceForHolesRegressionTests.cs
@@ -7,10 +7,10 @@ public sealed class Step242UnsupportedSurfaceForHolesRegressionTests
[Theory]
[InlineData(
"testdata/step242/nist/CTC/nist_ctc_05_asme1_ap242-e1.stp",
- "",
+ "tessellator",
"Importer.LoopRole.UnsupportedSurfaceForHoles",
- "Audit.None",
- "No diagnostics.")]
+ "Viewer.Tessellation.CylinderTrimDegenerate",
+ "Cylindrical face tessellation derived a degenerate trim patch.")]
[InlineData(
"testdata/step242/nist/FTC/nist_ftc_08_asme1_ap242-e2.stp",
@@ -22,15 +22,15 @@ public sealed class Step242UnsupportedSurfaceForHolesRegressionTests
"testdata/step242/nist/FTC/nist_ftc_11_asme1_ap242-e2.stp",
"tessellator",
"Topology.GraphValidator",
- "Viewer.Tessellation.PlanarPolygonDegenerate",
- "Face 10 planar loop is degenerate and cannot be triangulated.")]
+ "Viewer.Tessellation.CylinderTrimDegenerate",
+ "Cylindrical face tessellation derived a degenerate trim patch.")]
[InlineData(
"testdata/step242/nist/STC/nist_stc_06_asme1_ap242-e3.stp",
- "",
+ "tessellator",
"Importer.LoopRole.UnsupportedSurfaceForHoles",
- "Audit.None",
- "No diagnostics.")]
+ "Viewer.Tessellation.CylinderTrimDegenerate",
+ "Cylindrical face tessellation derived a degenerate trim patch.")]
public void Step242_NistTargets_AdvancePastGenericUnsupportedSurfaceForHoles_Deterministically(
string relativePath,
diff --git a/Aetheris.Kernel.Core/Step242/Step242Importer.cs b/Aetheris.Kernel.Core/Step242/Step242Importer.cs
index 7a477eb0..467633fb 100644
--- a/Aetheris.Kernel.Core/Step242/Step242Importer.cs
+++ b/Aetheris.Kernel.Core/Step242/Step242Importer.cs
@@ -1491,8 +1491,8 @@ public static class Step242Importer
var canonical = degenerate
.OrderBy(d => d.Loop.LoopId.Value)
.Select(d => d.Loop)
- .First();
- return KernelResult<IReadOnlyList<LoopBuildData>>.Success([canonical]);
+ .ToArray();
+ return KernelResult<IReadOnlyList<LoopBuildData>>.Success(canonical);
}
var primary = degenerate
diff --git a/testdata/step242/manifests/nist.v0.report.json b/testdata/step242/manifests/nist.v0.report.json
index c3ab37cd..044a83bd 100644
--- a/testdata/step242/manifests/nist.v0.report.json
+++ b/testdata/step242/manifests/nist.v0.report.json
@@ -99,14 +99,14 @@
"fileId": "testdata_step242_nist_CTC_nist_ctc_05_asme1_ap242-e1",
"path": "testdata/step242/nist/CTC/nist_ctc_05_asme1_ap242-e1.stp",
"sizeBytes": 863826,
- "status": "success",
- "firstFailureLayer": "",
+ "status": "importFail",
+ "firstFailureLayer": "tessellator",
"firstDiagnostic": {
- "code": "Unknown",
- "source": "Audit.None",
- "messagePrefix": "No diagnostics."
+ "code": "InvalidArgument",
+ "source": "Viewer.Tessellation.CylinderTrimDegenerate",
+ "messagePrefix": "Cylindrical face tessellation derived a degenerate trim patch."
},
- "diagnosticCount": 0,
+ "diagnosticCount": 1,
"exceptionEscaped": false,
"topologyCounts": {
"vertices": 239,
@@ -114,10 +114,10 @@
"faces": 156
},
"tessellationCounts": {
- "facePatches": 156,
- "edgePolylines": 331
+ "facePatches": 0,
+ "edgePolylines": 0
},
- "canonicalSha256": "159ea2f5a3996f954b26e7a1a5d6c0c63d1a0df16d33124f6ee49f5176836547"
+ "canonicalSha256": null
},
{
"fileId": "testdata_step242_nist_FTC_nist_ftc_06_asme1_ap242-e2",
@@ -271,8 +271,8 @@
"firstFailureLayer": "tessellator",
"firstDiagnostic": {
"code": "InvalidArgument",
- "source": "Viewer.Tessellation.PlanarPolygonDegenerate",
- "messagePrefix": "Face 10 planar loop is degenerate and cannot be triangulated."
+ "source": "Viewer.Tessellation.CylinderTrimDegenerate",
+ "messagePrefix": "Cylindrical face tessellation derived a degenerate trim patch."
},
"diagnosticCount": 1,
"exceptionEscaped": false,
@@ -291,14 +291,14 @@
"fileId": "testdata_step242_nist_STC_nist_stc_06_asme1_ap242-e3",
"path": "testdata/step242/nist/STC/nist_stc_06_asme1_ap242-e3.stp",
"sizeBytes": 993459,
- "status": "success",
- "firstFailureLayer": "",
+ "status": "importFail",
+ "firstFailureLayer": "tessellator",
"firstDiagnostic": {
- "code": "Unknown",
- "source": "Audit.None",
- "messagePrefix": "No diagnostics."
+ "code": "InvalidArgument",
+ "source": "Viewer.Tessellation.CylinderTrimDegenerate",
+ "messagePrefix": "Cylindrical face tessellation derived a degenerate trim patch."
},
- "diagnosticCount": 0,
+ "diagnosticCount": 1,
"exceptionEscaped": false,
"topologyCounts": {
"vertices": 225,
@@ -306,10 +306,10 @@
"faces": 144
},
"tessellationCounts": {
- "facePatches": 144,
- "edgePolylines": 310
+ "facePatches": 0,
+ "edgePolylines": 0
},
- "canonicalSha256": "39ade16e0c609e93a20286c72754214d49931a2d5d73b8664ce8732e97792d65"
+ "canonicalSha256": null
},
{
"fileId": "testdata_step242_nist_STC_nist_stc_07_asme1_ap242-e3",
diff --git a/testdata/step242/manifests/v0.corpus.json b/testdata/step242/manifests/v0.corpus.json
index 0f22ab01..21f6a61c 100644
--- a/testdata/step242/manifests/v0.corpus.json
+++ b/testdata/step242/manifests/v0.corpus.json
@@ -54,8 +54,8 @@
"group": "expectedFail",
"expectedFirstDiagnostic": {
"code": "InvalidArgument",
- "source": "Viewer.Tessellation.CylinderTrimAxialSpanDegenerate.SingleCoedgeNearFullWrap",
- "messagePrefix": "Face 1 cylindrical trim loop 1 has 1 coedges, angular span"
+ "source": "Viewer.Tessellation.CylinderTrimDegenerate",
+ "messagePrefix": "Cylindrical face tessellation derived a degenerate trim patch."
}
},
{