Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Run .NET8 regressions and refresh ctc_02 expectations
Yuechen Lie71d9e20a4c2
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242BSplineSurfaceWithKnotsTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242BSplineSurfaceWithKnotsTests.csindex 7eaf1a98..9eab583e 100644--- a/Aetheris.Kernel.Core.Tests/Step242/Step242BSplineSurfaceWithKnotsTests.cs+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242BSplineSurfaceWithKnotsTests.cs@@ -101,13 +101,13 @@ public sealed class Step242BSplineSurfaceWithKnotsTestsAssert.False(string.IsNullOrWhiteSpace(run.FirstDiagnostic.MessagePrefix));if (string.Equals(relativePath, "testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp", StringComparison.Ordinal)){- Assert.Equal("exporter", run.FirstFailureLayer);+ Assert.DoesNotContain("Unsupported curve kind 'Ellipse3'.", run.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);Assert.DoesNotContain("sphere tessellation supports only untrimmed sphere faces with zero loops.", run.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);}}[Theory]- [InlineData("testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp", "exporter", "Edge:1090", "Unsupported curve kind 'Ellipse3'.")]+ [InlineData("testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp", "", "Audit.None", "No diagnostics.")][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(@@ -147,6 +147,7 @@ public sealed class Step242BSplineSurfaceWithKnotsTestsif (string.Equals(relativePath, "testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp", StringComparison.Ordinal)){+ Assert.DoesNotContain("Unsupported curve kind 'Ellipse3'.", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);Assert.DoesNotContain("unsupported surface kind 'BSplineSurfaceWithKnots'", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);Assert.DoesNotContain("Unsupported surface kind 'Sphere'.", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);}diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242ConicalSurfaceRegressionTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242ConicalSurfaceRegressionTests.csindex 08789ca4..4a423fad 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", "Edge:1090", "Unsupported curve kind 'Ellipse3'.")]+ [InlineData("testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp", "", "Audit.None", "No diagnostics.")][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")]@@ -65,6 +65,7 @@ public sealed class Step242ConicalSurfaceRegressionTestsAssert.DoesNotContain("Unsupported surface kind 'Cone'", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);Assert.DoesNotContain("Unsupported curve kind 'Circle3'", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);Assert.DoesNotContain("Unsupported curve kind 'BSpline3'", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);+ Assert.DoesNotContain("Unsupported curve kind 'Ellipse3'.", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);if (!string.IsNullOrEmpty(expectedLayer)){Assert.Equal(expectedLayer, first.FirstFailureLayer);@@ -81,6 +82,7 @@ public sealed class Step242ConicalSurfaceRegressionTestsif (string.Equals(relativePath, "testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp", StringComparison.Ordinal)){+ Assert.DoesNotContain("Unsupported curve kind 'Ellipse3'.", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);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);@@ -95,9 +97,9 @@ public sealed class Step242ConicalSurfaceRegressionTests[Theory][InlineData("testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp",- "exporter",- "Edge:1090",- "Unsupported curve kind 'Ellipse3'.")]+ "",+ "Audit.None",+ "No diagnostics.")][InlineData("testdata/step242/nist/STC/nist_stc_10_asme1_ap242-e2.stp","importer-topology",@@ -138,6 +140,7 @@ public sealed class Step242ConicalSurfaceRegressionTestsif (string.Equals(relativePath, "testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp", StringComparison.Ordinal)){+ Assert.DoesNotContain("Unsupported curve kind 'Ellipse3'.", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);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);diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242EllipseEdgeRegressionTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242EllipseEdgeRegressionTests.csindex 46643a0f..334052f1 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", "Edge:1090", "Unsupported curve kind 'Ellipse3'.")]+ [InlineData("testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp", "", "Audit.None", "No diagnostics.")]public void Step242_NistEllipseTargets_AdvancePastUnsupportedEllipse_AndRemainDeterministic(string relativePath, string expectedLayer, string expectedSource, string expectedMessagePrefix){var entry = new Step242CorpusManifestEntry(@@ -22,6 +22,7 @@ public sealed class Step242EllipseEdgeRegressionTestsvar second = Step242CorpusManifestRunner.RunOne(entry);Assert.DoesNotContain("EDGE_CURVE geometry 'ELLIPSE' is unsupported.", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);+ Assert.DoesNotContain("Unsupported curve kind 'Ellipse3'.", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);if (!string.IsNullOrEmpty(expectedLayer)){Assert.Equal(expectedLayer, first.FirstFailureLayer);diff --git a/Aetheris.Kernel.Core/Step242/Step242Exporter.cs b/Aetheris.Kernel.Core/Step242/Step242Exporter.csindex c04e768c..a0142ac1 100644--- a/Aetheris.Kernel.Core/Step242/Step242Exporter.cs+++ b/Aetheris.Kernel.Core/Step242/Step242Exporter.cs@@ -40,6 +40,7 @@ public static class Step242Exportervar lineIds = new Dictionary<EdgeId, string>();var circleIds = new Dictionary<EdgeId, string>();var bsplineIds = new Dictionary<EdgeId, string>();+ var ellipseIds = new Dictionary<EdgeId, string>();var faceIds = new List<string>();@@ -78,7 +79,7 @@ public static class Step242Exporterif (!edgeCurveIds.TryGetValue(coedge.EdgeId, out var edgeCurveId)){- var edgeResult = BuildEdgeCurve(body, model, writer, coedge.EdgeId, vertexPoints, cartesianPointIds, vertexPointIds, lineIds, circleIds, bsplineIds);+ var edgeResult = BuildEdgeCurve(body, model, writer, coedge.EdgeId, vertexPoints, cartesianPointIds, vertexPointIds, lineIds, circleIds, bsplineIds, ellipseIds);if (!edgeResult.IsSuccess){return KernelResult<string>.Failure(edgeResult.Diagnostics);@@ -245,7 +246,8 @@ public static class Step242ExporterIDictionary<VertexId, string> vertexPointIds,IDictionary<EdgeId, string> lineIds,IDictionary<EdgeId, string> circleIds,- IDictionary<EdgeId, string> bsplineIds)+ IDictionary<EdgeId, string> bsplineIds,+ IDictionary<EdgeId, string> ellipseIds){var edge = model.GetEdge(edgeId);@@ -261,7 +263,8 @@ public static class Step242Exporterif (curve.Kind != CurveGeometryKind.Line3&& curve.Kind != CurveGeometryKind.Circle3- && curve.Kind != CurveGeometryKind.BSpline3)+ && curve.Kind != CurveGeometryKind.BSpline3+ && curve.Kind != CurveGeometryKind.Ellipse3){return Failure($"Unsupported curve kind '{curve.Kind}'.", $"Edge:{edgeId.Value}");}@@ -360,6 +363,17 @@ public static class Step242ExportergeometryCurveId = bsplineId;}+ else if (curve.Kind == CurveGeometryKind.Ellipse3 && curve.Ellipse3 is Ellipse3Curve ellipse)+ {+ if (!ellipseIds.TryGetValue(edgeId, out var ellipseId))+ {+ var axisPlacementId = BuildAxisPlacement(writer, ellipse.Center, ellipse.Normal, ellipse.XAxis);+ ellipseId = writer.AddEntity("ELLIPSE", "$", Step242TextWriter.Ref(axisPlacementId), Step242TextWriter.Number(ellipse.MajorRadius), Step242TextWriter.Number(ellipse.MinorRadius));+ ellipseIds[edgeId] = ellipseId;+ }++ geometryCurveId = ellipseId;+ }else{return Failure($"Unsupported curve kind '{curve.Kind}'.", $"Edge:{edgeId.Value}");@@ -551,6 +565,7 @@ public static class Step242ExporterCurveGeometryKind.Line3 when curve.Line3 is Line3Curve line => KernelResult<Point3D>.Success(line.Evaluate(parameter)),CurveGeometryKind.Circle3 when curve.Circle3 is Circle3Curve circle => KernelResult<Point3D>.Success(circle.Evaluate(parameter)),CurveGeometryKind.BSpline3 when curve.BSpline3 is BSpline3Curve spline => KernelResult<Point3D>.Success(spline.Evaluate(parameter)),+ CurveGeometryKind.Ellipse3 when curve.Ellipse3 is Ellipse3Curve ellipse => KernelResult<Point3D>.Success(ellipse.Evaluate(parameter)),_ => FailurePoint($"Unsupported curve kind '{curve.Kind}'.", $"Edge:{edgeId.Value}")};}diff --git a/testdata/step242/manifests/nist.v0.report.json b/testdata/step242/manifests/nist.v0.report.jsonindex c55bc678..abc13f74 100644--- a/testdata/step242/manifests/nist.v0.report.json+++ b/testdata/step242/manifests/nist.v0.report.json@@ -27,14 +27,14 @@"fileId": "testdata_step242_nist_CTC_nist_ctc_02_asme1_ap242-e2","path": "testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp","sizeBytes": 1958442,- "status": "importFail",- "firstFailureLayer": "exporter",+ "status": "success",+ "firstFailureLayer": "","firstDiagnostic": {- "code": "NotImplemented",- "source": "Edge:1090",- "messagePrefix": "Unsupported curve kind \u0027Ellipse3\u0027."+ "code": "Unknown",+ "source": "Audit.None",+ "messagePrefix": "No diagnostics."},- "diagnosticCount": 1,+ "diagnosticCount": 0,"exceptionEscaped": false,"topologyCounts": {"vertices": 870,@@ -45,7 +45,7 @@"facePatches": 635,"edgePolylines": 1410},- "canonicalSha256": null+ "canonicalSha256": "9e32a60debe271c1785ba8fcbbdb368169658d4f1afccc2cdb506321acdf5fdd"},{"fileId": "testdata_step242_nist_CTC_nist_ctc_03_asme1_ap242-e2",