Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

E8b: tighten mixed-Z reject and add in-family Firmament 2-edge case

Yuechen Li33e6d0273379
diff --git a/Aetheris.Kernel.Core.Tests/Brep/EdgeFinishing/BrepBoundedConcaveChamferPreflightTests.cs b/Aetheris.Kernel.Core.Tests/Brep/EdgeFinishing/BrepBoundedConcaveChamferPreflightTests.cs
index bdfb52e9..eee17251 100644
--- a/Aetheris.Kernel.Core.Tests/Brep/EdgeFinishing/BrepBoundedConcaveChamferPreflightTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Brep/EdgeFinishing/BrepBoundedConcaveChamferPreflightTests.cs
@@ -112,6 +112,30 @@ public sealed class BrepBoundedConcaveChamferPreflightTests
diagnostic.Message.Contains("supports exactly one inferred interacting edge", StringComparison.Ordinal));
}
+ [Fact]
+ public void ResolveInternalConcaveVerticalEdge_Rejects_MixedZ_OccupiedCells()
+ {
+ var composition = new SafeBooleanComposition(
+ new AxisAlignedBoxExtents(0d, 12d, 0d, 8d, 0d, 10d),
+ [],
+ SafeBooleanRootDescriptor.FromBox(new AxisAlignedBoxExtents(0d, 12d, 0d, 8d, 0d, 10d)),
+ OccupiedCells:
+ [
+ new AxisAlignedBoxExtents(0d, 12d, 0d, 4d, 0d, 10d),
+ new AxisAlignedBoxExtents(0d, 6d, 4d, 6d, 2d, 10d),
+ new AxisAlignedBoxExtents(0d, 12d, 6d, 8d, 0d, 10d),
+ ]);
+
+ var result = BrepBoundedConcaveChamferPreflight.ResolveInternalConcaveVerticalEdge(
+ composition,
+ BrepBoundedChamferEdge.InnerXMinYMin,
+ distance: 0.8d);
+
+ Assert.False(result.IsSuccess);
+ Assert.Contains(result.Diagnostics, diagnostic =>
+ diagnostic.Message.Contains("mixed-Z occupied cells are outside this milestone", StringComparison.Ordinal));
+ }
+
private static SafeBooleanComposition CreateLRootComposition()
{
var cells = new[]
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs
index 9262a618..07e4809c 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs
@@ -406,6 +406,48 @@ public sealed class FirmamentPrimitiveExecutionTests
&& diagnostic.Message.Contains("occupied-cell additive-root metadata", StringComparison.Ordinal));
}
+ [Fact]
+ public void Compile_Diagnoses_E8_MixedZ_AdditiveRoot_Metadata_As_NonPrismatic()
+ {
+ var result = CompileFixture("testdata/firmament/fixtures/e8b-diagnostic-additive-root-mixed-z.firmament");
+
+ Assert.True(result.Compilation.IsSuccess, string.Join(Environment.NewLine, result.Compilation.Diagnostics.Select(d => d.Message)));
+ var croot = Assert.Single(
+ result.Compilation.Value.PrimitiveExecutionResult!.ExecutedBooleans,
+ executed => executed.FeatureId == "croot");
+ var occupiedCells = croot.Body.SafeBooleanComposition?.OccupiedCells;
+ Assert.NotNull(occupiedCells);
+ Assert.NotEmpty(occupiedCells);
+
+ var minZSet = occupiedCells.Select(cell => cell.MinZ).Distinct().OrderBy(z => z).ToArray();
+ var maxZSet = occupiedCells.Select(cell => cell.MaxZ).Distinct().OrderBy(z => z).ToArray();
+ Assert.True(minZSet.Length > 1 || maxZSet.Length > 1);
+ }
+
+ [Fact]
+ public void Compile_Rejects_BoundedConcaveChamfer_For_E8_MixedZ_TwoEdgeFixture()
+ {
+ var result = CompileFixture("testdata/firmament/fixtures/e8-invalid-chamfer-concave-2edge-mixed-z.firmament");
+
+ Assert.False(result.Compilation.IsSuccess);
+ Assert.Contains(result.Compilation.Diagnostics, diagnostic =>
+ diagnostic.Source == "firmament.chamfer-bounded"
+ && diagnostic.Message.Contains("mixed-Z occupied cells", StringComparison.Ordinal));
+ }
+
+ [Fact]
+ public void Compile_Executes_BoundedConcaveChamfer_For_E8b_TwoEdgeInteraction_Firmament_Case()
+ {
+ var result = CompileFixture("testdata/firmament/fixtures/e8b-valid-chamfer-concave-2edge-interaction.firmament");
+
+ Assert.True(result.Compilation.IsSuccess, string.Join(Environment.NewLine, result.Compilation.Diagnostics.Select(d => d.Message)));
+ var execution = result.Compilation.Value.PrimitiveExecutionResult!;
+ var root = Assert.Single(execution.ExecutedBooleans, executed => executed.FeatureId == "croot");
+ var chamfer = Assert.Single(execution.ExecutedBooleans, executed => executed.FeatureId == "inner_pair_interaction");
+ Assert.Equal(FirmamentLoweredBooleanKind.Chamfer, chamfer.Kind);
+ Assert.NotEqual(root.Body.Topology.Faces.Count(), chamfer.Body.Topology.Faces.Count());
+ }
+
[Fact]
public void Compile_BoundedFilletCanonicalInternalCase_Reaches_Narrow_TruthfulRebuildBlocker()
{
diff --git a/testdata/firmament/fixtures/e8-valid-chamfer-concave-2edge-interaction.firmament b/testdata/firmament/fixtures/e8-invalid-chamfer-concave-2edge-mixed-z.firmament
similarity index 92%
rename from testdata/firmament/fixtures/e8-valid-chamfer-concave-2edge-interaction.firmament
rename to testdata/firmament/fixtures/e8-invalid-chamfer-concave-2edge-mixed-z.firmament
index 86cc7fd0..5b346706 100644
--- a/testdata/firmament/fixtures/e8-valid-chamfer-concave-2edge-interaction.firmament
+++ b/testdata/firmament/fixtures/e8-invalid-chamfer-concave-2edge-mixed-z.firmament
@@ -2,7 +2,7 @@ firmament:
version: 1
model:
- name: e8_valid_chamfer_concave_2edge_interaction
+ name: e8_invalid_chamfer_concave_2edge_mixed_z
units: mm
ops[4]:
diff --git a/testdata/firmament/fixtures/e8b-diagnostic-additive-root-mixed-z.firmament b/testdata/firmament/fixtures/e8b-diagnostic-additive-root-mixed-z.firmament
new file mode 100644
index 00000000..18d0ad0c
--- /dev/null
+++ b/testdata/firmament/fixtures/e8b-diagnostic-additive-root-mixed-z.firmament
@@ -0,0 +1,47 @@
+firmament:
+ version: 1
+
+model:
+ name: e8b_diagnostic_additive_root_mixed_z
+ units: mm
+
+ops[3]:
+ -
+ op: box
+ id: base
+ size[3]:
+ 12
+ 4
+ 10
+ -
+ op: add
+ id: mid
+ to: base
+ with:
+ op: box
+ size[3]:
+ 6
+ 2
+ 10
+ place:
+ on: origin
+ offset[3]:
+ 0
+ 4
+ 0
+ -
+ op: add
+ id: croot
+ to: mid
+ with:
+ op: box
+ size[3]:
+ 12
+ 2
+ 10
+ place:
+ on: origin
+ offset[3]:
+ 0
+ 6
+ 0
diff --git a/testdata/firmament/fixtures/e8b-valid-chamfer-concave-2edge-interaction.firmament b/testdata/firmament/fixtures/e8b-valid-chamfer-concave-2edge-interaction.firmament
new file mode 100644
index 00000000..3628f241
--- /dev/null
+++ b/testdata/firmament/fixtures/e8b-valid-chamfer-concave-2edge-interaction.firmament
@@ -0,0 +1,54 @@
+firmament:
+ version: 1
+
+model:
+ name: e8b_valid_chamfer_concave_2edge_interaction
+ units: mm
+
+ops[4]:
+ -
+ op: box
+ id: base
+ size[3]:
+ 12
+ 4
+ 10
+ -
+ op: add
+ id: mid
+ to: base
+ with:
+ op: box
+ size[3]:
+ 6
+ 2
+ 10
+ place:
+ on: origin
+ offset[3]:
+ 0
+ 2
+ 0
+ -
+ op: add
+ id: croot
+ to: mid
+ with:
+ op: box
+ size[3]:
+ 12
+ 2
+ 10
+ place:
+ on: origin
+ offset[3]:
+ 0
+ 4
+ 0
+ -
+ op: chamfer
+ id: inner_pair_interaction
+ from: croot
+ edges[1]:
+ inner_x_min_y_min
+ distance: 0.6