Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Run .NET 8 regressions and pin ctc_02 next blocker

Yuechen Lib5e2828d9d0d
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242BSplineSurfaceWithKnotsTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242BSplineSurfaceWithKnotsTests.cs
index e9a453ad..7eaf1a98 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242BSplineSurfaceWithKnotsTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242BSplineSurfaceWithKnotsTests.cs
@@ -14,6 +14,46 @@ public sealed class Step242BSplineSurfaceWithKnotsTests
Assert.True(import.IsSuccess);
Assert.Contains(import.Value.Geometry.Surfaces, s => s.Value.Kind == SurfaceGeometryKind.BSplineSurfaceWithKnots);
+
+ var export = Step242Exporter.ExportBody(import.Value);
+ Assert.True(export.IsSuccess);
+ Assert.Contains("B_SPLINE_SURFACE_WITH_KNOTS(", export.Value, StringComparison.Ordinal);
+ }
+
+ [Fact]
+ public void Step242_NistCtc02_BSplineSurfaces_ObservedAsNonRationalWithExpectedDegreeFamilies()
+ {
+ var path = Path.Combine(Step242CorpusManifestRunner.RepoRoot(), "testdata", "step242", "nist", "CTC", "nist_ctc_02_asme1_ap242-e2.stp");
+ var import = Step242Importer.ImportBody(File.ReadAllText(path));
+ Assert.True(import.IsSuccess);
+
+ var splineSurfaces = import.Value.Geometry.Surfaces
+ .Select(surface => surface.Value)
+ .Where(surface => surface.Kind == SurfaceGeometryKind.BSplineSurfaceWithKnots)
+ .Select(surface => surface.BSplineSurfaceWithKnots)
+ .Where(surface => surface is not null)
+ .Select(surface => surface!)
+ .ToArray();
+
+ Assert.NotEmpty(splineSurfaces);
+ Assert.All(splineSurfaces, surface =>
+ {
+ Assert.True(surface.ControlPoints.Count >= surface.DegreeU + 1);
+ Assert.True(surface.ControlPoints[0].Count >= surface.DegreeV + 1);
+ Assert.Equal(surface.KnotMultiplicitiesU.Count, surface.KnotValuesU.Count);
+ Assert.Equal(surface.KnotMultiplicitiesV.Count, surface.KnotValuesV.Count);
+ });
+
+ var degreePairs = splineSurfaces
+ .Select(surface => (surface.DegreeU, surface.DegreeV))
+ .Distinct()
+ .OrderBy(pair => pair.DegreeU)
+ .ThenBy(pair => pair.DegreeV)
+ .ToArray();
+
+ Assert.Contains((1, 3), degreePairs);
+ Assert.Contains((3, 1), degreePairs);
+ Assert.Contains((3, 3), degreePairs);
}
[Theory]
@@ -67,7 +107,7 @@ public sealed class Step242BSplineSurfaceWithKnotsTests
}
[Theory]
- [InlineData("testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp", "exporter", "Face:74", "Unsupported surface kind 'BSplineSurfaceWithKnots'.")]
+ [InlineData("testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp", "exporter", "Edge:1090", "Unsupported curve kind 'Ellipse3'.")]
[InlineData("testdata/step242/nist/FTC/nist_ftc_07_asme1_ap242-e2.stp", "tessellator", "", "Face 20 curved tessellation supports repeated torus/revolved families with mixed line/circle loops; this topology family is still unsupported. Observed")]
[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")]
public void Step242_TrimmedSphereTargets_AdvancePastOldUntrimmedSphereBlocker_AndRemainDeterministic(
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242ConicalSurfaceRegressionTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242ConicalSurfaceRegressionTests.cs
index 9660bcd2..08789ca4 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242ConicalSurfaceRegressionTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242ConicalSurfaceRegressionTests.cs
@@ -32,7 +32,7 @@ public sealed class Step242ConicalSurfaceRegressionTests
[Theory]
[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", "exporter", "Face:74", "Unsupported surface kind 'BSplineSurfaceWithKnots'.")]
+ [InlineData("testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp", "exporter", "Edge:1090", "Unsupported curve kind 'Ellipse3'.")]
[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 supports repeated cone/revolved families with mixed line/circle loops; this topology family is still unsupported. 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")]
@@ -96,8 +96,8 @@ public sealed class Step242ConicalSurfaceRegressionTests
[InlineData(
"testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp",
"exporter",
- "Face:74",
- "Unsupported surface kind 'BSplineSurfaceWithKnots'.")]
+ "Edge:1090",
+ "Unsupported curve kind 'Ellipse3'.")]
[InlineData(
"testdata/step242/nist/STC/nist_stc_10_asme1_ap242-e2.stp",
"importer-topology",
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242EllipseEdgeRegressionTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242EllipseEdgeRegressionTests.cs
index 89b7953b..46643a0f 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242EllipseEdgeRegressionTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242EllipseEdgeRegressionTests.cs
@@ -5,7 +5,7 @@ namespace Aetheris.Kernel.Core.Tests.Step242;
public sealed class Step242EllipseEdgeRegressionTests
{
[Theory]
- [InlineData("testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp", "exporter", "Face:74", "Unsupported surface kind 'BSplineSurfaceWithKnots'.")]
+ [InlineData("testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp", "exporter", "Edge:1090", "Unsupported curve kind 'Ellipse3'.")]
public void Step242_NistEllipseTargets_AdvancePastUnsupportedEllipse_AndRemainDeterministic(string relativePath, string expectedLayer, string expectedSource, string expectedMessagePrefix)
{
var entry = new Step242CorpusManifestEntry(
diff --git a/Aetheris.Kernel.Core/Step242/Step242Exporter.cs b/Aetheris.Kernel.Core/Step242/Step242Exporter.cs
index d4cb5308..c04e768c 100644
--- a/Aetheris.Kernel.Core/Step242/Step242Exporter.cs
+++ b/Aetheris.Kernel.Core/Step242/Step242Exporter.cs
@@ -166,6 +166,45 @@ public static class Step242Exporter
return writer.AddEntity("SPHERICAL_SURFACE", "$", Step242TextWriter.Ref(axisPlacementId), Step242TextWriter.Number(sphere.Radius));
}
+ private static string BuildBSplineSurfaceWithKnots(Step242TextWriter writer, BSplineSurfaceWithKnots surface)
+ {
+ var controlPointRows = surface.ControlPoints
+ .Select(row =>
+ {
+ var rowPointIds = row
+ .Select(point => writer.AddEntity("CARTESIAN_POINT", "$", PointList(point)))
+ .Select(Step242TextWriter.Ref)
+ .ToArray();
+ return Step242TextWriter.List(rowPointIds);
+ })
+ .ToArray();
+
+ var multiplicitiesU = surface.KnotMultiplicitiesU
+ .Select(multiplicity => multiplicity.ToString(System.Globalization.CultureInfo.InvariantCulture))
+ .ToArray();
+ var multiplicitiesV = surface.KnotMultiplicitiesV
+ .Select(multiplicity => multiplicity.ToString(System.Globalization.CultureInfo.InvariantCulture))
+ .ToArray();
+ var knotValuesU = surface.KnotValuesU.Select(Step242TextWriter.Number).ToArray();
+ var knotValuesV = surface.KnotValuesV.Select(Step242TextWriter.Number).ToArray();
+
+ return writer.AddEntity(
+ "B_SPLINE_SURFACE_WITH_KNOTS",
+ "$",
+ surface.DegreeU.ToString(System.Globalization.CultureInfo.InvariantCulture),
+ surface.DegreeV.ToString(System.Globalization.CultureInfo.InvariantCulture),
+ Step242TextWriter.List(controlPointRows),
+ Step242TextWriter.Enum(surface.SurfaceForm),
+ Step242TextWriter.BooleanLogical(surface.UClosed),
+ Step242TextWriter.BooleanLogical(surface.VClosed),
+ Step242TextWriter.BooleanLogical(surface.SelfIntersect),
+ Step242TextWriter.List(multiplicitiesU),
+ Step242TextWriter.List(multiplicitiesV),
+ Step242TextWriter.List(knotValuesU),
+ Step242TextWriter.List(knotValuesV),
+ Step242TextWriter.Enum(surface.KnotSpec));
+ }
+
private static KernelResult<string> BuildSurface(Step242TextWriter writer, SurfaceGeometry surface, FaceId faceId)
{
return surface.Kind switch
@@ -174,6 +213,7 @@ public static class Step242Exporter
SurfaceGeometryKind.Cylinder when surface.Cylinder is CylinderSurface cylinder => KernelResult<string>.Success(BuildCylinder(writer, cylinder)),
SurfaceGeometryKind.Cone when surface.Cone is ConeSurface cone => KernelResult<string>.Success(BuildCone(writer, cone)),
SurfaceGeometryKind.Sphere when surface.Sphere is SphereSurface sphere => KernelResult<string>.Success(BuildSphere(writer, sphere)),
+ SurfaceGeometryKind.BSplineSurfaceWithKnots when surface.BSplineSurfaceWithKnots is BSplineSurfaceWithKnots bSplineSurface => KernelResult<string>.Success(BuildBSplineSurfaceWithKnots(writer, bSplineSurface)),
_ => Failure($"Unsupported surface kind '{surface.Kind}'.", $"Face:{faceId.Value}")
};
}
diff --git a/testdata/step242/manifests/nist.v0.report.json b/testdata/step242/manifests/nist.v0.report.json
index b269c7bb..c55bc678 100644
--- a/testdata/step242/manifests/nist.v0.report.json
+++ b/testdata/step242/manifests/nist.v0.report.json
@@ -31,8 +31,8 @@
"firstFailureLayer": "exporter",
"firstDiagnostic": {
"code": "NotImplemented",
- "source": "Face:74",
- "messagePrefix": "Unsupported surface kind \u0027BSplineSurfaceWithKnots\u0027."
+ "source": "Edge:1090",
+ "messagePrefix": "Unsupported curve kind \u0027Ellipse3\u0027."
},
"diagnosticCount": 1,
"exceptionEscaped": false,