Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Add bounded chamfered-entry hole recovery variant and execution

Yuechen Li10b1e98d2074
diff --git a/Aetheris.Kernel.Firmament.Tests/ChamferedEntryHoleVariantAndExecutorTests.cs b/Aetheris.Kernel.Firmament.Tests/ChamferedEntryHoleVariantAndExecutorTests.cs
new file mode 100644
index 00000000..c43fe480
--- /dev/null
+++ b/Aetheris.Kernel.Firmament.Tests/ChamferedEntryHoleVariantAndExecutorTests.cs
@@ -0,0 +1,86 @@
+using Aetheris.Kernel.Core.Cir;
+using Aetheris.Kernel.Core.Math;
+using Aetheris.Kernel.Core.Step242;
+using Aetheris.Kernel.Firmament.Materializer;
+
+namespace Aetheris.Kernel.Firmament.Tests;
+
+public sealed class ChamferedEntryHoleVariantAndExecutorTests
+{
+ [Fact]
+ public void ChamferedEntryVariant_AdmitsSimpleBoxChamferedThroughHolePlan()
+ {
+ var eval = new HoleRecoveryPolicy().Evaluate(new FrepMaterializerContext(BuildChamfered()));
+ Assert.Contains("selected-variant:ChamferedEntryHoleVariant", eval.Evidence);
+ var plan = Assert.IsType<HoleRecoveryPlan>(eval.Plan);
+ Assert.Equal(HoleKind.ChamferedEntry, plan.HoleKind);
+ Assert.Equal(HoleProfileSegmentKind.Conical, plan.ProfileStack[0].SegmentKind);
+ Assert.Equal(HoleProfileSegmentKind.Cylindrical, plan.ProfileStack[1].SegmentKind);
+ Assert.Contains(plan.ExpectedSurfacePatches, p => p.Role == HoleSurfacePatchRole.ChamferedEntryWall);
+ }
+
+ [Fact]
+ public void ChamferedEntryVariant_RejectsCountersinkSizedCone()
+ {
+ var eval = new HoleRecoveryPolicy().Evaluate(new FrepMaterializerContext(BuildCountersink()));
+ Assert.Contains("selected-variant:CountersinkVariant", eval.Evidence);
+ Assert.Contains(eval.Diagnostics, d => d.Contains("Variant rejected: ChamferedEntryHoleVariant", StringComparison.Ordinal));
+ }
+
+ [Fact]
+ public void CountersinkVariant_RejectsChamferSizedCone()
+ {
+ var eval = new HoleRecoveryPolicy().Evaluate(new FrepMaterializerContext(BuildChamfered()));
+ Assert.Contains("selected-variant:ChamferedEntryHoleVariant", eval.Evidence);
+ Assert.Contains(eval.Diagnostics, d => d.Contains("Variant rejected: CountersinkVariant", StringComparison.Ordinal));
+ }
+
+ [Fact]
+ public void ChamferedEntryVariant_RejectsNonCoaxialConeCylinder()
+ {
+ var cone = new CirTransformNode(new CirConeNode(2d, 2.8d, 1d), Transform3D.CreateTranslation(new Vector3D(1d, 0d, 4.5d)));
+ var root = new CirSubtractNode(new CirSubtractNode(new CirBoxNode(20d,20d,10d), new CirCylinderNode(2d,20d)), cone);
+ var eval = new HoleRecoveryPolicy().Evaluate(new FrepMaterializerContext(root));
+ Assert.Contains(eval.EvaluationsFor(nameof(ChamferedEntryHoleVariant)), d => d.Contains("not coaxial", StringComparison.OrdinalIgnoreCase));
+ }
+
+ [Fact]
+ public void ChamferedEntryExecutor_CanonicalChamferedEntry_ProducesBrepBody()
+ {
+ var plan = Assert.IsType<HoleRecoveryPlan>(new HoleRecoveryPolicy().Evaluate(new FrepMaterializerContext(BuildChamfered())).Plan);
+ var result = HoleRecoveryExecutor.Execute(plan);
+ Assert.Equal(HoleRecoveryExecutionStatus.Succeeded, result.Status);
+ Assert.NotNull(result.Body);
+ Assert.Contains(result.Diagnostics, d => d.Contains("cylinder subtract invoked", StringComparison.OrdinalIgnoreCase));
+ Assert.Contains(result.Diagnostics, d => d.Contains("chamfer cone subtract invoked", StringComparison.OrdinalIgnoreCase));
+ }
+
+ [Fact]
+ public void ChamferedEntryStepSmoke_CanonicalChamferedEntry_ExportsStep()
+ {
+ var plan = Assert.IsType<HoleRecoveryPlan>(new HoleRecoveryPolicy().Evaluate(new FrepMaterializerContext(BuildChamfered())).Plan);
+ var exec = HoleRecoveryExecutor.Execute(plan);
+ var step = Step242Exporter.ExportBody(exec.Body!);
+ Assert.True(step.IsSuccess);
+ Assert.Contains("ISO-10303-21", step.Value);
+ Assert.Contains("MANIFOLD_SOLID_BREP", step.Value);
+ Assert.Contains("ADVANCED_FACE", step.Value);
+ Assert.Contains("CONICAL_SURFACE", step.Value);
+ Assert.Contains("CYLINDRICAL_SURFACE", step.Value);
+ Assert.DoesNotContain("BREP_WITH_VOIDS", step.Value);
+ }
+
+ [Fact]
+ public void ChamferedEntry_Unsupported_DoesNotFalseSucceed()
+ {
+ var cone = new CirTransformNode(new CirConeNode(2d, 2.8d, 1d), Transform3D.CreateTranslation(new Vector3D(0d, 0d, 1.5d)));
+ var root = new CirSubtractNode(new CirSubtractNode(new CirBoxNode(20d,20d,10d), new CirCylinderNode(2d,20d)), cone);
+ var eval = new HoleRecoveryPolicy().Evaluate(new FrepMaterializerContext(root));
+ Assert.False(eval.Admissible);
+ }
+
+ private static CirNode BuildChamfered()
+ => new CirSubtractNode(new CirSubtractNode(new CirBoxNode(20d,20d,10d), new CirCylinderNode(2d,20d)), new CirTransformNode(new CirConeNode(2d, 2.8d, 1d), Transform3D.CreateTranslation(new Vector3D(0d, 0d, 4.5d))));
+ private static CirNode BuildCountersink()
+ => new CirSubtractNode(new CirSubtractNode(new CirBoxNode(20d,20d,10d), new CirCylinderNode(2d,20d)), new CirTransformNode(new CirConeNode(2d, 4d, 4d), Transform3D.CreateTranslation(new Vector3D(0d, 0d, 3d))));
+}
diff --git a/Aetheris.Kernel.Firmament.Tests/FrepSemanticRecoveryRematerializerTests.cs b/Aetheris.Kernel.Firmament.Tests/FrepSemanticRecoveryRematerializerTests.cs
index 8a2a70dd..57dc6f24 100644
--- a/Aetheris.Kernel.Firmament.Tests/FrepSemanticRecoveryRematerializerTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FrepSemanticRecoveryRematerializerTests.cs
@@ -83,6 +83,17 @@ public sealed class FrepSemanticRecoveryRematerializerTests
Assert.Null(result.Body);
Assert.Contains(result.Diagnostics, d => d.Contains("executor failed", StringComparison.Ordinal));
}
+
+ [Fact]
+ public void ChamferedEntry_Rematerializer_ProducesBrepBody()
+ {
+ var result = FrepSemanticRecoveryRematerializer.TryRecover(
+ 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)))));
+ Assert.True(result.Succeeded);
+ Assert.NotNull(result.Body);
+ }
private static NativeGeometryReplayLog BuildReplay(string toolKind)
=> new([
new NativeGeometryReplayOperation(0, "base", "primitive:box", null, null, null, null, new NativeGeometryResolvedPlacement(NativeGeometryPlacementKind.None, null, null, Vector3D.Zero, Vector3D.Zero, true, null), null),
diff --git a/Aetheris.Kernel.Firmament.Tests/HoleRecoveryPolicyCoverageMatrixTests.cs b/Aetheris.Kernel.Firmament.Tests/HoleRecoveryPolicyCoverageMatrixTests.cs
index 9739f425..23e90cb5 100644
--- a/Aetheris.Kernel.Firmament.Tests/HoleRecoveryPolicyCoverageMatrixTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/HoleRecoveryPolicyCoverageMatrixTests.cs
@@ -17,6 +17,7 @@ public sealed class HoleRecoveryPolicyCoverageMatrixTests
{ "BlindHoleTop", BuildBlindHoleTop(), nameof(BlindHoleVariant), HoleKind.Blind, HoleDepthKind.Blind, FrepMaterializerCapability.ExactBRep },
{ "BlindHoleBottom", BuildBlindHoleBottom(), nameof(BlindHoleVariant), HoleKind.Blind, HoleDepthKind.Blind, FrepMaterializerCapability.ExactBRep },
{ "Countersink", BuildCountersink(), nameof(CountersinkVariant), HoleKind.Countersink, HoleDepthKind.ThroughWithEntryRelief, FrepMaterializerCapability.ExactBRep },
+ { "ChamferedEntry", BuildChamferedEntry(), nameof(ChamferedEntryHoleVariant), HoleKind.ChamferedEntry, HoleDepthKind.ThroughWithEntryRelief, FrepMaterializerCapability.ExactBRep },
{ "SteppedHole", BuildSteppedHole(), nameof(SteppedHoleVariant), HoleKind.Stepped, HoleDepthKind.ThroughWithEntryRelief, FrepMaterializerCapability.ExactBRep }
};
@@ -65,7 +66,7 @@ public sealed class HoleRecoveryPolicyCoverageMatrixTests
var plan = Assert.IsType<HoleRecoveryPlan>(eval.Plan);
Assert.Equal(expectedHoleKind, plan.HoleKind);
Assert.Equal(expectedDepthKind, plan.DepthKind);
- var all = new[] { nameof(ThroughHoleVariant), nameof(CounterboreVariant), nameof(BlindHoleVariant), nameof(CountersinkVariant), nameof(SteppedHoleVariant) };
+ var all = new[] { nameof(ThroughHoleVariant), nameof(CounterboreVariant), nameof(BlindHoleVariant), nameof(ChamferedEntryHoleVariant), nameof(CountersinkVariant), nameof(SteppedHoleVariant) };
foreach (var variant in all.Where(v => !string.Equals(v, expectedVariant, StringComparison.Ordinal)))
{
Assert.Contains(eval.Diagnostics, d => d.Contains($"Variant considered: {variant}; admissible=False.", StringComparison.Ordinal));
@@ -150,5 +151,6 @@ public sealed class HoleRecoveryPolicyCoverageMatrixTests
private static CirNode BuildBlindHoleBottom() => new CirSubtractNode(new CirBoxNode(20, 20, 10), new CirTransformNode(new CirCylinderNode(2, 4), Transform3D.CreateTranslation(new Vector3D(0, 0, -3))));
private static CirNode BuildCounterbore() => new CirSubtractNode(new CirSubtractNode(new CirBoxNode(20, 20, 10), new CirCylinderNode(2, 20)), new CirTransformNode(new CirCylinderNode(4, 4), Transform3D.CreateTranslation(new Vector3D(0, 0, -3))));
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 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/Materializer/HoleRecoveryExecutor.cs b/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryExecutor.cs
index 4632d58d..53c94252 100644
--- a/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryExecutor.cs
+++ b/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryExecutor.cs
@@ -59,6 +59,11 @@ public static class HoleRecoveryExecutor
diagnostics.Add("Countersink plan accepted for bounded execution.");
return ExecuteCountersink(plan, diagnostics);
}
+ if (plan.HoleKind == HoleKind.ChamferedEntry && (plan.DepthKind == HoleDepthKind.ThroughWithEntryRelief || plan.DepthKind == HoleDepthKind.BlindWithEntryRelief))
+ {
+ diagnostics.Add("Chamfered-entry plan accepted for bounded execution.");
+ return ExecuteCountersinkLike(plan, diagnostics, "chamfer cone");
+ }
if (plan.HoleKind == HoleKind.Stepped && plan.DepthKind == HoleDepthKind.ThroughWithEntryRelief)
{
@@ -376,6 +381,9 @@ public static class HoleRecoveryExecutor
}
private static HoleRecoveryExecutionResult ExecuteCountersink(HoleRecoveryPlan plan, List<string> diagnostics)
+ => ExecuteCountersinkLike(plan, diagnostics, "cone");
+
+ private static HoleRecoveryExecutionResult ExecuteCountersinkLike(HoleRecoveryPlan plan, List<string> diagnostics, string coneLabel)
{
if (plan.HostKind != HoleHostKind.RectangularBox || plan.Axis != HoleAxisKind.Z || plan.ProfileStack.Count != 2)
{
@@ -414,22 +422,22 @@ public static class HoleRecoveryExecutor
var coneResult = FirmamentPrimitiveExecutor.ExecuteCone(new FirmamentLoweredConeParameters(coneSeg.RadiusEnd, coneSeg.RadiusStart, coneHeight));
if (!coneResult.IsSuccess)
{
- diagnostics.Add("cone primitive construction failed.");
+ diagnostics.Add($"{coneLabel} primitive construction failed.");
return new(HoleRecoveryExecutionStatus.PrimitiveConstructionFailed, null, diagnostics);
}
var entryTopZ = plan.HostTranslation.Z + (plan.HostSizeZ * 0.5d);
var coneCenterZ = entryTopZ - (coneHeight * 0.5d);
var coneBody = TranslateBody(coneResult.Value, new Vector3D(plan.ToolTranslation.X, plan.ToolTranslation.Y, coneCenterZ));
- diagnostics.Add("cone subtract invoked.");
+ diagnostics.Add($"{coneLabel} subtract invoked.");
var secondSub = BrepBoolean.Subtract(firstSub.Value, coneBody);
if (!secondSub.IsSuccess || secondSub.Value is null)
{
- diagnostics.Add("cone subtract failed.");
+ diagnostics.Add($"{coneLabel} subtract failed.");
return new(HoleRecoveryExecutionStatus.UnsupportedPlan, null, diagnostics);
}
- diagnostics.Add("cone subtract succeeded.");
+ diagnostics.Add($"{coneLabel} subtract succeeded.");
diagnostics.Add("Result BRep body produced.");
return new(HoleRecoveryExecutionStatus.Succeeded, secondSub.Value, diagnostics);
}
diff --git a/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryPlan.cs b/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryPlan.cs
index 1d295201..cab8d122 100644
--- a/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryPlan.cs
+++ b/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryPlan.cs
@@ -4,13 +4,13 @@ namespace Aetheris.Kernel.Firmament.Materializer;
public enum HoleHostKind { RectangularBox, Unsupported }
public enum HoleAxisKind { Z, Unsupported }
-public enum HoleKind { Through, Blind, Counterbore, Countersink, Stepped, Unsupported }
+public enum HoleKind { Through, Blind, Counterbore, Countersink, ChamferedEntry, Stepped, Unsupported }
public enum HoleDepthKind { Through, Blind, ThroughWithEntryRelief, BlindWithEntryRelief, Unsupported }
public enum HoleProfileSegmentKind { Cylindrical, Conical, Chamfer, ThreadDeferred, Unsupported }
public enum HoleTierAnchorSide { Top, Bottom, Through, Unknown }
-public enum HoleEntryFeatureKind { Plain, Counterbore, Countersink, Stepped, Unsupported }
+public enum HoleEntryFeatureKind { Plain, Counterbore, Countersink, Chamfer, Stepped, Unsupported }
public enum HoleExitFeatureKind { Plain, ClosedBottom, Unsupported }
-public enum HoleSurfacePatchRole { EntryFace, ExitFace, HostRetainedPlanarFaces, CylindricalWall, BlindBottomCap, CounterboreFloorAnnulus, CounterboreWall, CountersinkWall, SteppedTransitionFloorAnnulus }
+public enum HoleSurfacePatchRole { EntryFace, ExitFace, HostRetainedPlanarFaces, CylindricalWall, BlindBottomCap, CounterboreFloorAnnulus, CounterboreWall, CountersinkWall, ChamferedEntryWall, SteppedTransitionFloorAnnulus }
public enum HoleTrimCurveRole { CircularRimTrim, Deferred }
public sealed record HoleProfileSegment(
diff --git a/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryPolicy.cs b/Aetheris.Kernel.Firmament/Materializer/HoleRecoveryPolicy.cs
index c1bfded3..423b3f98 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(), new CountersinkVariant(), new SteppedHoleVariant()];
+ private readonly IReadOnlyList<IHoleRecoveryVariant> _variants = [new ThroughHoleVariant(), new BlindHoleVariant(), new CounterboreVariant(), new ChamferedEntryHoleVariant(), new CountersinkVariant(), new SteppedHoleVariant()];
public string Name => nameof(HoleRecoveryPolicy);
public FrepMaterializerPolicyEvaluation Evaluate(FrepMaterializerContext context)
@@ -134,6 +134,13 @@ internal sealed class CountersinkVariant : IHoleRecoveryVariant
}
var coneDepth = cone.Height;
+ var depthRatio = coneDepth / Math.Max(host.CylinderRadius, tol);
+ var radiusDelta = entryRadius - host.CylinderRadius;
+ if (depthRatio <= ChamferedEntryHoleVariant.MaxChamferDepthToHoleRadius + tol && radiusDelta <= (ChamferedEntryHoleVariant.MaxChamferRadiusDeltaToHoleRadius * host.CylinderRadius) + tol)
+ {
+ diagnostics.Add("cone classified as chamfer-sized; countersink inadmissible.");
+ return new(Name, false, 0d, null, ["countersink", "rectangular-box-host"], ["RejectedChamferSizedEntryRelief"], diagnostics);
+ }
if (coneDepth >= host.BoxDepth - tol)
{
diagnostics.Add("cone through full depth.");
@@ -175,6 +182,105 @@ internal sealed class CountersinkVariant : IHoleRecoveryVariant
}
}
+internal sealed class ChamferedEntryHoleVariant : IHoleRecoveryVariant
+{
+ internal const double MaxChamferDepthToHoleRadius = 1.0d;
+ internal const double MaxChamferRadiusDeltaToHoleRadius = 0.75d;
+ private const double Score = 1040d;
+ public string Name => nameof(ChamferedEntryHoleVariant);
+
+ public HoleRecoveryVariantEvaluation Evaluate(FrepMaterializerContext context)
+ {
+ var diagnostics = new List<string> { "ChamferedEntryHoleVariant evaluated." };
+ if (context.Root is not CirSubtractNode outer || outer.Left is not CirSubtractNode inner)
+ {
+ diagnostics.Add("not chamfered-entry shape: requires Subtract(Subtract(Box,Cylinder),Cone).");
+ return new(Name, false, 0d, null, ["chamfered-entry", "rectangular-box-host"], ["UnsupportedChamferedEntryShape"], diagnostics);
+ }
+
+ var hostRec = CirBoxCylinderRecognizer.Recognize(new CirBoxCylinderRecognizerInput(new CirSubtractNode(inner.Left, inner.Right), context.ReplayLog, context.SourceLabel));
+ if (!hostRec.Success || hostRec.Value is null)
+ {
+ return new(Name, false, 0d, null, ["chamfered-entry", "rectangular-box-host"], [hostRec.Diagnostic, $"host-recognizer-reason:{hostRec.Reason}"], hostRec.Diagnostics);
+ }
+
+ if (!CounterboreVariant.TryUnwrapTranslation(outer.Right, out var coneNode, out var coneTranslation) || coneNode is not CirConeNode cone)
+ {
+ diagnostics.Add("missing cone primitive / unexpected tool kind.");
+ return new(Name, false, 0d, null, ["chamfered-entry", "rectangular-box-host"], ["UnsupportedMissingConePrimitiveOrTransform"], diagnostics);
+ }
+
+ var host = hostRec.Value;
+ var tol = Aetheris.Kernel.Core.Numerics.ToleranceContext.Default.Linear;
+ if (Math.Abs(coneTranslation.X - host.CylinderTranslation.X) > tol || Math.Abs(coneTranslation.Y - host.CylinderTranslation.Y) > tol)
+ {
+ diagnostics.Add("cone/cylinder not coaxial in XY.");
+ return new(Name, false, 0d, null, ["chamfered-entry", "rectangular-box-host"], ["UnsupportedNonCoaxialConeCylinder"], diagnostics);
+ }
+ diagnostics.Add("cone/cylinder coaxial in XY.");
+
+ var boxMinZ = host.BoxTranslation.Z - (host.BoxDepth * 0.5d);
+ var boxMaxZ = host.BoxTranslation.Z + (host.BoxDepth * 0.5d);
+ var coneMinZ = coneTranslation.Z - (cone.Height * 0.5d);
+ var coneMaxZ = coneTranslation.Z + (cone.Height * 0.5d);
+ var touchesTop = Math.Abs(coneMaxZ - boxMaxZ) <= tol;
+ if (!touchesTop)
+ {
+ diagnostics.Add("entry side unsupported: bounded v15 supports top-entry chamfer only.");
+ return new(Name, false, 0d, null, ["chamfered-entry", "rectangular-box-host"], ["UnsupportedEntrySide"], diagnostics);
+ }
+
+ var entryRadius = cone.TopRadius;
+ var transitionRadius = cone.BottomRadius;
+ if (entryRadius <= transitionRadius + tol)
+ {
+ diagnostics.Add("cone radius ordering invalid for entry side.");
+ return new(Name, false, 0d, null, ["chamfered-entry", "rectangular-box-host"], ["UnsupportedConeRadiusOrderingInvalid"], diagnostics);
+ }
+
+ if (Math.Abs(transitionRadius - host.CylinderRadius) > tol)
+ {
+ diagnostics.Add("cone transition radius incompatible with cylinder radius.");
+ return new(Name, false, 0d, null, ["chamfered-entry", "rectangular-box-host"], ["UnsupportedTransitionRadiusMismatch"], diagnostics);
+ }
+
+ var coneDepth = cone.Height;
+ var depthRatio = coneDepth / Math.Max(host.CylinderRadius, tol);
+ var radiusDelta = entryRadius - host.CylinderRadius;
+ var radiusDeltaLimit = MaxChamferRadiusDeltaToHoleRadius * host.CylinderRadius;
+ if (depthRatio > MaxChamferDepthToHoleRadius + tol || radiusDelta > radiusDeltaLimit + tol)
+ {
+ diagnostics.Add("entry conical relief exceeds chamfer thresholds; classify as countersink-like.");
+ return new(Name, false, 0d, null, ["chamfered-entry", "rectangular-box-host"], ["RejectedCountersinkLikeCone"], diagnostics);
+ }
+ diagnostics.Add("chamfer depth/radius thresholds validated.");
+
+ var halfW = host.BoxWidth * 0.5d;
+ var halfH = host.BoxHeight * 0.5d;
+ var dx = coneTranslation.X - host.BoxTranslation.X;
+ var dy = coneTranslation.Y - host.BoxTranslation.Y;
+ if ((dx + halfW - entryRadius) <= tol || (halfW - dx - entryRadius) <= tol || (dy + halfH - entryRadius) <= tol || (halfH - dy - entryRadius) <= tol)
+ {
+ diagnostics.Add("cone max radius tangent/grazing/oversized.");
+ return new(Name, false, 0d, null, ["chamfered-entry", "rectangular-box-host"], ["UnsupportedConeClearance"], diagnostics);
+ }
+
+ var depthKind = host.ThroughLength >= host.BoxDepth - tol ? HoleDepthKind.ThroughWithEntryRelief : HoleDepthKind.BlindWithEntryRelief;
+ var exitKind = depthKind == HoleDepthKind.ThroughWithEntryRelief ? HoleExitFeatureKind.Plain : HoleExitFeatureKind.ClosedBottom;
+ diagnostics.Add("entry side detected: top(+Z).");
+ diagnostics.Add("cone radius/order validated.");
+ diagnostics.Add("transition radius compatible.");
+ diagnostics.Add("Chamfered-entry plan produced.");
+ var plan = new HoleRecoveryPlan(HoleHostKind.RectangularBox, HoleAxisKind.Z, HoleKind.ChamferedEntry, depthKind, HoleEntryFeatureKind.Chamfer, exitKind,
+ host.ThroughLength, host.BoxWidth, host.BoxHeight, host.BoxDepth, host.BoxTranslation, host.CylinderTranslation,
+ [new(HoleProfileSegmentKind.Conical, entryRadius, transitionRadius, 0d, coneDepth), new(HoleProfileSegmentKind.Cylindrical, host.CylinderRadius, host.CylinderRadius, 0d, host.ThroughLength)],
+ [new(HoleSurfacePatchRole.HostRetainedPlanarFaces, "Host planar faces are retained after chamfered-entry subtraction."), new(HoleSurfacePatchRole.ChamferedEntryWall, "Conical chamfered-entry wall patch is expected."), new(HoleSurfacePatchRole.CylindricalWall, "Cylindrical continuation wall patch is expected.")],
+ [new(HoleTrimCurveRole.CircularRimTrim, "Circular entry/transition trims are expected.")], FrepMaterializerCapability.ExactBRep, diagnostics.ToArray());
+
+ return new(Name, true, Score, plan, ["chamfered-entry", "rectangular-box-host", "cone-primitive", "coaxial-cone-cylinder", "entry-relief", "semantic-profile-stack"], Array.Empty<string>(), diagnostics);
+ }
+}
+
internal sealed class ThroughHoleVariant : IHoleRecoveryVariant
{
private const double Score = 1000d;
diff --git a/docs/cir-recovery-v12-hole-family-coverage-matrix.md b/docs/cir-recovery-v12-hole-family-coverage-matrix.md
index 5dfa4518..6f549659 100644
--- a/docs/cir-recovery-v12-hole-family-coverage-matrix.md
+++ b/docs/cir-recovery-v12-hole-family-coverage-matrix.md
@@ -7,6 +7,7 @@ V12 hardens production `HoleRecoveryPolicy` coverage and diagnostics for the cur
- `CounterboreVariant`
- `BlindHoleVariant`
- `CountersinkVariant`
+- `ChamferedEntryHoleVariant` (added in V15 bounded entry-relief split)
- `SteppedHoleVariant`
This milestone adds matrix-style test coverage and diagnostics trace assertions. It does **not** add variants, change executor semantics, or change STEP exporter behavior.
@@ -19,6 +20,7 @@ This milestone adds matrix-style test coverage and diagnostics trace assertions.
- BlindHoleTop -> `BlindHoleVariant`, `HoleKind.Blind`, executable.
- BlindHoleBottom -> `BlindHoleVariant`, `HoleKind.Blind`, executable.
- Countersink -> `CountersinkVariant`, `HoleKind.Countersink`, executable.
+- ChamferedEntry -> `ChamferedEntryHoleVariant`, `HoleKind.ChamferedEntry`, executable.
- SteppedHole -> `SteppedHoleVariant`, `HoleKind.Stepped`, executable (A4 repeated-subtract production route) and manifold/non-void in STEP smoke assertions.
### Unsupported/fallback rows
diff --git a/docs/cir-recovery-v15-chamfered-entry-hole-variant.md b/docs/cir-recovery-v15-chamfered-entry-hole-variant.md
new file mode 100644
index 00000000..1ac6fc86
--- /dev/null
+++ b/docs/cir-recovery-v15-chamfered-entry-hole-variant.md
@@ -0,0 +1,61 @@
+# CIR-RECOVERY-V15 — bounded ChamferedEntryHoleVariant recognition + execution + STEP smoke
+
+## Supported bounded CIR shape
+
+`Subtract(Subtract(Box, HoleCylinder), EntryChamferCone)` with translation-only wrappers.
+
+## Chamfer vs countersink distinction
+
+Deterministic admissibility boundary in `HoleRecoveryPolicy`:
+- Chamfer admits only when `coneDepth / holeRadius <= 1.0` and `(entryRadius - holeRadius) <= 0.75 * holeRadius`.
+- Countersink rejects these chamfer-sized cones.
+- Chamfer rejects deeper/larger entry cones as countersink-like.
+
+This prevents cross-steal by admissibility (not scoring).
+
+## Variant behavior
+
+`ChamferedEntryHoleVariant` requires:
+- nested subtract shape,
+- rectangular host + cylindrical base hole,
+- cone entry tool,
+- cone/cylinder XY coaxial,
+- top-entry face touch (bounded v15),
+- valid radius ordering (entry radius > transition radius),
+- transition radius compatible with cylinder radius,
+- strict host XY clearance.
+
+Rejections are explicit with stable reason codes.
+
+## HoleRecoveryPlan shape
+
+Admitted plans produce:
+- `HoleKind = ChamferedEntry`
+- `DepthKind = ThroughWithEntryRelief | BlindWithEntryRelief`
+- entry feature `Chamfer`
+- profile stack `[Conical(entry->transition), Cylindrical(base)]`
+- expected patch includes `ChamferedEntryWall`.
+
+## Execution route
+
+`HoleRecoveryExecutor` supports chamfered-entry via existing bounded cone path:
+1. create host box
+2. subtract base cylinder
+3. create conical relief
+4. subtract conical relief
+
+No STEP exporter behavior changes.
+
+## STEP smoke expectations
+
+For canonical chamfered-entry outputs:
+- contains `ISO-10303-21`, `MANIFOLD_SOLID_BREP`, `ADVANCED_FACE`, `CONICAL_SURFACE`, `CYLINDRICAL_SURFACE`
+- does not contain `BREP_WITH_VOIDS`.
+
+## Non-goals
+
+No generic chamfer recovery, no threaded hole semantics, no generic profile-stack executor, no API/CLI expansion.
+
+## Next milestone suggestion
+
+Add safe bottom-entry chamfer support using the same bounded thresholds and explicit entry-side diagnostics.