Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Add bounded countersink variant blocker diagnostics

Yuechen Li99084f3deb76
diff --git a/Aetheris.Kernel.Firmament.Tests/CountersinkVariantAndExecutorTests.cs b/Aetheris.Kernel.Firmament.Tests/CountersinkVariantAndExecutorTests.cs
new file mode 100644
index 00000000..afa96f81
--- /dev/null
+++ b/Aetheris.Kernel.Firmament.Tests/CountersinkVariantAndExecutorTests.cs
@@ -0,0 +1,31 @@
+using Aetheris.Kernel.Core.Cir;
+using Aetheris.Kernel.Firmament.Materializer;
+
+namespace Aetheris.Kernel.Firmament.Tests;
+
+public sealed class CountersinkVariantAndExecutorTests
+{
+ [Fact]
+ public void CountersinkVariant_IsEvaluated_AndRejectedWithExplicitConePrimitiveBlocker()
+ {
+ var root = new CirSubtractNode(new CirBoxNode(20d, 20d, 10d), new CirCylinderNode(2d, 20d));
+ var eval = new HoleRecoveryPolicy().Evaluate(new FrepMaterializerContext(root));
+
+ var countersinkDiagnostics = eval.EvaluationsFor(nameof(CountersinkVariant));
+ Assert.NotEmpty(countersinkDiagnostics);
+ Assert.Contains(countersinkDiagnostics, d => d.Contains("no cone primitive node", StringComparison.OrdinalIgnoreCase));
+ }
+
+ [Fact]
+ public void CountersinkVariant_DoesNotOverrideCounterboreSelection()
+ {
+ var root = new CirSubtractNode(
+ new CirSubtractNode(new CirBoxNode(20, 20, 10), new CirCylinderNode(2, 20)),
+ new CirTransformNode(new CirCylinderNode(4, 4), Aetheris.Kernel.Core.Math.Transform3D.CreateTranslation(new Aetheris.Kernel.Core.Math.Vector3D(0, 0, -3))));
+
+ var eval = new HoleRecoveryPolicy().Evaluate(new FrepMaterializerContext(root));
+ Assert.True(eval.Admissible);
+ Assert.Contains("selected-variant:CounterboreVariant", eval.Evidence);
+ Assert.DoesNotContain("selected-variant:CountersinkVariant", eval.Evidence);
+ }
+}
diff --git a/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryPlan.cs b/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryPlan.cs
index 7c9ad2a8..6765453d 100644
--- a/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryPlan.cs
+++ b/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryPlan.cs
@@ -4,10 +4,10 @@ namespace Aetheris.Kernel.Firmament.Materializer;
public enum HoleHostKind { RectangularBox, Unsupported }
public enum HoleAxisKind { Z, Unsupported }
-public enum HoleKind { Through, Blind, Counterbore, Unsupported }
+public enum HoleKind { Through, Blind, Counterbore, Countersink, Unsupported }
public enum HoleDepthKind { Through, Blind, ThroughWithEntryRelief, Unsupported }
public enum HoleProfileSegmentKind { Cylindrical, Conical, Chamfer, ThreadDeferred, Unsupported }
-public enum HoleEntryFeatureKind { Plain, Counterbore, Unsupported }
+public enum HoleEntryFeatureKind { Plain, Counterbore, Countersink, Unsupported }
public enum HoleExitFeatureKind { Plain, ClosedBottom, Unsupported }
public enum HoleSurfacePatchRole { EntryFace, ExitFace, HostRetainedPlanarFaces, CylindricalWall, BlindBottomCap, CounterboreFloorAnnulus, CounterboreWall }
public enum HoleTrimCurveRole { CircularRimTrim, Deferred }
diff --git a/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryPolicy.cs b/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryPolicy.cs
index 8b07b71f..b9359c93 100644
--- a/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryPolicy.cs
+++ b/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryPolicy.cs
@@ -21,7 +21,7 @@ public sealed record HoleRecoveryVariantEvaluation(
public sealed class HoleRecoveryPolicy : IFrepMaterializerPolicy
{
private static readonly JudgmentEngine<FrepMaterializerContext> VariantEngine = new();
- private readonly IReadOnlyList<IHoleRecoveryVariant> _variants = [new ThroughHoleVariant(), new BlindHoleVariant(), new CounterboreVariant()];
+ private readonly IReadOnlyList<IHoleRecoveryVariant> _variants = [new ThroughHoleVariant(), new BlindHoleVariant(), new CounterboreVariant(), new CountersinkVariant()];
public string Name => nameof(HoleRecoveryPolicy);
public FrepMaterializerPolicyEvaluation Evaluate(FrepMaterializerContext context)
@@ -49,6 +49,30 @@ public sealed class HoleRecoveryPolicy : IFrepMaterializerPolicy
}
}
+internal sealed class CountersinkVariant : IHoleRecoveryVariant
+{
+ public string Name => nameof(CountersinkVariant);
+
+ public HoleRecoveryVariantEvaluation Evaluate(FrepMaterializerContext context)
+ {
+ var diagnostics = new List<string>
+ {
+ "CountersinkVariant evaluated.",
+ "Blocked: CIR currently has no cone primitive node (only Box/Cylinder/Sphere/Torus plus booleans/transforms).",
+ "Unsupported bounded countersink recognition until cone primitive exists in CIR tree."
+ };
+
+ return new(
+ Name,
+ false,
+ 0d,
+ null,
+ ["countersink", "rectangular-box-host"],
+ ["UnsupportedMissingConePrimitiveInCir"],
+ diagnostics);
+ }
+}
+
internal sealed class ThroughHoleVariant : IHoleRecoveryVariant
{
private const double Score = 1000d;
diff --git a/docs/cir-recovery-v10-countersink-variant-executor-step.md b/docs/cir-recovery-v10-countersink-variant-executor-step.md
new file mode 100644
index 00000000..0a85be53
--- /dev/null
+++ b/docs/cir-recovery-v10-countersink-variant-executor-step.md
@@ -0,0 +1,39 @@
+# CIR-RECOVERY-V10 — countersink variant/executor/STEP status
+
+## Outcome for this iteration
+
+**Meaningful progression**.
+
+We added `CountersinkVariant` to the `HoleRecoveryPolicy` JudgmentEngine lane and made it emit stable, explicit rejection diagnostics that isolate the current blocker: CIR does not yet expose a cone primitive node, so there is no bounded way to recognize a countersink cone tool in the CIR tree.
+
+## Blocker isolated
+
+- Current CIR primitives are `Box`, `Cylinder`, `Sphere`, `Torus` (+ boolean and transform nodes).
+- There is no `CirConeNode` / conical primitive available to represent the countersink entry tool in semantic recovery input.
+- Because of that, V10 cannot safely implement bounded countersink recognition/execution from CIR without scope expansion into CIR primitive surface area.
+
+## What landed now
+
+- `HoleKind` gained `Countersink`.
+- `HoleEntryFeatureKind` gained `Countersink`.
+- `CountersinkVariant` now participates in `HoleRecoveryPolicy` variant evaluation.
+- The variant returns deterministic rejection:
+ - `UnsupportedMissingConePrimitiveInCir`
+ - diagnostics clearly naming the missing cone primitive blocker.
+- Added focused tests proving:
+ - countersink variant is evaluated and reports the explicit blocker;
+ - existing counterbore selection remains unchanged.
+
+## Non-goals preserved
+
+- No STEP exporter behavior changes.
+- No `HoleRecoveryExecutor` countersink boolean path added yet.
+- No CLI/API expansion.
+- No generic profile-stack executor.
+
+## Recommended V11
+
+1. Introduce bounded CIR cone primitive support (`CirConeNode`) with translation-only transform conventions matching existing primitive lowering patterns.
+2. Add `CountersinkVariant` bounded recognition for `Subtract(Subtract(Box,Cylinder),Cone)` with strict coaxial/entry/depth/radius checks.
+3. Extend `HoleRecoveryExecutor` with cone subtract path using existing `BrepPrimitives.CreateCone` + `BrepBoolean.Subtract`.
+4. Add countersink STEP smoke asserting `CONICAL_SURFACE`, `CYLINDRICAL_SURFACE`, and no `BREP_WITH_VOIDS`.