Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Support four-coedge circle/bspline torus-revolved family

Yuechen Lif12fd1ed1544
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242BSplineSurfaceWithKnotsTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242BSplineSurfaceWithKnotsTests.cs
index b5c08c75..1c04df85 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242BSplineSurfaceWithKnotsTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242BSplineSurfaceWithKnotsTests.cs
@@ -109,7 +109,7 @@ public sealed class Step242BSplineSurfaceWithKnotsTests
[Theory]
[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 ")]
- [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")]
+ [InlineData("testdata/step242/nist/STC/nist_stc_08_asme1_ap242-e3.stp", "tessellator", "", "Face 62 curved tessellation supports selected repeated torus/revolved boundary subfamilies; unsupported subfamily 'circle-only non-seam loop'. Observed")]
public void Step242_TrimmedSphereTargets_AdvancePastOldUntrimmedSphereBlocker_AndRemainDeterministic(
string relativePath,
string expectedLayer,
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242ConicalSurfaceRegressionTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242ConicalSurfaceRegressionTests.cs
index 50f73344..f467342f 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242ConicalSurfaceRegressionTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242ConicalSurfaceRegressionTests.cs
@@ -81,9 +81,9 @@ 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 174 curved tessellation does not support this torus/revolved boundary topology yet. 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")]
- [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/CTC/nist_ctc_04_asme1_ap242-e1.stp", "tessellator", "", "Face 252 curved tessellation supports selected repeated torus/revolved boundary subfamilies; unsupported subfamily 'other (coedges=4, uniqueEdges=4)'. Observed")]
+ [InlineData("testdata/step242/nist/FTC/nist_ftc_06_asme1_ap242-e2.stp", "tessellator", "", "Face 12 spherical trim loop must contain at least three coedges. Observed")]
+ [InlineData("testdata/step242/nist/FTC/nist_ftc_09_asme1_ap242-e1.stp", "", "Audit.None", "No diagnostics.")]
[InlineData("testdata/step242/nist/FTC/nist_ftc_10_asme1_ap242-e2.stp", "tessellator", "", "Face ")]
[InlineData("testdata/step242/nist/STC/nist_stc_09_asme1_ap242-e3.stp", "", "", "")]
public void Step242_NistCurvedRevolvedTargets_AdvancePastOldTopologyFamily_AndReportDeterministicNextBlocker(
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242RevolvedTopologyFamilyRegressionTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242RevolvedTopologyFamilyRegressionTests.cs
index e46c52ff..c5909d61 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242RevolvedTopologyFamilyRegressionTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242RevolvedTopologyFamilyRegressionTests.cs
@@ -5,8 +5,9 @@ namespace Aetheris.Kernel.Core.Tests.Step242;
public sealed class Step242RevolvedTopologyFamilyRegressionTests
{
[Theory]
+ [InlineData("testdata/step242/nist/CTC/nist_ctc_04_asme1_ap242-e1.stp", "Face 252 curved tessellation supports selected repeated torus/revolved boundary subfamilies; unsupported subfamily 'other (coedges=4, uniqueEdges=4)'. Observed")]
[InlineData("testdata/step242/nist/FTC/nist_ftc_07_asme1_ap242-e2.stp", "Face 43 curved tessellation supports selected repeated torus/revolved boundary subfamilies; unsupported subfamily 'other (coedges=6, uniqueEdges=6)'. Observed")]
- [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")]
+ [InlineData("testdata/step242/nist/FTC/nist_ftc_10_asme1_ap242-e2.stp", "Face 25 curved tessellation supports selected repeated torus/revolved boundary subfamilies; unsupported subfamily 'four-coedge bspline-only revolved loop'. Observed")]
public void Step242_RepeatedCurvedRevolvedTargets_AdvanceWithExplicitDeterministicNextBlocker(
string relativePath,
string expectedMessagePrefix)
@@ -35,11 +36,9 @@ public sealed class Step242RevolvedTopologyFamilyRegressionTests
}
[Theory]
- [InlineData("testdata/step242/nist/CTC/nist_ctc_04_asme1_ap242-e1.stp")]
- [InlineData("testdata/step242/nist/FTC/nist_ftc_06_asme1_ap242-e2.stp")]
- [InlineData("testdata/step242/nist/FTC/nist_ftc_09_asme1_ap242-e1.stp")]
- [InlineData("testdata/step242/nist/STC/nist_stc_08_asme1_ap242-e3.stp")]
- public void Step242_RevolvedTopologyFamilyBlockers_StayDeterministic_AndRemainExplicit(string relativePath)
+ [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", "Face 62 curved tessellation supports selected repeated torus/revolved boundary subfamilies; unsupported subfamily 'circle-only non-seam loop'. Observed")]
+ public void Step242_RevolvedTopologyFamilyBlockers_StayDeterministic_AndRemainExplicit(string relativePath, string expectedMessagePrefix)
{
var entry = new Step242CorpusManifestEntry(
Id: Path.GetFileNameWithoutExtension(relativePath),
@@ -59,8 +58,32 @@ public sealed class Step242RevolvedTopologyFamilyRegressionTests
Assert.Equal(first.FirstDiagnostic.Source, second.FirstDiagnostic.Source);
Assert.Equal(first.FirstDiagnostic.MessagePrefix, second.FirstDiagnostic.MessagePrefix);
- Assert.Contains("curved tessellation", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);
Assert.Contains("Observed", first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);
Assert.False(string.IsNullOrWhiteSpace(first.FirstDiagnostic.MessagePrefix));
+ Assert.StartsWith(expectedMessagePrefix, first.FirstDiagnostic.MessagePrefix, StringComparison.Ordinal);
+ }
+
+ [Fact]
+ public void Step242_RepeatedCurvedRevolvedTargets_AdvanceToSuccess_Deterministically()
+ {
+ const string relativePath = "testdata/step242/nist/FTC/nist_ftc_09_asme1_ap242-e1.stp";
+ var entry = new Step242CorpusManifestEntry(
+ Id: Path.GetFileNameWithoutExtension(relativePath),
+ Path: relativePath,
+ Group: "nist-revolved-family-regression",
+ Notes: "advanced repeated family targets",
+ ExpectedFirstDiagnostic: null,
+ ExpectHashStableAfterCanonicalization: null,
+ ExpectTopologyCounts: null,
+ ExpectGeometryKinds: null);
+
+ var first = Step242CorpusManifestRunner.RunOne(entry);
+ var second = Step242CorpusManifestRunner.RunOne(entry);
+
+ Assert.Equal(string.Empty, first.FirstFailureLayer);
+ Assert.Equal(first.FirstFailureLayer, second.FirstFailureLayer);
+ Assert.Equal(first.FirstDiagnostic.Source, second.FirstDiagnostic.Source);
+ Assert.Equal(first.FirstDiagnostic.MessagePrefix, second.FirstDiagnostic.MessagePrefix);
+ Assert.Equal("No diagnostics.", first.FirstDiagnostic.MessagePrefix);
}
}
diff --git a/Aetheris.Kernel.Core/Brep/Tessellation/BrepDisplayTessellator.cs b/Aetheris.Kernel.Core/Brep/Tessellation/BrepDisplayTessellator.cs
index 452727ce..4054b78c 100644
--- a/Aetheris.Kernel.Core/Brep/Tessellation/BrepDisplayTessellator.cs
+++ b/Aetheris.Kernel.Core/Brep/Tessellation/BrepDisplayTessellator.cs
@@ -594,6 +594,15 @@ public static class BrepDisplayTessellator
CalculateAxialSegments(mixedRevolvedParameters.VStart, mixedRevolvedParameters.VEnd, options)), mixedRevolvedDiagnostics);
}
+ if (TryResolveFourUseCircleBsplineRevolvedLoop(body, coedges, circleCoedges, bSplineCoedges, axialParameterFromPoint, faceId, out var circleBsplineParameters, out var circleBsplineDiagnostics))
+ {
+ return KernelResult<(double, double, int, int)>.Success((
+ circleBsplineParameters.VStart,
+ circleBsplineParameters.VEnd,
+ CalculateSegmentCount(2d * double.Pi, System.Math.Max(1e-6d, radiusHint), options),
+ CalculateAxialSegments(circleBsplineParameters.VStart, circleBsplineParameters.VEnd, options)), circleBsplineDiagnostics);
+ }
+
if (TryResolveRepeatedCircleBsplineRevolvedLoop(body, coedges, circleCoedges, bSplineCoedges, axialParameterFromPoint, faceId, out var repeatedCircleBsplineParameters, out var repeatedCircleBsplineDiagnostics))
{
return KernelResult<(double, double, int, int)>.Success((
@@ -648,14 +657,9 @@ public static class BrepDisplayTessellator
return KernelResult<(double, double, int, int)>.Success((0d, 2d * double.Pi, angularSegments, axialSegments));
}
- if (coedges.Length != 4)
- {
- var topologyFamily = allowThreeCoedgeConeTopology ? "cone/revolved" : "torus/revolved";
- var observedFamily = ClassifyRevolvedTopologyFamily(body, coedges, lineCoedges, circleCoedges, bSplineCoedges);
- return KernelResult<(double, double, int, int)>.Failure([CreateNotImplemented($"Face {faceId.Value} curved tessellation supports selected repeated {topologyFamily} boundary subfamilies; unsupported subfamily '{observedFamily}'. Observed: {DescribeRevolvedLoopTopology(body, coedges)}")]);
- }
-
- return KernelResult<(double, double, int, int)>.Failure([CreateNotImplemented($"Face {faceId.Value} curved tessellation does not support this torus/revolved boundary topology yet. Observed: {DescribeRevolvedLoopTopology(body, coedges)}")]);
+ var topologyFamily = allowThreeCoedgeConeTopology ? "cone/revolved" : "torus/revolved";
+ var observedFamily = ClassifyRevolvedTopologyFamily(body, coedges, lineCoedges, circleCoedges, bSplineCoedges);
+ return KernelResult<(double, double, int, int)>.Failure([CreateNotImplemented($"Face {faceId.Value} curved tessellation supports selected repeated {topologyFamily} boundary subfamilies; unsupported subfamily '{observedFamily}'. Observed: {DescribeRevolvedLoopTopology(body, coedges)}")]);
}
@@ -752,6 +756,35 @@ public static class BrepDisplayTessellator
return true;
}
+ private static bool TryResolveFourUseCircleBsplineRevolvedLoop(
+ BrepBody body,
+ IReadOnlyList<Coedge> coedges,
+ IReadOnlyList<Coedge> circleCoedges,
+ 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 != 4 || circleCoedges.Count != 2 || bSplineCoedges.Count != 2 || axialParameterFromPoint is null)
+ {
+ 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 bool TryResolveConeRevolvedLoop(
BrepBody body,
IReadOnlyList<Coedge> coedges,
@@ -1043,6 +1076,16 @@ public static class BrepDisplayTessellator
return "four-coedge mixed line/circle loop";
}
+ if (lineCoedges.Count == 0 && circleCoedges.Count == 2 && bSplineCoedges.Count == 2 && coedges.Count == 4)
+ {
+ return "four-coedge mixed circle/bspline loop";
+ }
+
+ if (lineCoedges.Count == 0 && circleCoedges.Count == 0 && bSplineCoedges.Count == 4 && coedges.Count == 4)
+ {
+ return "four-coedge bspline-only revolved loop";
+ }
+
return $"other (coedges={coedges.Count}, uniqueEdges={uniqueEdgeIds.Length})";
}
diff --git a/testdata/step242/manifests/nist.v0.report.json b/testdata/step242/manifests/nist.v0.report.json
index e7d16c22..cf78c084 100644
--- a/testdata/step242/manifests/nist.v0.report.json
+++ b/testdata/step242/manifests/nist.v0.report.json
@@ -80,7 +80,7 @@
"firstDiagnostic": {
"code": "NotImplemented",
"source": "",
- "messagePrefix": "Face 174 curved tessellation does not support this torus/revolved boundary topology yet. Observed"
+ "messagePrefix": "Face 252 curved tessellation supports selected repeated torus/revolved boundary subfamilies; unsupported subfamily \u0027other (coedges=4, uniqueEdges=4)\u0027. Observed"
},
"diagnosticCount": 1,
"exceptionEscaped": false,
@@ -128,7 +128,7 @@
"firstDiagnostic": {
"code": "NotImplemented",
"source": "",
- "messagePrefix": "Face 2 curved tessellation does not support this torus/revolved boundary topology yet. Observed"
+ "messagePrefix": "Face 12 spherical trim loop must contain at least three coedges. Observed 2."
},
"diagnosticCount": 1,
"exceptionEscaped": false,
@@ -219,14 +219,14 @@
"fileId": "testdata_step242_nist_FTC_nist_ftc_09_asme1_ap242-e1",
"path": "testdata/step242/nist/FTC/nist_ftc_09_asme1_ap242-e1.stp",
"sizeBytes": 6057450,
- "status": "importFail",
- "firstFailureLayer": "tessellator",
+ "status": "success",
+ "firstFailureLayer": "",
"firstDiagnostic": {
- "code": "NotImplemented",
- "source": "",
- "messagePrefix": "Face 73 curved tessellation does not support this torus/revolved boundary topology yet. Observed"
+ "code": "Unknown",
+ "source": "Audit.None",
+ "messagePrefix": "No diagnostics."
},
- "diagnosticCount": 1,
+ "diagnosticCount": 0,
"exceptionEscaped": false,
"topologyCounts": {
"vertices": 304,
@@ -234,10 +234,10 @@
"faces": 159
},
"tessellationCounts": {
- "facePatches": 0,
- "edgePolylines": 0
+ "facePatches": 159,
+ "edgePolylines": 458
},
- "canonicalSha256": null
+ "canonicalSha256": "25b4cf509c5d90b49db0c212d9c8bc08e1db96011e424803a65593b3f275b30a"
},
{
"fileId": "testdata_step242_nist_FTC_nist_ftc_10_asme1_ap242-e2",
@@ -248,7 +248,7 @@
"firstDiagnostic": {
"code": "NotImplemented",
"source": "",
- "messagePrefix": "Face 25 curved tessellation does not support this torus/revolved boundary topology yet. Observed"
+ "messagePrefix": "Face 25 curved tessellation supports selected repeated torus/revolved boundary subfamilies; unsupported subfamily \u0027four-coedge bspline-only revolved loop\u0027. Observed"
},
"diagnosticCount": 1,
"exceptionEscaped": false,
@@ -344,7 +344,7 @@
"firstDiagnostic": {
"code": "NotImplemented",
"source": "",
- "messagePrefix": "Face 62 curved tessellation does not support this torus/revolved boundary topology yet. Observed"
+ "messagePrefix": "Face 62 curved tessellation supports selected repeated torus/revolved boundary subfamilies; unsupported subfamily \u0027circle-only non-seam loop\u0027. Observed"
},
"diagnosticCount": 1,
"exceptionEscaped": false,