Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Restore explicit FTC-06 bounded-curve regression guard
Yuechen Licd0195dab62d
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242BSplineEdgeTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242BSplineEdgeTests.csindex 180e0bed..08208864 100644--- a/Aetheris.Kernel.Core.Tests/Step242/Step242BSplineEdgeTests.cs+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242BSplineEdgeTests.cs@@ -99,14 +99,15 @@ public sealed class Step242BSplineEdgeTests}}+[Fact]- public void Step242_NistFtc06_AdvancesPastBoundedCurveBlocker_Deterministically()+ public void Step242_NistFtc06_StaysPastBoundedCurveAndSelfIntersectBlockers_Deterministically(){const string relativePath = "testdata/step242/nist/FTC/nist_ftc_06_asme1_ap242-e2.stp";var entry = new Step242CorpusManifestEntry(Id: Path.GetFileNameWithoutExtension(relativePath),Path: relativePath,- Group: "nist-bounded-curve-regression",+ Group: "nist-bspline-regression",Notes: "regression",ExpectedFirstDiagnostic: null,ExpectHashStableAfterCanonicalization: null,@@ -116,16 +117,18 @@ public sealed class Step242BSplineEdgeTestsvar first = Step242CorpusManifestRunner.RunOne(entry);var second = Step242CorpusManifestRunner.RunOne(entry);- Assert.NotEqual("EDGE_CURVE geometry 'BOUNDED_CURVE' is unsupported.", first.FirstDiagnostic.MessagePrefix);+ Assert.DoesNotContain("EDGE_CURVE geometry 'BOUNDED_CURVE' is unsupported.", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);+ Assert.DoesNotContain("B_SPLINE_CURVE_WITH_KNOTS self_intersect", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);Assert.Equal(first.FirstDiagnostic.MessagePrefix, second.FirstDiagnostic.MessagePrefix);Assert.Equal(first.FirstFailureLayer, second.FirstFailureLayer);}+[Theory][InlineData("testdata/step242/nist/CTC/nist_ctc_01_asme1_ap242-e1.stp")]+ [InlineData("testdata/step242/nist/FTC/nist_ftc_06_asme1_ap242-e2.stp")][InlineData("testdata/step242/nist/FTC/nist_ftc_07_asme1_ap242-e2.stp")]- [InlineData("testdata/step242/nist/FTC/nist_ftc_09_asme1_ap242-e1.stp")][InlineData("testdata/step242/nist/FTC/nist_ftc_11_asme1_ap242-e2.stp")]- public void Step242_NistTargets_AdvancePastBsplineEdgeUnsupportedBlocker(string relativePath)+ public void Step242_NistTargets_AdvancePastBsplineSelfIntersectBlocker_Deterministically(string relativePath){var entry = new Step242CorpusManifestEntry(Id: Path.GetFileNameWithoutExtension(relativePath),@@ -137,9 +140,13 @@ public sealed class Step242BSplineEdgeTestsExpectTopologyCounts: null,ExpectGeometryKinds: null);- var report = Step242CorpusManifestRunner.RunOne(entry);+ var first = Step242CorpusManifestRunner.RunOne(entry);+ var second = Step242CorpusManifestRunner.RunOne(entry);- Assert.NotEqual("EDGE_CURVE geometry 'B_SPLINE_CURVE_WITH_KNOTS' is unsupported.", report.FirstDiagnostic.MessagePrefix);+ Assert.DoesNotContain("B_SPLINE_CURVE_WITH_KNOTS self_intersect", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);+ Assert.Equal(first.FirstDiagnostic.MessagePrefix, second.FirstDiagnostic.MessagePrefix);+ Assert.Equal(first.FirstFailureLayer, second.FirstFailureLayer);+ Assert.False(string.IsNullOrWhiteSpace(first.FirstDiagnostic.MessagePrefix));}private static string LoadFixture(string relativePath)diff --git a/Aetheris.Kernel.Core/Step242/Step242SubsetDecoder.cs b/Aetheris.Kernel.Core/Step242/Step242SubsetDecoder.csindex bc716f07..74e221d1 100644--- a/Aetheris.Kernel.Core/Step242/Step242SubsetDecoder.cs+++ b/Aetheris.Kernel.Core/Step242/Step242SubsetDecoder.cs@@ -144,6 +144,29 @@ internal static class Step242SubsetDecoderreturn KernelResult<bool>.Success(value.Value);}+ public static KernelResult<bool?> ReadLogical(Step242ParsedEntity entity, int argumentIndex, string context)+ {+ if (argumentIndex < 0 || argumentIndex >= entity.Arguments.Count)+ {+ return Failure<bool?>($"{context}: missing argument at index {argumentIndex}.", $"Entity:{entity.Id}");+ }++ if (entity.Arguments[argumentIndex] is Step242BooleanValue boolValue)+ {+ return KernelResult<bool?>.Success(boolValue.Value);+ }++ if (entity.Arguments[argumentIndex] is Step242EnumValue enumValue+ && IsUnknownLogicalToken(enumValue.Value))+ {+ return KernelResult<bool?>.Success(null);+ }++ return Failure<bool?>(+ $"{context}: expected logical (.T. / .F. / .U.).",+ $"Entity:{entity.Id}");+ }+public static KernelResult<Point3D> ReadVertexPoint(Step242ParsedDocument document, int vertexPointEntityId){var vertexPointEntityResult = document.TryGetEntity(vertexPointEntityId, "VERTEX_POINT");@@ -380,7 +403,7 @@ internal static class Step242SubsetDecoderreturn KernelResult<BSpline3Curve>.Failure(closedCurveResult.Diagnostics);}- var selfIntersectResult = ReadBoolean(splineEntity, 5, "B_SPLINE_CURVE_WITH_KNOTS self_intersect");+ var selfIntersectResult = ReadLogical(splineEntity, 5, "B_SPLINE_CURVE_WITH_KNOTS self_intersect");if (!selfIntersectResult.IsSuccess){return KernelResult<BSpline3Curve>.Failure(selfIntersectResult.Diagnostics);@@ -413,7 +436,7 @@ internal static class Step242SubsetDecoderknotValuesResult.Value,curveFormResult.Value,closedCurveResult.Value,- selfIntersectResult.Value,+ selfIntersectResult.Value ?? false,knotSpecResult.Value));}catch (ArgumentException ex)@@ -936,6 +959,11 @@ internal static class Step242SubsetDecoderprivate static KernelResult<double> FailureNumberCode(string message, string source) => Failure<double>(KernelDiagnosticCode.InvalidArgument, message, source);+ private static bool IsUnknownLogicalToken(string token)+ => string.Equals(token, "U", StringComparison.OrdinalIgnoreCase)+ || string.Equals(token, "UNKNOWN", StringComparison.OrdinalIgnoreCase)+ || string.Equals(token, "UNSET", StringComparison.OrdinalIgnoreCase);+private static string SourceFor(int _entityId, string stableSource) => stableSource;private static KernelResult<T> Failure<T>(string message, string source) =>diff --git a/testdata/step242/manifests/nist.v0.report.json b/testdata/step242/manifests/nist.v0.report.jsonindex ea9146ec..38a676d8 100644--- a/testdata/step242/manifests/nist.v0.report.json+++ b/testdata/step242/manifests/nist.v0.report.json@@ -4,11 +4,11 @@"path": "testdata/step242/nist/CTC/nist_ctc_01_asme1_ap242-e1.stp","sizeBytes": 391739,"status": "importFail",- "firstFailureLayer": "importer-topology",+ "firstFailureLayer": "importer-geometry","firstDiagnostic": {- "code": "NotImplemented",- "source": "Entity:648",- "messagePrefix": "B_SPLINE_CURVE_WITH_KNOTS self_intersect"+ "code": "InvalidArgument",+ "source": "Importer.Geometry.Cone",+ "messagePrefix": "CONICAL_SURFACE radius"},"diagnosticCount": 1,"exceptionEscaped": false,@@ -124,11 +124,11 @@"path": "testdata/step242/nist/FTC/nist_ftc_06_asme1_ap242-e2.stp","sizeBytes": 1960222,"status": "importFail",- "firstFailureLayer": "importer-topology",+ "firstFailureLayer": "importer-geometry","firstDiagnostic": {- "code": "NotImplemented",- "source": "Entity:3133",- "messagePrefix": "B_SPLINE_CURVE_WITH_KNOTS self_intersect"+ "code": "InvalidArgument",+ "source": "Importer.Geometry.Cone",+ "messagePrefix": "CONICAL_SURFACE radius"},"diagnosticCount": 1,"exceptionEscaped": false,@@ -150,9 +150,9 @@"status": "importFail","firstFailureLayer": "importer-topology","firstDiagnostic": {- "code": "NotImplemented",- "source": "Entity:646",- "messagePrefix": "B_SPLINE_CURVE_WITH_KNOTS self_intersect"+ "code": "ValidationFailed",+ "source": "Importer.LoopRole.InnerNotContained",+ "messagePrefix": "Inner loop is not contained by outer loop."},"diagnosticCount": 1,"exceptionEscaped": false,