Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
M10l document loud-failure box-sphere boundary
Yuechen Li4c36bae7b455
diff --git a/Aetheris.Kernel.Core.Tests/Brep/Boolean/BrepBooleanTests.cs b/Aetheris.Kernel.Core.Tests/Brep/Boolean/BrepBooleanTests.csindex 7971f2ce..4e00d78e 100644--- a/Aetheris.Kernel.Core.Tests/Brep/Boolean/BrepBooleanTests.cs+++ b/Aetheris.Kernel.Core.Tests/Brep/Boolean/BrepBooleanTests.cs@@ -330,6 +330,49 @@ public sealed class BrepBooleanTestsAssert.Equal("Boolean Intersect: M13 only supports recognized axis-aligned boxes from BrepPrimitives.CreateBox(...).", diagnostic.Message);}++ [Fact]+ public void Subtract_BoxSphereFullyContained_StillReturnsDeterministicNotImplemented()+ {+ var left = BrepBooleanBoxRecognition.CreateBoxFromExtents(new AxisAlignedBoxExtents(-20d, 20d, -15d, 15d, -6d, 6d)).Value;+ var right = BrepPrimitives.CreateSphere(4d).Value;++ var result = BrepBoolean.Subtract(left, right);++ Assert.False(result.IsSuccess);+ var diagnostic = Assert.Single(result.Diagnostics);+ Assert.Equal(KernelDiagnosticCode.NotImplemented, diagnostic.Code);+ Assert.Equal("Boolean Subtract: M13 only supports recognized axis-aligned boxes from BrepPrimitives.CreateBox(...).", diagnostic.Message);+ }++ [Fact]+ public void Union_BoxSphereOverlap_StillReturnsDeterministicNotImplemented()+ {+ var left = BrepBooleanBoxRecognition.CreateBoxFromExtents(new AxisAlignedBoxExtents(-20d, 20d, -15d, 15d, -6d, 6d)).Value;+ var right = BrepPrimitives.CreateSphere(4d).Value;++ var result = BrepBoolean.Union(left, right);++ Assert.False(result.IsSuccess);+ var diagnostic = Assert.Single(result.Diagnostics);+ Assert.Equal(KernelDiagnosticCode.NotImplemented, diagnostic.Code);+ Assert.Equal("Boolean Union: M13 only supports recognized axis-aligned boxes from BrepPrimitives.CreateBox(...).", diagnostic.Message);+ }++ [Fact]+ public void Intersect_BoxSphereOverlap_StillReturnsDeterministicNotImplemented()+ {+ var left = BrepBooleanBoxRecognition.CreateBoxFromExtents(new AxisAlignedBoxExtents(-20d, 20d, -15d, 15d, -6d, 6d)).Value;+ var right = BrepPrimitives.CreateSphere(4d).Value;++ var result = BrepBoolean.Intersect(left, right);++ Assert.False(result.IsSuccess);+ var diagnostic = Assert.Single(result.Diagnostics);+ Assert.Equal(KernelDiagnosticCode.NotImplemented, diagnostic.Code);+ Assert.Equal("Boolean Intersect: M13 only supports recognized axis-aligned boxes from BrepPrimitives.CreateBox(...).", diagnostic.Message);+ }+[Fact]public void Execute_NonBoxInput_ReturnsDeterministicNotImplementedWithoutThrowing(){diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanCanonicalSuccessTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanCanonicalSuccessTests.csindex a0d8ad16..354f3290 100644--- a/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanCanonicalSuccessTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanCanonicalSuccessTests.cs@@ -78,17 +78,20 @@ public sealed class FirmamentBooleanCanonicalSuccessTestsdiagnostic.Message.Contains("requires at least one executed primitive or boolean body", StringComparison.Ordinal));}- public static TheoryData<string, string, string> UnsupportedBoxCylinderBooleanFixtures =>+ public static TheoryData<string, string, string> UnsupportedMixedPrimitiveBooleanFixtures =>new(){{ "testdata/firmament/fixtures/m10j-unsupported-box-add-cylinder.firmament", "joined", "add" },{ "testdata/firmament/fixtures/m10h1-unsupported-box-with-cylinder-hole.firmament", "hole", "subtract" },- { "testdata/firmament/fixtures/m10j-unsupported-box-intersect-cylinder.firmament", "overlap", "intersect" }+ { "testdata/firmament/fixtures/m10j-unsupported-box-intersect-cylinder.firmament", "overlap", "intersect" },+ { "testdata/firmament/fixtures/m10l-unsupported-box-subtract-sphere-contained.firmament", "cavity", "subtract" },+ { "testdata/firmament/fixtures/m10l-unsupported-box-add-sphere.firmament", "joined", "add" },+ { "testdata/firmament/fixtures/m10l-unsupported-box-intersect-sphere.firmament", "overlap", "intersect" }};[Theory]- [MemberData(nameof(UnsupportedBoxCylinderBooleanFixtures))]- public void BoxCylinderBooleans_Remain_Unsupported_And_Fail_Loudly(string fixturePath, string expectedFeatureId, string expectedKind)+ [MemberData(nameof(UnsupportedMixedPrimitiveBooleanFixtures))]+ public void MixedPrimitiveBooleans_Remain_Unsupported_And_Fail_Loudly(string fixturePath, string expectedFeatureId, string expectedKind){var result = FirmamentCorpusHarness.Compile(FirmamentCorpusHarness.ReadFixtureText(fixturePath));@@ -103,6 +106,24 @@ public sealed class FirmamentBooleanCanonicalSuccessTests|| diagnostic.Message.Contains("strict Z-aligned through-hole subset", StringComparison.Ordinal)));}++ [Theory]+ [InlineData("testdata/firmament/fixtures/m10l-unsupported-box-subtract-sphere-touching-boundary.firmament", "tangent_cavity")]+ [InlineData("testdata/firmament/fixtures/m10l-unsupported-box-subtract-sphere-partially-outside.firmament", "leaking_cavity")]+ public void BoxSphereSubtract_OutsideProvenSubset_RemainsUnsupported(string fixturePath, string expectedFeatureId)+ {+ var result = FirmamentCorpusHarness.Compile(FirmamentCorpusHarness.ReadFixtureText(fixturePath));++ Assert.False(result.Compilation.IsSuccess);+ Assert.Contains(result.Compilation.Diagnostics, diagnostic =>+ diagnostic.Code == KernelDiagnosticCode.NotImplemented+ && diagnostic.Source == "firmament"+ && diagnostic.Message.Contains($"Requested boolean feature '{expectedFeatureId}' (subtract) could not be executed.", StringComparison.Ordinal));+ Assert.Contains(result.Compilation.Diagnostics, diagnostic =>+ diagnostic.Code == KernelDiagnosticCode.NotImplemented+ && diagnostic.Message.Contains("M13 only supports recognized axis-aligned boxes from BrepPrimitives.CreateBox(...).", StringComparison.Ordinal));+ }+private static Aetheris.Kernel.Core.Results.KernelResult<FirmamentStepExportResult> ExportFixture(string fixturePath) =>FirmamentStepExporter.Export(new FirmamentCompileRequest(new FirmamentSourceDocument(FirmamentCorpusHarness.ReadFixtureText(fixturePath))));}diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.csindex d74f5ea9..d244dfc6 100644--- a/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs@@ -150,7 +150,10 @@ public sealed class FirmamentBuildAndExportTests[Theory][InlineData("testdata/firmament/fixtures/m10j-unsupported-box-add-cylinder.firmament", "m10j-unsupported-box-add-cylinder.step", "joined", "add")][InlineData("testdata/firmament/fixtures/m10j-unsupported-box-intersect-cylinder.firmament", "m10j-unsupported-box-intersect-cylinder.step", "overlap", "intersect")]- public void Run_Unsupported_BoxCylinder_Fixtures_Fail_And_Do_Not_Write_Fallback_Export(+ [InlineData("testdata/firmament/fixtures/m10l-unsupported-box-subtract-sphere-contained.firmament", "m10l-unsupported-box-subtract-sphere-contained.step", "cavity", "subtract")]+ [InlineData("testdata/firmament/fixtures/m10l-unsupported-box-add-sphere.firmament", "m10l-unsupported-box-add-sphere.step", "joined", "add")]+ [InlineData("testdata/firmament/fixtures/m10l-unsupported-box-intersect-sphere.firmament", "m10l-unsupported-box-intersect-sphere.step", "overlap", "intersect")]+ public void Run_Unsupported_MixedPrimitive_Fixtures_Fail_And_Do_Not_Write_Fallback_Export(string sourcePath,string expectedFileName,string expectedFeatureId,diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.csindex 0770bbbf..759c9475 100644--- a/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.cs@@ -97,6 +97,26 @@ public sealed class FirmamentStepExporterTestsAssert.DoesNotContain(first.Diagnostics, diagnostic => diagnostic.Message.Contains("requires at least one executed primitive or boolean body", StringComparison.Ordinal));}++ [Theory]+ [InlineData("testdata/firmament/fixtures/m10l-unsupported-box-subtract-sphere-contained.firmament", "cavity")]+ [InlineData("testdata/firmament/fixtures/m10l-unsupported-box-subtract-sphere-touching-boundary.firmament", "tangent_cavity")]+ [InlineData("testdata/firmament/fixtures/m10l-unsupported-box-subtract-sphere-partially-outside.firmament", "leaking_cavity")]+ [InlineData("testdata/firmament/fixtures/m10l-unsupported-box-add-sphere.firmament", "joined")]+ [InlineData("testdata/firmament/fixtures/m10l-unsupported-box-intersect-sphere.firmament", "overlap")]+ public void Export_BoxSphereFixtures_Fail_Loudly_Without_Fallback(string fixturePath, string expectedFeatureId)+ {+ var first = ExportFixture(fixturePath);+ var second = ExportFixture(fixturePath);++ Assert.False(first.IsSuccess);+ Assert.False(second.IsSuccess);+ Assert.Equal(first.Diagnostics, second.Diagnostics);+ Assert.Contains(first.Diagnostics, diagnostic => diagnostic.Message.Contains($"Requested boolean feature '{expectedFeatureId}'", StringComparison.Ordinal));+ Assert.Contains(first.Diagnostics, diagnostic => diagnostic.Message.Contains("M13 only supports recognized axis-aligned boxes from BrepPrimitives.CreateBox(...).", StringComparison.Ordinal));+ Assert.DoesNotContain(first.Diagnostics, diagnostic => diagnostic.Message.Contains("requires at least one executed primitive or boolean body", StringComparison.Ordinal));+ }+[Fact]public void Export_SchemaPresent_Model_Still_Exports_With_Stable_Metadata_And_Deterministic_Text(){diff --git a/testdata/firmament/examples/README.md b/testdata/firmament/examples/README.mdindex d1650ce5..9e367f3c 100644--- a/testdata/firmament/examples/README.md+++ b/testdata/firmament/examples/README.md@@ -19,4 +19,4 @@ Other combinations may fail and are intentionally not supported yet.- `placed_primitive.firmament` — selector-based placement using `place.on` and `offset[3]`; helper export path: `testdata/firmament/exports/placed_primitive.step`.- `schema_box_basic.firmament` — minimal schema-present export example showing schema presence without changing export body semantics; helper export path: `testdata/firmament/exports/schema_box_basic.step`.-Unsupported boolean requests are tracked as fixtures/tests, not presented in this working example pack. The only supported box+cylinder case is `subtract(box, cylinder)` where the cylinder stays axis-aligned with +Z/-Z, fully spans the box from bottom face to top face, and remains strictly inside the box footprint so the result is one connected box-with-through-hole solid. Box+cylinder `add`, box+cylinder `intersect`, rotated cylinders, partial-depth cuts, tangent/grazing cases, and outside-footprint cuts remain unsupported. These files are intended to stay minimal, readable, and aligned with the implemented language surface. Export artifacts are kept separately under `testdata/firmament/exports/` so examples remain source-only and demo outputs stay easy to find.+Unsupported boolean requests are tracked as fixtures/tests, not presented in this working example pack. The only supported box+cylinder case is `subtract(box, cylinder)` where the cylinder stays axis-aligned with +Z/-Z, fully spans the box from bottom face to top face, and remains strictly inside the box footprint so the result is one connected box-with-through-hole solid. Box+cylinder `add`, box+cylinder `intersect`, rotated cylinders, partial-depth cuts, tangent/grazing cases, and outside-footprint cuts remain unsupported. Box+sphere booleans are currently unsupported in all audited forms, including `subtract(box, sphere)` with a fully contained sphere, boundary-touching sphere, or partially outside sphere, plus all current box+sphere `add` and `intersect` requests. These files are intended to stay minimal, readable, and aligned with the implemented language surface. Export artifacts are kept separately under `testdata/firmament/exports/` so examples remain source-only and demo outputs stay easy to find.diff --git a/testdata/firmament/fixtures/m10l-unsupported-box-add-sphere.firmament b/testdata/firmament/fixtures/m10l-unsupported-box-add-sphere.firmamentnew file mode 100644index 00000000..7e6f478e--- /dev/null+++ b/testdata/firmament/fixtures/m10l-unsupported-box-add-sphere.firmament@@ -0,0 +1,23 @@+firmament:+ version: 1++model:+ name: m10l_unsupported_box_add_sphere+ units: mm++ops[2]:+ -+ op: box+ id: base+ size[3]:+ 40+ 30+ 12++ -+ op: add+ id: joined+ to: base+ with:+ op: sphere+ radius: 4diff --git a/testdata/firmament/fixtures/m10l-unsupported-box-intersect-sphere.firmament b/testdata/firmament/fixtures/m10l-unsupported-box-intersect-sphere.firmamentnew file mode 100644index 00000000..8a1bf3dd--- /dev/null+++ b/testdata/firmament/fixtures/m10l-unsupported-box-intersect-sphere.firmament@@ -0,0 +1,23 @@+firmament:+ version: 1++model:+ name: m10l_unsupported_box_intersect_sphere+ units: mm++ops[2]:+ -+ op: box+ id: base+ size[3]:+ 40+ 30+ 12++ -+ op: intersect+ id: overlap+ left: base+ with:+ op: sphere+ radius: 4diff --git a/testdata/firmament/fixtures/m10l-unsupported-box-subtract-sphere-contained.firmament b/testdata/firmament/fixtures/m10l-unsupported-box-subtract-sphere-contained.firmamentnew file mode 100644index 00000000..f64fd6d9--- /dev/null+++ b/testdata/firmament/fixtures/m10l-unsupported-box-subtract-sphere-contained.firmament@@ -0,0 +1,23 @@+firmament:+ version: 1++model:+ name: m10l_unsupported_box_subtract_sphere_contained+ units: mm++ops[2]:+ -+ op: box+ id: base+ size[3]:+ 40+ 30+ 12++ -+ op: subtract+ id: cavity+ from: base+ with:+ op: sphere+ radius: 4diff --git a/testdata/firmament/fixtures/m10l-unsupported-box-subtract-sphere-partially-outside.firmament b/testdata/firmament/fixtures/m10l-unsupported-box-subtract-sphere-partially-outside.firmamentnew file mode 100644index 00000000..eb613ae6--- /dev/null+++ b/testdata/firmament/fixtures/m10l-unsupported-box-subtract-sphere-partially-outside.firmament@@ -0,0 +1,23 @@+firmament:+ version: 1++model:+ name: m10l_unsupported_box_subtract_sphere_partially_outside+ units: mm++ops[2]:+ -+ op: box+ id: base+ size[3]:+ 40+ 30+ 12++ -+ op: subtract+ id: leaking_cavity+ from: base+ with:+ op: sphere+ radius: 8diff --git a/testdata/firmament/fixtures/m10l-unsupported-box-subtract-sphere-touching-boundary.firmament b/testdata/firmament/fixtures/m10l-unsupported-box-subtract-sphere-touching-boundary.firmamentnew file mode 100644index 00000000..17836ca3--- /dev/null+++ b/testdata/firmament/fixtures/m10l-unsupported-box-subtract-sphere-touching-boundary.firmament@@ -0,0 +1,23 @@+firmament:+ version: 1++model:+ name: m10l_unsupported_box_subtract_sphere_touching_boundary+ units: mm++ops[2]:+ -+ op: box+ id: base+ size[3]:+ 40+ 30+ 12++ -+ op: subtract+ id: tangent_cavity+ from: base+ with:+ op: sphere+ radius: 6