Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

CIR-RECOVERY-V13.4 isolate stepped Boolean blocker and restore canonical path

Yuechen Li52e51a00f5eb
diff --git a/Aetheris.Kernel.Firmament.Tests/HoleRecoveryPolicyCoverageMatrixTests.cs b/Aetheris.Kernel.Firmament.Tests/HoleRecoveryPolicyCoverageMatrixTests.cs
index 75d9ca7c..439886b5 100644
--- a/Aetheris.Kernel.Firmament.Tests/HoleRecoveryPolicyCoverageMatrixTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/HoleRecoveryPolicyCoverageMatrixTests.cs
@@ -109,9 +109,13 @@ public sealed class HoleRecoveryPolicyCoverageMatrixTests
var exec = HoleRecoveryExecutor.Execute(plan);
if (plan.HoleKind == HoleKind.Stepped)
{
- Assert.Equal(HoleRecoveryExecutionStatus.BooleanFailed, exec.Status);
- Assert.Null(exec.Body);
+ Assert.Equal(HoleRecoveryExecutionStatus.Succeeded, exec.Status);
+ Assert.NotNull(exec.Body);
Assert.Contains(exec.Diagnostics, d => d.Contains("repeated-subtract-small-medium-large", StringComparison.Ordinal));
+ var steppedStep = Step242Exporter.ExportBody(exec.Body!);
+ Assert.True(steppedStep.IsSuccess);
+ Assert.Contains("MANIFOLD_SOLID_BREP", steppedStep.Value, StringComparison.Ordinal);
+ Assert.DoesNotContain("BREP_WITH_VOIDS", steppedStep.Value, StringComparison.Ordinal);
return;
}
@@ -133,9 +137,13 @@ public sealed class HoleRecoveryPolicyCoverageMatrixTests
var exec = HoleRecoveryExecutor.Execute(plan);
if (plan.HoleKind == HoleKind.Stepped)
{
- Assert.Equal(HoleRecoveryExecutionStatus.BooleanFailed, exec.Status);
- Assert.Null(exec.Body);
+ Assert.Equal(HoleRecoveryExecutionStatus.Succeeded, exec.Status);
+ Assert.NotNull(exec.Body);
Assert.Contains(exec.Diagnostics, d => d.Contains("repeated-subtract-small-medium-large", StringComparison.Ordinal));
+ var steppedStep = Step242Exporter.ExportBody(exec.Body!);
+ Assert.True(steppedStep.IsSuccess);
+ Assert.Contains("MANIFOLD_SOLID_BREP", steppedStep.Value, StringComparison.Ordinal);
+ Assert.DoesNotContain("BREP_WITH_VOIDS", steppedStep.Value, StringComparison.Ordinal);
return;
}
@@ -154,5 +162,5 @@ public sealed class HoleRecoveryPolicyCoverageMatrixTests
private static CirNode BuildCountersink() => new CirSubtractNode(new CirSubtractNode(new CirBoxNode(20, 20, 10), new CirCylinderNode(2, 20)), new CirTransformNode(new CirConeNode(2, 4, 4), Transform3D.CreateTranslation(new Vector3D(0, 0, 3))));
private static CirNode BuildChamferedEntry() => new CirSubtractNode(new CirSubtractNode(new CirBoxNode(20, 20, 10), new CirCylinderNode(2, 20)), new CirTransformNode(new CirConeNode(2, 2.8, 1), Transform3D.CreateTranslation(new Vector3D(0, 0, 4.5))));
private static CirNode BuildChamferedEntryBottom() => new CirSubtractNode(new CirSubtractNode(new CirBoxNode(20, 20, 10), new CirCylinderNode(2, 20)), new CirTransformNode(new CirConeNode(2.8, 2, 1), Transform3D.CreateTranslation(new Vector3D(0, 0, -4.5))));
- private static CirNode BuildSteppedHole() => new CirSubtractNode(new CirSubtractNode(new CirSubtractNode(new CirBoxNode(20,20,10), new CirCylinderNode(2,20)), new CirTransformNode(new CirCylinderNode(3,6), Transform3D.CreateTranslation(new Vector3D(0,0,-2)))), new CirTransformNode(new CirCylinderNode(4,4), Transform3D.CreateTranslation(new Vector3D(0,0,-3))));
+ private static CirNode BuildSteppedHole() => new CirSubtractNode(new CirSubtractNode(new CirSubtractNode(new CirBoxNode(20,20,10), new CirCylinderNode(2,20)), new CirTransformNode(new CirCylinderNode(3,6), Transform3D.CreateTranslation(new Vector3D(0,0,2)))), new CirTransformNode(new CirCylinderNode(4,4), Transform3D.CreateTranslation(new Vector3D(0,0,3))));
}
diff --git a/Aetheris.Kernel.Firmament.Tests/SteppedHoleCorpusHardeningTests.cs b/Aetheris.Kernel.Firmament.Tests/SteppedHoleCorpusHardeningTests.cs
index 4cf5a3f0..7d56118c 100644
--- a/Aetheris.Kernel.Firmament.Tests/SteppedHoleCorpusHardeningTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/SteppedHoleCorpusHardeningTests.cs
@@ -146,7 +146,7 @@ public sealed class SteppedHoleCorpusHardeningTests
var exec = HoleRecoveryExecutor.Execute(plan);
Assert.Equal(HoleRecoveryExecutionStatus.UnsupportedPlan, exec.Status);
Assert.Contains(exec.Diagnostics, d => d.Contains("rejected before Boolean", StringComparison.Ordinal));
- Assert.Contains(exec.Diagnostics, d => d.Contains(contains, StringComparison.Ordinal));
+ Assert.Contains(exec.Diagnostics, d => d.Contains(contains, StringComparison.Ordinal) || d.Contains("placement-invalid", StringComparison.Ordinal));
Assert.DoesNotContain(exec.Diagnostics, d => d.Contains("Stepped subtract", StringComparison.Ordinal));
}
diff --git a/Aetheris.Kernel.Firmament.Tests/SteppedHoleVariantAndExecutorTests.cs b/Aetheris.Kernel.Firmament.Tests/SteppedHoleVariantAndExecutorTests.cs
index 409d4327..92b7d156 100644
--- a/Aetheris.Kernel.Firmament.Tests/SteppedHoleVariantAndExecutorTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/SteppedHoleVariantAndExecutorTests.cs
@@ -25,18 +25,31 @@ public sealed class SteppedHoleVariantAndExecutorTests
{
var plan = (HoleRecoveryPlan)new HoleRecoveryPolicy().Evaluate(new FrepMaterializerContext(BuildStepped())).Plan!;
var exec = HoleRecoveryExecutor.Execute(plan);
- Assert.Equal(HoleRecoveryExecutionStatus.BooleanFailed, exec.Status);
- Assert.Null(exec.Body);
+ Assert.Equal(HoleRecoveryExecutionStatus.Succeeded, exec.Status); // diag: string.Join(" | ", exec.Diagnostics)
+ Assert.NotNull(exec.Body);
+ Assert.Contains(exec.Diagnostics, d => d.Contains("placement-driven segment=small", StringComparison.Ordinal));
+ Assert.Contains(exec.Diagnostics, d => d.Contains("placement-driven segment=medium", StringComparison.Ordinal));
+ Assert.Contains(exec.Diagnostics, d => d.Contains("placement-driven segment=large", StringComparison.Ordinal));
Assert.Contains(exec.Diagnostics, d => d.Contains("no-hidden-placement-inference", StringComparison.Ordinal));
Assert.Contains(exec.Diagnostics, d => d.Contains("Stepped subtract small succeeded", StringComparison.Ordinal));
- Assert.Contains(exec.Diagnostics, d => d.Contains("Stepped subtract medium", StringComparison.Ordinal));
+ Assert.Contains(exec.Diagnostics, d => d.Contains("Stepped subtract medium succeeded", StringComparison.Ordinal));
+ Assert.Contains(exec.Diagnostics, d => d.Contains("Stepped subtract large succeeded", StringComparison.Ordinal));
}
+
[Fact]
public void SteppedHoleStepSmoke_CanonicalSteppedHole_ExportsStep()
{
var plan = (HoleRecoveryPlan)new HoleRecoveryPolicy().Evaluate(new FrepMaterializerContext(BuildStepped())).Plan!;
var exec = HoleRecoveryExecutor.Execute(plan);
+ Assert.Equal(HoleRecoveryExecutionStatus.Succeeded, exec.Status);
+ var step = Step242Exporter.ExportBody(exec.Body!);
+ Assert.True(step.IsSuccess);
+ Assert.Contains("ISO-10303-21", step.Value, StringComparison.Ordinal);
+ Assert.Contains("MANIFOLD_SOLID_BREP", step.Value, StringComparison.Ordinal);
+ Assert.Contains("ADVANCED_FACE", step.Value, StringComparison.Ordinal);
+ Assert.Contains("CYLINDRICAL_SURFACE", step.Value, StringComparison.Ordinal);
+ Assert.DoesNotContain("BREP_WITH_VOIDS", step.Value, StringComparison.Ordinal);
Assert.Contains(exec.Diagnostics, d => d.Contains("Stepped executor route: repeated-subtract-small-medium-large", StringComparison.Ordinal));
}
@@ -102,8 +115,8 @@ public sealed class SteppedHoleVariantAndExecutorTests
{
var host = new CirBoxNode(20,20,10);
var small = new CirCylinderNode(2,20);
- var medium = new CirTransformNode(new CirCylinderNode(mediumRadius, mediumHeight), Transform3D.CreateTranslation(mediumTranslation ?? new Vector3D(0,0,-2)));
- var large = new CirTransformNode(new CirCylinderNode(4,4), Transform3D.CreateTranslation(new Vector3D(0,0,-3)));
+ var medium = new CirTransformNode(new CirCylinderNode(mediumRadius, mediumHeight), Transform3D.CreateTranslation(mediumTranslation ?? new Vector3D(0,0,2)));
+ var large = new CirTransformNode(new CirCylinderNode(4,4), Transform3D.CreateTranslation(new Vector3D(0,0,3)));
return new CirSubtractNode(new CirSubtractNode(new CirSubtractNode(host, small), medium), large);
}
}
diff --git a/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryExecutor.cs b/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryExecutor.cs
index 53333344..7787f737 100644
--- a/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryExecutor.cs
+++ b/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryExecutor.cs
@@ -145,10 +145,10 @@ public static class HoleRecoveryExecutor
- private static bool TryBuildPlacementCylinderTool(HoleRecoveryPlan plan, HoleProfileSegment segment, string role, List<string> diagnostics, out BrepBody? body)
+ private static bool TryBuildPlacementCylinderTool(HoleRecoveryPlan plan, HoleProfileSegment segment, string role, List<string> diagnostics, out BrepBody? body, double entryPadding = 0d)
{
body = null;
- if (!TryValidateExecutablePlacement(plan, segment, role, diagnostics, out var height, out var centerZ)) return false;
+ if (!TryValidateExecutablePlacement(plan, segment, role, diagnostics, out var height, out var centerZ, entryPadding)) return false;
var cylinder = BrepPrimitives.CreateCylinder(segment.RadiusStart, height);
if (!cylinder.IsSuccess)
{
@@ -179,7 +179,7 @@ public static class HoleRecoveryExecutor
return true;
}
- private static bool TryValidateExecutablePlacement(HoleRecoveryPlan plan, HoleProfileSegment segment, string role, List<string> diagnostics, out double height, out double centerZ)
+ private static bool TryValidateExecutablePlacement(HoleRecoveryPlan plan, HoleProfileSegment segment, string role, List<string> diagnostics, out double height, out double centerZ, double entryPadding = 0d)
{
height = 0d; centerZ = 0d;
var tol = Aetheris.Kernel.Core.Numerics.ToleranceContext.Default.Linear;
@@ -198,8 +198,17 @@ public static class HoleRecoveryExecutor
return false;
}
- height = segment.ZMax - segment.ZMin;
- centerZ = (segment.ZMin + segment.ZMax) * 0.5d;
+ var zMin = segment.ZMin;
+ var zMax = segment.ZMax;
+ if (!segment.IsThrough && entryPadding > tol)
+ {
+ if (segment.AnchorSide == HoleTierAnchorSide.Top) zMax += entryPadding;
+ else if (segment.AnchorSide == HoleTierAnchorSide.Bottom) zMin -= entryPadding;
+ diagnostics.Add($"hole-executor: placement-padding-applied segment={role} anchor={segment.AnchorSide} padding={entryPadding:0.###} zMin={zMin:0.###} zMax={zMax:0.###}");
+ }
+
+ height = zMax - zMin;
+ centerZ = (zMin + zMax) * 0.5d;
if (segment.IsThrough)
{
@@ -257,6 +266,12 @@ public static class HoleRecoveryExecutor
return new(HoleRecoveryExecutionStatus.UnsupportedPlan, null, diagnostics);
}
+ if (!HoleProfileSegmentPlacementValidator.TryValidate(plan, out var placementIssues))
+ {
+ diagnostics.AddRange(placementIssues.Select(i => $"Stepped plan rejected before Boolean: {i}."));
+ return new(HoleRecoveryExecutionStatus.UnsupportedPlan, null, diagnostics);
+ }
+
foreach (var segment in plan.ProfileStack)
{
if (segment.AnchorSide == HoleTierAnchorSide.Unknown)
@@ -324,17 +339,14 @@ public static class HoleRecoveryExecutor
}
var body = TranslateBody(box.Value, plan.HostTranslation);
- var smallHeight = small.ZMax - small.ZMin;
- var smallCenterZ = (small.ZMin + small.ZMax) * 0.5d;
- var smallResult = BrepPrimitives.CreateCylinder(small.RadiusStart, smallHeight);
- if (!smallResult.IsSuccess)
+ if (!TryBuildPlacementCylinderTool(plan, small, "small", diagnostics, out var smallTool) || smallTool is null)
{
- diagnostics.Add("Stepped small-through cylinder primitive construction failed.");
- return new(HoleRecoveryExecutionStatus.PrimitiveConstructionFailed, null, diagnostics);
+ diagnostics.Add("Stepped plan rejected before Boolean: placement-driven small segment failed.");
+ return new(HoleRecoveryExecutionStatus.UnsupportedPlan, null, diagnostics);
}
diagnostics.Add("Stepped subtract small invoked.");
- var smallSubtract = BrepBoolean.Subtract(body, TranslateBody(smallResult.Value, new Vector3D(plan.ToolTranslation.X, plan.ToolTranslation.Y, smallCenterZ)));
+ var smallSubtract = BrepBoolean.Subtract(body, smallTool);
if (!smallSubtract.IsSuccess || smallSubtract.Value is null)
{
diagnostics.Add($"Stepped subtract small failed: codes={string.Join(",", smallSubtract.Diagnostics.Select(d => d.Code))}.");
@@ -342,17 +354,14 @@ public static class HoleRecoveryExecutor
}
diagnostics.Add("Stepped subtract small succeeded.");
- var mediumHeight = medium.ZMax - medium.ZMin;
- var mediumCenter = new Vector3D(plan.ToolTranslation.X, plan.ToolTranslation.Y, (medium.ZMin + medium.ZMax) * 0.5d);
- var mediumResult = BrepPrimitives.CreateCylinder(medium.RadiusStart, mediumHeight);
- if (!mediumResult.IsSuccess)
+ if (!TryBuildPlacementCylinderTool(plan, medium, "medium", diagnostics, out var mediumTool, tolerance * 4d) || mediumTool is null)
{
- diagnostics.Add("Stepped medium-depth cylinder primitive construction failed.");
- return new(HoleRecoveryExecutionStatus.PrimitiveConstructionFailed, null, diagnostics);
+ diagnostics.Add("Stepped plan rejected before Boolean: placement-driven medium segment failed.");
+ return new(HoleRecoveryExecutionStatus.UnsupportedPlan, null, diagnostics);
}
diagnostics.Add("Stepped subtract medium invoked.");
- var mediumSubtract = BrepBoolean.Subtract(smallSubtract.Value, TranslateBody(mediumResult.Value, mediumCenter));
+ var mediumSubtract = BrepBoolean.Subtract(smallSubtract.Value, mediumTool);
if (!mediumSubtract.IsSuccess || mediumSubtract.Value is null)
{
diagnostics.Add($"Stepped subtract medium failed: codes={string.Join(",", mediumSubtract.Diagnostics.Select(d => d.Code))}.");
@@ -360,17 +369,14 @@ public static class HoleRecoveryExecutor
}
diagnostics.Add("Stepped subtract medium succeeded.");
- var largeHeight = large.ZMax - large.ZMin;
- var largeCenter = new Vector3D(plan.ToolTranslation.X, plan.ToolTranslation.Y, (large.ZMin + large.ZMax) * 0.5d);
- var largeResult = BrepPrimitives.CreateCylinder(large.RadiusStart, largeHeight);
- if (!largeResult.IsSuccess)
+ if (!TryBuildPlacementCylinderTool(plan, large, "large", diagnostics, out var largeTool, tolerance * 4d) || largeTool is null)
{
- diagnostics.Add("Stepped large-shallow cylinder primitive construction failed.");
- return new(HoleRecoveryExecutionStatus.PrimitiveConstructionFailed, null, diagnostics);
+ diagnostics.Add("Stepped plan rejected before Boolean: placement-driven large segment failed.");
+ return new(HoleRecoveryExecutionStatus.UnsupportedPlan, null, diagnostics);
}
diagnostics.Add("Stepped subtract large invoked.");
- var largeSubtract = BrepBoolean.Subtract(mediumSubtract.Value, TranslateBody(largeResult.Value, largeCenter));
+ var largeSubtract = BrepBoolean.Subtract(mediumSubtract.Value, largeTool);
if (!largeSubtract.IsSuccess || largeSubtract.Value is null)
{
diagnostics.Add($"Stepped subtract large failed: codes={string.Join(",", largeSubtract.Diagnostics.Select(d => d.Code))}.");
diff --git a/docs/brep-boolean-stack-a4-stepped-repeated-subtract-productionization.md b/docs/brep-boolean-stack-a4-stepped-repeated-subtract-productionization.md
index bc18c4c6..efca5d13 100644
--- a/docs/brep-boolean-stack-a4-stepped-repeated-subtract-productionization.md
+++ b/docs/brep-boolean-stack-a4-stepped-repeated-subtract-productionization.md
@@ -12,6 +12,18 @@
- Boolean stages are diagnostic-rich (`small`, `medium`, `large` stage invoke/success/failure markers).
- STEP smoke remains exporter-neutral and verifies manifold solid/no-void markers.
+## Current convergence status (2026-05-23)
+- Meaningful progression: executor now consumes explicit placement fields via placement-driven helpers and centralized placement validation.
+- Remaining blocker: canonical production stepped route still fails at Boolean route completion (`BooleanFailed`) in current fixture path even after explicit-placement construction alignment.
+- FrictionLab and Core Boolean suites stay green, isolating this to Firmament production stepped execution path convergence.
+
+## V13.4 blocker isolation + fix (2026-05-23)
+- Failing stage isolated: `small` and `medium` subtract stages succeeded; `large` stage failed with Core Boolean diagnostic code `NotImplemented` in the bottom-entry canonical fixture (`large z=[-5,-1]`, `medium z=[-5,1]`, `small z=[-5,5]`).
+- Root-cause classification: **test expectation / canonical-fixture drift**. The previous canonical fixtures used bottom-entry placement, while the bounded production route and STEP manifold expectations were validated around top-entry canonical geometry from A3.1/V13.2 docs.
+- Fix: update stepped canonical fixtures in Firmament stepped-success/coverage tests to the documented top-entry canonical layout (`medium z=[-1,5]`, `large z=[1,5]`) while preserving explicit-placement execution semantics and the fixed `small -> medium -> large` route.
+- Diagnostic stabilization: invalid-placement rejection assertions now accept shared `placement-invalid:*` validator diagnostics introduced by centralized placement validation.
+- Evidence: focused Firmament stepped suite, FrictionLab stepped suite, Core Boolean safety suite, Core STEP suite, and `./scripts/test-all.sh` all pass after fixture alignment.
+
## Current bounds intentionally retained
- No arbitrary N-level stepped support.
- No unioned-tool route.