Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Fix planar coedge direction composition in STEP242 loop assembly
Yuechen Lic4112199951c
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242LoopRoleNormalizationRegressionTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242LoopRoleNormalizationRegressionTests.csindex 7bab2ed4..2259f54c 100644--- a/Aetheris.Kernel.Core.Tests/Step242/Step242LoopRoleNormalizationRegressionTests.cs+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242LoopRoleNormalizationRegressionTests.cs@@ -5,10 +5,10 @@ namespace Aetheris.Kernel.Core.Tests.Step242;public sealed class Step242LoopRoleNormalizationRegressionTests{[Theory]- [InlineData("testdata/step242/nist/CTC/nist_ctc_04_asme1_ap242-e1.stp", "Importer.LoopRole.DisconnectedCoedges", "Planar loop contains disconnected consecutive coedges")]+ [InlineData("testdata/step242/nist/CTC/nist_ctc_04_asme1_ap242-e1.stp", null, null)][InlineData("testdata/step242/nist/CTC/nist_ctc_05_asme1_ap242-e1.stp", "Entity:1234", "FACE_BOUND loop type 'VERTEX_LOOP' is unsupported")]- [InlineData("testdata/step242/nist/FTC/nist_ftc_07_asme1_ap242-e2.stp", "Importer.LoopRole.DisconnectedCoedges", "Planar loop contains disconnected consecutive coedges")]- [InlineData("testdata/step242/nist/FTC/nist_ftc_10_asme1_ap242-e2.stp", "Importer.LoopRole.DisconnectedCoedges", "Planar loop contains disconnected consecutive coedges")]+ [InlineData("testdata/step242/nist/FTC/nist_ftc_07_asme1_ap242-e2.stp", "Importer.EntityFamily", null)]+ [InlineData("testdata/step242/nist/FTC/nist_ftc_10_asme1_ap242-e2.stp", "Importer.EntityFamily", null)][InlineData("testdata/step242/nist/FTC/nist_ftc_11_asme1_ap242-e2.stp", "Importer.LoopRole.CylinderNonNormalizableDegenerateProjection", "Cylinder loop normalization failed")][InlineData("testdata/step242/nist/STC/nist_stc_06_asme1_ap242-e3.stp", null, null)][InlineData("testdata/step242/nist/STC/nist_stc_09_asme1_ap242-e3.stp", null, null)]@@ -40,7 +40,10 @@ public sealed class Step242LoopRoleNormalizationRegressionTestselse{Assert.Equal(expectedSource, first.FirstDiagnostic.Source);- Assert.StartsWith(expectedMessagePrefix!, first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);+ if (expectedMessagePrefix is not null)+ {+ Assert.StartsWith(expectedMessagePrefix, first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);+ }}Assert.Equal(first.FirstFailureLayer, second.FirstFailureLayer);@@ -60,8 +63,26 @@ public sealed class Step242LoopRoleNormalizationRegressionTestsAssert.NotEmpty(first);Assert.Equal(first, second);- Assert.Contains(first, d => d.WouldCreateGhostSegmentWithoutNormalization);- Assert.Contains(first, d => d.Classification == Step242Importer.LoopCoedgeGapClassification.Disconnected);+ Assert.All(first, d => Assert.True(d.Gap3d >= 0d));+ }++ [Theory]+ [InlineData("testdata/step242/nist/CTC/nist_ctc_04_asme1_ap242-e1.stp", 259, 977)]+ [InlineData("testdata/step242/nist/FTC/nist_ftc_07_asme1_ap242-e2.stp", 11, 35)]+ [InlineData("testdata/step242/nist/FTC/nist_ftc_10_asme1_ap242-e2.stp", 3, 20)]+ public void Step242_PlanarLoopRole_KnownWorstLoopJoinGaps_CollapseToNearZero(+ string relativePath,+ int loopId,+ int coedgeId)+ {+ var diagnostics = CaptureCoedgeGaps(relativePath);+ var matching = diagnostics+ .Where(d => d.LoopId == loopId && (d.NextCoedgeId == coedgeId || d.PreviousCoedgeId == coedgeId))+ .ToArray();++ Assert.NotEmpty(matching);+ var worstGap = matching.Max(d => d.Gap3d);+ Assert.InRange(worstGap, 0d, 1e-8);}[Theory]diff --git a/Aetheris.Kernel.Core/Step242/Step242Importer.cs b/Aetheris.Kernel.Core/Step242/Step242Importer.csindex 790b127f..8194d2a6 100644--- a/Aetheris.Kernel.Core/Step242/Step242Importer.cs+++ b/Aetheris.Kernel.Core/Step242/Step242Importer.cs@@ -201,7 +201,7 @@ public static class Step242Importerreturn KernelResult<BrepBody>.Failure(boundOrientationResult.Diagnostics);}- var boundOrientation = boundOrientationResult.Value;+ _ = boundOrientationResult.Value;var loopEntityResult = document.TryGetEntity(loopRefResult.Value.TargetId);if (!loopEntityResult.IsSuccess)@@ -309,10 +309,6 @@ public static class Step242Importer}var isReversed = orientedSenseResult.Value != edgeSameSenseResult.Value;- if (!boundOrientation)- {- isReversed = !isReversed;- }var coedge = new Coedge(coedgeIds[i],diff --git a/testdata/step242/manifests/nist.v0.report.json b/testdata/step242/manifests/nist.v0.report.jsonindex b6fdb678..4990ebba 100644--- a/testdata/step242/manifests/nist.v0.report.json+++ b/testdata/step242/manifests/nist.v0.report.json@@ -76,18 +76,18 @@"path": "testdata/step242/nist/CTC/nist_ctc_04_asme1_ap242-e1.stp","sizeBytes": 1265846,"status": "importFail",- "firstFailureLayer": "importer-topology",+ "firstFailureLayer": "tessellator","firstDiagnostic": {- "code": "ValidationFailed",- "source": "Importer.LoopRole.DisconnectedCoedges",- "messagePrefix": "Planar loop contains disconnected consecutive coedges and cannot be normalized safely. innerLoopId=261, outerLoopId=259,"+ "code": "NotImplemented",+ "source": "",+ "messagePrefix": "Face 1 curved tessellation supports four-coedge torus/revolved loop layouts and the three-coedge cone loop emitted by the handcrafted fixture. Observed"},"diagnosticCount": 1,"exceptionEscaped": false,"topologyCounts": {- "vertices": 0,- "edges": 0,- "faces": 0+ "vertices": 662,+ "edges": 1108,+ "faces": 483},"tessellationCounts": {"facePatches": 0,@@ -150,9 +150,9 @@"status": "importFail","firstFailureLayer": "importer-topology","firstDiagnostic": {- "code": "ValidationFailed",- "source": "Importer.LoopRole.DisconnectedCoedges",- "messagePrefix": "Planar loop contains disconnected consecutive coedges and cannot be normalized safely. innerLoopId=24, outerLoopId=25, o"+ "code": "NotImplemented",+ "source": "Importer.EntityFamily",+ "messagePrefix": "ADVANCED_FACE surface \u0027B_SPLINE_SURFACE_WITH_KNOTS\u0027 is unsupported."},"diagnosticCount": 1,"exceptionEscaped": false,@@ -246,9 +246,9 @@"status": "importFail","firstFailureLayer": "importer-topology","firstDiagnostic": {- "code": "ValidationFailed",- "source": "Importer.LoopRole.DisconnectedCoedges",- "messagePrefix": "Planar loop contains disconnected consecutive coedges and cannot be normalized safely. innerLoopId=5, outerLoopId=6, out"+ "code": "NotImplemented",+ "source": "Importer.EntityFamily",+ "messagePrefix": "ADVANCED_FACE surface \u0027B_SPLINE_SURFACE_WITH_KNOTS\u0027 is unsupported."},"diagnosticCount": 1,"exceptionEscaped": false,