Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Refine cylinder-root keyway subset and diagnostics
Yuechen Liec18ff7b7b20
diff --git a/Aetheris.Kernel.Core.Tests/Brep/Boolean/BrepBooleanTests.cs b/Aetheris.Kernel.Core.Tests/Brep/Boolean/BrepBooleanTests.csindex 32895591..a98c870f 100644--- a/Aetheris.Kernel.Core.Tests/Brep/Boolean/BrepBooleanTests.cs+++ b/Aetheris.Kernel.Core.Tests/Brep/Boolean/BrepBooleanTests.cs@@ -438,6 +438,22 @@ public sealed class BrepBooleanTests&& surface?.Kind == SurfaceGeometryKind.Cylinder);}+ [Fact]+ public void Subtract_CylinderRootCenterlineKeyway_ProgressesToExplicitOpenSlotRebuildBlocker()+ {+ var shaft = BrepPrimitives.CreateCylinder(15d, 80d).Value;+ var keywayTool = BrepBooleanBoxRecognition.CreateBoxFromExtents(new AxisAlignedBoxExtents(5d, 15d, -3d, 3d, -45d, 45d)).Value;++ var result = BrepBoolean.Subtract(shaft, keywayTool);++ Assert.False(result.IsSuccess);+ var diagnostic = Assert.Single(result.Diagnostics);+ Assert.Equal(KernelDiagnosticCode.NotImplemented, diagnostic.Code);+ Assert.Equal(+ "Boolean Subtract: bounded cylinder-root keyway family is recognized (single world-Z through rectangular slot), but rebuild/export for open-slot topology is not implemented yet.",+ diagnostic.Message);+ }+[Fact]public void Subtract_CylinderRootCenterBore_Exports_And_RoundTrips_Deterministically(){diff --git a/Aetheris.Kernel.Core/Brep/Boolean/BrepBoolean.cs b/Aetheris.Kernel.Core/Brep/Boolean/BrepBoolean.csindex 31bbd5fb..e2a6e947 100644--- a/Aetheris.Kernel.Core/Brep/Boolean/BrepBoolean.cs+++ b/Aetheris.Kernel.Core/Brep/Boolean/BrepBoolean.cs@@ -826,10 +826,11 @@ public static class BrepBooleanreturn false;}- if (ContainsPoint(toolBox.MinX, toolBox.MaxX, rootCenterX, tolerance)- && ContainsPoint(toolBox.MinY, toolBox.MaxY, rootCenterY, tolerance))+ var reachesFarSideWall = ContainsPoint(toolBox.MinX, toolBox.MaxX, rootCenterX - rootCylinder.Radius, tolerance)+ && ContainsPoint(toolBox.MinY, toolBox.MaxY, rootCenterY, tolerance);+ if (reachesFarSideWall){- unsupportedReason = "Boolean Subtract: bounded keyway family excludes centerline-spanning trenches; slot must remain one-sided off-axis.";+ unsupportedReason = "Boolean Subtract: bounded keyway family requires a single exterior mouth and cannot cut through the far-side cylindrical wall.";return false;}diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanCanonicalSuccessTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanCanonicalSuccessTests.csindex 85294a5b..a8f26f01 100644--- a/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanCanonicalSuccessTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanCanonicalSuccessTests.cs@@ -211,7 +211,7 @@ public sealed class FirmamentBooleanCanonicalSuccessTests}[Fact]- public void CylinderRootKeywayPressureCase_Fails_WithExplicitCenterlineSubsetDiagnostic()+ public void CylinderRootKeywayPressureCase_Fails_WithExplicitOpenSlotRebuildDiagnostic(){var source = FirmamentCorpusHarness.ReadFixtureText("Aetheris.Firmament.FrictionLab/Cases/shaft-keyway/part.firmament");var result = FirmamentCorpusHarness.Compile(source);@@ -220,7 +220,7 @@ public sealed class FirmamentBooleanCanonicalSuccessTestsAssert.Contains(result.Compilation.Diagnostics, diagnostic =>diagnostic.Code == KernelDiagnosticCode.NotImplemented&& diagnostic.Source == "BrepBoolean.RebuildResult"- && diagnostic.Message.Contains("bounded keyway family excludes centerline-spanning trenches", StringComparison.Ordinal));+ && diagnostic.Message.Contains("bounded cylinder-root keyway family is recognized", StringComparison.Ordinal));}[Fact]@@ -268,6 +268,51 @@ public sealed class FirmamentBooleanCanonicalSuccessTests&& diagnostic.Message.Contains("requires a through slot that spans both cylinder end caps", StringComparison.Ordinal));}+ [Fact]+ public void CylinderRootKeywayOutsideBoundedSubset_Fails_WhenToolCutsThroughFarSideWall()+ {+ const string source = """+ firmament:+ version: 1++ model:+ name: keyway_far_side_cut_outside_subset+ units: mm++ ops[2]:+ -+ op: cylinder+ id: shaft+ radius: 15+ height: 80++ -+ op: subtract+ id: deep_keyway+ from: shaft+ with:+ op: box+ size[3]:+ 40+ 6+ 90+ place:+ on: origin+ offset[3]:+ 0+ 0+ 0+ """;++ var result = FirmamentCorpusHarness.Compile(source);++ Assert.False(result.Compilation.IsSuccess);+ Assert.Contains(result.Compilation.Diagnostics, diagnostic =>+ diagnostic.Code == KernelDiagnosticCode.NotImplemented+ && diagnostic.Source == "BrepBoolean.RebuildResult"+ && diagnostic.Message.Contains("requires a single exterior mouth and cannot cut through the far-side cylindrical wall", StringComparison.Ordinal));+ }+public static TheoryData<string, string, string> UnsupportedBoxTorusVariantSources =>new(){diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.csindex a1af0aba..4e55a3d0 100644--- a/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs@@ -541,7 +541,7 @@ public sealed class FirmamentBuildAndExportTestsdiagnostic.Message.Contains("Requested boolean feature 'keyway' (subtract) could not be executed.", StringComparison.Ordinal));Assert.Contains(result.Diagnostics, diagnostic =>diagnostic.Source == "BrepBoolean.RebuildResult"- && diagnostic.Message.Contains("bounded keyway family excludes centerline-spanning trenches", StringComparison.Ordinal));+ && diagnostic.Message.Contains("bounded cylinder-root keyway family is recognized", StringComparison.Ordinal));}[Fact]