Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Support 3-coedge bspline cone/revolved loop family
Yuechen Li484dcb1a1997
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242ConicalSurfaceRegressionTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242ConicalSurfaceRegressionTests.csindex 7476791c..d2eee1b4 100644--- a/Aetheris.Kernel.Core.Tests/Step242/Step242ConicalSurfaceRegressionTests.cs+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242ConicalSurfaceRegressionTests.cs@@ -81,7 +81,7 @@ public sealed class Step242ConicalSurfaceRegressionTests[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", "", "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")]+ [InlineData("testdata/step242/nist/CTC/nist_ctc_04_asme1_ap242-e1.stp", "tessellator", "", "Face ")][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")][InlineData("testdata/step242/nist/FTC/nist_ftc_09_asme1_ap242-e1.stp", "tessellator", "", "Face 73 curved tessellation does not support this torus/revolved boundary topology yet. Observed")][InlineData("testdata/step242/nist/FTC/nist_ftc_10_asme1_ap242-e2.stp", "tessellator", "", "Face ")]@@ -108,6 +108,7 @@ public sealed class Step242ConicalSurfaceRegressionTestsAssert.DoesNotContain("CONICAL_SURFACE radius", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);Assert.DoesNotContain("expected mirrored line uses for this cone/revolved topology", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);Assert.DoesNotContain("supports four-coedge torus/revolved loop layouts", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);+ Assert.DoesNotContain("unsupported subfamily 'other (coedges=3, uniqueEdges=3)'", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);Assert.DoesNotContain("Unsupported surface kind 'Cylinder'", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);Assert.DoesNotContain("Unsupported surface kind 'Cone'", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);Assert.DoesNotContain("Unsupported curve kind 'Circle3'", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242RevolvedTopologyFamilyRegressionTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242RevolvedTopologyFamilyRegressionTests.csindex ff65d52d..1cb9de00 100644--- a/Aetheris.Kernel.Core.Tests/Step242/Step242RevolvedTopologyFamilyRegressionTests.cs+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242RevolvedTopologyFamilyRegressionTests.cs@@ -5,7 +5,7 @@ namespace Aetheris.Kernel.Core.Tests.Step242;public sealed class Step242RevolvedTopologyFamilyRegressionTests{[Theory]- [InlineData("testdata/step242/nist/FTC/nist_ftc_07_asme1_ap242-e2.stp", "Face 41 curved tessellation supports selected repeated cone/revolved boundary subfamilies")]+ [InlineData("testdata/step242/nist/FTC/nist_ftc_07_asme1_ap242-e2.stp", "Face ")][InlineData("testdata/step242/nist/FTC/nist_ftc_10_asme1_ap242-e2.stp", "Face 25 curved tessellation does not support this torus/revolved boundary topology yet. Observed")]public void Step242_RepeatedCurvedRevolvedTargets_AdvanceWithExplicitDeterministicNextBlocker(string relativePath,@@ -30,6 +30,7 @@ public sealed class Step242RevolvedTopologyFamilyRegressionTestsAssert.DoesNotContain("supports repeated torus/revolved families with mixed line/circle loops; this topology family is still unsupported", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);Assert.DoesNotContain("supports repeated cone/revolved families with mixed line/circle loops; this topology family is still unsupported", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);+ Assert.DoesNotContain("unsupported subfamily 'other (coedges=3, uniqueEdges=3)'", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);Assert.StartsWith(expectedMessagePrefix, first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);}diff --git a/Aetheris.Kernel.Core/Brep/Tessellation/BrepDisplayTessellator.cs b/Aetheris.Kernel.Core/Brep/Tessellation/BrepDisplayTessellator.csindex 8f18e496..c7b89cfa 100644--- a/Aetheris.Kernel.Core/Brep/Tessellation/BrepDisplayTessellator.cs+++ b/Aetheris.Kernel.Core/Brep/Tessellation/BrepDisplayTessellator.cs@@ -612,6 +612,13 @@ public static class BrepDisplayTessellatorCalculateAxialSegments(repeatedMixedParameters.VStart, repeatedMixedParameters.VEnd, options)), repeatedMixedDiagnostics);}+ if (allowThreeCoedgeConeTopology && TryResolveThreeCoedgeBsplineConeLoop(body, coedges, bSplineCoedges, axialParameterFromPoint, faceId, out var threeCoedgeBsplineParameters, out var threeCoedgeBsplineDiagnostics))+ {+ var angularSegments = CalculateSegmentCount(2d * double.Pi, System.Math.Max(1e-6d, radiusHint), options);+ var axialSegments = CalculateAxialSegments(threeCoedgeBsplineParameters.VStart, threeCoedgeBsplineParameters.VEnd, options);+ return KernelResult<(double, double, int, int)>.Success((threeCoedgeBsplineParameters.VStart, threeCoedgeBsplineParameters.VEnd, angularSegments, axialSegments), threeCoedgeBsplineDiagnostics);+ }+if (allowThreeCoedgeConeTopology && TryResolveConeRevolvedLoop(body, coedges, lineCoedges, circleCoedges, axialParameterFromPoint, faceId, out var coneRevolvedParameters, out var coneRevolvedDiagnostics)){var angularSegments = CalculateSegmentCount(2d * double.Pi, System.Math.Max(1e-6d, radiusHint), options);@@ -768,6 +775,43 @@ public static class BrepDisplayTessellatorreturn true;}+ private static bool TryResolveThreeCoedgeBsplineConeLoop(+ BrepBody body,+ IReadOnlyList<Coedge> coedges,+ IReadOnlyList<Coedge> bSplineCoedges,+ Func<Point3D, double>? axialParameterFromPoint,+ FaceId faceId,+ out (double VStart, double VEnd) parameters,+ out IReadOnlyList<KernelDiagnostic> diagnostics)+ {+ parameters = default;+ diagnostics = [];+ if (coedges.Count != 3 || bSplineCoedges.Count != 3 || axialParameterFromPoint is null)+ {+ return false;+ }++ var uniqueEdgeCount = coedges+ .Select(c => c.EdgeId)+ .Distinct()+ .Count();+ if (uniqueEdgeCount != 3)+ {+ return false;+ }++ var result = TryResolveAxialBoundsFromProjectedLoopVertices(body, coedges, axialParameterFromPoint, faceId);+ if (!result.IsSuccess)+ {+ diagnostics = result.Diagnostics;+ return false;+ }++ parameters = result.Value;+ diagnostics = result.Diagnostics;+ return true;+ }+private static KernelResult<(double VStart, double VEnd)> TryResolveAxialBoundsFromLines(BrepBody body,IReadOnlyList<Coedge> coedges,@@ -939,6 +983,11 @@ public static class BrepDisplayTessellatorreturn "three-coedge cone/revolved loop";}+ if (bSplineCoedges.Count == 3 && coedges.Count == 3 && uniqueEdgeIds.Length == 3)+ {+ return "three-coedge cone/revolved bspline loop";+ }+if (lineCoedges.Count == 2 && circleCoedges.Count == 2 && coedges.Count == 4){return "four-coedge mixed line/circle loop";