Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Implement bounded open-mouth box pocket placement path
Yuechen Li910b7c354c68
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.csindex 0d28958c..a1af0aba 100644--- a/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs@@ -545,12 +545,41 @@ public sealed class FirmamentBuildAndExportTests}[Fact]- public void Run_FrictionLabPocketedPlate_NowFailsWithExplicitEnclosedPocketDiagnostic()+ public void Run_FrictionLabPocketedPlate_ExecutesBoundedOpenMouthPocketAndExports(){var fullSourcePath = Path.Combine(FirmamentCorpusHarness.RepoRoot(), "Aetheris.Firmament.FrictionLab/Cases/pocketed-plate/part.firmament");+ var existingOutputPath = Path.Combine(FirmamentCorpusHarness.RepoRoot(), "Aetheris.Firmament.FrictionLab/Cases/pocketed-plate/part.step");+ if (File.Exists(existingOutputPath))+ {+ File.Delete(existingOutputPath);+ }++ var result = FirmamentBuildAndExport.Run(fullSourcePath);++ Assert.True(result.IsSuccess, string.Join(Environment.NewLine, result.Diagnostics.Select(d => d.Message)));+ Assert.Equal("pocket", result.Value.Export.ExportedFeatureId);+ Assert.Equal("boolean", result.Value.Export.ExportedBodyCategory);+ Assert.Equal("subtract", result.Value.Export.ExportedFeatureKind);+ Assert.True(File.Exists(result.Value.OutputPath));++ var stepText = result.Value.Export.StepText;+ Assert.True(CountOccurrences(stepText, "ADVANCED_FACE") > 6);+ }++ [Fact]+ public void Run_BoundedPocketFixture_WithSealedCavity_RemainsExplicitlyRejected()+ {+ var fullSourcePath = FirmamentCorpusHarness.ResolveFixtureFullPath("testdata/firmament/fixtures/m13b-unsupported-sealed-pocket-box.firmament");+ var expectedOutputPath = Path.Combine(FirmamentCorpusHarness.RepoRoot(), "testdata", "firmament", "exports", "m13b-unsupported-sealed-pocket-box.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.Source == "BrepBoolean.RebuildResult"&& diagnostic.Message.Contains("requires the subtract box to open to exactly one exterior root face", StringComparison.Ordinal));diff --git a/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutor.cs b/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutor.csindex e787bb69..302a0159 100644--- a/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutor.cs+++ b/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutor.cs@@ -361,8 +361,18 @@ internal static class FirmamentPrimitiveExecutorprivate static bool ShouldUseSemanticToolPlacement(FirmamentLoweredBoolean boolean, BrepBody baseBody, BrepBody toolBody){if (boolean.Placement is null- || boolean.Kind != FirmamentLoweredBooleanKind.Subtract- || !string.Equals(boolean.Tool.OpName, "cylinder", StringComparison.Ordinal))+ || boolean.Kind != FirmamentLoweredBooleanKind.Subtract)+ {+ return false;+ }++ if (string.Equals(boolean.Tool.OpName, "box", StringComparison.Ordinal))+ {+ return BrepBooleanBoxRecognition.TryRecognizeAxisAlignedBox(baseBody, ToleranceContext.Default, out _, out _)+ && BrepBooleanBoxRecognition.TryRecognizeAxisAlignedBox(toolBody, ToleranceContext.Default, out _, out _);+ }++ if (!string.Equals(boolean.Tool.OpName, "cylinder", StringComparison.Ordinal)){return false;}diff --git a/testdata/firmament/fixtures/m13b-unsupported-sealed-pocket-box.firmament b/testdata/firmament/fixtures/m13b-unsupported-sealed-pocket-box.firmamentnew file mode 100644index 00000000..d4b57ef8--- /dev/null+++ b/testdata/firmament/fixtures/m13b-unsupported-sealed-pocket-box.firmament@@ -0,0 +1,32 @@+firmament:+ version: 1++model:+ name: m13b_unsupported_sealed_pocket_box+ units: mm++ops[2]:+ -+ op: box+ id: plate+ size[3]:+ 90+ 60+ 12++ -+ op: subtract+ id: sealed_pocket+ from: plate+ with:+ op: box+ size[3]:+ 60+ 30+ 6+ place:+ on: origin+ offset[3]:+ 0+ 0+ -4