Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Support single-coedge circle seam-reused cone tessellation family
Yuechen Li279df6b07d7c
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242RevolvedTopologyFamilyRegressionTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242RevolvedTopologyFamilyRegressionTests.csindex 38920a05..283c306b 100644--- a/Aetheris.Kernel.Core.Tests/Step242/Step242RevolvedTopologyFamilyRegressionTests.cs+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242RevolvedTopologyFamilyRegressionTests.cs@@ -62,6 +62,32 @@ public sealed class Step242RevolvedTopologyFamilyRegressionTestsAssert.StartsWith("Face 129 curved tessellation supports selected repeated cone/revolved boundary subfamilies; unsupported subfamily 'four-coedge mixed line/bspline revolved loop'. Observed", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);}++ [Fact]+ public void Step242_Ctc05_CircleOnlySeamReusedSingleCoedgeConeLoop_AdvancesDeterministically_ToExplicitNextBlocker()+ {+ const string relativePath = "testdata/step242/nist/CTC/nist_ctc_05_asme1_ap242-e1.stp";+ var entry = new Step242CorpusManifestEntry(+ Id: Path.GetFileNameWithoutExtension(relativePath),+ Path: relativePath,+ Group: "nist-revolved-family-regression",+ Notes: "single-coedge circle-only seam-reused cone/revolved progression",+ ExpectedFirstDiagnostic: null,+ ExpectHashStableAfterCanonicalization: null,+ ExpectTopologyCounts: null,+ ExpectGeometryKinds: null);++ var first = Step242CorpusManifestRunner.RunOne(entry);+ var second = Step242CorpusManifestRunner.RunOne(entry);++ Assert.Equal(first.FirstFailureLayer, second.FirstFailureLayer);+ Assert.Equal(first.FirstDiagnostic.Source, second.FirstDiagnostic.Source);+ Assert.Equal(first.FirstDiagnostic.MessagePrefix, second.FirstDiagnostic.MessagePrefix);++ Assert.DoesNotContain("unsupported subfamily 'circle-only seam reused loop'", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);+ Assert.StartsWith("Face 31 cylindrical trim loop 62 has 1 coedges, angular span", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);+ }+[Theory][InlineData("testdata/step242/nist/FTC/nist_ftc_06_asme1_ap242-e2.stp", "Face 12 spherical trim loop must contain at least three coedges. Observed")][InlineData("testdata/step242/nist/STC/nist_stc_08_asme1_ap242-e3.stp", "No diagnostics.")]diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242UnsupportedSurfaceForHolesRegressionTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242UnsupportedSurfaceForHolesRegressionTests.csindex 3473be07..95105226 100644--- a/Aetheris.Kernel.Core.Tests/Step242/Step242UnsupportedSurfaceForHolesRegressionTests.cs+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242UnsupportedSurfaceForHolesRegressionTests.cs@@ -9,8 +9,8 @@ public sealed class Step242UnsupportedSurfaceForHolesRegressionTests"testdata/step242/nist/CTC/nist_ctc_05_asme1_ap242-e1.stp","tessellator","Importer.LoopRole.UnsupportedSurfaceForHoles",- null,- "Face 30 curved tessellation supports selected repeated cone/revolved boundary subfamilies")]+ "Viewer.Tessellation.CylinderTrimAxialSpanDegenerate",+ "Face 31 cylindrical trim loop 62 has 1 coedges, angular span")][InlineData("testdata/step242/nist/FTC/nist_ftc_08_asme1_ap242-e2.stp","tessellator",diff --git a/Aetheris.Kernel.Core/Brep/Tessellation/BrepDisplayTessellator.cs b/Aetheris.Kernel.Core/Brep/Tessellation/BrepDisplayTessellator.csindex 2ac71e48..55547e79 100644--- a/Aetheris.Kernel.Core/Brep/Tessellation/BrepDisplayTessellator.cs+++ b/Aetheris.Kernel.Core/Brep/Tessellation/BrepDisplayTessellator.cs@@ -687,6 +687,13 @@ public static class BrepDisplayTessellatorreturn KernelResult<(double, double, int, int)>.Success((coneRevolvedParameters.VStart, coneRevolvedParameters.VEnd, angularSegments, axialSegments), coneRevolvedDiagnostics);}+ if (allowThreeCoedgeConeTopology && TryResolveSingleCoedgeCircleSeamReusedConeLoop(body, coedges, lineCoedges, circleCoedges, axialParameterFromPoint, faceId, out var singleCoedgeCircleSeamReusedConeParameters, out var singleCoedgeCircleSeamReusedConeDiagnostics))+ {+ var angularSegments = CalculateSegmentCount(2d * double.Pi, System.Math.Max(1e-6d, radiusHint), options);+ var axialSegments = CalculateAxialSegments(singleCoedgeCircleSeamReusedConeParameters.VStart, singleCoedgeCircleSeamReusedConeParameters.VEnd, options);+ return KernelResult<(double, double, int, int)>.Success((singleCoedgeCircleSeamReusedConeParameters.VStart, singleCoedgeCircleSeamReusedConeParameters.VEnd, angularSegments, axialSegments), singleCoedgeCircleSeamReusedConeDiagnostics);+ }+if (TryResolveFourUseCircleOnlyNonSeamRevolvedLoop(body, coedges, lineCoedges, circleCoedges, axialParameterFromPoint, faceId, out var fourUseCircleOnlyNonSeamParameters, out var fourUseCircleOnlyNonSeamDiagnostics)){var angularSegments = CalculateSegmentCount(2d * double.Pi, System.Math.Max(1e-6d, radiusHint), options);@@ -797,6 +804,57 @@ public static class BrepDisplayTessellatorreturn true;}+ private static bool TryResolveSingleCoedgeCircleSeamReusedConeLoop(+ BrepBody body,+ IReadOnlyList<Coedge> coedges,+ IReadOnlyList<Coedge> lineCoedges,+ IReadOnlyList<Coedge> circleCoedges,+ Func<Point3D, double>? axialParameterFromPoint,+ FaceId faceId,+ out (double VStart, double VEnd) parameters,+ out IReadOnlyList<KernelDiagnostic> diagnostics)+ {+ parameters = default;+ diagnostics = [];++ if (axialParameterFromPoint is null || coedges.Count != 1 || lineCoedges.Count != 0 || circleCoedges.Count != 1)+ {+ return false;+ }++ var coedge = coedges[0];+ var edge = body.Topology.GetEdge(coedge.EdgeId);+ if (edge.StartVertexId != edge.EndVertexId)+ {+ return false;+ }++ if (body.GetEdgeCurve(coedge.EdgeId).Kind != CurveGeometryKind.Circle3)+ {+ return false;+ }++ var vertexPoint = GetVertexPoint(body, edge.StartVertexId);+ if (!vertexPoint.IsSuccess)+ {+ diagnostics = vertexPoint.Diagnostics;+ return false;+ }++ var trimV = axialParameterFromPoint(vertexPoint.Value);+ if (!double.IsFinite(trimV) || trimV <= 1e-8d)+ {+ diagnostics =+ [+ CreateNotImplemented($"Face {faceId.Value} curved tessellation could not derive finite non-degenerate axial bounds for single-coedge seam-reused circle cone topology. Observed: {DescribeRevolvedLoopTopology(body, coedges)}", CurvedTopologyUnsupportedSource)+ ];+ return false;+ }++ parameters = (0d, trimV);+ return true;+ }+private static bool TryResolveRepeatedMixedRevolvedLoop(BrepBody body,IReadOnlyList<Coedge> coedges,@@ -1328,6 +1386,11 @@ public static class BrepDisplayTessellatorif (lineCoedges.Count == 0 && circleCoedges.Count == coedges.Count){+ if (coedges.Count == 1 && uniqueEdgeIds.Length == 1 && seamUses == 1)+ {+ return "single-coedge circle-only seam-reused revolved loop";+ }+if (coedges.Count == 4 && uniqueEdgeIds.Length == 4 && seamUses == 0){return "four-coedge circle-only non-seam revolved loop";diff --git a/testdata/step242/manifests/nist.v0.report.json b/testdata/step242/manifests/nist.v0.report.jsonindex 6babe509..127452c2 100644--- a/testdata/step242/manifests/nist.v0.report.json+++ b/testdata/step242/manifests/nist.v0.report.json@@ -102,9 +102,9 @@"status": "importFail","firstFailureLayer": "tessellator","firstDiagnostic": {- "code": "NotImplemented",- "source": "",- "messagePrefix": "Face 30 curved tessellation supports selected repeated cone/revolved boundary subfamilies; unsupported subfamily \u0027circle-only seam reused loop\u0027. Observed"+ "code": "InvalidArgument",+ "source": "Viewer.Tessellation.CylinderTrimAxialSpanDegenerate",+ "messagePrefix": "Face 31 cylindrical trim loop 62 has 1 coedges, angular span 6.108652381980155, axial span 0, loop count 1; classified a"},"diagnosticCount": 1,"exceptionEscaped": false,