Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Narrow mixed analytic+prismatic subtract blocker diagnostics

Yuechen Li66f6f453f64b
diff --git a/Aetheris.Kernel.Core.Tests/Brep/Boolean/BrepBooleanTests.cs b/Aetheris.Kernel.Core.Tests/Brep/Boolean/BrepBooleanTests.cs
index f298520e..f9b2fda7 100644
--- a/Aetheris.Kernel.Core.Tests/Brep/Boolean/BrepBooleanTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Brep/Boolean/BrepBooleanTests.cs
@@ -1664,6 +1664,22 @@ public sealed class BrepBooleanTests
Assert.Contains("through-cut tool", diagnostic.Message, StringComparison.Ordinal);
}
+ [Fact]
+ public void Unsupported_MixedSubtract_Reveals_RebuildBoundary()
+ {
+ var root = BrepPrimitives.CreateBox(20d, 20d, 20d).Value;
+ var holeTool = BrepPrimitives.CreateCylinder(3d, 24d).Value;
+ var withHole = BrepBoolean.Subtract(root, holeTool);
+ Assert.True(withHole.IsSuccess);
+
+ var slotTool = TransformBody(StandardLibraryPrimitives.CreateSlotCut(16d, 8d, 10d, 4d).Value, Transform3D.CreateTranslation(new Vector3D(0d, 0d, -5d)));
+ var result = BrepBoolean.Subtract(withHole.Value, slotTool);
+
+ Assert.False(result.IsSuccess);
+ var diagnostic = Assert.Single(result.Diagnostics);
+ Assert.Contains("bounded mixed analytic+prismatic subtract continuation is recognized but bounded reconstruction for this mixed family is not implemented yet", diagnostic.Message, StringComparison.Ordinal);
+ }
+
[Fact]
public void Execute_NonBoxInput_ReturnsDeterministicNotImplementedWithoutThrowing()
{
diff --git a/Aetheris.Kernel.Core/Brep/Boolean/BrepBoolean.cs b/Aetheris.Kernel.Core/Brep/Boolean/BrepBoolean.cs
index 49c16218..9e73cea9 100644
--- a/Aetheris.Kernel.Core/Brep/Boolean/BrepBoolean.cs
+++ b/Aetheris.Kernel.Core/Brep/Boolean/BrepBoolean.cs
@@ -1771,7 +1771,13 @@ public static class BrepBoolean
if (leftComposition.Holes.Count > 0 || (leftComposition.OpenSlots?.Count ?? 0) > 0)
{
- unsupportedReason = "Boolean Subtract: bounded prismatic subtract continuation currently requires a recognized safe box root without existing analytic-hole/open-slot subtractions.";
+ if (!SupportsBoundedAnalyticHistoryForPrismaticContinuation(leftComposition, tolerance, out var historyReason))
+ {
+ unsupportedReason = historyReason;
+ return false;
+ }
+
+ unsupportedReason = "Boolean Subtract: bounded mixed analytic+prismatic subtract continuation is recognized but bounded reconstruction for this mixed family is not implemented yet.";
return false;
}
@@ -1796,6 +1802,42 @@ public static class BrepBoolean
return true;
}
+ private static bool SupportsBoundedAnalyticHistoryForPrismaticContinuation(
+ SafeBooleanComposition composition,
+ ToleranceContext tolerance,
+ out string unsupportedReason)
+ {
+ unsupportedReason = "Boolean Subtract: bounded prismatic subtract continuation currently requires prior subtract history to stay inside supported analytic-hole/open-slot families.";
+ if (composition.OpenSlots is { Count: > 0 })
+ {
+ return false;
+ }
+
+ foreach (var hole in composition.Holes)
+ {
+ if (hole.SpanKind != SupportedBooleanHoleSpanKind.Through)
+ {
+ return false;
+ }
+
+ if (hole.Surface.Kind is not (AnalyticSurfaceKind.Cylinder or AnalyticSurfaceKind.Cone))
+ {
+ return false;
+ }
+
+ var axis = hole.Axis.ToVector();
+ if (!ToleranceMath.AlmostZero(axis.X, tolerance)
+ || !ToleranceMath.AlmostZero(axis.Y, tolerance)
+ || !ToleranceMath.AlmostEqual(System.Math.Abs(axis.Z), 1d, tolerance))
+ {
+ return false;
+ }
+ }
+
+ unsupportedReason = string.Empty;
+ return true;
+ }
+
private static KernelResult<BrepBody> ValidateOutput(BrepBody body, IReadOnlyList<KernelDiagnostic> diagnostics)
{
var validation = BrepBindingValidator.Validate(body, requireAllEdgeAndFaceBindings: true);
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentConnectorLibraryPartTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentConnectorLibraryPartTests.cs
index 8d4c42b1..1cc84979 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentConnectorLibraryPartTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentConnectorLibraryPartTests.cs
@@ -46,7 +46,7 @@ public sealed class FirmamentConnectorLibraryPartTests
}
[Fact]
- public void ConnectorPart_With_SlotCut_Composition_Reveals_Next_Bounded_Blocker()
+ public void ConnectorPart_With_SlotCut_Composition_Reveals_Narrower_MixedRebuild_Blocker()
{
var source = FirmamentCorpusHarness.ReadFixtureText("testdata/firmament/examples/composed_part_with_slot.firmament");
@@ -59,7 +59,7 @@ public sealed class FirmamentConnectorLibraryPartTests
Assert.Contains(
compile.Compilation.Diagnostics,
diagnostic => diagnostic.Source == "BrepBoolean.RebuildResult"
- && diagnostic.Message.Contains("bounded prismatic subtract continuation currently requires a recognized safe box root without existing analytic-hole/open-slot subtractions", StringComparison.Ordinal));
+ && diagnostic.Message.Contains("bounded mixed analytic+prismatic subtract continuation is recognized but bounded reconstruction for this mixed family is not implemented yet", StringComparison.Ordinal));
}
[Fact]
diff --git a/docs/boolean-deferred.md b/docs/boolean-deferred.md
index 92ca4d6c..49615242 100644
--- a/docs/boolean-deferred.md
+++ b/docs/boolean-deferred.md
@@ -13,7 +13,7 @@ The current supported boolean subset is intentionally narrow and family-specific
- box − sphere cavity
- rotated cylinder through-hole
- safe-family composition for the currently supported through-hole family
-- recognized safe box-root subtract with bounded prismatic through-cut tools (triangular/hexagonal/slot profiles) when the root has no prior analytic-hole/open-slot subtract history
+- recognized safe box-root subtract with bounded prismatic through-cut tools (triangular/hexagonal/slot profiles) when the root has no prior subtract history
## Current deferred boolean pile
@@ -26,7 +26,7 @@ The following items remain deferred:
- torus booleans
- broad add/intersect expansion outside the current narrow box-box subset
- general BRep booleans
-- prismatic continuation from safe roots that already contain analytic-hole/open-slot subtract history
+- bounded mixed analytic-hole + prismatic continuation rebuild path on safe box roots (recognition now exists; bounded reconstruction remains deferred)
## Known blocker: rotated cone through-hole