Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
FORGE-M0d: add Forge slot_cut op and isolate connector composition blocker
Yuechen Lif9c844e6a760
diff --git a/Aetheris.Kernel.Core.Tests/Brep/Features/ForgeRoundedRectangleTests.cs b/Aetheris.Kernel.Core.Tests/Brep/Features/ForgeRoundedRectangleTests.csindex 017781e8..165a2a9a 100644--- a/Aetheris.Kernel.Core.Tests/Brep/Features/ForgeRoundedRectangleTests.cs+++ b/Aetheris.Kernel.Core.Tests/Brep/Features/ForgeRoundedRectangleTests.cs@@ -34,4 +34,14 @@ public sealed class ForgeRoundedRectangleTestsAssert.True(result.Value.Topology.Faces.Count() >= 10);Assert.True(result.Value.Topology.Edges.Count() >= 24);}++ [Fact]+ public void SlotCut_StandardLibrary_Succeeds()+ {+ var result = StandardLibraryPrimitives.CreateSlotCut(length: 40d, width: 12d, height: 10d, cornerRadius: 6d);++ Assert.True(result.IsSuccess);+ Assert.True(result.Value.Topology.Faces.Count() >= 10);+ Assert.True(result.Value.Topology.Edges.Count() >= 24);+ }}diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentConnectorLibraryPartTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentConnectorLibraryPartTests.csindex 4515c666..f1742845 100644--- a/Aetheris.Kernel.Firmament.Tests/FirmamentConnectorLibraryPartTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentConnectorLibraryPartTests.cs@@ -45,10 +45,40 @@ public sealed class FirmamentConnectorLibraryPartTestsAssert.Equal(FirmamentLoweredPrimitiveKind.LibraryPart, primitive.Kind);}+ [Fact]+ public void ConnectorPart_Then_Op_Composition_Reveals_BoundedSubtract_Blocker()+ {+ var source = FirmamentCorpusHarness.ReadFixtureText("testdata/firmament/examples/composed_part_with_slot.firmament");++ var compile = FirmamentCorpusHarness.Compile(source);++ Assert.False(compile.Compilation.IsSuccess);+ Assert.Contains(+ compile.Compilation.Diagnostics,+ diagnostic => diagnostic.Message.Contains("Requested boolean feature 'slot_carve' (subtract) could not be executed.", StringComparison.Ordinal));+ Assert.Contains(+ compile.Compilation.Diagnostics,+ diagnostic => diagnostic.Source == "BrepBoolean.RebuildResult"+ && diagnostic.Message.Contains("sequential safe composition only supports subtracting supported analytic holes", StringComparison.Ordinal));+ }++ [Fact]+ public void Firmament_Composed_Model_Export_Reveals_Same_Blocker()+ {+ var source = FirmamentCorpusHarness.ReadFixtureText("testdata/firmament/examples/composed_part_with_slot.firmament");++ var compile = FirmamentCorpusHarness.Compile(source);+ Assert.False(compile.Compilation.IsSuccess);++ var export = FirmamentStepExporter.Export(new FirmamentCompileRequest(new FirmamentSourceDocument(source)));+ Assert.False(export.IsSuccess);+ }+[Fact]public void LaneConnectorResponsibility_Is_Not_Blurred(){Assert.False(FirmamentLaneOperationCatalog.IsLaneRoutedOperation(FirmamentKnownOpKind.LibraryPart));Assert.True(FirmamentLaneOperationCatalog.IsLaneRoutedOperation(FirmamentKnownOpKind.RoundedCornerBox));+ Assert.True(FirmamentLaneOperationCatalog.IsLaneRoutedOperation(FirmamentKnownOpKind.SlotCut));}}diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentExamplePackSmokeTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentExamplePackSmokeTests.csindex 8ef919e9..b7e42295 100644--- a/Aetheris.Kernel.Firmament.Tests/FirmamentExamplePackSmokeTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentExamplePackSmokeTests.cs@@ -16,6 +16,7 @@ public sealed class FirmamentExamplePackSmokeTests"testdata/firmament/examples/hexagonal_prism_basic.firmament","testdata/firmament/examples/straight_slot_basic.firmament","testdata/firmament/examples/rounded_corner_box_basic.firmament",+ "testdata/firmament/examples/slot_cut_basic.firmament","testdata/firmament/examples/library_part_cube_with_hole_basic.firmament","testdata/firmament/examples/box_add_basic.firmament","testdata/firmament/examples/boolean_add_basic.firmament",@@ -54,6 +55,7 @@ public sealed class FirmamentExamplePackSmokeTests[InlineData("testdata/firmament/examples/hexagonal_prism_basic.firmament", "hex1", 0, "primitive", "hexagonalprism")][InlineData("testdata/firmament/examples/straight_slot_basic.firmament", "slot1", 0, "primitive", "straightslot")][InlineData("testdata/firmament/examples/rounded_corner_box_basic.firmament", "rbox1", 0, "primitive", "roundedcornerbox")]+ [InlineData("testdata/firmament/examples/slot_cut_basic.firmament", "slot_cut_1", 0, "primitive", "slotcut")][InlineData("testdata/firmament/examples/library_part_cube_with_hole_basic.firmament", "lib_part_1", 0, "primitive", "librarypart")][InlineData("testdata/firmament/examples/box_add_basic.firmament", "joined", 1, "boolean", "add")][InlineData("testdata/firmament/examples/boolean_add_basic.firmament", "joined", 2, "boolean", "add")]diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.csindex 234e11c1..2fad9329 100644--- a/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs@@ -236,6 +236,23 @@ public sealed class FirmamentPrimitiveExecutionTestsAssert.True(executed.Body.Topology.Faces.Count() >= 10);}+ [Fact]+ public void Firmament_Routes_SlotCut_Through_Correct_Seam()+ {+ var result = CompileFixture("testdata/firmament/examples/slot_cut_basic.firmament");++ Assert.True(result.Compilation.IsSuccess);+ var plan = result.Compilation.Value.PrimitiveLoweringPlan!;+ var lowered = Assert.Single(plan.Primitives);+ Assert.Equal(FirmamentLoweredPrimitiveKind.SlotCut, lowered.Kind);+ Assert.Equal("slot_cut_1", lowered.FeatureId);++ var executed = Assert.Single(result.Compilation.Value.PrimitiveExecutionResult!.ExecutedPrimitives);+ Assert.Equal("slot_cut_1", executed.FeatureId);+ Assert.Equal(FirmamentLoweredPrimitiveKind.SlotCut, executed.Kind);+ Assert.True(executed.Body.Topology.Faces.Count() >= 10);+ }+[Fact]public void Compile_Executes_Add_Boolean_Into_Real_Body(){@@ -625,7 +642,7 @@ 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', 'cone', 'torus', 'triangular_prism', 'hexagonal_prism', and 'straight_slot' only", diagnostic.Message, StringComparison.Ordinal);+ Assert.Contains("supports nested tool ops 'box', 'cylinder', 'sphere', 'cone', 'torus', 'triangular_prism', 'hexagonal_prism', 'straight_slot', and 'slot_cut' only", diagnostic.Message, StringComparison.Ordinal);}[Theory]diff --git a/Aetheris.Kernel.Firmament/Execution/FirmamentBooleanToolBodyFactory.cs b/Aetheris.Kernel.Firmament/Execution/FirmamentBooleanToolBodyFactory.csindex b3f0d129..6128fe9f 100644--- a/Aetheris.Kernel.Firmament/Execution/FirmamentBooleanToolBodyFactory.cs+++ b/Aetheris.Kernel.Firmament/Execution/FirmamentBooleanToolBodyFactory.cs@@ -74,6 +74,6 @@ internal static class FirmamentBooleanToolBodyFactoryreturn FirmamentPrismFamilyTools.TryCreateBody(tool);}- return KernelResult<BrepBody>.Failure([new KernelDiagnostic(KernelDiagnosticCode.NotImplemented, KernelDiagnosticSeverity.Error, $"Boolean execution supports nested tool ops 'box', 'cylinder', 'sphere', 'cone', 'torus', 'triangular_prism', 'hexagonal_prism', and 'straight_slot' only. Got '{tool.OpName}'.")]);+ return KernelResult<BrepBody>.Failure([new KernelDiagnostic(KernelDiagnosticCode.NotImplemented, KernelDiagnosticSeverity.Error, $"Boolean execution supports nested tool ops 'box', 'cylinder', 'sphere', 'cone', 'torus', 'triangular_prism', 'hexagonal_prism', 'straight_slot', and 'slot_cut' only. Got '{tool.OpName}'.")]);}}diff --git a/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutor.cs b/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutor.csindex 6cc7f491..d0537797 100644--- a/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutor.cs+++ b/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutor.cs@@ -177,26 +177,36 @@ internal static class FirmamentPrimitiveExecutorif (FirmamentPrismFamilyTools.TryGetDescriptor(boolean.Tool.OpName, out var prismTool)){- var prismResult = ExecuteBoundedPrismSubtractOnBoxRoot(- boolean,- prismTool,- baseBody,- featureGraphStates);- if (!prismResult.IsSuccess)+ var canUseBoundedPrismPath =+ boolean.Kind == FirmamentLoweredBooleanKind.Subtract+ && boolean.Placement is null+ && featureGraphStates.TryGetValue(boolean.PrimaryReferenceFeatureId, out var sourceState)+ && sourceState == FirmamentSafeSubtractFeatureGraphState.BoxRoot;++ var allowGeneralBooleanFallback = prismTool.Kind == FirmamentPrismToolKind.SlotCut;+ if (canUseBoundedPrismPath || !allowGeneralBooleanFallback){- return KernelResult<FirmamentPrimitiveExecutionResult>.Failure(- [- CreateBooleanExecutionFailureDiagnostic(boolean),- .. WithBooleanContext(boolean, prismResult.Diagnostics)- ]);+ var prismResult = ExecuteBoundedPrismSubtractOnBoxRoot(+ boolean,+ prismTool,+ baseBody,+ featureGraphStates);+ if (!prismResult.IsSuccess)+ {+ return KernelResult<FirmamentPrimitiveExecutionResult>.Failure(+ [+ CreateBooleanExecutionFailureDiagnostic(boolean),+ .. WithBooleanContext(boolean, prismResult.Diagnostics)+ ]);+ }++ var prismBooleanBody = prismResult.Value;+ executedBooleans.Add(new FirmamentExecutedBoolean(boolean.OpIndex, boolean.FeatureId, boolean.Kind, prismBooleanBody));+ publishedBodiesByFeatureId[boolean.FeatureId] = prismBooleanBody;+ booleanExecutionBodiesByFeatureId[boolean.FeatureId] = prismBooleanBody;+ featureGraphStates[boolean.FeatureId] = FirmamentSafeSubtractFeatureGraphState.Other;+ continue;}-- var prismBooleanBody = prismResult.Value;- executedBooleans.Add(new FirmamentExecutedBoolean(boolean.OpIndex, boolean.FeatureId, boolean.Kind, prismBooleanBody));- publishedBodiesByFeatureId[boolean.FeatureId] = prismBooleanBody;- booleanExecutionBodiesByFeatureId[boolean.FeatureId] = prismBooleanBody;- featureGraphStates[boolean.FeatureId] = FirmamentSafeSubtractFeatureGraphState.Other;- continue;}var featureGraphValidation = FirmamentSafeSubtractFeatureGraphValidator.ValidateNextBoolean(@@ -389,6 +399,7 @@ internal static class FirmamentPrimitiveExecutorFirmamentLoweredPrimitiveKind.HexagonalPrism => TranslateBody(body, new Vector3D(0d, 0d, ((FirmamentLoweredHexagonalPrismParameters)primitive.Parameters).Height * 0.5d)),FirmamentLoweredPrimitiveKind.StraightSlot => TranslateBody(body, new Vector3D(0d, 0d, ((FirmamentLoweredStraightSlotParameters)primitive.Parameters).Height * 0.5d)),FirmamentLoweredPrimitiveKind.RoundedCornerBox => TranslateBody(body, new Vector3D(0d, 0d, ((FirmamentLoweredRoundedCornerBoxParameters)primitive.Parameters).Height * 0.5d)),+ FirmamentLoweredPrimitiveKind.SlotCut => TranslateBody(body, new Vector3D(0d, 0d, ((FirmamentLoweredSlotCutParameters)primitive.Parameters).Height * 0.5d)),_ => body};}@@ -418,6 +429,11 @@ internal static class FirmamentPrimitiveExecutor((FirmamentLoweredRoundedCornerBoxParameters)primitive.Parameters).Depth,((FirmamentLoweredRoundedCornerBoxParameters)primitive.Parameters).Height,((FirmamentLoweredRoundedCornerBoxParameters)primitive.Parameters).CornerRadius),+ FirmamentLoweredPrimitiveKind.SlotCut => StandardLibraryPrimitives.CreateSlotCut(+ ((FirmamentLoweredSlotCutParameters)primitive.Parameters).Length,+ ((FirmamentLoweredSlotCutParameters)primitive.Parameters).Width,+ ((FirmamentLoweredSlotCutParameters)primitive.Parameters).Height,+ ((FirmamentLoweredSlotCutParameters)primitive.Parameters).CornerRadius),FirmamentLoweredPrimitiveKind.LibraryPart => FirmamentPartLibraryConnector.ResolvePart(((FirmamentLoweredLibraryPartParameters)primitive.Parameters).PartReference),_ => KernelResult<BrepBody>.Failure([new KernelDiagnostic(KernelDiagnosticCode.NotImplemented, KernelDiagnosticSeverity.Error, $"Primitive execution for kind '{primitive.Kind}' is not implemented.")])diff --git a/Aetheris.Kernel.Firmament/Execution/FirmamentPrismFamilyTools.cs b/Aetheris.Kernel.Firmament/Execution/FirmamentPrismFamilyTools.csindex 5539cb35..13fe4ac3 100644--- a/Aetheris.Kernel.Firmament/Execution/FirmamentPrismFamilyTools.cs+++ b/Aetheris.Kernel.Firmament/Execution/FirmamentPrismFamilyTools.cs@@ -4,6 +4,7 @@ using Aetheris.Kernel.Core.Diagnostics;using Aetheris.Kernel.Core.Math;using Aetheris.Kernel.Core.Results;using Aetheris.Kernel.Firmament.Lowering;+using Aetheris.Kernel.StandardLibrary;namespace Aetheris.Kernel.Firmament.Execution;@@ -11,7 +12,8 @@ internal enum FirmamentPrismToolKind{TriangularPrism,HexagonalPrism,- StraightSlot+ StraightSlot,+ SlotCut}internal sealed record FirmamentPrismToolDescriptor(@@ -95,12 +97,38 @@ internal static class FirmamentPrismFamilyToolsreturn profileVertices;});+ private static readonly FirmamentPrismToolDescriptor SlotCutDescriptor = new(+ FirmamentPrismToolKind.SlotCut,+ "slot_cut",+ ["length", "width", "height", "corner_radius"],+ static tool => StandardLibraryPrimitives.CreateSlotCut(+ FirmamentPrimitiveToolParsing.ParseScalar(tool.RawFields["length"]),+ FirmamentPrimitiveToolParsing.ParseScalar(tool.RawFields["width"]),+ FirmamentPrimitiveToolParsing.ParseScalar(tool.RawFields["height"]),+ FirmamentPrimitiveToolParsing.ParseScalar(tool.RawFields["corner_radius"])),+ static tool => FirmamentPrimitiveToolParsing.ParseScalar(tool.RawFields["height"]),+ static tool =>+ {+ var profile = Forge.ForgeRoundedRectangleProfile.Create(+ FirmamentPrimitiveToolParsing.ParseScalar(tool.RawFields["length"]),+ FirmamentPrimitiveToolParsing.ParseScalar(tool.RawFields["width"]),+ FirmamentPrimitiveToolParsing.ParseScalar(tool.RawFields["corner_radius"]));+ if (!profile.IsSuccess)+ {+ return [];+ }++ var polyline = profile.Value.ToPolylineProfile();+ return polyline.IsSuccess ? polyline.Value.Vertices.ToArray() : [];+ });+private static readonly IReadOnlyDictionary<string, FirmamentPrismToolDescriptor> DescriptorsByOpName =new Dictionary<string, FirmamentPrismToolDescriptor>(StringComparer.Ordinal){[TriangularPrismDescriptor.OpName] = TriangularPrismDescriptor,[HexagonalPrismDescriptor.OpName] = HexagonalPrismDescriptor,- [StraightSlotDescriptor.OpName] = StraightSlotDescriptor+ [StraightSlotDescriptor.OpName] = StraightSlotDescriptor,+ [SlotCutDescriptor.OpName] = SlotCutDescriptor};public static bool TryGetDescriptor(string opName, out FirmamentPrismToolDescriptor descriptor)diff --git a/Aetheris.Kernel.Firmament/Formatting/FirmamentCanonicalFormatter.cs b/Aetheris.Kernel.Firmament/Formatting/FirmamentCanonicalFormatter.csindex 358b3d31..ca489e6c 100644--- a/Aetheris.Kernel.Firmament/Formatting/FirmamentCanonicalFormatter.cs+++ b/Aetheris.Kernel.Firmament/Formatting/FirmamentCanonicalFormatter.cs@@ -173,6 +173,12 @@ internal static class FirmamentCanonicalFormatterEmitIfPresent(builder, entry.RawFields, emitted, indentLevel, "height");EmitIfPresent(builder, entry.RawFields, emitted, indentLevel, "corner_radius");break;+ case FirmamentKnownOpKind.SlotCut:+ EmitIfPresent(builder, entry.RawFields, emitted, indentLevel, "length");+ EmitIfPresent(builder, entry.RawFields, emitted, indentLevel, "width");+ EmitIfPresent(builder, entry.RawFields, emitted, indentLevel, "height");+ EmitIfPresent(builder, entry.RawFields, emitted, indentLevel, "corner_radius");+ break;case FirmamentKnownOpKind.LibraryPart:EmitIfPresent(builder, entry.RawFields, emitted, indentLevel, "part");break;diff --git a/Aetheris.Kernel.Firmament/Lowering/FirmamentPrimitiveLowerer.cs b/Aetheris.Kernel.Firmament/Lowering/FirmamentPrimitiveLowerer.csindex 806ee8ca..4a652133 100644--- a/Aetheris.Kernel.Firmament/Lowering/FirmamentPrimitiveLowerer.cs+++ b/Aetheris.Kernel.Firmament/Lowering/FirmamentPrimitiveLowerer.cs@@ -119,6 +119,18 @@ internal static class FirmamentPrimitiveLowererCornerRadius: ParseScalar(entry.RawFields["corner_radius"])),Placement: LowerPlacement(entry.Placement)));break;+ case FirmamentKnownOpKind.SlotCut:+ loweredPrimitives.Add(new FirmamentLoweredPrimitive(+ OpIndex: index,+ FeatureId: entry.RawFields["id"],+ Kind: FirmamentLoweredPrimitiveKind.SlotCut,+ Parameters: new FirmamentLoweredSlotCutParameters(+ Length: ParseScalar(entry.RawFields["length"]),+ Width: ParseScalar(entry.RawFields["width"]),+ Height: ParseScalar(entry.RawFields["height"]),+ CornerRadius: ParseScalar(entry.RawFields["corner_radius"])),+ Placement: LowerPlacement(entry.Placement)));+ break;case FirmamentKnownOpKind.LibraryPart:loweredPrimitives.Add(new FirmamentLoweredPrimitive(diff --git a/Aetheris.Kernel.Firmament/Lowering/FirmamentPrimitiveLoweringPlan.cs b/Aetheris.Kernel.Firmament/Lowering/FirmamentPrimitiveLoweringPlan.csindex e37d21c5..3f29de2c 100644--- a/Aetheris.Kernel.Firmament/Lowering/FirmamentPrimitiveLoweringPlan.cs+++ b/Aetheris.Kernel.Firmament/Lowering/FirmamentPrimitiveLoweringPlan.cs@@ -60,6 +60,7 @@ public enum FirmamentLoweredPrimitiveKindHexagonalPrism,StraightSlot,RoundedCornerBox,+ SlotCut,LibraryPart}@@ -92,6 +93,9 @@ public sealed record FirmamentLoweredStraightSlotParameters(double Length, doublpublic sealed record FirmamentLoweredRoundedCornerBoxParameters(double Width, double Depth, double Height, double CornerRadius): FirmamentLoweredPrimitiveParameters;+public sealed record FirmamentLoweredSlotCutParameters(double Length, double Width, double Height, double CornerRadius)+ : FirmamentLoweredPrimitiveParameters;+public sealed record FirmamentLoweredToolOp(string OpName,IReadOnlyDictionary<string, string> RawFields,diff --git a/Aetheris.Kernel.Firmament/ParsedModel/FirmamentKnownOpKind.cs b/Aetheris.Kernel.Firmament/ParsedModel/FirmamentKnownOpKind.csindex 818154ec..8d5baf58 100644--- a/Aetheris.Kernel.Firmament/ParsedModel/FirmamentKnownOpKind.cs+++ b/Aetheris.Kernel.Firmament/ParsedModel/FirmamentKnownOpKind.cs@@ -11,6 +11,7 @@ public enum FirmamentKnownOpKindHexagonalPrism,StraightSlot,RoundedCornerBox,+ SlotCut,LibraryPart,Add,Subtract,@@ -40,6 +41,7 @@ internal static class FirmamentKnownOpKinds["hexagonal_prism"] = FirmamentKnownOpKind.HexagonalPrism,["straight_slot"] = FirmamentKnownOpKind.StraightSlot,["rounded_corner_box"] = FirmamentKnownOpKind.RoundedCornerBox,+ ["slot_cut"] = FirmamentKnownOpKind.SlotCut,["library_part"] = FirmamentKnownOpKind.LibraryPart,["add"] = FirmamentKnownOpKind.Add,["subtract"] = FirmamentKnownOpKind.Subtract,@@ -70,6 +72,7 @@ internal static class FirmamentKnownOpKindsFirmamentKnownOpKind.HexagonalPrism => FirmamentOpFamily.Primitive,FirmamentKnownOpKind.StraightSlot => FirmamentOpFamily.Primitive,FirmamentKnownOpKind.RoundedCornerBox => FirmamentOpFamily.Primitive,+ FirmamentKnownOpKind.SlotCut => FirmamentOpFamily.Primitive,FirmamentKnownOpKind.LibraryPart => FirmamentOpFamily.Primitive,FirmamentKnownOpKind.Add => FirmamentOpFamily.Boolean,FirmamentKnownOpKind.Subtract => FirmamentOpFamily.Boolean,diff --git a/Aetheris.Kernel.Firmament/Validation/FirmamentBooleanRequiredFieldValidator.cs b/Aetheris.Kernel.Firmament/Validation/FirmamentBooleanRequiredFieldValidator.csindex 8718d36b..4c35816c 100644--- a/Aetheris.Kernel.Firmament/Validation/FirmamentBooleanRequiredFieldValidator.cs+++ b/Aetheris.Kernel.Firmament/Validation/FirmamentBooleanRequiredFieldValidator.cs@@ -445,6 +445,22 @@ internal static class FirmamentBooleanRequiredFieldValidator}}+ if (prismTool.Kind == FirmamentPrismToolKind.SlotCut)+ {+ _ = TryParseNumeric(withFields["length"], out var length);+ _ = TryParseNumeric(withFields["width"], out var width);+ _ = TryParseNumeric(withFields["corner_radius"], out var cornerRadius);+ if (length <= width)+ {+ return InvalidFieldValue("with.length", opIndex, entry.OpName, "expected a numeric value greater than 'with.width' for slot_cut");+ }++ if (cornerRadius > width * 0.5d)+ {+ return InvalidFieldValue("with.corner_radius", opIndex, entry.OpName, "expected a numeric value less than or equal to with.width / 2 for slot_cut");+ }+ }+return KernelResult<bool>.Success(true);}diff --git a/Aetheris.Kernel.Firmament/Validation/FirmamentPmiValidator.cs b/Aetheris.Kernel.Firmament/Validation/FirmamentPmiValidator.csindex 55fbabee..18a24973 100644--- a/Aetheris.Kernel.Firmament/Validation/FirmamentPmiValidator.cs+++ b/Aetheris.Kernel.Firmament/Validation/FirmamentPmiValidator.cs@@ -326,6 +326,7 @@ internal static class FirmamentPmiValidatoror FirmamentKnownOpKind.HexagonalPrismor FirmamentKnownOpKind.StraightSlotor FirmamentKnownOpKind.RoundedCornerBox+ or FirmamentKnownOpKind.SlotCutor FirmamentKnownOpKind.LibraryPartor FirmamentKnownOpKind.Addor FirmamentKnownOpKind.Subtractdiff --git a/Aetheris.Kernel.Firmament/Validation/FirmamentPrimitiveRequiredFieldValidator.cs b/Aetheris.Kernel.Firmament/Validation/FirmamentPrimitiveRequiredFieldValidator.csindex 7bd7073c..541ff5b4 100644--- a/Aetheris.Kernel.Firmament/Validation/FirmamentPrimitiveRequiredFieldValidator.cs+++ b/Aetheris.Kernel.Firmament/Validation/FirmamentPrimitiveRequiredFieldValidator.cs@@ -33,6 +33,7 @@ internal static class FirmamentPrimitiveRequiredFieldValidatorFirmamentKnownOpKind.HexagonalPrism => ValidateHexagonalPrism(entry, index),FirmamentKnownOpKind.StraightSlot => ValidateStraightSlot(entry, index),FirmamentKnownOpKind.RoundedCornerBox => ValidateRoundedCornerBox(entry, index),+ FirmamentKnownOpKind.SlotCut => ValidateSlotCut(entry, index),FirmamentKnownOpKind.LibraryPart => ValidateLibraryPart(entry, index),_ => KernelResult<bool>.Success(true)};@@ -330,6 +331,7 @@ internal static class FirmamentPrimitiveRequiredFieldValidatorreturn KernelResult<bool>.Success(true);}+private static KernelResult<bool> ValidateStraightSlot(FirmamentParsedOpEntry entry, int opIndex){if (!TryGetRequiredNonEmptyScalar(entry, "id", opIndex, out var missingOrTypeDiagnostic))@@ -358,6 +360,53 @@ internal static class FirmamentPrimitiveRequiredFieldValidatorreturn ValidatePlacement(entry, opIndex);}+ private static KernelResult<bool> ValidateSlotCut(FirmamentParsedOpEntry entry, int opIndex)+ {+ if (!TryGetRequiredNonEmptyScalar(entry, "id", opIndex, out var missingOrTypeDiagnostic))+ {+ return KernelResult<bool>.Failure([missingOrTypeDiagnostic!]);+ }++ var lengthResult = ValidatePositiveNumericField(entry, "length", opIndex);+ if (!lengthResult.IsSuccess)+ {+ return lengthResult;+ }++ var widthResult = ValidatePositiveNumericField(entry, "width", opIndex);+ if (!widthResult.IsSuccess)+ {+ return widthResult;+ }++ var heightResult = ValidatePositiveNumericField(entry, "height", opIndex);+ if (!heightResult.IsSuccess)+ {+ return heightResult;+ }++ var cornerRadiusResult = ValidateNonNegativeNumericField(entry, "corner_radius", opIndex);+ if (!cornerRadiusResult.IsSuccess)+ {+ return cornerRadiusResult;+ }++ var length = ParseRequiredNumeric(entry.RawFields["length"]);+ var width = ParseRequiredNumeric(entry.RawFields["width"]);+ if (length <= width)+ {+ return InvalidFieldValue("length", opIndex, entry.OpName, "expected a numeric value greater than 'width' for slot_cut");+ }++ var cornerRadius = ParseRequiredNumeric(entry.RawFields["corner_radius"]);+ if (cornerRadius > width * 0.5d)+ {+ return InvalidFieldValue("corner_radius", opIndex, entry.OpName, "expected a numeric value less than or equal to width / 2 for slot_cut");+ }++ return ValidatePlacement(entry, opIndex);+ }+private static KernelResult<bool> ValidatePlacement(FirmamentParsedOpEntry entry, int opIndex){if (!entry.RawFields.ContainsKey("place"))diff --git a/Aetheris.Kernel.Firmament/Validation/FirmamentSelectorContracts.cs b/Aetheris.Kernel.Firmament/Validation/FirmamentSelectorContracts.csindex 0084889e..7760dcf1 100644--- a/Aetheris.Kernel.Firmament/Validation/FirmamentSelectorContracts.cs+++ b/Aetheris.Kernel.Firmament/Validation/FirmamentSelectorContracts.cs@@ -74,6 +74,7 @@ internal static class FirmamentSelectorContractscase FirmamentKnownOpKind.HexagonalPrism:case FirmamentKnownOpKind.StraightSlot:case FirmamentKnownOpKind.RoundedCornerBox:+ case FirmamentKnownOpKind.SlotCut:case FirmamentKnownOpKind.LibraryPart:allowedPorts = BoxAllowedPorts;return true;@@ -126,6 +127,7 @@ internal static class FirmamentSelectorContractscase FirmamentKnownOpKind.HexagonalPrism:case FirmamentKnownOpKind.StraightSlot:case FirmamentKnownOpKind.RoundedCornerBox:+ case FirmamentKnownOpKind.SlotCut:case FirmamentKnownOpKind.LibraryPart:contracts = BoxPorts;return true;diff --git a/Aetheris.Kernel.StandardLibrary/StandardLibraryPrimitives.cs b/Aetheris.Kernel.StandardLibrary/StandardLibraryPrimitives.csindex ccf86766..e556755b 100644--- a/Aetheris.Kernel.StandardLibrary/StandardLibraryPrimitives.cs+++ b/Aetheris.Kernel.StandardLibrary/StandardLibraryPrimitives.cs@@ -16,4 +16,15 @@ public static class StandardLibraryPrimitivesreturn ForgeAtomics.ExtrudeCentered(profile.Value, height);}++ public static KernelResult<BrepBody> CreateSlotCut(double length, double width, double height, double cornerRadius, int cornerSegments = 8)+ {+ var profile = ForgeAtomics.RoundedRectangle(length, width, cornerRadius, cornerSegments);+ if (!profile.IsSuccess)+ {+ return KernelResult<BrepBody>.Failure(profile.Diagnostics);+ }++ return ForgeAtomics.ExtrudeCentered(profile.Value, height);+ }}diff --git a/testdata/firmament/examples/README.md b/testdata/firmament/examples/README.mdindex 5aa20d15..708b29e2 100644--- a/testdata/firmament/examples/README.md+++ b/testdata/firmament/examples/README.md@@ -11,6 +11,11 @@ Other combinations may fail and are intentionally not supported yet.- `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`.+- `straight_slot_basic.firmament` — minimal single straight-slot export example; helper export path: `testdata/firmament/exports/straight_slot_basic.step`.+- `rounded_corner_box_basic.firmament` — minimal single rounded-corner-box export example using Forge-backed rounded-rectangle atomics under StandardLibrary; helper export path: `testdata/firmament/exports/rounded_corner_box_basic.step`.+- `slot_cut_basic.firmament` — minimal single slot-cut export example using the same Forge rounded-rectangle atomic seam under StandardLibrary; helper export path: `testdata/firmament/exports/slot_cut_basic.step`.+- `library_part_cube_with_hole_basic.firmament` — connector-routed standard library reusable part example for `standard_library/cube_with_cylindrical_hole`; helper export path: `testdata/firmament/exports/library_part_cube_with_hole_basic.step`.+- `composed_part_with_slot.firmament` — bounded composability probe combining connector part import (`standard_library/cube_with_cylindrical_hole`) and lane-routed `slot_cut` subtract in one model; currently documents a real bounded-safe-composition blocker rather than a successful export.- `box_add_basic.firmament` — minimal supported box-plus-box boolean add example; helper export path: `testdata/firmament/exports/box_add_basic.step`.- `boolean_add_basic.firmament` — canonical proven boolean add example for the current box/box single-box subset; helper export path: `testdata/firmament/exports/boolean_add_basic.step`.- `ribbed_support_f1.firmament` — bounded F1 connected orthogonal add family example for rib/wall-like parts; helper export path: `testdata/firmament/exports/ribbed_support_f1.step`.@@ -30,4 +35,4 @@ Other combinations may fail and are intentionally not supported yet.- `p2_mirror_hole_pair.firmament` — bounded `pattern_mirror` example for principal-plane mirrored hole placement.- `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 supported safe subtract family remains narrow and explicit: `subtract(box, cylinder)` and `subtract(box, cone)` still require a Z-aligned tool, full span through the current box shell, non-degenerate boundary circles for cones, and strict in-bounds clearance with no tangent/grazing contact. Sequential composition is limited to repeated document-order subtracts from that same safe family only: `box → subtract cylinder/cone → subtract cylinder/cone`, while the intermediate result must stay representable as one outer box shell plus non-interfering analytic through-holes. This is not general multi-feature boolean support. Box+cylinder `add`, box+cylinder `intersect`, rotated cylinders, partial-depth cuts, tangent/grazing cases, outside-footprint cuts, interfering multi-hole layouts, and unsupported subtract orderings remain unsupported. Box+cone `add`, box+cone `intersect`, tilted cones, partial-depth cone cuts, tangent/grazing cone cuts, apex-inside cases, outside-footprint cone cuts, and unsupported mixed-ordering requests remain unsupported. Box+sphere support is still narrow and truth-first: only `subtract(box, sphere)` with a strictly contained, non-tangent, fully enclosed cavity is supported, reconstructed via one outer shell plus one inner spherical shell. `add(box, sphere)`, `intersect(box, sphere)`, tangent cavity requests, and partially outside sphere requests remain unsupported. 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.+Unsupported boolean requests are tracked as fixtures/tests, not presented in this working example pack. The supported safe subtract family remains narrow and explicit: `subtract(box, cylinder)` and `subtract(box, cone)` still require a Z-aligned tool, full span through the current box shell, non-degenerate boundary circles for cones, and strict in-bounds clearance with no tangent/grazing contact. Sequential composition is limited to repeated document-order subtracts from that same safe family only: `box → subtract cylinder/cone → subtract cylinder/cone`, while the intermediate result must stay representable as one outer box shell plus non-interfering analytic through-holes. This is not general multi-feature boolean support. The composability probe `composed_part_with_slot.firmament` captures a current blocker: `subtract(library_part, slot_cut)` reaches execution but fails the bounded sequential safe-composition gate because the existing connector part already contains a hole-family composition that does not admit an additional non-analytic slot tool. Box+cylinder `add`, box+cylinder `intersect`, rotated cylinders, partial-depth cuts, tangent/grazing cases, outside-footprint cuts, interfering multi-hole layouts, and unsupported subtract orderings remain unsupported. Box+cone `add`, box+cone `intersect`, tilted cones, partial-depth cone cuts, tangent/grazing cone cuts, apex-inside cases, outside-footprint cone cuts, and unsupported mixed-ordering requests remain unsupported. Box+sphere support is still narrow and truth-first: only `subtract(box, sphere)` with a strictly contained, non-tangent, fully enclosed cavity is supported, reconstructed via one outer shell plus one inner spherical shell. `add(box, sphere)`, `intersect(box, sphere)`, tangent cavity requests, and partially outside sphere requests remain unsupported. 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/examples/composed_part_with_slot.firmament b/testdata/firmament/examples/composed_part_with_slot.firmamentnew file mode 100644index 00000000..d3bd7b92--- /dev/null+++ b/testdata/firmament/examples/composed_part_with_slot.firmament@@ -0,0 +1,29 @@+firmament:+ version: 1++model:+ name: composed_part_with_slot+ units: mm++ops[2]:+ -+ op: library_part+ id: lib_part_1+ part: standard_library/cube_with_cylindrical_hole++ -+ op: subtract+ id: slot_carve+ from: lib_part_1+ with:+ op: slot_cut+ length: 16+ width: 8+ height: 10+ corner_radius: 4+ place:+ on: origin+ offset[3]:+ 0+ 0+ -5diff --git a/testdata/firmament/examples/slot_cut_basic.firmament b/testdata/firmament/examples/slot_cut_basic.firmamentnew file mode 100644index 00000000..aad06e91--- /dev/null+++ b/testdata/firmament/examples/slot_cut_basic.firmament@@ -0,0 +1,15 @@+firmament:+ version: 1++model:+ name: slot_cut_basic+ units: mm++ops[1]:+ -+ op: slot_cut+ id: slot_cut_1+ length: 36+ width: 12+ height: 10+ corner_radius: 6