Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Enforce loud failure for box-torus booleans
Yuechen Liba3db3119932
diff --git a/Aetheris.Kernel.Core.Tests/Brep/Boolean/BrepBooleanTests.cs b/Aetheris.Kernel.Core.Tests/Brep/Boolean/BrepBooleanTests.csindex b03107fe..11e78278 100644--- a/Aetheris.Kernel.Core.Tests/Brep/Boolean/BrepBooleanTests.cs+++ b/Aetheris.Kernel.Core.Tests/Brep/Boolean/BrepBooleanTests.cs@@ -446,6 +446,39 @@ public sealed class BrepBooleanTestsAssert.Equal("Boolean Union: M13 only supports recognized axis-aligned boxes from BrepPrimitives.CreateBox(...).", diagnostic.Message);}+ public static TheoryData<string, BooleanOperation, Transform3D> BoxTorusRepresentativeCases =>+ new()+ {+ { "subtract centered torus", BooleanOperation.Subtract, Transform3D.CreateTranslation(new Vector3D(0d, 0d, 0d)) },+ { "subtract torus fully inside box", BooleanOperation.Subtract, Transform3D.CreateTranslation(new Vector3D(0d, 0d, 10d)) },+ { "subtract offset torus", BooleanOperation.Subtract, Transform3D.CreateTranslation(new Vector3D(4d, 0d, 10d)) },+ { "subtract torus intersecting faces", BooleanOperation.Subtract, Transform3D.CreateTranslation(new Vector3D(0d, 0d, 18d)) },+ { "subtract torus outside footprint", BooleanOperation.Subtract, Transform3D.CreateTranslation(new Vector3D(18d, 0d, 10d)) },+ { "add torus fully inside box", BooleanOperation.Union, Transform3D.CreateTranslation(new Vector3D(0d, 0d, 10d)) },+ { "add offset torus", BooleanOperation.Union, Transform3D.CreateTranslation(new Vector3D(4d, 0d, 10d)) },+ { "add torus intersecting faces", BooleanOperation.Union, Transform3D.CreateTranslation(new Vector3D(0d, 0d, 18d)) },+ { "add torus outside footprint", BooleanOperation.Union, Transform3D.CreateTranslation(new Vector3D(18d, 0d, 10d)) },+ { "intersect torus fully inside box", BooleanOperation.Intersect, Transform3D.CreateTranslation(new Vector3D(0d, 0d, 10d)) },+ { "intersect offset torus", BooleanOperation.Intersect, Transform3D.CreateTranslation(new Vector3D(4d, 0d, 10d)) },+ { "intersect torus intersecting faces", BooleanOperation.Intersect, Transform3D.CreateTranslation(new Vector3D(0d, 0d, 18d)) },+ { "intersect torus outside footprint", BooleanOperation.Intersect, Transform3D.CreateTranslation(new Vector3D(18d, 0d, 10d)) },+ };++ [Theory]+ [MemberData(nameof(BoxTorusRepresentativeCases))]+ public void BoxTorusRepresentativeCases_RemainUnsupported(string _, BooleanOperation operation, Transform3D transform)+ {+ var left = BrepBooleanBoxRecognition.CreateBoxFromExtents(new AxisAlignedBoxExtents(-10d, 10d, -10d, 10d, 0d, 20d)).Value;+ var right = TransformBody(BrepPrimitives.CreateTorus(6d, 2d).Value, transform);++ var result = BrepBoolean.Execute(new BooleanRequest(left, right, operation));++ Assert.False(result.IsSuccess);+ var diagnostic = Assert.Single(result.Diagnostics);+ Assert.Equal(KernelDiagnosticCode.NotImplemented, diagnostic.Code);+ Assert.Equal($"Boolean {operation}: M13 only supports recognized axis-aligned boxes from BrepPrimitives.CreateBox(...).", diagnostic.Message);+ }+private static BrepBody CreateCone(double bottomRadius, double topRadius, double height){var frame = new ExtrudeFrame3D(@@ -498,6 +531,23 @@ public sealed class BrepBooleanTeststransform.Apply(surfaceEntry.Value.Cylinder.Value.Axis),surfaceEntry.Value.Cylinder.Value.Radius,transform.Apply(surfaceEntry.Value.Cylinder.Value.XAxis))),+ SurfaceGeometryKind.Cone => SurfaceGeometry.FromCone(new ConeSurface(+ transform.Apply(surfaceEntry.Value.Cone!.Value.PlacementOrigin),+ transform.Apply(surfaceEntry.Value.Cone.Value.Axis),+ surfaceEntry.Value.Cone.Value.PlacementRadius,+ surfaceEntry.Value.Cone.Value.SemiAngleRadians,+ transform.Apply(surfaceEntry.Value.Cone.Value.ReferenceAxis))),+ SurfaceGeometryKind.Torus => SurfaceGeometry.FromTorus(new TorusSurface(+ transform.Apply(surfaceEntry.Value.Torus!.Value.Center),+ transform.Apply(surfaceEntry.Value.Torus.Value.Axis),+ surfaceEntry.Value.Torus.Value.MajorRadius,+ surfaceEntry.Value.Torus.Value.MinorRadius,+ transform.Apply(surfaceEntry.Value.Torus.Value.XAxis))),+ SurfaceGeometryKind.Sphere => SurfaceGeometry.FromSphere(new SphereSurface(+ transform.Apply(surfaceEntry.Value.Sphere!.Value.Center),+ transform.Apply(surfaceEntry.Value.Sphere.Value.Axis),+ surfaceEntry.Value.Sphere.Value.Radius,+ transform.Apply(surfaceEntry.Value.Sphere.Value.XAxis))),_ => surfaceEntry.Value});}diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanCanonicalSuccessTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanCanonicalSuccessTests.csindex 766af05a..c28b3844 100644--- a/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanCanonicalSuccessTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanCanonicalSuccessTests.cs@@ -89,7 +89,10 @@ public sealed class FirmamentBooleanCanonicalSuccessTests{ "testdata/firmament/fixtures/m10l-unsupported-box-intersect-sphere.firmament", "overlap", "intersect" },{ "testdata/firmament/fixtures/m10m-unsupported-box-subtract-cone.firmament", "tapered_cut", "subtract" },{ "testdata/firmament/fixtures/m10m-unsupported-box-add-cone.firmament", "joined", "add" },- { "testdata/firmament/fixtures/m10m-unsupported-box-intersect-cone.firmament", "overlap", "intersect" }+ { "testdata/firmament/fixtures/m10m-unsupported-box-intersect-cone.firmament", "overlap", "intersect" },+ { "testdata/firmament/fixtures/m10n-unsupported-box-subtract-torus.firmament", "ring_cut", "subtract" },+ { "testdata/firmament/fixtures/m10n-unsupported-box-add-torus.firmament", "joined", "add" },+ { "testdata/firmament/fixtures/m10n-unsupported-box-intersect-torus.firmament", "overlap", "intersect" }};[Theory]@@ -127,6 +130,73 @@ public sealed class FirmamentBooleanCanonicalSuccessTests&& diagnostic.Message.Contains("M13 only supports recognized axis-aligned boxes from BrepPrimitives.CreateBox(...).", StringComparison.Ordinal));}+ public static TheoryData<string, string, string> UnsupportedBoxTorusVariantSources =>+ new()+ {+ { CreateBoxTorusSource("subtract", "ring_cut", "from", "contained", 0d, 0d, 0d), "ring_cut", "subtract" },+ { CreateBoxTorusSource("subtract", "offset_ring_cut", "from", "offset", 6d, 0d, 0d), "offset_ring_cut", "subtract" },+ { CreateBoxTorusSource("subtract", "face_ring_cut", "from", "intersecting", 0d, 0d, 8d, 8d, 3d), "face_ring_cut", "subtract" },+ { CreateBoxTorusSource("subtract", "outside_ring_cut", "from", "outside", 20d, 0d, 0d), "outside_ring_cut", "subtract" },+ { CreateBoxTorusSource("add", "joined", "to", "contained", 0d, 0d, 0d), "joined", "add" },+ { CreateBoxTorusSource("add", "offset_joined", "to", "offset", 6d, 0d, 0d), "offset_joined", "add" },+ { CreateBoxTorusSource("add", "face_joined", "to", "intersecting", 0d, 0d, 8d, 8d, 3d), "face_joined", "add" },+ { CreateBoxTorusSource("add", "outside_joined", "to", "outside", 20d, 0d, 0d), "outside_joined", "add" },+ { CreateBoxTorusSource("intersect", "overlap", "left", "contained", 0d, 0d, 0d), "overlap", "intersect" },+ { CreateBoxTorusSource("intersect", "offset_overlap", "left", "offset", 6d, 0d, 0d), "offset_overlap", "intersect" },+ { CreateBoxTorusSource("intersect", "face_overlap", "left", "intersecting", 0d, 0d, 8d, 8d, 3d), "face_overlap", "intersect" },+ { CreateBoxTorusSource("intersect", "outside_overlap", "left", "outside", 20d, 0d, 0d), "outside_overlap", "intersect" }+ };++ [Theory]+ [MemberData(nameof(UnsupportedBoxTorusVariantSources))]+ public void BoxTorusVariants_RemainUnsupported_Across_Audited_Positions(string source, string expectedFeatureId, string expectedKind)+ {+ var result = FirmamentCorpusHarness.Compile(source);++ 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 string CreateBoxTorusSource(string op, string featureId, string targetField, string nameSuffix, double offsetX, double offsetY, double offsetZ, double majorRadius = 6d, double minorRadius = 2d) =>+ $"""+ firmament:+ version: 1++ model:+ name: m10n_box_torus_{nameSuffix}_{op}+ units: mm++ ops[2]:+ -+ op: box+ id: base+ size[3]:+ 40+ 30+ 12++ -+ op: {op}+ id: {featureId}+ {targetField}: base+ with:+ op: torus+ major_radius: {majorRadius}+ minor_radius: {minorRadius}+ place:+ on: origin+ offset[3]:+ {offsetX}+ {offsetY}+ {offsetZ}+ """;+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/FirmamentBooleanRequiredFieldValidationTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanRequiredFieldValidationTests.csindex fdf0c4c4..6b5851ab 100644--- a/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanRequiredFieldValidationTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanRequiredFieldValidationTests.cs@@ -103,13 +103,52 @@ public sealed class FirmamentBooleanRequiredFieldValidationTestsid: int1left: basewith:- op: box- size[3]:- 1- 1- 1+ op: box+ size[3]:+ 1+ 1+ 1""");+ [Fact]+ public void Compiler_Allows_ValidTorusBooleanToolShape_Past_FieldValidation()+ {+ const string source = """+ firmament:+ version: 1++ model:+ name: demo+ units: mm++ ops[2]:+ -+ op: box+ id: base+ size[3]:+ 40+ 30+ 12+ -+ op: subtract+ id: groove+ from: base+ with:+ op: torus+ major_radius: 10+ minor_radius: 3+ """;++ var compiler = new FirmamentCompiler();+ var result = compiler.Compile(new FirmamentCompileRequest(new FirmamentSourceDocument(source)));++ Assert.False(result.Compilation.IsSuccess);+ Assert.DoesNotContain(result.Compilation.Diagnostics, diagnostic => diagnostic.Message.Contains("[FIRM-STRUCT-", StringComparison.Ordinal));+ Assert.Contains(result.Compilation.Diagnostics, diagnostic =>+ diagnostic.Code == Aetheris.Kernel.Core.Diagnostics.KernelDiagnosticCode.NotImplemented+ && diagnostic.Message.Contains("M13 only supports recognized axis-aligned boxes from BrepPrimitives.CreateBox(...).", StringComparison.Ordinal));+ }+[Fact]public void Compiler_Rejects_Add_MissingId() =>AssertBooleanFailure(@@ -215,6 +254,37 @@ public sealed class FirmamentBooleanRequiredFieldValidationTestsFirmamentDiagnosticCodes.BooleanInvalidFieldTypeOrShape,"Boolean op 'add' at index 0 has invalid field 'with.op'; expected a non-empty scalar/string-like value.");+ [Fact]+ public void Compiler_Rejects_TorusTool_MajorRadius_NotGreaterThan_MinorRadius() =>+ AssertBooleanFailure(+ """+ firmament:+ version: 1++ model:+ name: demo+ units: mm++ ops[2]:+ -+ op: box+ id: base+ size[3]:+ 40+ 30+ 12+ -+ op: add+ id: joined+ to: base+ with:+ op: torus+ major_radius: 3+ minor_radius: 3+ """,+ FirmamentDiagnosticCodes.BooleanInvalidFieldValue,+ "Boolean op 'add' at index 1 has invalid field 'with.major_radius'; expected a numeric value greater than 'with.minor_radius'.");+[Fact]public void Compiler_Rejects_Subtract_MissingId() =>AssertBooleanFailure(diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.csindex fdd99916..f742ef77 100644--- a/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs@@ -258,7 +258,25 @@ public sealed class FirmamentPrimitiveExecutionTestsAssert.False(result.Compilation.IsSuccess);var diagnostic = Assert.Single(result.Compilation.Diagnostics);Assert.Equal(Aetheris.Kernel.Core.Diagnostics.KernelDiagnosticCode.NotImplemented, diagnostic.Code);- Assert.Contains("supports nested tool ops 'box', 'cylinder', 'sphere', and 'cone' only", diagnostic.Message, StringComparison.Ordinal);+ Assert.Contains("supports nested tool ops 'box', 'cylinder', 'sphere', 'cone', and 'torus' only", diagnostic.Message, StringComparison.Ordinal);+ }++ [Theory]+ [InlineData("testdata/firmament/fixtures/m10n-unsupported-box-subtract-torus.firmament", "ring_cut", "subtract")]+ [InlineData("testdata/firmament/fixtures/m10n-unsupported-box-add-torus.firmament", "joined", "add")]+ [InlineData("testdata/firmament/fixtures/m10n-unsupported-box-intersect-torus.firmament", "overlap", "intersect")]+ public void Compile_BoxTorusBooleanFixtures_Reach_Kernel_And_Fail_Loudly(string fixturePath, string expectedFeatureId, string expectedKind)+ {+ var result = CompileFixture(fixturePath);++ Assert.False(result.Compilation.IsSuccess);+ Assert.Contains(result.Compilation.Diagnostics, diagnostic =>+ diagnostic.Code == Aetheris.Kernel.Core.Diagnostics.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 == Aetheris.Kernel.Core.Diagnostics.KernelDiagnosticCode.NotImplemented+ && diagnostic.Message.Contains("M13 only supports recognized axis-aligned boxes from BrepPrimitives.CreateBox(...).", StringComparison.Ordinal));}[Fact]diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.csindex 575e7c84..2baeea4e 100644--- a/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.cs@@ -107,7 +107,10 @@ public sealed class FirmamentStepExporterTests[InlineData("testdata/firmament/fixtures/m10m-unsupported-box-subtract-cone.firmament", "tapered_cut")][InlineData("testdata/firmament/fixtures/m10m-unsupported-box-add-cone.firmament", "joined")][InlineData("testdata/firmament/fixtures/m10m-unsupported-box-intersect-cone.firmament", "overlap")]- public void Export_BoxSphereFixtures_Fail_Loudly_Without_Fallback(string fixturePath, string expectedFeatureId)+ [InlineData("testdata/firmament/fixtures/m10n-unsupported-box-subtract-torus.firmament", "ring_cut")]+ [InlineData("testdata/firmament/fixtures/m10n-unsupported-box-add-torus.firmament", "joined")]+ [InlineData("testdata/firmament/fixtures/m10n-unsupported-box-intersect-torus.firmament", "overlap")]+ public void Export_UnsupportedMixedPrimitiveBooleanFixtures_Fail_Loudly_Without_Fallback(string fixturePath, string expectedFeatureId){var first = ExportFixture(fixturePath);var second = ExportFixture(fixturePath);@@ -120,6 +123,38 @@ public sealed class FirmamentStepExporterTestsAssert.DoesNotContain(first.Diagnostics, diagnostic => diagnostic.Message.Contains("requires at least one executed primitive or boolean body", StringComparison.Ordinal));}+ public static TheoryData<string, string> UnsupportedBoxTorusVariantSources =>+ new()+ {+ { CreateBoxTorusSource("subtract", "ring_cut", "from", 0d, 0d, 0d), "ring_cut" },+ { CreateBoxTorusSource("subtract", "offset_ring_cut", "from", 6d, 0d, 0d), "offset_ring_cut" },+ { CreateBoxTorusSource("subtract", "face_ring_cut", "from", 0d, 0d, 8d, 8d, 3d), "face_ring_cut" },+ { CreateBoxTorusSource("subtract", "outside_ring_cut", "from", 20d, 0d, 0d), "outside_ring_cut" },+ { CreateBoxTorusSource("add", "joined", "to", 0d, 0d, 0d), "joined" },+ { CreateBoxTorusSource("add", "offset_joined", "to", 6d, 0d, 0d), "offset_joined" },+ { CreateBoxTorusSource("add", "face_joined", "to", 0d, 0d, 8d, 8d, 3d), "face_joined" },+ { CreateBoxTorusSource("add", "outside_joined", "to", 20d, 0d, 0d), "outside_joined" },+ { CreateBoxTorusSource("intersect", "overlap", "left", 0d, 0d, 0d), "overlap" },+ { CreateBoxTorusSource("intersect", "offset_overlap", "left", 6d, 0d, 0d), "offset_overlap" },+ { CreateBoxTorusSource("intersect", "face_overlap", "left", 0d, 0d, 8d, 8d, 3d), "face_overlap" },+ { CreateBoxTorusSource("intersect", "outside_overlap", "left", 20d, 0d, 0d), "outside_overlap" }+ };++ [Theory]+ [MemberData(nameof(UnsupportedBoxTorusVariantSources))]+ public void Export_BoxTorusVariants_Fail_Loudly_Without_Fallback(string source, string expectedFeatureId)+ {+ var first = Export(source);+ var second = Export(source);++ 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(){@@ -472,6 +507,40 @@ ops[1]:private static FirmamentCompileResult CompileFixture(string fixturePath) =>FirmamentCorpusHarness.Compile(FirmamentCorpusHarness.ReadFixtureText(fixturePath));+ private static string CreateBoxTorusSource(string op, string featureId, string targetField, double offsetX, double offsetY, double offsetZ, double majorRadius = 6d, double minorRadius = 2d) =>+ $"""+ firmament:+ version: 1++ model:+ name: m10n_box_torus_export_{featureId}+ units: mm++ ops[2]:+ -+ op: box+ id: base+ size[3]:+ 40+ 30+ 12++ -+ op: {op}+ id: {featureId}+ {targetField}: base+ with:+ op: torus+ major_radius: {majorRadius}+ minor_radius: {minorRadius}+ place:+ on: origin+ offset[3]:+ {offsetX}+ {offsetY}+ {offsetZ}+ """;+private static string WriteExportArtifact(string fileName, string stepText){var path = Path.Combine(diff --git a/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutor.cs b/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutor.csindex 7d6ec342..036227c2 100644--- a/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutor.cs+++ b/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutor.cs@@ -191,7 +191,20 @@ internal static class FirmamentPrimitiveExecutorFirmamentPrimitiveToolParsing.ParseScalar(coneHeightRaw)));}- return KernelResult<BrepBody>.Failure([new KernelDiagnostic(KernelDiagnosticCode.NotImplemented, KernelDiagnosticSeverity.Error, $"Boolean execution supports nested tool ops 'box', 'cylinder', 'sphere', and 'cone' only. Got '{tool.OpName}'.")]);+ if (string.Equals(tool.OpName, "torus", StringComparison.Ordinal))+ {+ if (!tool.RawFields.TryGetValue("major_radius", out var majorRadiusRaw) || string.IsNullOrWhiteSpace(majorRadiusRaw)+ || !tool.RawFields.TryGetValue("minor_radius", out var minorRadiusRaw) || string.IsNullOrWhiteSpace(minorRadiusRaw))+ {+ return KernelResult<BrepBody>.Failure([new KernelDiagnostic(KernelDiagnosticCode.ValidationFailed, KernelDiagnosticSeverity.Error, "Boolean execution expected validated nested fields 'with.major_radius' and 'with.minor_radius' for tool op 'torus'.")]);+ }++ return BrepPrimitives.CreateTorus(+ FirmamentPrimitiveToolParsing.ParseScalar(majorRadiusRaw),+ FirmamentPrimitiveToolParsing.ParseScalar(minorRadiusRaw));+ }++ return KernelResult<BrepBody>.Failure([new KernelDiagnostic(KernelDiagnosticCode.NotImplemented, KernelDiagnosticSeverity.Error, $"Boolean execution supports nested tool ops 'box', 'cylinder', 'sphere', 'cone', and 'torus' only. Got '{tool.OpName}'.")]);}private static KernelResult<BrepBody> ExecuteBoolean(FirmamentLoweredBooleanKind kind, BrepBody left, BrepBody right) =>diff --git a/Aetheris.Kernel.Firmament/Validation/FirmamentBooleanRequiredFieldValidator.cs b/Aetheris.Kernel.Firmament/Validation/FirmamentBooleanRequiredFieldValidator.csindex 9b21fffa..f52b8f62 100644--- a/Aetheris.Kernel.Firmament/Validation/FirmamentBooleanRequiredFieldValidator.cs+++ b/Aetheris.Kernel.Firmament/Validation/FirmamentBooleanRequiredFieldValidator.cs@@ -97,6 +97,11 @@ internal static class FirmamentBooleanRequiredFieldValidatorreturn ValidateConeTool(entry, opIndex, withFields);}+ if (string.Equals(withOpRaw, "torus", StringComparison.Ordinal))+ {+ return ValidateTorusTool(entry, opIndex, withFields);+ }+return KernelResult<bool>.Success(true);}@@ -177,6 +182,30 @@ internal static class FirmamentBooleanRequiredFieldValidatorreturn KernelResult<bool>.Success(true);}+ private static KernelResult<bool> ValidateTorusTool(FirmamentParsedOpEntry entry, int opIndex, IReadOnlyDictionary<string, string> withFields)+ {+ var majorRadiusResult = ValidatePositiveNumericWithField(entry, opIndex, withFields, "major_radius");+ if (!majorRadiusResult.IsSuccess)+ {+ return majorRadiusResult;+ }++ var minorRadiusResult = ValidatePositiveNumericWithField(entry, opIndex, withFields, "minor_radius");+ if (!minorRadiusResult.IsSuccess)+ {+ return minorRadiusResult;+ }++ _ = TryParseNumeric(withFields["major_radius"], out var majorRadius);+ _ = TryParseNumeric(withFields["minor_radius"], out var minorRadius);+ if (majorRadius <= minorRadius)+ {+ return InvalidFieldValue("with.major_radius", opIndex, entry.OpName, "expected a numeric value greater than 'with.minor_radius'");+ }++ return KernelResult<bool>.Success(true);+ }+private static KernelResult<bool> ValidatePositiveNumericWithField(FirmamentParsedOpEntry entry, int opIndex, IReadOnlyDictionary<string, string> withFields, string fieldName){var qualifiedFieldName = $"with.{fieldName}";diff --git a/testdata/firmament/examples/README.md b/testdata/firmament/examples/README.mdindex daf56e22..16764d98 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. 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. Box+cone booleans are also currently unsupported in all audited forms, including `subtract(box, cone)` with both pointed-cone and frustum-cone tools, plus all current box+cone `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.+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. Box+cone booleans are also currently unsupported in all audited forms, including `subtract(box, cone)` with both pointed-cone and frustum-cone tools, plus all current box+cone `add` and `intersect` requests. Box+torus booleans are currently unsupported in every audited form: `subtract(box, torus)`, `add(box, torus)`, and `intersect(box, torus)` all fail the real kernel boundary for centered, offset, fully contained, face-intersecting, and outside-footprint torus placements, so no box+torus example is included here. 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/m10n-unsupported-box-add-torus.firmament b/testdata/firmament/fixtures/m10n-unsupported-box-add-torus.firmamentnew file mode 100644index 00000000..fa4e0b06--- /dev/null+++ b/testdata/firmament/fixtures/m10n-unsupported-box-add-torus.firmament@@ -0,0 +1,24 @@+firmament:+ version: 1++model:+ name: m10n_unsupported_box_add_torus+ units: mm++ops[2]:+ -+ op: box+ id: base+ size[3]:+ 40+ 30+ 12++ -+ op: add+ id: joined+ to: base+ with:+ op: torus+ major_radius: 6+ minor_radius: 2diff --git a/testdata/firmament/fixtures/m10n-unsupported-box-intersect-torus.firmament b/testdata/firmament/fixtures/m10n-unsupported-box-intersect-torus.firmamentnew file mode 100644index 00000000..648ffd06--- /dev/null+++ b/testdata/firmament/fixtures/m10n-unsupported-box-intersect-torus.firmament@@ -0,0 +1,24 @@+firmament:+ version: 1++model:+ name: m10n_unsupported_box_intersect_torus+ units: mm++ops[2]:+ -+ op: box+ id: base+ size[3]:+ 40+ 30+ 12++ -+ op: intersect+ id: overlap+ left: base+ with:+ op: torus+ major_radius: 6+ minor_radius: 2diff --git a/testdata/firmament/fixtures/m10n-unsupported-box-subtract-torus.firmament b/testdata/firmament/fixtures/m10n-unsupported-box-subtract-torus.firmamentnew file mode 100644index 00000000..cca1ccc0--- /dev/null+++ b/testdata/firmament/fixtures/m10n-unsupported-box-subtract-torus.firmament@@ -0,0 +1,24 @@+firmament:+ version: 1++model:+ name: m10n_unsupported_box_subtract_torus+ units: mm++ops[2]:+ -+ op: box+ id: base+ size[3]:+ 40+ 30+ 12++ -+ op: subtract+ id: ring_cut+ from: base+ with:+ op: torus+ major_radius: 6+ minor_radius: 2