Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Fail loudly on unsupported Firmament booleans

Yuechen Li9f954f74168c
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanRequiredFieldValidationTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanRequiredFieldValidationTests.cs
index ea09f9a0..fdf0c4c4 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanRequiredFieldValidationTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanRequiredFieldValidationTests.cs
@@ -44,22 +44,40 @@ public sealed class FirmamentBooleanRequiredFieldValidationTests
name: demo
units: mm
- ops[2]:
+ ops[3]:
-
op: box
id: base
size[3]:
1
- 2
- 3
+ 1
+ 1
+ -
+ op: add
+ id: anchor
+ to: base
+ with:
+ op: box
+ size[3]:
+ 1
+ 1
+ 1
+ place:
+ on: origin
+ offset[3]:
+ 10
+ 0
+ 0
-
op: subtract
id: sub1
- from: base
+ from: anchor
with:
- op: cylinder
- radius: 1
- height: 1
+ op: box
+ size[3]:
+ 1
+ 1
+ 1
""");
[Fact]
@@ -85,8 +103,11 @@ public sealed class FirmamentBooleanRequiredFieldValidationTests
id: int1
left: base
with:
- op: sphere
- radius: 1
+ op: box
+ size[3]:
+ 1
+ 1
+ 1
""");
[Fact]
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs
index 6f9f853d..1164d6e7 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs
@@ -78,15 +78,33 @@ public sealed class FirmamentBuildAndExportTests
}
[Fact]
- public void Run_BoxWithHoleExample_Writes_Default_Export_Artifact()
+ public void Run_BoxAddBasicExample_Writes_Default_Export_Artifact()
{
AssertExampleBuildAndExport(
- "testdata/firmament/examples/box_with_hole.firmament",
- "box_with_hole.step",
- "base",
- 0,
- "primitive",
- "box");
+ "testdata/firmament/examples/box_add_basic.firmament",
+ "box_add_basic.step",
+ "joined",
+ 1,
+ "boolean",
+ "add");
+ }
+
+ [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);
+
+ 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));
}
private static void AssertExampleBuildAndExport(string sourcePath, string expectedFileName, string expectedFeatureId, int expectedOpIndex, string expectedBodyCategory, string expectedFeatureKind)
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentExamplePackSmokeTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentExamplePackSmokeTests.cs
index 5e4153ea..0fe7e99f 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentExamplePackSmokeTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentExamplePackSmokeTests.cs
@@ -12,9 +12,9 @@ public sealed class FirmamentExamplePackSmokeTests
"testdata/firmament/examples/cone_pointed_top_zero.firmament",
"testdata/firmament/examples/sphere_basic.firmament",
"testdata/firmament/examples/torus_basic.firmament",
- "testdata/firmament/examples/box_with_hole.firmament",
+ "testdata/firmament/examples/box_add_basic.firmament",
"testdata/firmament/examples/placed_primitive.firmament",
- "testdata/firmament/examples/cnc_min_tool_radius_demo.firmament"
+ "testdata/firmament/examples/schema_box_basic.firmament"
];
[Theory]
@@ -38,8 +38,9 @@ public sealed class FirmamentExamplePackSmokeTests
[InlineData("testdata/firmament/examples/cone_pointed_top_zero.firmament", "pointed1", 0, "primitive", "cone")]
[InlineData("testdata/firmament/examples/sphere_basic.firmament", "ball", 0, "primitive", "sphere")]
[InlineData("testdata/firmament/examples/torus_basic.firmament", "donut1", 0, "primitive", "torus")]
- [InlineData("testdata/firmament/examples/box_with_hole.firmament", "base", 0, "primitive", "box")]
+ [InlineData("testdata/firmament/examples/box_add_basic.firmament", "joined", 1, "boolean", "add")]
[InlineData("testdata/firmament/examples/placed_primitive.firmament", "post", 1, "primitive", "cylinder")]
+ [InlineData("testdata/firmament/examples/schema_box_basic.firmament", "schema_box", 0, "primitive", "box")]
public void ExamplePack_GoldenPath_Examples_Export(string fixturePath, string expectedFeatureId, int expectedOpIndex, string expectedBodyCategory, string expectedFeatureKind)
{
var first = ExportFixture(fixturePath);
@@ -58,14 +59,14 @@ public sealed class FirmamentExamplePackSmokeTests
}
[Fact]
- public void ExamplePack_SchemaExample_Attaches_CncSchema_And_BooleanPlan()
+ public void ExamplePack_SchemaExample_Attaches_Schema_Without_Changing_Geometric_Export()
{
- var result = FirmamentCorpusHarness.Compile(FirmamentCorpusHarness.ReadFixtureText("testdata/firmament/examples/cnc_min_tool_radius_demo.firmament"));
+ var result = FirmamentCorpusHarness.Compile(FirmamentCorpusHarness.ReadFixtureText("testdata/firmament/examples/schema_box_basic.firmament"));
Assert.True(result.Compilation.IsSuccess);
Assert.NotNull(result.Compilation.Value.CompiledSchema);
- Assert.Single(result.Compilation.Value.PrimitiveLoweringPlan!.Booleans);
- Assert.Equal("hole", result.Compilation.Value.PrimitiveLoweringPlan.Booleans.Single().FeatureId);
+ Assert.Empty(result.Compilation.Value.PrimitiveLoweringPlan!.Booleans);
+ Assert.Single(result.Compilation.Value.PrimitiveExecutionResult!.ExecutedPrimitives);
}
private static Aetheris.Kernel.Core.Results.KernelResult<FirmamentStepExportResult> ExportFixture(string fixturePath) =>
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentPlacementValidationTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentPlacementValidationTests.cs
index 68f7383b..d23253e4 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentPlacementValidationTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentPlacementValidationTests.cs
@@ -166,14 +166,12 @@ public sealed class FirmamentPlacementValidationTests
}
[Fact]
- public void Boolean_Placement_Runtime_Selector_Resolution_Failure_Is_Diagnostic()
+ public void Boolean_Placement_Fails_Early_When_Requested_Boolean_Cannot_Execute()
{
var result = CompileFixture("testdata/firmament/fixtures/m7d-invalid-boolean-placement-selector-runtime-empty.firmament");
Assert.False(result.Compilation.IsSuccess);
- var diagnostic = Assert.Single(result.Compilation.Diagnostics);
- Assert.Contains(FirmamentDiagnosticCodes.ValidationTargetSelectorResolvedEmpty.Value, diagnostic.Message, StringComparison.Ordinal);
- Assert.Contains("resolved empty", diagnostic.Message, StringComparison.OrdinalIgnoreCase);
+ Assert.Contains(result.Compilation.Diagnostics, diagnostic => diagnostic.Message.Contains("Requested boolean feature 'cut' (subtract) could not be executed.", StringComparison.Ordinal));
}
[Fact]
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs
index 6493031c..6b283f05 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs
@@ -197,12 +197,14 @@ public sealed class FirmamentPrimitiveExecutionTests
}
[Fact]
- public void Compile_Subtract_Boolean_Is_Deterministically_NonExecuted_When_Kernel_Cannot_Represent_Result()
+ public void Compile_Subtract_Boolean_Fails_Deterministically_When_Kernel_Cannot_Represent_Result()
{
var result = CompileFixture("testdata/firmament/fixtures/m3d-valid-subtract-exec.firmament");
- Assert.True(result.Compilation.IsSuccess);
- Assert.Empty(result.Compilation.Value.PrimitiveExecutionResult!.ExecutedBooleans);
+ Assert.False(result.Compilation.IsSuccess);
+ Assert.Equal("firmament", result.Compilation.Diagnostics[0].Source);
+ Assert.Contains("Requested boolean feature 'cut' (subtract) could not be executed.", result.Compilation.Diagnostics[0].Message, StringComparison.Ordinal);
+ Assert.Contains(result.Compilation.Diagnostics, diagnostic => diagnostic.Code == Aetheris.Kernel.Core.Diagnostics.KernelDiagnosticCode.NotImplemented);
}
[Fact]
@@ -219,37 +221,21 @@ public sealed class FirmamentPrimitiveExecutionTests
}
[Fact]
- public void Compile_Mixed_Document_Executes_Primitives_And_Booleans_In_Source_Order_With_Preserved_Ids_And_Skips_Validation_Family()
+ public void Compile_Mixed_Document_With_Unsupported_Boolean_Fails_Before_Publishing_Success_Artifact()
{
var result = CompileFixture("testdata/firmament/fixtures/m3d-mixed-primitive-boolean-validation.firmament");
- Assert.True(result.Compilation.IsSuccess);
- var artifact = result.Compilation.Value;
-
- Assert.Equal("firmament-placement-executed", artifact.ArtifactKind);
- Assert.Equal(2, artifact.PrimitiveLoweringPlan!.Primitives.Count);
- Assert.Equal(2, artifact.PrimitiveLoweringPlan.Booleans.Count);
- Assert.Single(artifact.PrimitiveLoweringPlan.SkippedOps);
-
- Assert.Equal(new[] { "base", "cap" }, artifact.PrimitiveExecutionResult!.ExecutedPrimitives.Select(p => p.FeatureId).ToArray());
- Assert.Equal(new[] { "join1" }, artifact.PrimitiveExecutionResult.ExecutedBooleans.Select(b => b.FeatureId).ToArray());
-
- var ordered = artifact.PrimitiveExecutionResult.ExecutedPrimitives
- .Select(p => (p.OpIndex, p.FeatureId))
- .Concat(artifact.PrimitiveExecutionResult.ExecutedBooleans.Select(b => (b.OpIndex, b.FeatureId)))
- .OrderBy(entry => entry.OpIndex)
- .ToArray();
- Assert.Equal(new[] { "base", "join1", "cap" }, ordered.Select(x => x.FeatureId).ToArray());
+ Assert.False(result.Compilation.IsSuccess);
+ Assert.Contains(result.Compilation.Diagnostics, diagnostic => diagnostic.Message.Contains("Requested boolean feature 'cut1' (subtract) could not be executed.", StringComparison.Ordinal));
}
[Fact]
- public void Compile_Boolean_Can_Depend_On_Earlier_Executed_Boolean_Result()
+ public void Compile_Boolean_Chain_Fails_When_Earlier_Requested_Boolean_Could_Not_Execute()
{
var result = CompileFixture("testdata/firmament/fixtures/m3d-valid-boolean-chain-exec.firmament");
- Assert.True(result.Compilation.IsSuccess);
- var booleans = result.Compilation.Value.PrimitiveExecutionResult!.ExecutedBooleans;
- Assert.Empty(booleans);
+ Assert.False(result.Compilation.IsSuccess);
+ Assert.Contains(result.Compilation.Diagnostics, diagnostic => diagnostic.Message.Contains("Requested boolean feature 'cut1' (subtract) could not be executed.", StringComparison.Ordinal));
}
[Fact]
@@ -286,7 +272,7 @@ public sealed class FirmamentPrimitiveExecutionTests
[Fact]
public void Compile_Primitive_And_Boolean_Execution_Output_Is_Deterministic_For_Metadata()
{
- var fixture = "testdata/firmament/fixtures/m3d-mixed-primitive-boolean-validation.firmament";
+ var fixture = "testdata/firmament/fixtures/m10h1-valid-mixed-primitive-boolean-validation.firmament";
var first = CompileFixture(fixture);
var second = CompileFixture(fixture);
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveLoweringTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveLoweringTests.cs
index 96be3947..eda868df 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveLoweringTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveLoweringTests.cs
@@ -207,11 +207,11 @@ public sealed class FirmamentPrimitiveLoweringTests
var result = Compile(FirmamentCorpusHarness.ReadFixtureText("testdata/firmament/fixtures/m1b-valid-subtract.firmament"));
Assert.True(result.Compilation.IsSuccess);
- var boolean = Assert.Single(result.Compilation.Value.PrimitiveLoweringPlan!.Booleans);
+ var boolean = result.Compilation.Value.PrimitiveLoweringPlan!.Booleans.Single(b => b.FeatureId == "sub1");
Assert.Equal(FirmamentLoweredBooleanKind.Subtract, boolean.Kind);
Assert.Equal("from", boolean.PrimaryReferenceField);
- Assert.Equal("base", boolean.PrimaryReferenceFeatureId);
- Assert.Equal("sphere", boolean.Tool.OpName);
+ Assert.Equal("anchor", boolean.PrimaryReferenceFeatureId);
+ Assert.Equal("box", boolean.Tool.OpName);
}
[Fact]
@@ -224,7 +224,7 @@ public sealed class FirmamentPrimitiveLoweringTests
Assert.Equal(FirmamentLoweredBooleanKind.Intersect, boolean.Kind);
Assert.Equal("left", boolean.PrimaryReferenceField);
Assert.Equal("base", boolean.PrimaryReferenceFeatureId);
- Assert.Equal("cylinder", boolean.Tool.OpName);
+ Assert.Equal("box", boolean.Tool.OpName);
}
[Fact]
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs
index a337ab75..c336a6f4 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs
@@ -78,30 +78,42 @@ public sealed class FirmamentScaffoldTests
name: demo
units: mm
- ops[2]:
+ ops[3]:
-
op: box
id: b1
size[3]:
- 2
- 3
- 4
+ 1
+ 1
+ 1
-
- op: subtract
- id: cut1
- from: b1
+ op: add
+ id: anchor
+ to: b1
with:
op: box
size[3]:
1
1
1
+ place:
+ on: origin
+ offset[3]:
+ 10
+ 0
+ 0
+ -
+ op: subtract
+ id: cut1
+ from: anchor
+ with:
+ op: box
size[3]:
1
1
1
""",
- 2);
+ 3);
[Fact]
@@ -167,22 +179,40 @@ public sealed class FirmamentScaffoldTests
name: demo
units: mm
- ops[3]:
+ ops[4]:
-
op: box
id: b1
size[3]:
1
- 2
- 3
+ 1
+ 1
+ -
+ op: add
+ id: anchor
+ to: b1
+ with:
+ op: box
+ size[3]:
+ 1
+ 1
+ 1
+ place:
+ on: origin
+ offset[3]:
+ 10
+ 0
+ 0
-
op: subtract
id: s1
- from: b1
+ from: anchor
with:
- op: sphere
- radius: 1
- radius: 1
+ op: box
+ size[3]:
+ 1
+ 1
+ 1
-
op: expect_manifold
target: s1
@@ -196,6 +226,7 @@ public sealed class FirmamentScaffoldTests
ops,
op => Assert.Equal(FirmamentOpFamily.Primitive, op.Family),
op => Assert.Equal(FirmamentOpFamily.Boolean, op.Family),
+ op => Assert.Equal(FirmamentOpFamily.Boolean, op.Family),
op => Assert.Equal(FirmamentOpFamily.Validation, op.Family));
}
@@ -216,15 +247,18 @@ public sealed class FirmamentScaffoldTests
id: b1
size[3]:
1
- 2
+ 1
3
-
op: add
id: add1
to: b1
with:
- op: sphere
- radius: 1
+ op: box
+ size[3]:
+ 1
+ 1
+ 1
""",
2);
@@ -947,9 +981,11 @@ public sealed class FirmamentScaffoldTests
id: a1
to: b1
with:
- op: sphere
- radius: 1
- radius: 1
+ op: box
+ size[3]:
+ 1
+ 1
+ 1
""",
"subtract" => """
-
@@ -959,14 +995,22 @@ public sealed class FirmamentScaffoldTests
1
1
1
+ place:
+ on: origin
+ offset[3]:
+ 10
+ 0
+ 0
-
op: subtract
id: s1
from: b1
with:
- op: sphere
- radius: 1
- radius: 1
+ op: box
+ size[3]:
+ 1
+ 1
+ 1
""",
"intersect" => """
-
@@ -981,9 +1025,11 @@ public sealed class FirmamentScaffoldTests
id: i1
left: b1
with:
- op: sphere
- radius: 1
- radius: 1
+ op: box
+ size[3]:
+ 1
+ 1
+ 1
""",
"expect_exists" => """
-
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentSchemaCncDfmValidationTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentSchemaCncDfmValidationTests.cs
index 8eff8888..1ebd5807 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentSchemaCncDfmValidationTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentSchemaCncDfmValidationTests.cs
@@ -36,9 +36,9 @@ ops[2]:
var result = Compile(source);
- Assert.True(result.Compilation.IsSuccess);
- var loweredBoolean = Assert.Single(result.Compilation.Value.PrimitiveLoweringPlan!.Booleans);
- Assert.Equal("hole", loweredBoolean.FeatureId);
+ Assert.False(result.Compilation.IsSuccess);
+ Assert.DoesNotContain(result.Compilation.Diagnostics, diagnostic => diagnostic.Message.Contains(FirmamentDiagnosticCodes.SchemaCncMinimumToolRadiusViolated.Value, StringComparison.Ordinal));
+ Assert.Contains(result.Compilation.Diagnostics, diagnostic => diagnostic.Message.Contains("Requested boolean feature 'hole' (subtract) could not be executed.", StringComparison.Ordinal));
}
[Fact]
@@ -46,10 +46,8 @@ ops[2]:
{
var result = CompileFixture("testdata/firmament/fixtures/m8c-valid-schema-cnc-minimum-tool-radius.firmament");
- Assert.True(result.Compilation.IsSuccess);
- var loweredBoolean = Assert.Single(result.Compilation.Value.PrimitiveLoweringPlan!.Booleans);
- Assert.Equal("hole", loweredBoolean.FeatureId);
- Assert.Equal("2", loweredBoolean.Tool.RawFields["radius"]);
+ Assert.False(result.Compilation.IsSuccess);
+ Assert.Contains(result.Compilation.Diagnostics, diagnostic => diagnostic.Message.Contains("Requested boolean feature 'hole' (subtract) could not be executed.", StringComparison.Ordinal));
}
[Fact]
@@ -106,8 +104,9 @@ ops[2]:
height: 8
""");
- Assert.True(result.Compilation.IsSuccess);
- Assert.Single(result.Compilation.Value.PrimitiveLoweringPlan!.Booleans);
+ Assert.False(result.Compilation.IsSuccess);
+ Assert.DoesNotContain(result.Compilation.Diagnostics, diagnostic => diagnostic.Message.Contains(FirmamentDiagnosticCodes.SchemaCncMinimumToolRadiusViolated.Value, StringComparison.Ordinal));
+ Assert.Contains(result.Compilation.Diagnostics, diagnostic => diagnostic.Message.Contains("Requested boolean feature 'hole' (subtract) could not be executed.", StringComparison.Ordinal));
}
[Fact]
@@ -144,13 +143,13 @@ ops[2]:
var result = Compile(source);
- Assert.True(result.Compilation.IsSuccess);
- var loweredBoolean = Assert.Single(result.Compilation.Value.PrimitiveLoweringPlan!.Booleans);
- Assert.Equal("pocket", loweredBoolean.FeatureId);
+ Assert.False(result.Compilation.IsSuccess);
+ Assert.DoesNotContain(result.Compilation.Diagnostics, diagnostic => diagnostic.Message.Contains(FirmamentDiagnosticCodes.SchemaCncMinimumToolRadiusViolated.Value, StringComparison.Ordinal));
+ Assert.Contains(result.Compilation.Diagnostics, diagnostic => diagnostic.Message.Contains("Requested boolean feature 'pocket' (subtract) could not be executed.", StringComparison.Ordinal));
}
[Fact]
- public void Compile_WithValidCncSchema_Preserves_BooleanExecution_Metadata()
+ public void Compile_WithValidCncSchema_Preserves_Failure_Truth_For_Unsupported_Boolean_Execution()
{
const string baseline = """
firmament:
@@ -211,17 +210,10 @@ ops[2]:
var first = Compile(baseline);
var second = Compile(withSchema);
- Assert.True(first.Compilation.IsSuccess);
- Assert.True(second.Compilation.IsSuccess);
-
- var firstMetadata = first.Compilation.Value.PrimitiveExecutionResult!.ExecutedBooleans
- .Select(b => (b.OpIndex, b.FeatureId, Kind: b.Kind.ToString(), BodyCount: b.Body.Topology.Bodies.Count(), FaceCount: b.Body.Topology.Faces.Count()))
- .ToArray();
- var secondMetadata = second.Compilation.Value.PrimitiveExecutionResult!.ExecutedBooleans
- .Select(b => (b.OpIndex, b.FeatureId, Kind: b.Kind.ToString(), BodyCount: b.Body.Topology.Bodies.Count(), FaceCount: b.Body.Topology.Faces.Count()))
- .ToArray();
-
- Assert.Equal(firstMetadata, secondMetadata);
+ Assert.False(first.Compilation.IsSuccess);
+ Assert.False(second.Compilation.IsSuccess);
+ Assert.Equal(first.Compilation.Diagnostics, second.Compilation.Diagnostics);
+ Assert.Contains(first.Compilation.Diagnostics, diagnostic => diagnostic.Message.Contains("Requested boolean feature 'hole' (subtract) could not be executed.", StringComparison.Ordinal));
}
private static FirmamentCompileResult Compile(string source)
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.cs
index 46fb3245..8d352935 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.cs
@@ -66,6 +66,19 @@ public sealed class FirmamentStepExporterTests
Assert.Equal(first.Value.StepText, File.ReadAllText(artifactPath));
}
+ [Fact]
+ public void Export_UnsupportedBoxWithCylinderHole_Fails_Instead_Of_Falling_Back_To_Base_Primitive()
+ {
+ var first = ExportFixture("testdata/firmament/fixtures/m10h1-unsupported-box-with-cylinder-hole.firmament");
+ var second = ExportFixture("testdata/firmament/fixtures/m10h1-unsupported-box-with-cylinder-hole.firmament");
+
+ 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 'hole' (subtract) could not be executed.", 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()
{
@@ -267,7 +280,7 @@ ops[2]:
[Fact]
public void Export_MultipleExecutedGeometryBodies_Selects_Last_Executed_Geometric_Feature_Body()
{
- var compile = CompileFixture("testdata/firmament/fixtures/m3d-mixed-primitive-boolean-validation.firmament");
+ var compile = CompileFixture("testdata/firmament/fixtures/m10h1-valid-mixed-primitive-boolean-validation.firmament");
Assert.True(compile.Compilation.IsSuccess);
var export = FirmamentStepExporter.Export(compile.Compilation.Value);
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentValidationExecutionTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentValidationExecutionTests.cs
index a70213ec..d18253a3 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentValidationExecutionTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentValidationExecutionTests.cs
@@ -400,7 +400,7 @@ ops[4]:
[Fact]
public void Compile_Still_Executes_Primitives_And_Booleans_With_M6b_ValidationExecution_Output()
{
- var result = CompileFixture("testdata/firmament/fixtures/m3d-mixed-primitive-boolean-validation.firmament");
+ var result = CompileFixture("testdata/firmament/fixtures/m10h1-valid-mixed-primitive-boolean-validation.firmament");
Assert.True(result.Compilation.IsSuccess);
Assert.NotEmpty(result.Compilation.Value.PrimitiveExecutionResult!.ExecutedPrimitives);
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentValidationTargetFeatureExistenceTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentValidationTargetFeatureExistenceTests.cs
index bd948e90..4c0bcc79 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentValidationTargetFeatureExistenceTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentValidationTargetFeatureExistenceTests.cs
@@ -277,16 +277,19 @@ ops[2]:
}
[Theory]
- [InlineData("add", "join", "to", "join.top_face", "Face", "One")]
- [InlineData("subtract", "cut", "from", "cut.side_faces", "FaceSet", "Many")]
- [InlineData("intersect", "clip", "left", "clip.edges", "EdgeSet", "Many")]
+ [InlineData("add", "join", "to", "base", "join.top_face", "Face", "One", "10\n 20\n 30", "")]
+ [InlineData("subtract", "cut", "from", "anchor", "cut.side_faces", "FaceSet", "Many", "1\n 1\n 1", "\n -\n op: add\n id: anchor\n to: base\n with:\n op: box\n size[3]:\n 1\n 1\n 1\n place:\n on: origin\n offset[3]:\n 10\n 0\n 0")]
+ [InlineData("intersect", "clip", "left", "base", "clip.edges", "EdgeSet", "Many", "10\n 20\n 30", "")]
public void Compiler_Attaches_SelectorContractMetadata_For_Legal_BooleanRoot_SelectorTargets(
string booleanOp,
string featureId,
string referenceField,
+ string primaryReferenceFeatureId,
string selectorTarget,
string expectedResultKind,
- string expectedCardinality)
+ string expectedCardinality,
+ string baseSize,
+ string preambleOps)
{
var source = $$"""
firmament:
@@ -301,13 +304,12 @@ ops[3]:
op: box
id: base
size[3]:
- 10
- 20
- 30
+ {{baseSize}}
+{{preambleOps}}
-
op: {{booleanOp}}
id: {{featureId}}
- {{referenceField}}: base
+ {{referenceField}}: {{primaryReferenceFeatureId}}
with:
op: box
size[3]:
@@ -322,7 +324,7 @@ ops[3]:
var result = new FirmamentCompiler().Compile(new FirmamentCompileRequest(new FirmamentSourceDocument(source)));
Assert.True(result.Compilation.IsSuccess);
- var validationOp = result.Compilation.Value.ParsedDocument!.Ops.Entries[2];
+ var validationOp = result.Compilation.Value.ParsedDocument!.Ops.Entries[^1];
Assert.NotNull(validationOp.ClassifiedFields);
Assert.Equal("SelectorShaped", validationOp.ClassifiedFields!["targetShape"]);
Assert.Equal(expectedResultKind, validationOp.ClassifiedFields["selectorResultKind"]);
diff --git a/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutor.cs b/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutor.cs
index fc483c50..260618ea 100644
--- a/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutor.cs
+++ b/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutor.cs
@@ -52,12 +52,11 @@ internal static class FirmamentPrimitiveExecutor
var booleanResult = ExecuteBoolean(boolean.Kind, baseBody, toolResult.Value);
if (!booleanResult.IsSuccess)
{
- if (booleanResult.Diagnostics.All(d => d.Code == KernelDiagnosticCode.NotImplemented))
- {
- continue;
- }
-
- return KernelResult<FirmamentPrimitiveExecutionResult>.Failure(booleanResult.Diagnostics);
+ return KernelResult<FirmamentPrimitiveExecutionResult>.Failure(
+ [
+ CreateBooleanExecutionFailureDiagnostic(boolean),
+ .. booleanResult.Diagnostics
+ ]);
}
var placedBooleanBody = booleanResult.Value;
@@ -77,6 +76,13 @@ internal static class FirmamentPrimitiveExecutor
return KernelResult<FirmamentPrimitiveExecutionResult>.Success(new FirmamentPrimitiveExecutionResult(executedPrimitives, executedBooleans));
}
+ private static KernelDiagnostic CreateBooleanExecutionFailureDiagnostic(FirmamentLoweredBoolean boolean)
+ => new(
+ KernelDiagnosticCode.NotImplemented,
+ KernelDiagnosticSeverity.Error,
+ $"Requested boolean feature '{boolean.FeatureId}' ({boolean.Kind.ToString().ToLowerInvariant()}) could not be executed.",
+ Source: "firmament");
+
private static KernelResult<FirmamentExecutedPrimitiveBodies> ExecutePrimitive(FirmamentLoweredPrimitive primitive, IReadOnlyDictionary<string, BrepBody> publishedBodies)
{
var legacyResult = ExecuteLegacyPrimitive(primitive);
diff --git a/testdata/firmament/examples/README.md b/testdata/firmament/examples/README.md
index 4e971151..f7b3a773 100644
--- a/testdata/firmament/examples/README.md
+++ b/testdata/firmament/examples/README.md
@@ -8,8 +8,8 @@ This directory contains small canonical Firmament examples for the current v1 su
- `cone_pointed_top_zero.firmament` — minimal single pointed-cone export example using the same v1 `cone` primitive with `top_radius: 0`; helper export path: `testdata/firmament/exports/cone_pointed_top_zero.step`.
- `sphere_basic.firmament` — minimal single-sphere export example; helper export path: `testdata/firmament/exports/sphere_basic.step`.
- `torus_basic.firmament` — minimal single-torus export example using the canonical `major_radius` / `minor_radius` surface; helper export paths: `testdata/firmament/exports/torus_basic.step` and the milestone proof artifact `testdata/firmament/exports/m10g2-torus.step`.
-- `box_with_hole.firmament` — box plus subtract-with-cylinder boolean syntax example; helper export path: `testdata/firmament/exports/box_with_hole.step`.
+- `box_add_basic.firmament` — minimal supported box-plus-box boolean add example; helper export path: `testdata/firmament/exports/box_add_basic.step`.
- `placed_primitive.firmament` — selector-based placement using `place.on` and `offset[3]`; helper export path: `testdata/firmament/exports/placed_primitive.step`.
-- `cnc_min_tool_radius_demo.firmament` — schema-aware CNC example using `minimum_tool_radius` with a subtract cylinder sized to pass the current rule.
+- `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`.
-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. 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/examples/box_add_basic.firmament b/testdata/firmament/examples/box_add_basic.firmament
new file mode 100644
index 00000000..ed46fe4a
--- /dev/null
+++ b/testdata/firmament/examples/box_add_basic.firmament
@@ -0,0 +1,26 @@
+firmament:
+ version: 1
+
+model:
+ name: box_add_basic
+ units: mm
+
+ops[2]:
+ -
+ op: box
+ id: base
+ size[3]:
+ 4
+ 4
+ 4
+
+ -
+ op: add
+ id: joined
+ to: base
+ with:
+ op: box
+ size[3]:
+ 2
+ 2
+ 2
diff --git a/testdata/firmament/examples/cnc_min_tool_radius_demo.firmament b/testdata/firmament/examples/cnc_min_tool_radius_demo.firmament
deleted file mode 100644
index 976a57fa..00000000
--- a/testdata/firmament/examples/cnc_min_tool_radius_demo.firmament
+++ /dev/null
@@ -1,28 +0,0 @@
-firmament:
- version: 1
-
-model:
- name: cnc_min_tool_radius_demo
- units: mm
-
-schema:
- process: cnc
- minimum_tool_radius: 2
-
-ops[2]:
- -
- op: box
- id: base
- size[3]:
- 24
- 24
- 12
-
- -
- op: subtract
- id: hole
- from: base
- with:
- op: cylinder
- radius: 2
- height: 12
diff --git a/testdata/firmament/examples/schema_box_basic.firmament b/testdata/firmament/examples/schema_box_basic.firmament
new file mode 100644
index 00000000..6e453378
--- /dev/null
+++ b/testdata/firmament/examples/schema_box_basic.firmament
@@ -0,0 +1,19 @@
+firmament:
+ version: 1
+
+model:
+ name: schema_box_basic
+ units: mm
+
+schema:
+ process: additive
+ printer_resolution: 0.1
+
+ops[1]:
+ -
+ op: box
+ id: schema_box
+ size[3]:
+ 5
+ 6
+ 7
diff --git a/testdata/firmament/exports/box_add_basic.step b/testdata/firmament/exports/box_add_basic.step
new file mode 100644
index 00000000..30c2db43
--- /dev/null
+++ b/testdata/firmament/exports/box_add_basic.step
@@ -0,0 +1,172 @@
+ISO-10303-21;
+HEADER;
+FILE_DESCRIPTION(('Aetheris AP242 subset export'),'2;1');
+FILE_NAME('aetheris_export.step','1970-01-01T00:00:00',('Aetheris'),('Aetheris'),'Aetheris.Kernel','Aetheris.Kernel','');
+FILE_SCHEMA(('AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF'));
+ENDSEC;
+DATA;
+#1=CARTESIAN_POINT($,(0,0,-2));
+#2=DIRECTION($,(0,0,-1));
+#3=DIRECTION($,(1,0,0));
+#4=AXIS2_PLACEMENT_3D($,#1,#2,#3);
+#5=PLANE($,#4);
+#6=CARTESIAN_POINT($,(-2,-2,-2));
+#7=VERTEX_POINT($,#6);
+#8=CARTESIAN_POINT($,(2,-2,-2));
+#9=VERTEX_POINT($,#8);
+#10=CARTESIAN_POINT($,(-2,-2,-2));
+#11=DIRECTION($,(1,0,0));
+#12=VECTOR($,#11,1);
+#13=LINE($,#10,#12);
+#14=EDGE_CURVE($,#7,#9,#13,.T.);
+#15=ORIENTED_EDGE($,$,$,#14,.T.);
+#16=CARTESIAN_POINT($,(2,2,-2));
+#17=VERTEX_POINT($,#16);
+#18=CARTESIAN_POINT($,(2,-2,-2));
+#19=DIRECTION($,(0,1,0));
+#20=VECTOR($,#19,1);
+#21=LINE($,#18,#20);
+#22=EDGE_CURVE($,#9,#17,#21,.T.);
+#23=ORIENTED_EDGE($,$,$,#22,.T.);
+#24=CARTESIAN_POINT($,(-2,2,-2));
+#25=VERTEX_POINT($,#24);
+#26=CARTESIAN_POINT($,(2,2,-2));
+#27=DIRECTION($,(-1,0,0));
+#28=VECTOR($,#27,1);
+#29=LINE($,#26,#28);
+#30=EDGE_CURVE($,#17,#25,#29,.T.);
+#31=ORIENTED_EDGE($,$,$,#30,.T.);
+#32=CARTESIAN_POINT($,(-2,2,-2));
+#33=DIRECTION($,(0,-1,0));
+#34=VECTOR($,#33,1);
+#35=LINE($,#32,#34);
+#36=EDGE_CURVE($,#25,#7,#35,.T.);
+#37=ORIENTED_EDGE($,$,$,#36,.T.);
+#38=EDGE_LOOP($,(#15,#23,#31,#37));
+#39=FACE_OUTER_BOUND('',#38,.T.);
+#40=ADVANCED_FACE('',(#39),#5,.T.);
+#41=CARTESIAN_POINT($,(0,0,2));
+#42=DIRECTION($,(0,0,1));
+#43=DIRECTION($,(1,0,0));
+#44=AXIS2_PLACEMENT_3D($,#41,#42,#43);
+#45=PLANE($,#44);
+#46=CARTESIAN_POINT($,(-2,-2,2));
+#47=VERTEX_POINT($,#46);
+#48=CARTESIAN_POINT($,(2,-2,2));
+#49=VERTEX_POINT($,#48);
+#50=CARTESIAN_POINT($,(-2,-2,2));
+#51=DIRECTION($,(1,0,0));
+#52=VECTOR($,#51,1);
+#53=LINE($,#50,#52);
+#54=EDGE_CURVE($,#47,#49,#53,.T.);
+#55=ORIENTED_EDGE($,$,$,#54,.T.);
+#56=CARTESIAN_POINT($,(2,2,2));
+#57=VERTEX_POINT($,#56);
+#58=CARTESIAN_POINT($,(2,-2,2));
+#59=DIRECTION($,(0,1,0));
+#60=VECTOR($,#59,1);
+#61=LINE($,#58,#60);
+#62=EDGE_CURVE($,#49,#57,#61,.T.);
+#63=ORIENTED_EDGE($,$,$,#62,.T.);
+#64=CARTESIAN_POINT($,(-2,2,2));
+#65=VERTEX_POINT($,#64);
+#66=CARTESIAN_POINT($,(2,2,2));
+#67=DIRECTION($,(-1,0,0));
+#68=VECTOR($,#67,1);
+#69=LINE($,#66,#68);
+#70=EDGE_CURVE($,#57,#65,#69,.T.);
+#71=ORIENTED_EDGE($,$,$,#70,.T.);
+#72=CARTESIAN_POINT($,(-2,2,2));
+#73=DIRECTION($,(0,-1,0));
+#74=VECTOR($,#73,1);
+#75=LINE($,#72,#74);
+#76=EDGE_CURVE($,#65,#47,#75,.T.);
+#77=ORIENTED_EDGE($,$,$,#76,.T.);
+#78=EDGE_LOOP($,(#55,#63,#71,#77));
+#79=FACE_OUTER_BOUND('',#78,.T.);
+#80=ADVANCED_FACE('',(#79),#45,.T.);
+#81=CARTESIAN_POINT($,(0,-2,0));
+#82=DIRECTION($,(0,-1,0));
+#83=DIRECTION($,(1,0,0));
+#84=AXIS2_PLACEMENT_3D($,#81,#82,#83);
+#85=PLANE($,#84);
+#86=ORIENTED_EDGE($,$,$,#14,.T.);
+#87=CARTESIAN_POINT($,(2,-2,-2));
+#88=DIRECTION($,(0,0,1));
+#89=VECTOR($,#88,1);
+#90=LINE($,#87,#89);
+#91=EDGE_CURVE($,#9,#49,#90,.T.);
+#92=ORIENTED_EDGE($,$,$,#91,.T.);
+#93=ORIENTED_EDGE($,$,$,#54,.F.);
+#94=CARTESIAN_POINT($,(-2,-2,-2));
+#95=DIRECTION($,(0,0,1));
+#96=VECTOR($,#95,1);
+#97=LINE($,#94,#96);
+#98=EDGE_CURVE($,#7,#47,#97,.T.);
+#99=ORIENTED_EDGE($,$,$,#98,.F.);
+#100=EDGE_LOOP($,(#86,#92,#93,#99));
+#101=FACE_OUTER_BOUND('',#100,.T.);
+#102=ADVANCED_FACE('',(#101),#85,.T.);
+#103=CARTESIAN_POINT($,(2,0,0));
+#104=DIRECTION($,(1,0,0));
+#105=DIRECTION($,(0,1,0));
+#106=AXIS2_PLACEMENT_3D($,#103,#104,#105);
+#107=PLANE($,#106);
+#108=ORIENTED_EDGE($,$,$,#22,.T.);
+#109=CARTESIAN_POINT($,(2,2,-2));
+#110=DIRECTION($,(0,0,1));
+#111=VECTOR($,#110,1);
+#112=LINE($,#109,#111);
+#113=EDGE_CURVE($,#17,#57,#112,.T.);
+#114=ORIENTED_EDGE($,$,$,#113,.T.);
+#115=ORIENTED_EDGE($,$,$,#62,.F.);
+#116=ORIENTED_EDGE($,$,$,#91,.F.);
+#117=EDGE_LOOP($,(#108,#114,#115,#116));
+#118=FACE_OUTER_BOUND('',#117,.T.);
+#119=ADVANCED_FACE('',(#118),#107,.T.);
+#120=CARTESIAN_POINT($,(0,2,0));
+#121=DIRECTION($,(0,1,0));
+#122=DIRECTION($,(-1,0,0));
+#123=AXIS2_PLACEMENT_3D($,#120,#121,#122);
+#124=PLANE($,#123);
+#125=ORIENTED_EDGE($,$,$,#30,.T.);
+#126=CARTESIAN_POINT($,(-2,2,-2));
+#127=DIRECTION($,(0,0,1));
+#128=VECTOR($,#127,1);
+#129=LINE($,#126,#128);
+#130=EDGE_CURVE($,#25,#65,#129,.T.);
+#131=ORIENTED_EDGE($,$,$,#130,.T.);
+#132=ORIENTED_EDGE($,$,$,#70,.F.);
+#133=ORIENTED_EDGE($,$,$,#113,.F.);
+#134=EDGE_LOOP($,(#125,#131,#132,#133));
+#135=FACE_OUTER_BOUND('',#134,.T.);
+#136=ADVANCED_FACE('',(#135),#124,.T.);
+#137=CARTESIAN_POINT($,(-2,0,0));
+#138=DIRECTION($,(-1,0,0));
+#139=DIRECTION($,(0,1,0));
+#140=AXIS2_PLACEMENT_3D($,#137,#138,#139);
+#141=PLANE($,#140);
+#142=ORIENTED_EDGE($,$,$,#36,.T.);
+#143=ORIENTED_EDGE($,$,$,#98,.T.);
+#144=ORIENTED_EDGE($,$,$,#76,.F.);
+#145=ORIENTED_EDGE($,$,$,#130,.F.);
+#146=EDGE_LOOP($,(#142,#143,#144,#145));
+#147=FACE_OUTER_BOUND('',#146,.T.);
+#148=ADVANCED_FACE('',(#147),#141,.T.);
+#149=CLOSED_SHELL($,(#40,#80,#102,#119,#136,#148));
+#150=MANIFOLD_SOLID_BREP('AetherisBody',#149);
+#151=APPLICATION_CONTEXT('mechanical design');
+#152=PRODUCT_CONTEXT('',#151,'mechanical');
+#153=PRODUCT('AETHERIS','AetherisBody','',(#152));
+#154=PRODUCT_DEFINITION_FORMATION('','',#153);
+#155=PRODUCT_DEFINITION_CONTEXT('design',#151,'design');
+#156=PRODUCT_DEFINITION('','',#154,#155);
+#157=PRODUCT_DEFINITION_SHAPE('','',#156);
+#158=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.));
+#159=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
+#160=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT());
+#161=(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNIT_ASSIGNED_CONTEXT((#158,#159,#160))REPRESENTATION_CONTEXT('3','3D'));
+#162=SHAPE_REPRESENTATION('AetherisBody',(#150),#161);
+#163=SHAPE_DEFINITION_REPRESENTATION(#157,#162);
+ENDSEC;
+END-ISO-10303-21;
diff --git a/testdata/firmament/exports/schema_box_basic.step b/testdata/firmament/exports/schema_box_basic.step
new file mode 100644
index 00000000..acdc1fc2
--- /dev/null
+++ b/testdata/firmament/exports/schema_box_basic.step
@@ -0,0 +1,172 @@
+ISO-10303-21;
+HEADER;
+FILE_DESCRIPTION(('Aetheris AP242 subset export'),'2;1');
+FILE_NAME('aetheris_export.step','1970-01-01T00:00:00',('Aetheris'),('Aetheris'),'Aetheris.Kernel','Aetheris.Kernel','');
+FILE_SCHEMA(('AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF'));
+ENDSEC;
+DATA;
+#1=CARTESIAN_POINT($,(0,0,0));
+#2=DIRECTION($,(0,0,-1));
+#3=DIRECTION($,(1,0,0));
+#4=AXIS2_PLACEMENT_3D($,#1,#2,#3);
+#5=PLANE($,#4);
+#6=CARTESIAN_POINT($,(-2.5,-3,-0));
+#7=VERTEX_POINT($,#6);
+#8=CARTESIAN_POINT($,(2.5,-3,-0));
+#9=VERTEX_POINT($,#8);
+#10=CARTESIAN_POINT($,(-2.5,-3,-0));
+#11=DIRECTION($,(1,0,0));
+#12=VECTOR($,#11,1);
+#13=LINE($,#10,#12);
+#14=EDGE_CURVE($,#7,#9,#13,.T.);
+#15=ORIENTED_EDGE($,$,$,#14,.T.);
+#16=CARTESIAN_POINT($,(2.5,3,-0));
+#17=VERTEX_POINT($,#16);
+#18=CARTESIAN_POINT($,(2.5,-3,-0));
+#19=DIRECTION($,(0,1,0));
+#20=VECTOR($,#19,1);
+#21=LINE($,#18,#20);
+#22=EDGE_CURVE($,#9,#17,#21,.T.);
+#23=ORIENTED_EDGE($,$,$,#22,.T.);
+#24=CARTESIAN_POINT($,(-2.5,3,-0));
+#25=VERTEX_POINT($,#24);
+#26=CARTESIAN_POINT($,(2.5,3,-0));
+#27=DIRECTION($,(-1,0,0));
+#28=VECTOR($,#27,1);
+#29=LINE($,#26,#28);
+#30=EDGE_CURVE($,#17,#25,#29,.T.);
+#31=ORIENTED_EDGE($,$,$,#30,.T.);
+#32=CARTESIAN_POINT($,(-2.5,3,-0));
+#33=DIRECTION($,(0,-1,0));
+#34=VECTOR($,#33,1);
+#35=LINE($,#32,#34);
+#36=EDGE_CURVE($,#25,#7,#35,.T.);
+#37=ORIENTED_EDGE($,$,$,#36,.T.);
+#38=EDGE_LOOP($,(#15,#23,#31,#37));
+#39=FACE_OUTER_BOUND('',#38,.T.);
+#40=ADVANCED_FACE('',(#39),#5,.T.);
+#41=CARTESIAN_POINT($,(0,0,7));
+#42=DIRECTION($,(0,0,1));
+#43=DIRECTION($,(1,0,0));
+#44=AXIS2_PLACEMENT_3D($,#41,#42,#43);
+#45=PLANE($,#44);
+#46=CARTESIAN_POINT($,(-2.5,-3,7));
+#47=VERTEX_POINT($,#46);
+#48=CARTESIAN_POINT($,(2.5,-3,7));
+#49=VERTEX_POINT($,#48);
+#50=CARTESIAN_POINT($,(-2.5,-3,7));
+#51=DIRECTION($,(1,0,0));
+#52=VECTOR($,#51,1);
+#53=LINE($,#50,#52);
+#54=EDGE_CURVE($,#47,#49,#53,.T.);
+#55=ORIENTED_EDGE($,$,$,#54,.T.);
+#56=CARTESIAN_POINT($,(2.5,3,7));
+#57=VERTEX_POINT($,#56);
+#58=CARTESIAN_POINT($,(2.5,-3,7));
+#59=DIRECTION($,(0,1,0));
+#60=VECTOR($,#59,1);
+#61=LINE($,#58,#60);
+#62=EDGE_CURVE($,#49,#57,#61,.T.);
+#63=ORIENTED_EDGE($,$,$,#62,.T.);
+#64=CARTESIAN_POINT($,(-2.5,3,7));
+#65=VERTEX_POINT($,#64);
+#66=CARTESIAN_POINT($,(2.5,3,7));
+#67=DIRECTION($,(-1,0,0));
+#68=VECTOR($,#67,1);
+#69=LINE($,#66,#68);
+#70=EDGE_CURVE($,#57,#65,#69,.T.);
+#71=ORIENTED_EDGE($,$,$,#70,.T.);
+#72=CARTESIAN_POINT($,(-2.5,3,7));
+#73=DIRECTION($,(0,-1,0));
+#74=VECTOR($,#73,1);
+#75=LINE($,#72,#74);
+#76=EDGE_CURVE($,#65,#47,#75,.T.);
+#77=ORIENTED_EDGE($,$,$,#76,.T.);
+#78=EDGE_LOOP($,(#55,#63,#71,#77));
+#79=FACE_OUTER_BOUND('',#78,.T.);
+#80=ADVANCED_FACE('',(#79),#45,.T.);
+#81=CARTESIAN_POINT($,(0,-3,3.5));
+#82=DIRECTION($,(0,-1,0));
+#83=DIRECTION($,(1,0,0));
+#84=AXIS2_PLACEMENT_3D($,#81,#82,#83);
+#85=PLANE($,#84);
+#86=ORIENTED_EDGE($,$,$,#14,.T.);
+#87=CARTESIAN_POINT($,(2.5,-3,-0));
+#88=DIRECTION($,(0,0,1));
+#89=VECTOR($,#88,1);
+#90=LINE($,#87,#89);
+#91=EDGE_CURVE($,#9,#49,#90,.T.);
+#92=ORIENTED_EDGE($,$,$,#91,.T.);
+#93=ORIENTED_EDGE($,$,$,#54,.F.);
+#94=CARTESIAN_POINT($,(-2.5,-3,-0));
+#95=DIRECTION($,(0,0,1));
+#96=VECTOR($,#95,1);
+#97=LINE($,#94,#96);
+#98=EDGE_CURVE($,#7,#47,#97,.T.);
+#99=ORIENTED_EDGE($,$,$,#98,.F.);
+#100=EDGE_LOOP($,(#86,#92,#93,#99));
+#101=FACE_OUTER_BOUND('',#100,.T.);
+#102=ADVANCED_FACE('',(#101),#85,.T.);
+#103=CARTESIAN_POINT($,(2.5,0,3.5));
+#104=DIRECTION($,(1,0,0));
+#105=DIRECTION($,(0,1,0));
+#106=AXIS2_PLACEMENT_3D($,#103,#104,#105);
+#107=PLANE($,#106);
+#108=ORIENTED_EDGE($,$,$,#22,.T.);
+#109=CARTESIAN_POINT($,(2.5,3,-0));
+#110=DIRECTION($,(0,0,1));
+#111=VECTOR($,#110,1);
+#112=LINE($,#109,#111);
+#113=EDGE_CURVE($,#17,#57,#112,.T.);
+#114=ORIENTED_EDGE($,$,$,#113,.T.);
+#115=ORIENTED_EDGE($,$,$,#62,.F.);
+#116=ORIENTED_EDGE($,$,$,#91,.F.);
+#117=EDGE_LOOP($,(#108,#114,#115,#116));
+#118=FACE_OUTER_BOUND('',#117,.T.);
+#119=ADVANCED_FACE('',(#118),#107,.T.);
+#120=CARTESIAN_POINT($,(0,3,3.5));
+#121=DIRECTION($,(0,1,0));
+#122=DIRECTION($,(-1,0,0));
+#123=AXIS2_PLACEMENT_3D($,#120,#121,#122);
+#124=PLANE($,#123);
+#125=ORIENTED_EDGE($,$,$,#30,.T.);
+#126=CARTESIAN_POINT($,(-2.5,3,-0));
+#127=DIRECTION($,(0,0,1));
+#128=VECTOR($,#127,1);
+#129=LINE($,#126,#128);
+#130=EDGE_CURVE($,#25,#65,#129,.T.);
+#131=ORIENTED_EDGE($,$,$,#130,.T.);
+#132=ORIENTED_EDGE($,$,$,#70,.F.);
+#133=ORIENTED_EDGE($,$,$,#113,.F.);
+#134=EDGE_LOOP($,(#125,#131,#132,#133));
+#135=FACE_OUTER_BOUND('',#134,.T.);
+#136=ADVANCED_FACE('',(#135),#124,.T.);
+#137=CARTESIAN_POINT($,(-2.5,0,3.5));
+#138=DIRECTION($,(-1,0,0));
+#139=DIRECTION($,(0,1,0));
+#140=AXIS2_PLACEMENT_3D($,#137,#138,#139);
+#141=PLANE($,#140);
+#142=ORIENTED_EDGE($,$,$,#36,.T.);
+#143=ORIENTED_EDGE($,$,$,#98,.T.);
+#144=ORIENTED_EDGE($,$,$,#76,.F.);
+#145=ORIENTED_EDGE($,$,$,#130,.F.);
+#146=EDGE_LOOP($,(#142,#143,#144,#145));
+#147=FACE_OUTER_BOUND('',#146,.T.);
+#148=ADVANCED_FACE('',(#147),#141,.T.);
+#149=CLOSED_SHELL($,(#40,#80,#102,#119,#136,#148));
+#150=MANIFOLD_SOLID_BREP('AetherisBody',#149);
+#151=APPLICATION_CONTEXT('mechanical design');
+#152=PRODUCT_CONTEXT('',#151,'mechanical');
+#153=PRODUCT('AETHERIS','AetherisBody','',(#152));
+#154=PRODUCT_DEFINITION_FORMATION('','',#153);
+#155=PRODUCT_DEFINITION_CONTEXT('design',#151,'design');
+#156=PRODUCT_DEFINITION('','',#154,#155);
+#157=PRODUCT_DEFINITION_SHAPE('','',#156);
+#158=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.));
+#159=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
+#160=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT());
+#161=(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNIT_ASSIGNED_CONTEXT((#158,#159,#160))REPRESENTATION_CONTEXT('3','3D'));
+#162=SHAPE_REPRESENTATION('AetherisBody',(#150),#161);
+#163=SHAPE_DEFINITION_REPRESENTATION(#157,#162);
+ENDSEC;
+END-ISO-10303-21;
diff --git a/testdata/firmament/fixtures/m0b-valid-two-ops.firmament b/testdata/firmament/fixtures/m0b-valid-two-ops.firmament
index d0f4483d..0a29ec54 100644
--- a/testdata/firmament/fixtures/m0b-valid-two-ops.firmament
+++ b/testdata/firmament/fixtures/m0b-valid-two-ops.firmament
@@ -14,10 +14,12 @@ ops[2]:
2
3
-
- op: subtract
- id: cut1
- from: b1
+ op: add
+ id: add1
+ to: b1
with:
- op: cylinder
- radius: 1
- height: 1
\ No newline at end of file
+ op: box
+ size[3]:
+ 1
+ 1
+ 1
diff --git a/testdata/firmament/fixtures/m0c-valid-known-boolean-op.firmament b/testdata/firmament/fixtures/m0c-valid-known-boolean-op.firmament
index 633fa453..9d16fcbd 100644
--- a/testdata/firmament/fixtures/m0c-valid-known-boolean-op.firmament
+++ b/testdata/firmament/fixtures/m0c-valid-known-boolean-op.firmament
@@ -18,5 +18,8 @@ ops[2]:
id: add1
to: base
with:
- op: sphere
- radius: 1
\ No newline at end of file
+ op: box
+ size[3]:
+ 1
+ 1
+ 1
diff --git a/testdata/firmament/examples/box_with_hole.firmament b/testdata/firmament/fixtures/m10h1-unsupported-box-with-cylinder-hole.firmament
similarity index 82%
rename from testdata/firmament/examples/box_with_hole.firmament
rename to testdata/firmament/fixtures/m10h1-unsupported-box-with-cylinder-hole.firmament
index b9dbf67d..44dde2b1 100644
--- a/testdata/firmament/examples/box_with_hole.firmament
+++ b/testdata/firmament/fixtures/m10h1-unsupported-box-with-cylinder-hole.firmament
@@ -2,7 +2,7 @@ firmament:
version: 1
model:
- name: box_with_hole
+ name: m10h1_unsupported_box_with_cylinder_hole
units: mm
ops[2]:
diff --git a/testdata/firmament/fixtures/m10h1-valid-mixed-primitive-boolean-validation.firmament b/testdata/firmament/fixtures/m10h1-valid-mixed-primitive-boolean-validation.firmament
new file mode 100644
index 00000000..c878f809
--- /dev/null
+++ b/testdata/firmament/fixtures/m10h1-valid-mixed-primitive-boolean-validation.firmament
@@ -0,0 +1,38 @@
+firmament:
+ version: 1
+
+model:
+ name: m10h1_valid_mixed
+ units: mm
+
+ops[4]:
+ -
+ op: box
+ id: base
+ size[3]:
+ 12
+ 12
+ 12
+
+ -
+ op: add
+ id: join1
+ to: base
+ with:
+ op: box
+ size[3]:
+ 1
+ 1
+ 1
+
+ -
+ op: box
+ id: cap
+ size[3]:
+ 6
+ 6
+ 6
+
+ -
+ op: expect_exists
+ target: cap
diff --git a/testdata/firmament/fixtures/m1b-valid-intersect.firmament b/testdata/firmament/fixtures/m1b-valid-intersect.firmament
index 4f99ce6c..74389ff5 100644
--- a/testdata/firmament/fixtures/m1b-valid-intersect.firmament
+++ b/testdata/firmament/fixtures/m1b-valid-intersect.firmament
@@ -18,6 +18,8 @@ ops[2]:
id: int1
left: base
with:
- op: cylinder
- radius: 1
- height: 1
\ No newline at end of file
+ op: box
+ size[3]:
+ 1
+ 1
+ 1
diff --git a/testdata/firmament/fixtures/m1b-valid-subtract.firmament b/testdata/firmament/fixtures/m1b-valid-subtract.firmament
index 16d6760f..dd202cad 100644
--- a/testdata/firmament/fixtures/m1b-valid-subtract.firmament
+++ b/testdata/firmament/fixtures/m1b-valid-subtract.firmament
@@ -5,18 +5,37 @@ model:
name: demo
units: mm
-ops[2]:
+ops[3]:
-
op: box
id: base
size[3]:
1
- 2
- 3
+ 1
+ 1
+ -
+ op: add
+ id: anchor
+ to: base
+ with:
+ op: box
+ size[3]:
+ 1
+ 1
+ 1
+ place:
+ on: origin
+ offset[3]:
+ 10
+ 0
+ 0
-
op: subtract
id: sub1
- from: base
+ from: anchor
with:
- op: sphere
- radius: 1
\ No newline at end of file
+ op: box
+ size[3]:
+ 1
+ 1
+ 1
diff --git a/testdata/firmament/fixtures/m2a-valid-boolean-references-earlier-id.firmament b/testdata/firmament/fixtures/m2a-valid-boolean-references-earlier-id.firmament
index e6b119f5..89f3633f 100644
--- a/testdata/firmament/fixtures/m2a-valid-boolean-references-earlier-id.firmament
+++ b/testdata/firmament/fixtures/m2a-valid-boolean-references-earlier-id.firmament
@@ -18,6 +18,8 @@ ops[2]:
id: fused
to: base
with:
- op: cylinder
- radius: 1
- height: 1
\ No newline at end of file
+ op: box
+ size[3]:
+ 1
+ 1
+ 1
diff --git a/testdata/firmament/fixtures/m2a-valid-chained-features.firmament b/testdata/firmament/fixtures/m2a-valid-chained-features.firmament
index 51b3d837..9feb6183 100644
--- a/testdata/firmament/fixtures/m2a-valid-chained-features.firmament
+++ b/testdata/firmament/fixtures/m2a-valid-chained-features.firmament
@@ -14,20 +14,25 @@ ops[4]:
20
30
-
- op: subtract
- id: cut1
- from: base
+ op: add
+ id: joined
+ to: base
with:
- op: cylinder
- radius: 1
- height: 1
+ op: box
+ size[3]:
+ 1
+ 1
+ 1
-
op: intersect
id: clipped
- left: cut1
+ left: joined
with:
- op: sphere
- radius: 1
+ op: box
+ size[3]:
+ 1
+ 1
+ 1
-
op: add
id: merged
@@ -37,4 +42,4 @@ ops[4]:
size[3]:
1
1
- 1
\ No newline at end of file
+ 1
diff --git a/testdata/firmament/fixtures/m3a-mixed-primitive-boolean.firmament b/testdata/firmament/fixtures/m3a-mixed-primitive-boolean.firmament
index e4d3ae4f..70f2034c 100644
--- a/testdata/firmament/fixtures/m3a-mixed-primitive-boolean.firmament
+++ b/testdata/firmament/fixtures/m3a-mixed-primitive-boolean.firmament
@@ -18,5 +18,8 @@ ops[2]:
id: join1
to: base
with:
- op: sphere
- radius: 1
+ op: box
+ size[3]:
+ 1
+ 1
+ 1
diff --git a/testdata/firmament/fixtures/m3b-mixed-primitive-boolean-validation.firmament b/testdata/firmament/fixtures/m3b-mixed-primitive-boolean-validation.firmament
index 390c80c6..fd6bb48d 100644
--- a/testdata/firmament/fixtures/m3b-mixed-primitive-boolean-validation.firmament
+++ b/testdata/firmament/fixtures/m3b-mixed-primitive-boolean-validation.firmament
@@ -19,8 +19,17 @@ ops[5]:
id: join1
to: base
with:
- op: sphere
- radius: 1
+ op: box
+ size[3]:
+ 1
+ 1
+ 1
+ place:
+ on: origin
+ offset[3]:
+ 10
+ 0
+ 0
-
op: cylinder
diff --git a/testdata/firmament/fixtures/m3b-valid-primitives-and-booleans-lower.firmament b/testdata/firmament/fixtures/m3b-valid-primitives-and-booleans-lower.firmament
index 31785c57..9a9b1e5f 100644
--- a/testdata/firmament/fixtures/m3b-valid-primitives-and-booleans-lower.firmament
+++ b/testdata/firmament/fixtures/m3b-valid-primitives-and-booleans-lower.firmament
@@ -19,9 +19,17 @@ ops[6]:
id: join1
to: base
with:
- op: cylinder
- radius: 1
- height: 1
+ op: box
+ size[3]:
+ 1
+ 1
+ 1
+ place:
+ on: origin
+ offset[3]:
+ 10
+ 0
+ 0
-
op: sphere
@@ -33,13 +41,16 @@ ops[6]:
id: cut1
from: join1
with:
- op: sphere
- radius: 1
+ op: box
+ size[3]:
+ 1
+ 1
+ 1
-
- op: intersect
+ op: subtract
id: clip1
- left: cut1
+ from: cut1
with:
op: box
size[3]:
diff --git a/testdata/firmament/fixtures/m3c-mixed-primitive-boolean-validation.firmament b/testdata/firmament/fixtures/m3c-mixed-primitive-boolean-validation.firmament
index 23019373..2e39f8fc 100644
--- a/testdata/firmament/fixtures/m3c-mixed-primitive-boolean-validation.firmament
+++ b/testdata/firmament/fixtures/m3c-mixed-primitive-boolean-validation.firmament
@@ -19,19 +19,24 @@ ops[5]:
id: join1
to: base
with:
- op: cylinder
- radius: 1
- height: 1
+ op: box
+ size[3]:
+ 1
+ 1
+ 1
-
- op: sphere
+ op: box
id: cap
- radius: 3
+ size[3]:
+ 3
+ 3
+ 3
-
- op: subtract
+ op: add
id: cut1
- from: cap
+ to: cap
with:
op: box
size[3]:
diff --git a/testdata/firmament/fixtures/m7b-valid-placement-selector-anchors.firmament b/testdata/firmament/fixtures/m7b-valid-placement-selector-anchors.firmament
index 4f179a13..b8d7a40e 100644
--- a/testdata/firmament/fixtures/m7b-valid-placement-selector-anchors.firmament
+++ b/testdata/firmament/fixtures/m7b-valid-placement-selector-anchors.firmament
@@ -30,9 +30,11 @@ ops[6]:
id: union
to: base
with:
- op: cylinder
- radius: 1
- height: 2
+ op: box
+ size[3]:
+ 1
+ 1
+ 1
-
op: box