Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
M47c: allow inline CONICAL_SURFACE in ADVANCED_FACE.surface
Yuechen Li9cd9066e757f
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242ImporterTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242ImporterTests.csindex fec8fa61..3230168f 100644--- a/Aetheris.Kernel.Core.Tests/Step242/Step242ImporterTests.cs+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242ImporterTests.cs@@ -184,6 +184,45 @@ public sealed class Step242ImporterTestsAssert.StartsWith("Inline ADVANCED_FACE.surface constructor 'CYLINDRICAL_SURFACE' has unsupported argument shape.", diagnostic.Message, StringComparison.Ordinal);}+ [Fact]+ public void Step242_AdvancedFace_Surface_AllowsInlineConicalSurfaceConstructor()+ {+ var text = LoadFixture("testdata/step242/syntax-robustness/advanced-face-inline-cone-valid.step");++ var parseResult = Step242SubsetParser.Parse(text);+ Assert.True(parseResult.IsSuccess);++ var import = Step242Importer.ImportBody(text);++ Assert.DoesNotContain(import.Diagnostics, d => d.Source is not null && d.Source.StartsWith("Parser", StringComparison.Ordinal));+ Assert.DoesNotContain(import.Diagnostics, d => string.Equals(d.Source, "Importer.StepSyntax.InlineEntity", StringComparison.Ordinal));++ if (!import.IsSuccess)+ {+ Assert.NotEmpty(import.Diagnostics);+ return;+ }++ Assert.Contains(import.Value.Geometry.Surfaces, s => s.Value.Kind == SurfaceGeometryKind.Cone);+ }++ [Fact]+ public void Step242_AdvancedFace_Surface_RejectsInlineConicalSurface_MalformedArgs()+ {+ var text = LoadFixture("testdata/step242/syntax-robustness/advanced-face-inline-cone-malformed.step");++ var parseResult = Step242SubsetParser.Parse(text);+ Assert.True(parseResult.IsSuccess);++ var import = Step242Importer.ImportBody(text);++ Assert.False(import.IsSuccess);+ var diagnostic = Assert.Single(import.Diagnostics);+ Assert.Equal(KernelDiagnosticCode.NotImplemented, diagnostic.Code);+ Assert.Equal("Importer.StepSyntax.InlineEntity", diagnostic.Source);+ Assert.StartsWith("Inline ADVANCED_FACE.surface constructor 'CONICAL_SURFACE' has unsupported argument shape.", diagnostic.Message, StringComparison.Ordinal);+ }+private static string LoadFixture(string relativePath){var path = Path.Combine(Step242CorpusManifestRunner.RepoRoot(), relativePath.Replace('/', Path.DirectorySeparatorChar));diff --git a/Aetheris.Kernel.Core/Step242/Step242Importer.cs b/Aetheris.Kernel.Core/Step242/Step242Importer.csindex 49adad10..48c11740 100644--- a/Aetheris.Kernel.Core/Step242/Step242Importer.cs+++ b/Aetheris.Kernel.Core/Step242/Step242Importer.cs@@ -585,7 +585,8 @@ public static class Step242Importer}if (!string.Equals(surfaceName, "PLANE", StringComparison.Ordinal)- && !string.Equals(surfaceName, "CYLINDRICAL_SURFACE", StringComparison.Ordinal))+ && !string.Equals(surfaceName, "CYLINDRICAL_SURFACE", StringComparison.Ordinal)+ && !string.Equals(surfaceName, "CONICAL_SURFACE", StringComparison.Ordinal)){return FailureInlineSurface<Step242ParsedEntity>($"ADVANCED_FACE surface: inline constructor '{surfaceName}' is not supported in this subset.", SourceFor(faceEntityId, "Importer.StepSyntax.InlineEntity"));}@@ -660,6 +661,41 @@ public static class Step242Importerreturn FailureInlineSurface<IReadOnlyList<Step242Value>>("Inline ADVANCED_FACE.surface constructor 'CYLINDRICAL_SURFACE' has unsupported argument shape.", SourceFor(faceEntityId, "Importer.StepSyntax.InlineEntity"));}+ if (string.Equals(surfaceName, "CONICAL_SURFACE", StringComparison.Ordinal))+ {+ if (inlineArguments.Count == 3)+ {+ if (inlineArguments[0] is not Step242EntityReference+ || inlineArguments[1] is not Step242NumberValue+ || inlineArguments[2] is not Step242NumberValue)+ {+ return FailureInlineSurface<IReadOnlyList<Step242Value>>("Inline ADVANCED_FACE.surface constructor 'CONICAL_SURFACE' has unsupported argument shape.", SourceFor(faceEntityId, "Importer.StepSyntax.InlineEntity"));+ }++ return KernelResult<IReadOnlyList<Step242Value>>.Success([+ Step242OmittedValue.Instance,+ inlineArguments[0],+ inlineArguments[1],+ inlineArguments[2]+ ]);+ }++ if (inlineArguments.Count == 4)+ {+ if (inlineArguments[0] is not Step242OmittedValue+ || inlineArguments[1] is not Step242EntityReference+ || inlineArguments[2] is not Step242NumberValue+ || inlineArguments[3] is not Step242NumberValue)+ {+ return FailureInlineSurface<IReadOnlyList<Step242Value>>("Inline ADVANCED_FACE.surface constructor 'CONICAL_SURFACE' has unsupported argument shape.", SourceFor(faceEntityId, "Importer.StepSyntax.InlineEntity"));+ }++ return KernelResult<IReadOnlyList<Step242Value>>.Success(inlineArguments);+ }++ return FailureInlineSurface<IReadOnlyList<Step242Value>>("Inline ADVANCED_FACE.surface constructor 'CONICAL_SURFACE' has unsupported argument shape.", SourceFor(faceEntityId, "Importer.StepSyntax.InlineEntity"));+ }+return KernelResult<IReadOnlyList<Step242Value>>.Success(inlineArguments);}diff --git a/docs/support-matrix-step242-v0.md b/docs/support-matrix-step242-v0.mdindex 2c8b6edd..10b86a46 100644--- a/docs/support-matrix-step242-v0.md+++ b/docs/support-matrix-step242-v0.md@@ -10,7 +10,7 @@ Aetheris STEP242 v0 is intentionally narrow and deterministic.- Exporter line-edge consistency: for exported `EDGE_CURVE` instances backed by `LINE`, both referenced vertex points are guaranteed to lie on the exported line geometry within export tolerance.- STEP Part 21 complex entity-instance assignments are accepted for parser/decoder context use (for example `#5=(GEOMETRIC_REPRESENTATION_CONTEXT(...)...REPRESENTATION_CONTEXT(...));`).- STEP Part 21 typed parameter values are supported in value position with deterministic normalization (`IDENT(...)` parsed as uppercase identifier + argument list), including common nested wrappers such as `LENGTH_MEASURE(...)` and `LENGTH_MEASURE_WITH_UNIT(LENGTH_MEASURE(...),#...)`.-- `ADVANCED_FACE.surface` accepts either a `#entity` reference or a limited inline surface constructor (`PLANE(...)` and `CYLINDRICAL_SURFACE(...)` in M47b).+- `ADVANCED_FACE.surface` accepts either a `#entity` reference or a limited inline surface constructor (`PLANE(...)`, `CYLINDRICAL_SURFACE(...)`, and `CONICAL_SURFACE(...)` in M47c).## Supported entity families (Tier1)@@ -33,7 +33,7 @@ Aetheris STEP242 v0 is intentionally narrow and deterministic.- Toroidal and other exotic analytic surface support.- Any modeling/editor feature expansion in the Viewer tab.- Typed wrapper decoding is intentionally limited in v0: primitive readers currently unwrap single-argument typed values; wrappers with unexpected arity fail deterministically via `Importer.StepSyntax.TypedValue`.-- Inline surface constructors are intentionally limited in v0: `ADVANCED_FACE.surface = PLANE(...)` and `ADVANCED_FACE.surface = CYLINDRICAL_SURFACE(...)` are accepted in M47b; other inline surface constructors fail deterministically via `Importer.StepSyntax.InlineEntity`.+- Inline surface constructors are intentionally limited in v0: `ADVANCED_FACE.surface = PLANE(...)`, `CYLINDRICAL_SURFACE(...)`, and `CONICAL_SURFACE(...)` are accepted in M47c; other inline surface constructors fail deterministically via `Importer.StepSyntax.InlineEntity`.## Corpus and CI gatediff --git a/testdata/step242/syntax-robustness/advanced-face-inline-cone-malformed.step b/testdata/step242/syntax-robustness/advanced-face-inline-cone-malformed.stepnew file mode 100644index 00000000..f8328f10--- /dev/null+++ b/testdata/step242/syntax-robustness/advanced-face-inline-cone-malformed.step@@ -0,0 +1,21 @@+ISO-10303-21;+HEADER;+ENDSEC;+DATA;+#1=MANIFOLD_SOLID_BREP('solid',#2);+#2=CLOSED_SHELL($,(#3));+#3=ADVANCED_FACE((#4),CONICAL_SURFACE(#30,0.4),.T.);+#4=FACE_OUTER_BOUND($,#6,.T.);+#6=EDGE_LOOP($,(#7));+#7=ORIENTED_EDGE($,$,$,#8,.T.);+#8=EDGE_CURVE($,#9,#9,#11,.T.);+#9=VERTEX_POINT($,#12);+#11=CIRCLE($,#31,1.0);+#12=CARTESIAN_POINT($,(1,0,0));+#30=AXIS2_PLACEMENT_3D($,#14,#15,#16);+#31=AXIS2_PLACEMENT_3D($,#14,#15,#16);+#14=CARTESIAN_POINT($,(0,0,0));+#15=DIRECTION($,(0,0,1));+#16=DIRECTION($,(1,0,0));+ENDSEC;+END-ISO-10303-21;diff --git a/testdata/step242/syntax-robustness/advanced-face-inline-cone-valid.step b/testdata/step242/syntax-robustness/advanced-face-inline-cone-valid.stepnew file mode 100644index 00000000..b3b422b8--- /dev/null+++ b/testdata/step242/syntax-robustness/advanced-face-inline-cone-valid.step@@ -0,0 +1,37 @@+ISO-10303-21;+HEADER;+ENDSEC;+DATA;+#1=MANIFOLD_SOLID_BREP('solid',#2);+#2=CLOSED_SHELL($,(#3));+#3=ADVANCED_FACE((#4),CONICAL_SURFACE(#30,0.4,1.0),.T.);+#4=FACE_OUTER_BOUND($,#6,.T.);+#6=EDGE_LOOP($,(#7,#8,#9,#10));+#7=ORIENTED_EDGE($,$,$,#11,.T.);+#8=ORIENTED_EDGE($,$,$,#12,.T.);+#9=ORIENTED_EDGE($,$,$,#13,.T.);+#10=ORIENTED_EDGE($,$,$,#14,.T.);+#11=EDGE_CURVE($,#15,#16,#17,.T.);+#12=EDGE_CURVE($,#16,#16,#18,.T.);+#13=EDGE_CURVE($,#16,#15,#19,.T.);+#14=EDGE_CURVE($,#15,#15,#20,.T.);+#15=VERTEX_POINT($,#21);+#16=VERTEX_POINT($,#22);+#17=LINE($,#21,#23);+#18=CIRCLE($,#31,1.0);+#19=LINE($,#22,#24);+#20=CIRCLE($,#30,1.0);+#21=CARTESIAN_POINT($,(1,0,0));+#22=CARTESIAN_POINT($,(1,0,1));+#23=VECTOR($,#25,1.0);+#24=VECTOR($,#26,1.0);+#25=DIRECTION($,(0,0,1));+#26=DIRECTION($,(0,0,-1));+#30=AXIS2_PLACEMENT_3D($,#27,#28,#29);+#31=AXIS2_PLACEMENT_3D($,#32,#28,#29);+#32=CARTESIAN_POINT($,(0,0,1));+#27=CARTESIAN_POINT($,(0,0,0));+#28=DIRECTION($,(0,0,1));+#29=DIRECTION($,(1,0,0));+ENDSEC;+END-ISO-10303-21;