Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Add box-cylinder boolean boundary coverage

Yuechen Lic4dfc1c502a4
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanCanonicalSuccessTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanCanonicalSuccessTests.cs
index 2baa362a..0d9cbdaf 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanCanonicalSuccessTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanCanonicalSuccessTests.cs
@@ -72,6 +72,30 @@ public sealed class FirmamentBooleanCanonicalSuccessTests
diagnostic.Message.Contains("requires at least one executed primitive or boolean body", StringComparison.Ordinal));
}
+ public static TheoryData<string, string, string> UnsupportedBoxCylinderBooleanFixtures =>
+ 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" }
+ };
+
+ [Theory]
+ [MemberData(nameof(UnsupportedBoxCylinderBooleanFixtures))]
+ public void BoxCylinderBooleans_Remain_Unsupported_And_Fail_Loudly(string fixturePath, string expectedFeatureId, string expectedKind)
+ {
+ 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}' ({expectedKind}) 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.cs
index c89a342a..e3fa3f55 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs
@@ -128,19 +128,23 @@ public sealed class FirmamentBuildAndExportTests
[Fact]
public void Run_UnsupportedBoxWithCylinderHoleFixture_Fails_And_Does_Not_Write_Fallback_Export()
{
- var sourcePath = "testdata/firmament/fixtures/m10h1-unsupported-box-with-cylinder-hole.firmament";
- var fullSourcePath = FirmamentCorpusHarness.ResolveFixtureFullPath(sourcePath);
- var expectedOutputPath = Path.Combine(FirmamentCorpusHarness.RepoRoot(), "testdata", "firmament", "exports", "m10h1-unsupported-box-with-cylinder-hole.step");
- if (File.Exists(expectedOutputPath))
- {
- File.Delete(expectedOutputPath);
- }
-
- var result = FirmamentBuildAndExport.Run(fullSourcePath);
+ AssertUnsupportedBuildAndExport(
+ "testdata/firmament/fixtures/m10h1-unsupported-box-with-cylinder-hole.firmament",
+ "m10h1-unsupported-box-with-cylinder-hole.step",
+ "hole",
+ "subtract");
+ }
- Assert.False(result.IsSuccess);
- Assert.False(File.Exists(expectedOutputPath));
- Assert.Contains(result.Diagnostics, diagnostic => diagnostic.Message.Contains("Requested boolean feature 'hole' (subtract) could not be executed.", StringComparison.Ordinal));
+ [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(
+ string sourcePath,
+ string expectedFileName,
+ string expectedFeatureId,
+ string expectedKind)
+ {
+ AssertUnsupportedBuildAndExport(sourcePath, expectedFileName, expectedFeatureId, expectedKind);
}
private static void AssertExampleBuildAndExport(string sourcePath, string expectedFileName, string expectedFeatureId, int expectedOpIndex, string expectedBodyCategory, string expectedFeatureKind)
@@ -164,4 +168,21 @@ public sealed class FirmamentBuildAndExportTests
Assert.True(File.Exists(expectedOutputPath));
Assert.Equal(result.Value.Export.StepText, File.ReadAllText(expectedOutputPath, Encoding.UTF8));
}
+
+ private static void AssertUnsupportedBuildAndExport(string sourcePath, string expectedFileName, string expectedFeatureId, string expectedKind)
+ {
+ var fullSourcePath = FirmamentCorpusHarness.ResolveFixtureFullPath(sourcePath);
+ var expectedOutputPath = Path.Combine(FirmamentCorpusHarness.RepoRoot(), "testdata", "firmament", "exports", expectedFileName);
+ if (File.Exists(expectedOutputPath))
+ {
+ File.Delete(expectedOutputPath);
+ }
+
+ var result = FirmamentBuildAndExport.Run(fullSourcePath);
+
+ Assert.False(result.IsSuccess);
+ Assert.False(File.Exists(expectedOutputPath));
+ Assert.Contains(result.Diagnostics, diagnostic => diagnostic.Message.Contains($"Requested boolean feature '{expectedFeatureId}' ({expectedKind}) could not be executed.", StringComparison.Ordinal));
+ Assert.Contains(result.Diagnostics, diagnostic => diagnostic.Message.Contains("M13 only supports recognized axis-aligned boxes from BrepPrimitives.CreateBox(...).", StringComparison.Ordinal));
+ }
}
diff --git a/testdata/firmament/examples/README.md b/testdata/firmament/examples/README.md
index 4c6f7e8f..2c055435 100644
--- a/testdata/firmament/examples/README.md
+++ b/testdata/firmament/examples/README.md
@@ -18,4 +18,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. 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. In particular, box+cylinder `add`, `subtract`, and `intersect` are not part of the current supported subset; the current kernel boolean path only proves box/box cases that rebuild to a single box. 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/m10j-unsupported-box-add-cylinder.firmament b/testdata/firmament/fixtures/m10j-unsupported-box-add-cylinder.firmament
new file mode 100644
index 00000000..5c525e26
--- /dev/null
+++ b/testdata/firmament/fixtures/m10j-unsupported-box-add-cylinder.firmament
@@ -0,0 +1,24 @@
+firmament:
+ version: 1
+
+model:
+ name: m10j_unsupported_box_add_cylinder
+ units: mm
+
+ops[2]:
+ -
+ op: box
+ id: base
+ size[3]:
+ 40
+ 30
+ 12
+
+ -
+ op: add
+ id: joined
+ to: base
+ with:
+ op: cylinder
+ radius: 4
+ height: 12
diff --git a/testdata/firmament/fixtures/m10j-unsupported-box-intersect-cylinder.firmament b/testdata/firmament/fixtures/m10j-unsupported-box-intersect-cylinder.firmament
new file mode 100644
index 00000000..b4a6f5e9
--- /dev/null
+++ b/testdata/firmament/fixtures/m10j-unsupported-box-intersect-cylinder.firmament
@@ -0,0 +1,24 @@
+firmament:
+ version: 1
+
+model:
+ name: m10j_unsupported_box_intersect_cylinder
+ units: mm
+
+ops[2]:
+ -
+ op: box
+ id: base
+ size[3]:
+ 40
+ 30
+ 12
+
+ -
+ op: intersect
+ id: overlap
+ left: base
+ with:
+ op: cylinder
+ radius: 4
+ height: 12