Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Fix CIR box-minus-box exporter test replay log mismatch

Yuechen Li87c52eaa0b34
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.cs
index 5d47e4f0..f5a7393c 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.cs
@@ -1,5 +1,6 @@
using System.Linq;
using Aetheris.Kernel.Core.Step242;
+using Aetheris.Kernel.Core.Math;
using Aetheris.Kernel.Firmament.Execution;
using Aetheris.Kernel.Firmament.Lowering;
@@ -265,7 +266,7 @@ public sealed class FirmamentStepExporterTests
[new FirmamentLoweredPrimitive(0, "base", FirmamentLoweredPrimitiveKind.Box, new FirmamentLoweredBoxParameters(20, 20, 10), null)],
[new FirmamentLoweredBoolean(1, "notch", FirmamentLoweredBooleanKind.Subtract, "from", "base", new FirmamentLoweredToolOp("box", new Dictionary<string, string> { { "op", "box" }, { "size", "[6,20,10]" } }, "op box size=[6,20,10]"), new FirmamentLoweredPlacement(new FirmamentLoweredPlacementOriginAnchor(), true, [7d, 0d, 0d], null, null, null, []))],
[]);
- var cirOnlyState = new NativeGeometryState(NativeGeometryExecutionMode.CirOnly, NativeGeometryMaterializationAuthority.PendingRematerialization, null, "notch", new NativeGeometryReplayLog([]), [], new NativeGeometryCirMirrorState(CirMirrorStatus.NotAttempted, null, []));
+ var cirOnlyState = new NativeGeometryState(NativeGeometryExecutionMode.CirOnly, NativeGeometryMaterializationAuthority.PendingRematerialization, null, "notch", BuildReplayLogForBoxMinusBox(), [], new NativeGeometryCirMirrorState(CirMirrorStatus.NotAttempted, null, []));
var cirOnlyArtifact = new FirmamentCompilationArtifact(
PrimitiveLoweringPlan: plan,
PrimitiveExecutionResult: new FirmamentPrimitiveExecutionResult([], [], cirOnlyState));
@@ -363,6 +364,13 @@ public sealed class FirmamentStepExporterTests
Assert.DoesNotContain(first.Diagnostics, diagnostic => diagnostic.Message.Contains("requires at least one executed primitive or boolean body", StringComparison.Ordinal));
}
+
+ private static NativeGeometryReplayLog BuildReplayLogForBoxMinusBox()
+ => new([
+ new NativeGeometryReplayOperation(0, "base", "primitive:box", null, null, null, null, new NativeGeometryResolvedPlacement(NativeGeometryPlacementKind.None, null, null, Vector3D.Zero, Vector3D.Zero, true, null), null),
+ new NativeGeometryReplayOperation(1, "notch", "boolean:subtract", "base", "box", "tool", null, new NativeGeometryResolvedPlacement(NativeGeometryPlacementKind.None, null, null, Vector3D.Zero, Vector3D.Zero, true, null), null)
+ ]);
+
private static bool HasExpectedMixedPrimitiveFailure(string message)
=> message.Contains("bounded boolean family only supports recognized axis-aligned boxes from BrepPrimitives.CreateBox(...).", StringComparison.Ordinal)
|| message.Contains("sequential safe composition only supports subtracting supported cylinder/cone analytic holes", StringComparison.Ordinal)