Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Unify localized edge finish compilation

Yuechen Lieb2edbf9738e
diff --git a/Aetheris.CLI.Tests/LocalizedPlanarSingleEdgeChamferPipelineTests.cs b/Aetheris.CLI.Tests/LocalizedPlanarSingleEdgeChamferPipelineTests.cs
index 4999277b..a23ade00 100644
--- a/Aetheris.CLI.Tests/LocalizedPlanarSingleEdgeChamferPipelineTests.cs
+++ b/Aetheris.CLI.Tests/LocalizedPlanarSingleEdgeChamferPipelineTests.cs
@@ -34,6 +34,12 @@ public sealed class LocalizedPlanarSingleEdgeChamferPipelineTests
Assert.Equal(2, localized.GetProperty("retainedFaces").GetInt32());
Assert.Equal(1, localized.GetProperty("replacementFaces").GetInt32());
Assert.Equal("valid", localized.GetProperty("preflight").GetString());
+ var shared = air.GetProperty("localizedEdgeFinish");
+ Assert.Equal("Chamfer", shared.GetProperty("kind").GetString());
+ Assert.Equal("LocalizedEdgeReplacement", shared.GetProperty("construction").GetString());
+ Assert.Equal("PlanarChamfer", shared.GetProperty("replacementGeometry").GetString());
+ Assert.Equal("ExplicitOwnedEndpoints", shared.GetProperty("endpointPolicy").GetString());
+ Assert.True(shared.GetProperty("bRepPlan").GetProperty("authoritative").GetBoolean());
var stepPath = json.RootElement.GetProperty("outputPath").GetString()!;
var bytes = File.ReadAllBytes(stepPath);
diff --git a/Aetheris.CLI.Tests/LocalizedTangentBlendFilletPipelineTests.cs b/Aetheris.CLI.Tests/LocalizedTangentBlendFilletPipelineTests.cs
index cad89e01..f9f39b83 100644
--- a/Aetheris.CLI.Tests/LocalizedTangentBlendFilletPipelineTests.cs
+++ b/Aetheris.CLI.Tests/LocalizedTangentBlendFilletPipelineTests.cs
@@ -33,6 +33,12 @@ public sealed class LocalizedTangentBlendFilletPipelineTests
Assert.Equal(2, localized.GetProperty("retainedFaces").GetInt32());
Assert.Equal(1, localized.GetProperty("replacementFaces").GetInt32());
Assert.Equal("valid", localized.GetProperty("preflight").GetString());
+ var shared = air.GetProperty("localizedEdgeFinish");
+ Assert.Equal("Fillet", shared.GetProperty("kind").GetString());
+ Assert.Equal("LocalizedEdgeReplacement", shared.GetProperty("construction").GetString());
+ Assert.Equal("CylindricalFillet", shared.GetProperty("replacementGeometry").GetString());
+ Assert.Equal("ExplicitOwnedEndpoints", shared.GetProperty("endpointPolicy").GetString());
+ Assert.True(shared.GetProperty("bRepPlan").GetProperty("authoritative").GetBoolean());
Assert.True(air.GetProperty("step").GetProperty("reimportSucceeded").GetBoolean());
var stepPath = json.RootElement.GetProperty("outputPath").GetString()!;
diff --git a/Aetheris.Kernel.Core/Air/AirBRepPlan.cs b/Aetheris.Kernel.Core/Air/AirBRepPlan.cs
index de5151f0..56823106 100644
--- a/Aetheris.Kernel.Core/Air/AirBRepPlan.cs
+++ b/Aetheris.Kernel.Core/Air/AirBRepPlan.cs
@@ -5,7 +5,7 @@ namespace Aetheris.Kernel.Core.Air.BRepPlan;
internal enum AirBRepPlanKind { PrismaticSectionTransition, RevolvedProfile, LocalizedPlanarReplacement, LocalizedTangentBlend, Unsupported }
internal enum AirBRepPlanElementKind { Vertex, Curve, Edge, Coedge, Loop, Surface, Face, Shell, Body }
-internal enum AirBRepPlanRole { Unknown, SectionVertex, SectionEdge, VerticalTransitionEdge, SectionLoop, ProfileVertex, ProfileSegment, CircularRim, SeamEdge, CapFace, SideFace, CylindricalFace, ConicalTransitionFace, TransitionFace, PrismaticTransitionFace, ChamferFace, FilletFace, RetainedSupportFaceA, RetainedSupportFaceB, EndpointTransitionStart, EndpointTransitionEnd, UnaffectedFace, BodyShell, Body }
+internal enum AirBRepPlanRole { Unknown, SectionVertex, SectionEdge, VerticalTransitionEdge, SectionLoop, ProfileVertex, ProfileSegment, CircularRim, SeamEdge, CapFace, SideFace, CylindricalFace, ConicalTransitionFace, TransitionFace, PrismaticTransitionFace, ChamferFace, FilletFace, ReplacementFace, ReplacementBoundaryA, ReplacementBoundaryB, RetainedSupportFaceA, RetainedSupportFaceB, EndpointTransitionStart, EndpointTransitionEnd, UnaffectedFace, BodyShell, Body }
internal readonly record struct AirBRepPlanId(string Value)
{
@@ -78,9 +78,10 @@ internal sealed record AirBRepPlan(
PrismaticSectionTransitionTopologyPlan? RealizationPlan = null,
RevolvedProfileTopologyPlan? RevolvedRealizationPlan = null,
AirLocalizedPlanarReplacementTopologyPlan? LocalizedPlanarReplacementRealizationPlan = null,
- AirLocalizedTangentBlendTopologyPlan? LocalizedTangentBlendRealizationPlan = null)
+ AirLocalizedTangentBlendTopologyPlan? LocalizedTangentBlendRealizationPlan = null,
+ LocalizedEdgeReplacementTopologyPlan? LocalizedEdgeReplacementRealizationPlan = null)
{
- public bool IsAuthoritative => RealizationPlan is not null || RevolvedRealizationPlan is not null || LocalizedPlanarReplacementRealizationPlan is not null || LocalizedTangentBlendRealizationPlan is not null;
+ public bool IsAuthoritative => RealizationPlan is not null || RevolvedRealizationPlan is not null || LocalizedPlanarReplacementRealizationPlan is not null || LocalizedTangentBlendRealizationPlan is not null || LocalizedEdgeReplacementRealizationPlan is not null;
}
internal sealed record AirBRepPlanResult(AirBRepPlan? Plan, AirBRepPlanValidationResult Validation)
diff --git a/Aetheris.Kernel.Core/Air/AirLocalizedPlanarReplacementChamferCompiler.cs b/Aetheris.Kernel.Core/Air/AirLocalizedPlanarReplacementChamferCompiler.cs
index 7a138c11..9693f094 100644
--- a/Aetheris.Kernel.Core/Air/AirLocalizedPlanarReplacementChamferCompiler.cs
+++ b/Aetheris.Kernel.Core/Air/AirLocalizedPlanarReplacementChamferCompiler.cs
@@ -1,12 +1,7 @@
-using System.Security.Cryptography;
-using System.Text;
using Aetheris.Kernel.Core.Air.BRepPlan;
using Aetheris.Kernel.Core.Brep;
using Aetheris.Kernel.Core.Geometry;
-using Aetheris.Kernel.Core.Geometry.Curves;
-using Aetheris.Kernel.Core.Geometry.Surfaces;
using Aetheris.Kernel.Core.Math;
-using Aetheris.Kernel.Core.Topology;
namespace Aetheris.Kernel.Core.Air;
@@ -19,7 +14,8 @@ internal sealed record AirLocalizedPlanarReplacementWitness(
internal sealed record AirLocalizedPlanarReplacementTopologyPlan(
IReadOnlyList<Point3D> CrossSection, double MinY, double MaxY,
- IReadOnlyList<string> FaceRoles, string DeterministicSignature)
+ IReadOnlyList<string> FaceRoles, string DeterministicSignature,
+ LocalizedEdgeReplacementTopologyPlan SharedTopologyPlan)
{
public int ExpectedVertexCount => CrossSection.Count * 2;
public int ExpectedEdgeCount => CrossSection.Count * 3;
@@ -30,7 +26,8 @@ internal sealed record AirLocalizedPlanarReplacementTopologyPlan(
internal sealed record AirLocalizedPlanarReplacementConstruction(
string ConstructionId, string SourceFeatureId, AirLocalizedPlanarReplacementWitness Witness,
- AirLocalizedPlanarReplacementTopologyPlan TopologyPlan);
+ AirLocalizedPlanarReplacementTopologyPlan TopologyPlan,
+ LocalizedEdgeReplacementConstruction SharedConstruction);
internal sealed record AirLocalizedPlanarReplacementChamferCompileRequest(
string BodyId, string FeatureId, string FeatureName, double Width, double Depth, double Height,
@@ -45,8 +42,6 @@ internal sealed record AirLocalizedPlanarReplacementChamferCompileResult(
internal static class AirLocalizedPlanarReplacementChamferCompiler
{
- private const double Tol = 1e-9;
-
public static AirLocalizedPlanarReplacementChamferCompileResult Compile(AirLocalizedPlanarReplacementChamferCompileRequest input)
{
var lowered = Lower(input);
@@ -55,7 +50,7 @@ internal static class AirLocalizedPlanarReplacementChamferCompiler
var construction = lowered.Value!;
var plan = BuildPlan(input, feature, construction);
- var emitted = AirLocalizedPlanarReplacementEmitter.Emit(construction.TopologyPlan);
+ var emitted = AirLocalizedPlanarReplacementEmitter.Emit(construction.SharedConstruction);
if (!emitted.Succeeded || emitted.Body is null)
{
var error = new ChamferLoweringError(ChamferLoweringErrorKind.BackendMaterializationDefect,
@@ -78,15 +73,10 @@ internal static class AirLocalizedPlanarReplacementChamferCompiler
{
ChamferLoweringResult<AirLocalizedPlanarReplacementConstruction> Fail(ChamferLoweringErrorKind kind, string code, string message) =>
ChamferLoweringResult<AirLocalizedPlanarReplacementConstruction>.Err(new(kind, code, message, "FeatureAIR->ConstructionAIR"));
- if (!input.HistoryKnown) return Fail(ChamferLoweringErrorKind.UnsupportedHistory, "localized-chamfer-unsupported-history", "Localized replacement requires known prismatic construction history.");
if (!string.Equals(input.Kind, "Chamfer", StringComparison.Ordinal)) return Fail(ChamferLoweringErrorKind.InvalidAuthoredInput, "localized-chamfer-invalid-kind", "Only equal-distance chamfer intent is admitted.");
- if (!string.Equals(input.FaceA, "+X", StringComparison.Ordinal) || !string.Equals(input.FaceB, "+Z", StringComparison.Ordinal))
- return Fail(ChamferLoweringErrorKind.UnsupportedSelection, "localized-chamfer-unsupported-selection:expected-shared-edge-plus-x-plus-z", "The first localized route admits SharedEdge(+X,+Z) only.");
- if (!double.IsFinite(input.Width) || !double.IsFinite(input.Depth) || !double.IsFinite(input.Height) || input.Width <= Tol || input.Depth <= Tol || input.Height <= Tol)
- return Fail(ChamferLoweringErrorKind.InvalidAuthoredInput, "localized-chamfer-invalid-box-dimensions", "Host dimensions must be finite and positive.");
- if (!double.IsFinite(input.Distance) || input.Distance <= Tol) return Fail(ChamferLoweringErrorKind.InvalidAuthoredInput, "localized-chamfer-distance-must-be-positive", "Distance must be finite and positive.");
- if (input.Distance >= input.Width - Tol || input.Distance >= input.Height - Tol)
- return Fail(ChamferLoweringErrorKind.DistanceTooLarge, "localized-chamfer-distance-too-large", "Distance must remain within both planar support-face extents.");
+ var context = new LocalizedEdgeReplacementContext(input.BodyId, input.FeatureId, input.FeatureName, input.Width, input.Depth, input.Height, input.FaceA, input.FaceB, AirLocalizedEdgeFinishKind.Chamfer, input.Distance, input.SourceSpan, input.HistoryKnown);
+ var admitted = LocalizedEdgeReplacementCompilerModel.Admit(context);
+ if (!admitted.IsSuccess) return ChamferLoweringResult<AirLocalizedPlanarReplacementConstruction>.Err(admitted.Error!);
var hx = input.Width / 2d; var hy = input.Depth / 2d; var hz = input.Height / 2d; var d = input.Distance;
var cross = new[] { new Point3D(-hx, -hy, -hz), new Point3D(hx, -hy, -hz), new Point3D(hx, -hy, hz - d), new Point3D(hx - d, -hy, hz), new Point3D(-hx, -hy, hz) };
@@ -96,12 +86,14 @@ internal static class AirLocalizedPlanarReplacementChamferCompiler
var retainedX = new[] { new Point3D(hx, -hy, -hz), new Point3D(hx, hy, -hz), new Point3D(hx, hy, hz - d), new Point3D(hx, -hy, hz - d) };
var retainedZ = new[] { new Point3D(-hx, -hy, hz), new Point3D(hx - d, -hy, hz), new Point3D(hx - d, hy, hz), new Point3D(-hx, hy, hz) };
if (replacement.Distinct().Count() != 4) return Fail(ChamferLoweringErrorKind.DegenerateTransition, "localized-chamfer-degenerate-transition", "Endpoint transition quad is degenerate.");
- var signature = Signature(input.Width, input.Depth, input.Height, d);
+ var sharedTopology = LocalizedEdgeReplacementCompilerModel.Topology(context, cross);
var topology = new AirLocalizedPlanarReplacementTopologyPlan(cross, -hy, hy,
- ["UnaffectedFace(-Z)", "UnaffectedFace(-Y)", "RetainedSupportFaceA(+X)", "ChamferFace", "RetainedSupportFaceB(+Z)", "EndpointTransitionStart(-Y)", "EndpointTransitionEnd(+Y)"], signature);
+ sharedTopology.FaceRoles, sharedTopology.DeterministicSignature, sharedTopology);
var witness = new AirLocalizedPlanarReplacementWitness("plane(+X)", "plane(+Z)", start, end, retainedX, retainedZ, replacement,
"inside:x<=max,z<=max,x+z<=maxX+maxZ-distance", "ExplicitOwnedEndpoints");
- return ChamferLoweringResult<AirLocalizedPlanarReplacementConstruction>.Ok(new($"construction:{input.FeatureId}", input.FeatureId, witness, topology));
+ var shared = new LocalizedEdgeReplacementConstruction($"construction:{input.FeatureId}", input.FeatureId, admitted.Value!, retainedX, retainedZ, cross,
+ new PlanarChamferReplacement([cross[2], cross[3]], [replacement[3], replacement[2]], replacement), sharedTopology, "history-known-axis-aligned-rectangular-prism");
+ return ChamferLoweringResult<AirLocalizedPlanarReplacementConstruction>.Ok(new($"construction:{input.FeatureId}", input.FeatureId, witness, topology, shared));
}
private static AirChamferFeature Feature(AirLocalizedPlanarReplacementChamferCompileRequest input, ChamferLoweringError? error) => new(
@@ -112,59 +104,21 @@ internal static class AirLocalizedPlanarReplacementChamferCompiler
private static AirBRepPlan BuildPlan(AirLocalizedPlanarReplacementChamferCompileRequest input, AirChamferFeature feature, AirLocalizedPlanarReplacementConstruction construction)
{
- var p = construction.TopologyPlan;
var provenance = new AirProvenance("AIR-CHAMFER-LOCALIZED-PLAN-A1", "Localized planar replacement", "shared-edge(+X,+Z)", input.FeatureId,
nameof(AirLocalizedPlanarReplacementChamferCompiler), AirSelectionClass.None, AirRuleKind.UniformChamfer, feature.ConstructionHistoryKind, true,
["No legacy direct-BRep surgery.", "Plan is constructed before emission."]);
- var elements = new List<AirBRepPlanElement>();
- for (var i = 0; i < p.ExpectedVertexCount; i++) elements.Add(new(new($"vertex:{i}"), AirBRepPlanElementKind.Vertex, i is 2 or 7 ? AirBRepPlanRole.EndpointTransitionStart : i is 3 or 8 ? AirBRepPlanRole.EndpointTransitionEnd : AirBRepPlanRole.SectionVertex, input.FeatureId, provenance));
- for (var i = 0; i < p.ExpectedEdgeCount; i++) elements.Add(new(new($"edge:{i}"), AirBRepPlanElementKind.Edge, AirBRepPlanRole.SectionEdge, input.FeatureId, provenance));
- for (var i = 0; i < p.FaceRoles.Count; i++)
- {
- var role = p.FaceRoles[i].StartsWith("RetainedSupportFaceA", StringComparison.Ordinal) ? AirBRepPlanRole.RetainedSupportFaceA : p.FaceRoles[i].StartsWith("RetainedSupportFaceB", StringComparison.Ordinal) ? AirBRepPlanRole.RetainedSupportFaceB : p.FaceRoles[i].StartsWith("ChamferFace", StringComparison.Ordinal) ? AirBRepPlanRole.ChamferFace : p.FaceRoles[i].StartsWith("Endpoint", StringComparison.Ordinal) ? (i == 5 ? AirBRepPlanRole.EndpointTransitionStart : AirBRepPlanRole.EndpointTransitionEnd) : AirBRepPlanRole.UnaffectedFace;
- elements.Add(new(new($"loop:{i}"), AirBRepPlanElementKind.Loop, role, input.FeatureId, provenance));
- for (var c = 0; c < (i < 2 ? 5 : 4); c++) elements.Add(new(new($"coedge:{i}:{c}"), AirBRepPlanElementKind.Coedge, role, input.FeatureId, provenance));
- elements.Add(new(new($"face:{i}"), AirBRepPlanElementKind.Face, role, input.FeatureId, provenance, FaceRole: p.FaceRoles[i]));
- }
- elements.Add(new(new("shell:0"), AirBRepPlanElementKind.Shell, AirBRepPlanRole.BodyShell, input.FeatureId, provenance));
- elements.Add(new(new("body:0"), AirBRepPlanElementKind.Body, AirBRepPlanRole.Body, input.FeatureId, provenance));
- var summary = new AirBRepPlanSummary(AirBRepPlanKind.LocalizedPlanarReplacement, input.FeatureId, p.ExpectedVertexCount, p.ExpectedEdgeCount, p.ExpectedEdgeCount, p.ExpectedCoedgeCount, p.ExpectedLoopCount, p.ExpectedFaceCount, p.ExpectedFaceCount, 1, 1, 0, 4, 1, 1,
- $"box={input.Width:R}x{input.Depth:R}x{input.Height:R}", "explicit-owned-endpoints", [], ["authoritative", "no legacy fallback", "direct single candidate"],
- new(AirNodeKind.TopFaceLoopChamfer, AirRouteKind.Unsupported, AirSelectionClass.None, AirRuleKind.UniformChamfer, feature.ConstructionHistoryKind, "Direct", ["SharedEdge(+X,+Z)"]));
- return new($"brep-plan:localized-planar-replacement:{input.FeatureId}", AirBRepPlanKind.LocalizedPlanarReplacement, input.FeatureId, provenance, elements, summary, [], summary.Guarantees, summary.FeatureContext, LocalizedPlanarReplacementRealizationPlan: p);
+ return LocalizedEdgeReplacementCompilerModel.BuildBRepPlan(construction.SharedConstruction, provenance, AirBRepPlanKind.LocalizedPlanarReplacement);
}
- private static string Signature(double w, double d, double h, double c) => Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(FormattableString.Invariant($"localized-planar-replacement:+X,+Z:{w:R}:{d:R}:{h:R}:{c:R}"))));
}
internal sealed record AirLocalizedPlanarReplacementEmissionResult(bool Succeeded, BrepBody? Body, IReadOnlyList<string> Diagnostics);
internal static class AirLocalizedPlanarReplacementEmitter
{
- public static AirLocalizedPlanarReplacementEmissionResult Emit(AirLocalizedPlanarReplacementTopologyPlan plan)
+ public static AirLocalizedPlanarReplacementEmissionResult Emit(LocalizedEdgeReplacementConstruction construction)
{
- var n = plan.CrossSection.Count;
- if (n != 5 || plan.FaceRoles.Count != 7) return new(false, null, ["localized-chamfer-invalid-authoritative-plan"]);
- var b = new TopologyBuilder(); var low = new VertexId[n]; var high = new VertexId[n];
- for (var i = 0; i < n; i++) { low[i] = b.AddVertex(); high[i] = b.AddVertex(); }
- var lowEdges = new EdgeId[n]; var highEdges = new EdgeId[n]; var spans = new EdgeId[n];
- for (var i = 0; i < n; i++) { var next = (i + 1) % n; lowEdges[i] = b.AddEdge(low[i], low[next]); highEdges[i] = b.AddEdge(high[i], high[next]); spans[i] = b.AddEdge(low[i], high[i]); }
- var faces = new List<FaceId> { AddFace(b, lowEdges.Select(Use.F).ToArray()), AddFace(b, highEdges.Reverse().Select(Use.R).ToArray()) };
- for (var i = 0; i < n; i++) { var next = (i + 1) % n; faces.Add(AddFace(b, [Use.R(lowEdges[i]), Use.F(spans[i]), Use.F(highEdges[i]), Use.R(spans[next])])); }
- var shell = b.AddShell(faces); b.AddBody([shell]);
- var lower = plan.CrossSection.ToArray(); var upper = lower.Select(p => new Point3D(p.X, plan.MaxY, p.Z)).ToArray();
- var geo = new BrepGeometryStore(); var bindings = new BrepBindingModel(); int curve = 1;
- void BindEdge(EdgeId id, Point3D a, Point3D z) { var cid = new CurveGeometryId(curve++); geo.AddCurve(cid, CurveGeometry.FromLine(new Line3Curve(a, Direction3D.Create(z - a)))); bindings.AddEdgeBinding(new EdgeGeometryBinding(id, cid, new ParameterInterval(0, (z-a).Length))); }
- for (var i = 0; i < n; i++) { var next=(i+1)%n; BindEdge(lowEdges[i],lower[i],lower[next]); BindEdge(highEdges[i],upper[i],upper[next]); BindEdge(spans[i],lower[i],upper[i]); }
- int surface = 1;
- void BindFace(FaceId id, Point3D origin, Vector3D normal, Vector3D u) { var sid=new SurfaceGeometryId(surface++); geo.AddSurface(sid,SurfaceGeometry.FromPlane(new PlaneSurface(origin,Direction3D.Create(normal),Direction3D.Create(u)))); bindings.AddFaceBinding(new FaceGeometryBinding(id,sid)); }
- BindFace(faces[0], lower[0], new Vector3D(0,-1,0), new Vector3D(1,0,0));
- BindFace(faces[1], upper[0], new Vector3D(0,1,0), new Vector3D(1,0,0));
- for (var i=0;i<n;i++) { var next=(i+1)%n; var edge=lower[next]-lower[i]; BindFace(faces[i+2],lower[i],new Vector3D(0,1,0).Cross(edge),new Vector3D(0,1,0)); }
- var points = new Dictionary<VertexId,Point3D>(); for(var i=0;i<n;i++){points[low[i]]=lower[i];points[high[i]]=upper[i];}
- var body = new BrepBody(b.Model,geo,bindings,points); var check=BrepBindingValidator.Validate(body,true);
- return check.IsSuccess ? new(true,body,["localized-chamfer-plan-emitted"]) : new(false,null,check.Diagnostics.Select(d=>d.Message).ToArray());
+ var emitted = LocalizedEdgeReplacementCompilerModel.Emit(construction);
+ return new(emitted.Succeeded, emitted.Body, emitted.Diagnostics);
}
- private static FaceId AddFace(TopologyBuilder b, IReadOnlyList<Use> uses) { var loop=b.AllocateLoopId(); var ids=new CoedgeId[uses.Count]; for(var i=0;i<ids.Length;i++)ids[i]=b.AllocateCoedgeId(); for(var i=0;i<ids.Length;i++)b.AddCoedge(new Coedge(ids[i],uses[i].Id,loop,ids[(i+1)%ids.Length],ids[(i+ids.Length-1)%ids.Length],uses[i].Reverse)); b.AddLoop(new Loop(loop,ids)); return b.AddFace([loop]); }
- private readonly record struct Use(EdgeId Id,bool Reverse) { public static Use F(EdgeId id)=>new(id,false); public static Use R(EdgeId id)=>new(id,true); }
}
diff --git a/Aetheris.Kernel.Core/Air/AirLocalizedTangentBlendFilletCompiler.cs b/Aetheris.Kernel.Core/Air/AirLocalizedTangentBlendFilletCompiler.cs
index ca5677c5..9429cf37 100644
--- a/Aetheris.Kernel.Core/Air/AirLocalizedTangentBlendFilletCompiler.cs
+++ b/Aetheris.Kernel.Core/Air/AirLocalizedTangentBlendFilletCompiler.cs
@@ -1,5 +1,3 @@
-using System.Security.Cryptography;
-using System.Text;
using Aetheris.Kernel.Core.Air.BRepPlan;
using Aetheris.Kernel.Core.Brep;
using Aetheris.Kernel.Core.Geometry;
@@ -24,7 +22,8 @@ internal sealed record AirLocalizedTangentBlendWitness(
internal sealed record AirLocalizedTangentBlendTopologyPlan(
IReadOnlyList<Point3D> CrossSection, double MinY, double MaxY, double Radius,
- IReadOnlyList<string> FaceRoles, string DeterministicSignature)
+ IReadOnlyList<string> FaceRoles, string DeterministicSignature,
+ LocalizedEdgeReplacementTopologyPlan SharedTopologyPlan)
{
public int ExpectedVertexCount => CrossSection.Count * 2;
public int ExpectedEdgeCount => CrossSection.Count * 3;
@@ -35,7 +34,8 @@ internal sealed record AirLocalizedTangentBlendTopologyPlan(
internal sealed record AirLocalizedTangentBlendConstruction(
string ConstructionId, string SourceFeatureId, AirLocalizedTangentBlendWitness Witness,
- AirLocalizedTangentBlendTopologyPlan TopologyPlan);
+ AirLocalizedTangentBlendTopologyPlan TopologyPlan,
+ LocalizedEdgeReplacementConstruction SharedConstruction);
internal sealed record AirLocalizedTangentBlendFilletCompileRequest(
string BodyId, string FeatureId, string FeatureName, double Width, double Depth, double Height,
@@ -66,7 +66,7 @@ internal static class AirLocalizedTangentBlendFilletCompiler
var construction = lowered.Value!;
var plan = BuildPlan(input, feature, construction);
- var emitted = AirLocalizedTangentBlendEmitter.Emit(construction);
+ var emitted = AirLocalizedTangentBlendEmitter.Emit(construction.SharedConstruction);
if (!emitted.Succeeded || emitted.Body is null)
{
var error = new ChamferLoweringError(ChamferLoweringErrorKind.BackendMaterializationDefect,
@@ -91,15 +91,10 @@ internal static class AirLocalizedTangentBlendFilletCompiler
{
ChamferLoweringResult<AirLocalizedTangentBlendConstruction> Fail(ChamferLoweringErrorKind kind, string code, string message) =>
ChamferLoweringResult<AirLocalizedTangentBlendConstruction>.Err(new(kind, code, message, "FeatureAIR->ConstructionAIR"));
- if (!input.HistoryKnown) return Fail(ChamferLoweringErrorKind.UnsupportedHistory, "localized-fillet-unsupported-history", "Localized tangent blending requires known prismatic construction history.");
if (!string.Equals(input.Kind, "Fillet", StringComparison.Ordinal)) return Fail(ChamferLoweringErrorKind.InvalidAuthoredInput, "localized-fillet-invalid-kind", "This lowerer accepts constant-radius Fillet intent only.");
- if (!string.Equals(input.FaceA, "+X", StringComparison.Ordinal) || !string.Equals(input.FaceB, "+Z", StringComparison.Ordinal))
- return Fail(ChamferLoweringErrorKind.UnsupportedSelection, "localized-fillet-unsupported-selection:expected-shared-edge-plus-x-plus-z", "The first localized fillet route admits SharedEdge(+X,+Z) only.");
- if (!double.IsFinite(input.Width) || !double.IsFinite(input.Depth) || !double.IsFinite(input.Height) || input.Width <= Tol || input.Depth <= Tol || input.Height <= Tol)
- return Fail(ChamferLoweringErrorKind.InvalidAuthoredInput, "localized-fillet-invalid-box-dimensions", "Host dimensions must be finite and positive.");
- if (!double.IsFinite(input.Radius) || input.Radius <= Tol) return Fail(ChamferLoweringErrorKind.InvalidAuthoredInput, "localized-fillet-radius-must-be-positive", "Radius must be finite and positive.");
- if (input.Radius >= input.Width - Tol || input.Radius >= input.Height - Tol)
- return Fail(ChamferLoweringErrorKind.DistanceTooLarge, "localized-fillet-radius-too-large", "Radius must remain within both orthogonal planar support-face extents.");
+ var context = new LocalizedEdgeReplacementContext(input.BodyId, input.FeatureId, input.FeatureName, input.Width, input.Depth, input.Height, input.FaceA, input.FaceB, AirLocalizedEdgeFinishKind.Fillet, input.Radius, input.SourceSpan, input.HistoryKnown);
+ var admitted = LocalizedEdgeReplacementCompilerModel.Admit(context);
+ if (!admitted.IsSuccess) return ChamferLoweringResult<AirLocalizedTangentBlendConstruction>.Err(admitted.Error!);
var hx = input.Width / 2d; var hy = input.Depth / 2d; var hz = input.Height / 2d; var r = input.Radius;
var cross = new[] { new Point3D(-hx, -hy, -hz), new Point3D(hx, -hy, -hz), new Point3D(hx, -hy, hz - r), new Point3D(hx - r, -hy, hz), new Point3D(-hx, -hy, hz) };
@@ -116,11 +111,14 @@ internal static class AirLocalizedTangentBlendFilletCompiler
var retainedX = new[] { new Point3D(hx, -hy, -hz), new Point3D(hx, hy, -hz), new Point3D(hx, hy, hz-r), new Point3D(hx, -hy, hz-r) };
var retainedZ = new[] { new Point3D(-hx, -hy, hz), new Point3D(hx-r, -hy, hz), new Point3D(hx-r, hy, hz), new Point3D(-hx, hy, hz) };
if ((cross[2] - cross[3]).Length <= Tol) return Fail(ChamferLoweringErrorKind.DegenerateTransition, "localized-fillet-degenerate-blend", "The tangent points produce a degenerate blend boundary.");
+ var sharedTopology = LocalizedEdgeReplacementCompilerModel.Topology(context, cross);
var topology = new AirLocalizedTangentBlendTopologyPlan(cross, -hy, hy, r,
- ["UnaffectedFace(-Z)", "UnaffectedFace(-Y)", "RetainedSupportFaceA(+X)", "CylindricalFilletFace", "RetainedSupportFaceB(+Z)", "EndpointTransitionStart(-Y)", "EndpointTransitionEnd(+Y)"], Signature(input.Width, input.Depth, input.Height, r));
+ sharedTopology.FaceRoles, sharedTopology.DeterministicSignature, sharedTopology);
var witness = new AirLocalizedTangentBlendWitness("plane(+X)", "plane(+Z)", new Point3D(hx, -hy, hz), new Point3D(hx, hy, hz), centerStart, centerEnd, arcStart, arcEnd, cylinder, r,
retainedX, retainedZ, "inside:x<=max,z<=max; remove exterior corner outside quarter-circle", "ExplicitOwnedEndpoints", "history-known-axis-aligned-rectangular-prism");
- return ChamferLoweringResult<AirLocalizedTangentBlendConstruction>.Ok(new($"construction:{input.FeatureId}", input.FeatureId, witness, topology));
+ var shared = new LocalizedEdgeReplacementConstruction($"construction:{input.FeatureId}", input.FeatureId, admitted.Value!, retainedX, retainedZ, cross,
+ new CylindricalFilletReplacement([cross[2], cross[3]], [new Point3D(hx, hy, hz - r), new Point3D(hx - r, hy, hz)], arcStart, arcEnd, cylinder, r), sharedTopology, "history-known-axis-aligned-rectangular-prism");
+ return ChamferLoweringResult<AirLocalizedTangentBlendConstruction>.Ok(new($"construction:{input.FeatureId}", input.FeatureId, witness, topology, shared));
}
private static AirFilletFeature Feature(AirLocalizedTangentBlendFilletCompileRequest input, ChamferLoweringError? error) => new(
@@ -131,67 +129,21 @@ internal static class AirLocalizedTangentBlendFilletCompiler
private static AirBRepPlan BuildPlan(AirLocalizedTangentBlendFilletCompileRequest input, AirFilletFeature feature, AirLocalizedTangentBlendConstruction construction)
{
- var p = construction.TopologyPlan;
var provenance = new AirProvenance("AIR-FILLET-LOCALIZED-M1", "Localized tangent-blend Construction AIR", "shared-edge(+X,+Z)", input.FeatureId,
nameof(AirLocalizedTangentBlendFilletCompiler), AirSelectionClass.SingleEdge, AirRuleKind.ConstantRadiusFillet, feature.ConstructionHistoryKind, true,
["Exact quarter-circle profile.", "Exact cylinder generated by linear sweep.", "No legacy direct-BRep surgery.", "Plan is constructed before emission."]);
- var elements = new List<AirBRepPlanElement>();
- for (var i = 0; i < p.ExpectedVertexCount; i++) elements.Add(new(new($"vertex:{i}"), AirBRepPlanElementKind.Vertex, i is 2 or 7 ? AirBRepPlanRole.EndpointTransitionStart : i is 3 or 8 ? AirBRepPlanRole.EndpointTransitionEnd : AirBRepPlanRole.SectionVertex, input.FeatureId, provenance));
- for (var i = 0; i < p.ExpectedEdgeCount; i++) elements.Add(new(new($"edge:{i}"), AirBRepPlanElementKind.Edge, i is 2 or 7 ? AirBRepPlanRole.FilletFace : AirBRepPlanRole.SectionEdge, input.FeatureId, provenance));
- for (var i = 0; i < p.FaceRoles.Count; i++)
- {
- var role = p.FaceRoles[i].StartsWith("RetainedSupportFaceA", StringComparison.Ordinal) ? AirBRepPlanRole.RetainedSupportFaceA : p.FaceRoles[i].StartsWith("RetainedSupportFaceB", StringComparison.Ordinal) ? AirBRepPlanRole.RetainedSupportFaceB : p.FaceRoles[i].StartsWith("CylindricalFilletFace", StringComparison.Ordinal) ? AirBRepPlanRole.FilletFace : p.FaceRoles[i].StartsWith("Endpoint", StringComparison.Ordinal) ? (i == 5 ? AirBRepPlanRole.EndpointTransitionStart : AirBRepPlanRole.EndpointTransitionEnd) : AirBRepPlanRole.UnaffectedFace;
- elements.Add(new(new($"loop:{i}"), AirBRepPlanElementKind.Loop, role, input.FeatureId, provenance));
- for (var c = 0; c < (i < 2 ? 5 : 4); c++) elements.Add(new(new($"coedge:{i}:{c}"), AirBRepPlanElementKind.Coedge, role, input.FeatureId, provenance));
- elements.Add(new(new($"face:{i}"), AirBRepPlanElementKind.Face, role, input.FeatureId, provenance, FaceRole: p.FaceRoles[i]));
- }
- elements.Add(new(new("surface:cylinder:0"), AirBRepPlanElementKind.Surface, AirBRepPlanRole.FilletFace, input.FeatureId, provenance));
- elements.Add(new(new("shell:0"), AirBRepPlanElementKind.Shell, AirBRepPlanRole.BodyShell, input.FeatureId, provenance));
- elements.Add(new(new("body:0"), AirBRepPlanElementKind.Body, AirBRepPlanRole.Body, input.FeatureId, provenance));
- var summary = new AirBRepPlanSummary(AirBRepPlanKind.LocalizedTangentBlend, input.FeatureId, p.ExpectedVertexCount, p.ExpectedEdgeCount, p.ExpectedEdgeCount, p.ExpectedCoedgeCount, p.ExpectedLoopCount, p.ExpectedFaceCount, p.ExpectedFaceCount, 1, 1, 0, 4, 1, 0,
- $"box={input.Width:R}x{input.Depth:R}x{input.Height:R};radius={input.Radius:R}", "explicit-owned-endpoints", [], ["authoritative", "exact-cylinder", "no legacy fallback", "direct single candidate"],
- new(AirNodeKind.Unsupported, AirRouteKind.Unsupported, AirSelectionClass.SingleEdge, AirRuleKind.ConstantRadiusFillet, feature.ConstructionHistoryKind, "Direct", ["SharedEdge(+X,+Z)"]));
- return new($"brep-plan:localized-tangent-blend:{input.FeatureId}", AirBRepPlanKind.LocalizedTangentBlend, input.FeatureId, provenance, elements, summary, [], summary.Guarantees, summary.FeatureContext, LocalizedTangentBlendRealizationPlan: p);
+ return LocalizedEdgeReplacementCompilerModel.BuildBRepPlan(construction.SharedConstruction, provenance, AirBRepPlanKind.LocalizedTangentBlend);
}
- private static string Signature(double w, double d, double h, double r) => Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(FormattableString.Invariant($"localized-tangent-blend:+X,+Z:{w:R}:{d:R}:{h:R}:{r:R}"))));
}
internal sealed record AirLocalizedTangentBlendEmissionResult(bool Succeeded, BrepBody? Body, IReadOnlyList<string> Diagnostics);
internal static class AirLocalizedTangentBlendEmitter
{
- public static AirLocalizedTangentBlendEmissionResult Emit(AirLocalizedTangentBlendConstruction construction)
+ public static AirLocalizedTangentBlendEmissionResult Emit(LocalizedEdgeReplacementConstruction construction)
{
- var plan = construction.TopologyPlan; var witness = construction.Witness; var n = plan.CrossSection.Count;
- if (n != 5 || plan.FaceRoles.Count != 7 || plan.Radius <= 0d) return new(false, null, ["localized-fillet-invalid-authoritative-plan"]);
- var b = new TopologyBuilder(); var low = new VertexId[n]; var high = new VertexId[n];
- for (var i = 0; i < n; i++) { low[i] = b.AddVertex(); high[i] = b.AddVertex(); }
- var lowEdges = new EdgeId[n]; var highEdges = new EdgeId[n]; var spans = new EdgeId[n];
- for (var i = 0; i < n; i++) { var next = (i + 1) % n; lowEdges[i] = b.AddEdge(low[i], low[next]); highEdges[i] = b.AddEdge(high[i], high[next]); spans[i] = b.AddEdge(low[i], high[i]); }
- var faces = new List<FaceId> { AddFace(b, lowEdges.Select(Use.F).ToArray()), AddFace(b, highEdges.Reverse().Select(Use.R).ToArray()) };
- for (var i = 0; i < n; i++) { var next = (i + 1) % n; faces.Add(AddFace(b, [Use.R(lowEdges[i]), Use.F(spans[i]), Use.F(highEdges[i]), Use.R(spans[next])])); }
- var shell = b.AddShell(faces); b.AddBody([shell]);
- var lower = plan.CrossSection.ToArray(); var upper = lower.Select(p => new Point3D(p.X, plan.MaxY, p.Z)).ToArray();
- var geo = new BrepGeometryStore(); var bindings = new BrepBindingModel(); int curve = 1;
- void BindLine(EdgeId id, Point3D a, Point3D z) { var cid = new CurveGeometryId(curve++); geo.AddCurve(cid, CurveGeometry.FromLine(new Line3Curve(a, Direction3D.Create(z - a)))); bindings.AddEdgeBinding(new EdgeGeometryBinding(id, cid, new ParameterInterval(0, (z-a).Length))); }
- void BindArc(EdgeId id, Circle3Curve arc) { var cid = new CurveGeometryId(curve++); geo.AddCurve(cid, CurveGeometry.FromCircle(arc)); bindings.AddEdgeBinding(new EdgeGeometryBinding(id, cid, new ParameterInterval(0d, double.Pi / 2d))); }
- for (var i = 0; i < n; i++) { var next = (i + 1) % n; if (i == 2) { BindArc(lowEdges[i], witness.QuarterCircleStart); BindArc(highEdges[i], witness.QuarterCircleEnd); } else { BindLine(lowEdges[i], lower[i], lower[next]); BindLine(highEdges[i], upper[i], upper[next]); } BindLine(spans[i], lower[i], upper[i]); }
- int surface = 1;
- void BindPlane(FaceId id, Point3D origin, Vector3D normal, Vector3D u) { var sid = new SurfaceGeometryId(surface++); geo.AddSurface(sid, SurfaceGeometry.FromPlane(new PlaneSurface(origin, Direction3D.Create(normal), Direction3D.Create(u)))); bindings.AddFaceBinding(new FaceGeometryBinding(id, sid)); }
- BindPlane(faces[0], lower[0], new Vector3D(0, -1, 0), new Vector3D(1, 0, 0));
- BindPlane(faces[1], upper[0], new Vector3D(0, 1, 0), new Vector3D(1, 0, 0));
- for (var i = 0; i < n; i++)
- {
- var next = (i + 1) % n;
- if (i == 2) { var sid = new SurfaceGeometryId(surface++); geo.AddSurface(sid, SurfaceGeometry.FromCylinder(witness.BlendCylinder)); bindings.AddFaceBinding(new FaceGeometryBinding(faces[i + 2], sid)); }
- else { var edge = lower[next] - lower[i]; BindPlane(faces[i + 2], lower[i], new Vector3D(0, 1, 0).Cross(edge), new Vector3D(0, 1, 0)); }
- }
- var points = new Dictionary<VertexId, Point3D>(); for (var i = 0; i < n; i++) { points[low[i]] = lower[i]; points[high[i]] = upper[i]; }
- var body = new BrepBody(b.Model, geo, bindings, points); var check = BrepBindingValidator.Validate(body, true);
- return check.IsSuccess ? new(true, body, ["localized-fillet-plan-emitted"]) : new(false, null, check.Diagnostics.Select(d => d.Message).ToArray());
+ var emitted = LocalizedEdgeReplacementCompilerModel.Emit(construction);
+ return new(emitted.Succeeded, emitted.Body, emitted.Diagnostics);
}
-
- private static FaceId AddFace(TopologyBuilder b, IReadOnlyList<Use> uses) { var loop = b.AllocateLoopId(); var ids = new CoedgeId[uses.Count]; for (var i = 0; i < ids.Length; i++) ids[i] = b.AllocateCoedgeId(); for (var i = 0; i < ids.Length; i++) b.AddCoedge(new Coedge(ids[i], uses[i].Id, loop, ids[(i + 1) % ids.Length], ids[(i + ids.Length - 1) % ids.Length], uses[i].Reverse)); b.AddLoop(new Loop(loop, ids)); return b.AddFace([loop]); }
- private readonly record struct Use(EdgeId Id, bool Reverse) { public static Use F(EdgeId id) => new(id, false); public static Use R(EdgeId id) => new(id, true); }
}
diff --git a/Aetheris.Kernel.Core/Air/LocalizedEdgeReplacement.cs b/Aetheris.Kernel.Core/Air/LocalizedEdgeReplacement.cs
new file mode 100644
index 00000000..44d5cb8c
--- /dev/null
+++ b/Aetheris.Kernel.Core/Air/LocalizedEdgeReplacement.cs
@@ -0,0 +1,173 @@
+using System.Security.Cryptography;
+using System.Text;
+using Aetheris.Kernel.Core.Air.BRepPlan;
+using Aetheris.Kernel.Core.Brep;
+using Aetheris.Kernel.Core.Geometry;
+using Aetheris.Kernel.Core.Geometry.Curves;
+using Aetheris.Kernel.Core.Geometry.Surfaces;
+using Aetheris.Kernel.Core.Math;
+using Aetheris.Kernel.Core.Topology;
+
+namespace Aetheris.Kernel.Core.Air;
+
+/// <summary>Closed semantic family for the admitted localized edge replacement routes.
+/// It is deliberately not a public runtime extension point.</summary>
+internal enum AirLocalizedEdgeFinishKind { Chamfer, Fillet }
+
+internal abstract record AirEdgeFinishRule;
+internal sealed record AirEqualDistanceEdgeFinishRule(double Distance) : AirEdgeFinishRule;
+internal sealed record AirConstantRadiusEdgeFinishRule(double Radius) : AirEdgeFinishRule;
+
+/// <summary>Shared Feature AIR. Compatibility feature records remain route-facing only.</summary>
+internal sealed record AirEdgeFinishFeature(
+ string FeatureId, string FeatureName, string BodyId, AirFaceBoundarySelection Selection,
+ AirLocalizedEdgeFinishKind Kind, AirEdgeFinishRule Rule, AirSourceSpan SourceSpan,
+ string ConstructionHistoryKind, AirFeatureAdmissionStatus Admission, string AdmissionReason);
+
+internal sealed record LocalizedEdgeReplacementContext(
+ string BodyId, string FeatureId, string FeatureName, double Width, double Depth, double Height,
+ string FaceA, string FaceB, AirLocalizedEdgeFinishKind Kind, double Value,
+ AirSourceSpan SourceSpan, bool HistoryKnown);
+
+internal sealed record LocalizedEdgeReplacementAdmission(
+ Point3D EdgeStart, Point3D EdgeEnd, double HalfWidth, double HalfDepth, double HalfHeight,
+ string MaterialSide, string EndpointPolicy, AirEdgeFinishFeature Feature);
+
+internal abstract record LocalizedReplacementGeometry(
+ IReadOnlyList<Point3D> BoundaryAtStart, IReadOnlyList<Point3D> BoundaryAtEnd,
+ string GeometryKind);
+
+internal sealed record PlanarChamferReplacement(
+ IReadOnlyList<Point3D> BoundaryAtStart, IReadOnlyList<Point3D> BoundaryAtEnd,
+ IReadOnlyList<Point3D> ReplacementFace) : LocalizedReplacementGeometry(BoundaryAtStart, BoundaryAtEnd, "PlanarChamfer");
+
+internal sealed record CylindricalFilletReplacement(
+ IReadOnlyList<Point3D> BoundaryAtStart, IReadOnlyList<Point3D> BoundaryAtEnd,
+ Circle3Curve StartArc, Circle3Curve EndArc, CylinderSurface Cylinder, double Radius)
+ : LocalizedReplacementGeometry(BoundaryAtStart, BoundaryAtEnd, "CylindricalFillet");
+
+/// <summary>Immutable Construction AIR: common ownership and exact typed replacement geometry.</summary>
+internal sealed record LocalizedEdgeReplacementConstruction(
+ string ConstructionId, string SourceFeatureId, LocalizedEdgeReplacementAdmission Admission,
+ IReadOnlyList<Point3D> RetainedSupportFaceA, IReadOnlyList<Point3D> RetainedSupportFaceB,
+ IReadOnlyList<Point3D> CrossSection, LocalizedReplacementGeometry Replacement,
+ LocalizedEdgeReplacementTopologyPlan TopologyPlan, string Provenance);
+
+/// <summary>Topology authority shared by every localized edge replacement family.</summary>
+internal sealed record LocalizedEdgeReplacementTopologyPlan(
+ IReadOnlyList<Point3D> CrossSection, double MinY, double MaxY,
+ AirLocalizedEdgeFinishKind FinishKind, IReadOnlyList<string> FaceRoles,
+ string DeterministicSignature)
+{
+ public int ExpectedVertexCount => CrossSection.Count * 2;
+ public int ExpectedEdgeCount => CrossSection.Count * 3;
+ public int ExpectedFaceCount => CrossSection.Count + 2;
+ public int ExpectedLoopCount => ExpectedFaceCount;
+ public int ExpectedCoedgeCount => 6 * CrossSection.Count;
+}
+
+internal static class LocalizedEdgeReplacementCompilerModel
+{
+ internal const double Tolerance = 1e-9;
+
+ public static ChamferLoweringResult<LocalizedEdgeReplacementAdmission> Admit(LocalizedEdgeReplacementContext input)
+ {
+ ChamferLoweringResult<LocalizedEdgeReplacementAdmission> Fail(ChamferLoweringErrorKind kind, string code, string message) =>
+ ChamferLoweringResult<LocalizedEdgeReplacementAdmission>.Err(new(kind, code, message, "FeatureAIR->LocalizedEdgeReplacement"));
+
+ var family = input.Kind == AirLocalizedEdgeFinishKind.Chamfer ? "chamfer" : "fillet";
+ if (!input.HistoryKnown) return Fail(ChamferLoweringErrorKind.UnsupportedHistory, $"localized-{family}-unsupported-history", "Localized edge replacement requires known prismatic construction history.");
+ if (!string.Equals(input.FaceA, "+X", StringComparison.Ordinal) || !string.Equals(input.FaceB, "+Z", StringComparison.Ordinal))
+ return Fail(ChamferLoweringErrorKind.UnsupportedSelection, $"localized-{family}-unsupported-selection:expected-shared-edge-plus-x-plus-z", "The admitted localized route selects SharedEdge(+X,+Z) only.");
+ if (!double.IsFinite(input.Width) || !double.IsFinite(input.Depth) || !double.IsFinite(input.Height) || input.Width <= Tolerance || input.Depth <= Tolerance || input.Height <= Tolerance)
+ return Fail(ChamferLoweringErrorKind.InvalidAuthoredInput, $"localized-{family}-invalid-box-dimensions", "Host dimensions must be finite and positive.");
+ if (!double.IsFinite(input.Value) || input.Value <= Tolerance)
+ return Fail(ChamferLoweringErrorKind.InvalidAuthoredInput, $"localized-{family}-{(input.Kind == AirLocalizedEdgeFinishKind.Chamfer ? "distance" : "radius")}-must-be-positive", "Finish value must be finite and positive.");
+ if (input.Value >= input.Width - Tolerance || input.Value >= input.Height - Tolerance)
+ return Fail(ChamferLoweringErrorKind.DistanceTooLarge, $"localized-{family}-{(input.Kind == AirLocalizedEdgeFinishKind.Chamfer ? "distance" : "radius")}-too-large", "Finish value must remain within both orthogonal planar support-face extents.");
+
+ var hx = input.Width / 2d; var hy = input.Depth / 2d; var hz = input.Height / 2d;
+ var rule = input.Kind == AirLocalizedEdgeFinishKind.Chamfer
+ ? (AirEdgeFinishRule)new AirEqualDistanceEdgeFinishRule(input.Value)
+ : new AirConstantRadiusEdgeFinishRule(input.Value);
+ var feature = new AirEdgeFinishFeature(input.FeatureId, input.FeatureName, input.BodyId,
+ new AirFaceBoundarySelection("+X", "SharedEdge(+X,+Z)", false), input.Kind, rule, input.SourceSpan,
+ "generated/history-known-axis-aligned-rectangular-prism", AirFeatureAdmissionStatus.Admitted,
+ $"localized-{family}-direct-single-candidate");
+ return ChamferLoweringResult<LocalizedEdgeReplacementAdmission>.Ok(new(
+ new Point3D(hx, -hy, hz), new Point3D(hx, hy, hz), hx, hy, hz,
+ "inside:x<=max,z<=max", "ExplicitOwnedEndpoints", feature));
+ }
+
+ public static LocalizedEdgeReplacementTopologyPlan Topology(LocalizedEdgeReplacementContext input, IReadOnlyList<Point3D> crossSection)
+ {
+ var roles = new[] { "UnaffectedFace(-Z)", "UnaffectedFace(-Y)", "RetainedSupportFaceA(+X)",
+ $"ReplacementFace({(input.Kind == AirLocalizedEdgeFinishKind.Chamfer ? "PlanarChamfer" : "CylindricalFillet")})",
+ "RetainedSupportFaceB(+Z)", "EndpointTransitionStart(-Y)", "EndpointTransitionEnd(+Y)" };
+ var signature = Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(FormattableString.Invariant(
+ $"localized-edge-replacement:{input.Kind}:+X,+Z:{input.Width:R}:{input.Depth:R}:{input.Height:R}:{input.Value:R}"))));
+ return new(crossSection, -input.Depth / 2d, input.Depth / 2d, input.Kind, roles, signature);
+ }
+
+ public static AirBRepPlan BuildBRepPlan(LocalizedEdgeReplacementConstruction construction, AirProvenance provenance, AirBRepPlanKind compatibilityKind)
+ {
+ var p = construction.TopologyPlan;
+ var elements = new List<AirBRepPlanElement>();
+ for (var i = 0; i < p.ExpectedVertexCount; i++)
+ elements.Add(new(new($"vertex:{i}"), AirBRepPlanElementKind.Vertex, i is 2 or 7 ? AirBRepPlanRole.EndpointTransitionStart : i is 3 or 8 ? AirBRepPlanRole.EndpointTransitionEnd : AirBRepPlanRole.SectionVertex, construction.SourceFeatureId, provenance));
+ for (var i = 0; i < p.ExpectedEdgeCount; i++)
+ elements.Add(new(new($"edge:{i}"), AirBRepPlanElementKind.Edge, i is 2 or 7 ? AirBRepPlanRole.ReplacementBoundaryA : i is 3 or 8 ? AirBRepPlanRole.ReplacementBoundaryB : AirBRepPlanRole.SectionEdge, construction.SourceFeatureId, provenance));
+ for (var i = 0; i < p.FaceRoles.Count; i++)
+ {
+ var role = Role(p.FaceRoles[i], i);
+ elements.Add(new(new($"loop:{i}"), AirBRepPlanElementKind.Loop, role, construction.SourceFeatureId, provenance));
+ for (var c = 0; c < (i < 2 ? 5 : 4); c++) elements.Add(new(new($"coedge:{i}:{c}"), AirBRepPlanElementKind.Coedge, role, construction.SourceFeatureId, provenance));
+ elements.Add(new(new($"face:{i}"), AirBRepPlanElementKind.Face, role, construction.SourceFeatureId, provenance, FaceRole: p.FaceRoles[i], SemanticRoles: role == AirBRepPlanRole.ReplacementFace ? [AirBRepPlanRole.ReplacementFace, p.FinishKind == AirLocalizedEdgeFinishKind.Chamfer ? AirBRepPlanRole.ChamferFace : AirBRepPlanRole.FilletFace] : [role]));
+ }
+ elements.Add(new(new("surface:replacement:0"), AirBRepPlanElementKind.Surface, AirBRepPlanRole.ReplacementFace, construction.SourceFeatureId, provenance));
+ elements.Add(new(new("shell:0"), AirBRepPlanElementKind.Shell, AirBRepPlanRole.BodyShell, construction.SourceFeatureId, provenance));
+ elements.Add(new(new("body:0"), AirBRepPlanElementKind.Body, AirBRepPlanRole.Body, construction.SourceFeatureId, provenance));
+ var feature = construction.Admission.Feature;
+ var summary = new AirBRepPlanSummary(compatibilityKind, construction.SourceFeatureId, p.ExpectedVertexCount, p.ExpectedEdgeCount, p.ExpectedEdgeCount, p.ExpectedCoedgeCount, p.ExpectedLoopCount, p.ExpectedFaceCount, p.ExpectedFaceCount, 1, 1, 0, 4, 1, p.FinishKind == AirLocalizedEdgeFinishKind.Chamfer ? 1 : 0,
+ $"localized-edge-replacement={p.FinishKind};signature={p.DeterministicSignature}", "explicit-owned-endpoints", [],
+ ["authoritative localized edge-replacement topology", "no legacy fallback", "direct single candidate", "shared endpoint ownership"],
+ new(AirNodeKind.Unsupported, AirRouteKind.Unsupported, AirSelectionClass.SingleEdge, p.FinishKind == AirLocalizedEdgeFinishKind.Chamfer ? AirRuleKind.UniformChamfer : AirRuleKind.ConstantRadiusFillet, feature.ConstructionHistoryKind, "Direct", ["SharedEdge(+X,+Z)"]));
+ return new($"brep-plan:localized-edge-replacement:{construction.SourceFeatureId}", compatibilityKind, construction.SourceFeatureId, provenance, elements, summary, [], summary.Guarantees, summary.FeatureContext, LocalizedEdgeReplacementRealizationPlan: p);
+ }
+
+ public static AirLocalizedEdgeReplacementEmissionResult Emit(LocalizedEdgeReplacementConstruction construction)
+ {
+ var plan = construction.TopologyPlan; var n = plan.CrossSection.Count;
+ if (n != 5 || plan.FaceRoles.Count != 7) return new(false, null, ["localized-edge-replacement-invalid-authoritative-plan"]);
+ var builder = new TopologyBuilder(); var low = new VertexId[n]; var high = new VertexId[n];
+ for (var i = 0; i < n; i++) { low[i] = builder.AddVertex(); high[i] = builder.AddVertex(); }
+ var lowEdges = new EdgeId[n]; var highEdges = new EdgeId[n]; var spans = new EdgeId[n];
+ for (var i = 0; i < n; i++) { var next = (i + 1) % n; lowEdges[i] = builder.AddEdge(low[i], low[next]); highEdges[i] = builder.AddEdge(high[i], high[next]); spans[i] = builder.AddEdge(low[i], high[i]); }
+ var faces = new List<FaceId> { AddFace(builder, lowEdges.Select(Use.F).ToArray()), AddFace(builder, highEdges.Reverse().Select(Use.R).ToArray()) };
+ for (var i = 0; i < n; i++) { var next = (i + 1) % n; faces.Add(AddFace(builder, [Use.R(lowEdges[i]), Use.F(spans[i]), Use.F(highEdges[i]), Use.R(spans[next])])); }
+ var shell = builder.AddShell(faces); builder.AddBody([shell]);
+ var lower = plan.CrossSection.ToArray(); var upper = lower.Select(p => new Point3D(p.X, plan.MaxY, p.Z)).ToArray();
+ var geometry = new BrepGeometryStore(); var bindings = new BrepBindingModel(); var curveNumber = 1;
+ void BindLine(EdgeId id, Point3D a, Point3D z) { var cid = new CurveGeometryId(curveNumber++); geometry.AddCurve(cid, CurveGeometry.FromLine(new Line3Curve(a, Direction3D.Create(z - a)))); bindings.AddEdgeBinding(new EdgeGeometryBinding(id, cid, new ParameterInterval(0, (z - a).Length))); }
+ void BindArc(EdgeId id, Circle3Curve arc) { var cid = new CurveGeometryId(curveNumber++); geometry.AddCurve(cid, CurveGeometry.FromCircle(arc)); bindings.AddEdgeBinding(new EdgeGeometryBinding(id, cid, new ParameterInterval(0, double.Pi / 2d))); }
+ for (var i = 0; i < n; i++) { var next = (i + 1) % n; if (i == 2 && construction.Replacement is CylindricalFilletReplacement fillet) { BindArc(lowEdges[i], fillet.StartArc); BindArc(highEdges[i], fillet.EndArc); } else { BindLine(lowEdges[i], lower[i], lower[next]); BindLine(highEdges[i], upper[i], upper[next]); } BindLine(spans[i], lower[i], upper[i]); }
+ var surfaceNumber = 1;
+ void BindPlane(FaceId id, Point3D origin, Vector3D normal, Vector3D u) { var sid = new SurfaceGeometryId(surfaceNumber++); geometry.AddSurface(sid, SurfaceGeometry.FromPlane(new PlaneSurface(origin, Direction3D.Create(normal), Direction3D.Create(u)))); bindings.AddFaceBinding(new FaceGeometryBinding(id, sid)); }
+ BindPlane(faces[0], lower[0], new Vector3D(0, -1, 0), new Vector3D(1, 0, 0));
+ BindPlane(faces[1], upper[0], new Vector3D(0, 1, 0), new Vector3D(1, 0, 0));
+ for (var i = 0; i < n; i++) { var next = (i + 1) % n; if (i == 2 && construction.Replacement is CylindricalFilletReplacement fillet) { var sid = new SurfaceGeometryId(surfaceNumber++); geometry.AddSurface(sid, SurfaceGeometry.FromCylinder(fillet.Cylinder)); bindings.AddFaceBinding(new FaceGeometryBinding(faces[i + 2], sid)); } else { var edge = lower[next] - lower[i]; BindPlane(faces[i + 2], lower[i], new Vector3D(0, 1, 0).Cross(edge), new Vector3D(0, 1, 0)); } }
+ var points = new Dictionary<VertexId, Point3D>(); for (var i = 0; i < n; i++) { points[low[i]] = lower[i]; points[high[i]] = upper[i]; }
+ var body = new BrepBody(builder.Model, geometry, bindings, points); var check = BrepBindingValidator.Validate(body, true);
+ return check.IsSuccess ? new(true, body, ["localized-edge-replacement-plan-emitted"]) : new(false, null, check.Diagnostics.Select(d => d.Message).ToArray());
+ }
+
+ private static AirBRepPlanRole Role(string faceRole, int faceIndex) =>
+ faceRole.StartsWith("RetainedSupportFaceA", StringComparison.Ordinal) ? AirBRepPlanRole.RetainedSupportFaceA :
+ faceRole.StartsWith("RetainedSupportFaceB", StringComparison.Ordinal) ? AirBRepPlanRole.RetainedSupportFaceB :
+ faceRole.StartsWith("ReplacementFace", StringComparison.Ordinal) ? AirBRepPlanRole.ReplacementFace :
+ faceRole.StartsWith("Endpoint", StringComparison.Ordinal) ? (faceIndex == 5 ? AirBRepPlanRole.EndpointTransitionStart : AirBRepPlanRole.EndpointTransitionEnd) : AirBRepPlanRole.UnaffectedFace;
+ private static FaceId AddFace(TopologyBuilder b, IReadOnlyList<Use> uses) { var loop = b.AllocateLoopId(); var ids = new CoedgeId[uses.Count]; for (var i = 0; i < ids.Length; i++) ids[i] = b.AllocateCoedgeId(); for (var i = 0; i < ids.Length; i++) b.AddCoedge(new Coedge(ids[i], uses[i].Id, loop, ids[(i + 1) % ids.Length], ids[(i + ids.Length - 1) % ids.Length], uses[i].Reverse)); b.AddLoop(new Loop(loop, ids)); return b.AddFace([loop]); }
+ private readonly record struct Use(EdgeId Id, bool Reverse) { public static Use F(EdgeId id) => new(id, false); public static Use R(EdgeId id) => new(id, true); }
+}
+
+internal sealed record AirLocalizedEdgeReplacementEmissionResult(bool Succeeded, BrepBody? Body, IReadOnlyList<string> Diagnostics);
diff --git a/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs b/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs
index f3ed2521..5f8b2118 100644
--- a/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs
@@ -241,7 +241,7 @@ public static class FirmamentBuildAndExport
solid.Name, $"{solid.Name}.{finish.Name}", finish.Name, box.Size[0], box.Size[1], box.Size[2],
finish.FaceAxis, "+Z", finish.Kind, finish.Distance,
new AirSourceSpan(finish.SourceSpan.Start, finish.SourceSpan.Length, document.ModelName)));
- if (!compiled.Succeeded || compiled.Body is null || compiled.Construction is null || compiled.BRepPlan?.LocalizedPlanarReplacementRealizationPlan is null)
+ if (!compiled.Succeeded || compiled.Body is null || compiled.Construction is null || compiled.BRepPlan?.LocalizedEdgeReplacementRealizationPlan is null)
return AirChamferFailure(compiled.Error?.Code ?? compiled.Feature.AdmissionReason, compiled.Diagnostics);
var body = compiled.Body;
@@ -273,7 +273,8 @@ public static class FirmamentBuildAndExport
"ExplicitOwnedEndpoints", plan.DeterministicSignature, "LocalizedPlanarReplacement"),
new(AirLocalizedPlanarReplacementChamferCompileResult.ProductionRoute, false, true, body.Topology.Vertices.Count(), body.Topology.Edges.Count(), body.Topology.Faces.Count(), Bounds(body), finish.Distance, finish.Distance, 0, 0, planes),
new("AP242", Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(step.Value))), true, reimport.Value.Topology.Vertices.Count(), reimport.Value.Topology.Edges.Count(), reimport.Value.Topology.Faces.Count(), Bounds(reimport.Value), true),
- new("SharedEdge(+X,+Z)", "LocalizedPlanarReplacement", "Direct", 2, 1, "ExplicitOwnedEndpoints", new(true, plan.DeterministicSignature), "valid", false));
+ new("SharedEdge(+X,+Z)", "LocalizedPlanarReplacement", "Direct", 2, 1, "ExplicitOwnedEndpoints", new(true, plan.DeterministicSignature), "valid", false),
+ LocalizedEdgeFinish: new("Chamfer", "SharedEdge(+X,+Z)", "EqualDistance", finish.Distance, "LocalizedEdgeReplacement", "PlanarChamfer", "Direct", 2, 1, "ExplicitOwnedEndpoints", new(true, plan.DeterministicSignature), "valid", false));
return KernelResult<FirmamentStepExportResult>.Success(new FirmamentStepExportResult(step.Value, compiled.Feature.FeatureId, 0, "air-chamfer", "localized-planar-single-edge-chamfer", Air: report, ConceptIr: document.ConceptIr));
}
@@ -287,7 +288,7 @@ public static class FirmamentBuildAndExport
solid.Name, $"{solid.Name}.{finish.Name}", finish.Name, box.Size[0], box.Size[1], box.Size[2],
finish.FaceAxis, finish.Target switch { "SharedEdgePlusZ" => "+Z", "SharedEdgePlusY" => "+Y", _ => finish.Target }, finish.Kind, finish.Distance,
new AirSourceSpan(finish.SourceSpan.Start, finish.SourceSpan.Length, document.ModelName)));
- if (!compiled.Succeeded || compiled.Body is null || compiled.Construction is null || compiled.BRepPlan?.LocalizedTangentBlendRealizationPlan is null)
+ if (!compiled.Succeeded || compiled.Body is null || compiled.Construction is null || compiled.BRepPlan?.LocalizedEdgeReplacementRealizationPlan is null)
return AirChamferFailure(compiled.Error?.Code ?? compiled.Feature.AdmissionReason, compiled.Diagnostics);
var body = compiled.Body;
@@ -320,7 +321,8 @@ public static class FirmamentBuildAndExport
"ExplicitOwnedEndpoints", plan.DeterministicSignature, "LocalizedTangentBlend"),
new(AirLocalizedTangentBlendFilletCompileResult.ProductionRoute, false, true, body.Topology.Vertices.Count(), body.Topology.Edges.Count(), body.Topology.Faces.Count(), Bounds(body), finish.Distance, finish.Distance, cylinders, 0, planes),
new("AP242", Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(step.Value))), true, reimport.Value.Topology.Vertices.Count(), reimport.Value.Topology.Edges.Count(), reimport.Value.Topology.Faces.Count(), Bounds(reimport.Value), true),
- LocalizedFillet: new("SharedEdge(+X,+Z)", "ConstantRadius", finish.Distance, "LocalizedTangentBlend", "QuarterCircle", "Linear", "Direct", 2, 1, "ExplicitOwnedEndpoints", new(true, plan.DeterministicSignature), "valid", false));
+ LocalizedFillet: new("SharedEdge(+X,+Z)", "ConstantRadius", finish.Distance, "LocalizedTangentBlend", "QuarterCircle", "Linear", "Direct", 2, 1, "ExplicitOwnedEndpoints", new(true, plan.DeterministicSignature), "valid", false),
+ LocalizedEdgeFinish: new("Fillet", "SharedEdge(+X,+Z)", "ConstantRadius", finish.Distance, "LocalizedEdgeReplacement", "CylindricalFillet", "Direct", 2, 1, "ExplicitOwnedEndpoints", new(true, plan.DeterministicSignature), "valid", false));
return KernelResult<FirmamentStepExportResult>.Success(new FirmamentStepExportResult(step.Value, compiled.Feature.FeatureId, 0, "air-fillet", "localized-tangent-blend-single-edge-fillet", Air: report, ConceptIr: document.ConceptIr));
}
diff --git a/Aetheris.Kernel.Firmament/FirmamentStepExportResult.cs b/Aetheris.Kernel.Firmament/FirmamentStepExportResult.cs
index efcfc94c..988797ef 100644
--- a/Aetheris.Kernel.Firmament/FirmamentStepExportResult.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentStepExportResult.cs
@@ -46,7 +46,24 @@ public sealed record FirmamentAirChamferReport(
FirmamentAirChamferMaterializationReport Materialization,
FirmamentAirChamferStepReport Step,
FirmamentLocalizedChamferTrace? LocalizedChamfer = null,
- FirmamentLocalizedFilletTrace? LocalizedFillet = null);
+ FirmamentLocalizedFilletTrace? LocalizedFillet = null,
+ FirmamentLocalizedEdgeFinishTrace? LocalizedEdgeFinish = null);
+
+/// <summary>Authoritative shared semantic evidence for localized edge replacement routes.</summary>
+public sealed record FirmamentLocalizedEdgeFinishTrace(
+ string Kind,
+ string Selection,
+ string RuleKind,
+ double Value,
+ string Construction,
+ string ReplacementGeometry,
+ string SelectionMode,
+ int RetainedFaces,
+ int ReplacementFaces,
+ string EndpointPolicy,
+ FirmamentLocalizedChamferPlanTrace BRepPlan,
+ string Preflight,
+ bool LegacyFallback);
/// <summary>Bounded report of the localized AIR path; it is evidence, never input to emission.</summary>
public sealed record FirmamentLocalizedChamferTrace(
diff --git a/docs/air-fillet-localized-m1.md b/docs/air-fillet-localized-m1.md
index 9d27157f..fe7c0cfc 100644
--- a/docs/air-fillet-localized-m1.md
+++ b/docs/air-fillet-localized-m1.md
@@ -56,3 +56,6 @@ Deferred: concave or imported bodies, different support pairs, edge chains, mult
edges, endpoint/corner interactions, variable/asymmetric radius, and rolling-ball or
toroidal corner resolution. The recommended next milestone is a second straight edge
with an explicit junction Construction AIR witness and deterministic corner policy.
+## Status note
+
+This historical tangent-blend evidence is now implemented through the shared [AIR edge-finish consolidation M2](air/air-edge-finish-consolidation-m2.md) topology authority. The exact cylindrical quarter-arc geometry and existing compatibility report remain unchanged.
diff --git a/docs/air/air-edge-finish-consolidation-m2.md b/docs/air/air-edge-finish-consolidation-m2.md
new file mode 100644
index 00000000..b38fd127
--- /dev/null
+++ b/docs/air/air-edge-finish-consolidation-m2.md
@@ -0,0 +1,35 @@
+# AIR-EDGE-FINISH-CONSOLIDATION-M2
+
+This milestone consolidates the admitted localized Box `SharedEdge(+X,+Z)` chamfer and fillet routes under one closed, exact localized-edge-replacement compiler model. It does not admit junctions, corners, imported/no-history bodies, arbitrary support surfaces, or alternative finish constructions.
+
+## Shared model
+
+`AirEdgeFinishFeature` is the common Feature AIR record. It owns semantic body identity, typed edge selection, typed rule (`AirEqualDistanceEdgeFinishRule` or `AirConstantRadiusEdgeFinishRule`), source span, history classification, and admission outcome. It is internal compiler IR; Firmament continues to expose semantic intent and never emitted BRep identities.
+
+`LocalizedEdgeReplacementConstruction` is the common immutable Construction AIR. It owns the admitted finite selected edge, support ownership, retained regions, material side, explicit endpoint policy, cross-section, provenance, and a typed replacement geometry. `PlanarChamferReplacement` owns the straight setback boundaries and planar face. `CylindricalFilletReplacement` owns the exact start/end quarter arcs and cylindrical support surface.
+
+The shared hard-admission gate proves history-known positive Box dimensions, the finite `+X/+Z` straight convex edge, two planar supports, a positive bounded rule value, and the explicit-owned-endpoint policy. A single admitted construction is selected directly; there are no alternatives to score. Rule identity is checked before common admission, so a wrong kind remains a precise authored-input error. Oversize, invalid selection, invalid history, and degenerate geometry remain typed errors; chamfer and fillet retain their existing compatibility error codes.
+
+## One topology authority
+
+`LocalizedEdgeReplacementTopologyPlan` owns the 5-point section, planned vertices/edges, ordered loops/coedges, retained support faces, unaffected faces, replacement face, endpoint faces, stable boundary roles, and deterministic signature. `LocalizedEdgeReplacementCompilerModel.BuildBRepPlan` is the sole localized planner for both routes. It preserves the historical `LocalizedPlanarReplacement` and `LocalizedTangentBlend` plan kinds for compatibility while placing the shared realization plan in `AirBRepPlan.LocalizedEdgeReplacementRealizationPlan`.
+
+The shared emitter consumes that construction/plan and owns all topology assembly. It performs one closed typed replacement switch only where geometry differs: the chamfer binds lines and planes; the fillet binds quarter-circle trims and a cylinder. Neither route independently reconstructs loops, coedges, or faces.
+
+Stable roles include `RetainedSupportFaceA`, `RetainedSupportFaceB`, `ReplacementFace`, `ReplacementBoundaryA`, `ReplacementBoundaryB`, `EndpointTransitionStart`, `EndpointTransitionEnd`, and `UnaffectedFace`. Compatibility semantic roles additionally mark the replacement as `ChamferFace` or `FilletFace`.
+
+## Reporting and export
+
+`localizedEdgeFinish` is the authoritative common Firmament export trace. It records kind, rule, selected edge, `LocalizedEdgeReplacement` construction, typed replacement geometry, direct selection mode, ownership counts, endpoint policy, authoritative plan signature, valid preflight, and no legacy fallback. Existing `localizedChamfer` and `localizedFillet` traces remain unchanged for consumers.
+
+Both routes still validate the emitted body with `BrepExportPreflight`, export with `BrepExportPreflightMode.Enforce` and `TrustedProductionRoute`, then STEP-reimport and manifold-check. No fallback route is selected.
+
+## Regression evidence
+
+The real CLI regression suites cover chamfer and fillet for `10 x 8 x 6` at 1 and 2, and `12 x 5 x 7` at 1; they also cover zero, oversized, unsupported-selection, and two-edge-junction rejection. They verify deterministic STEP, preflight, STEP reimport, topology counts, planar/cylindrical surface classification, exact setbacks/radius/axis, and the shared trace. The exact prismatic-profile volumes are `W*D*H - D*d^2/2` for a chamfer and `W*D*H - D*r^2*(1-pi/4)` for a fillet; for the `10 x 8 x 6`, value-2 smoke artifacts these are `464` and `473.132741...` respectively. CAD Assistant also completed an import/display smoke of the generated R=2 fillet STEP after consolidation.
+
+## Deliberate limits and next seam
+
+Endpoint ownership is only the two explicit Box end caps. Adjacent selected edges, junction/corner patches, variable-radius blends, and non-planar support pairs remain rejected before topology emission. A future bounded finish adds one typed `LocalizedReplacementGeometry` case and its exact curve/surface bindings; it reuses the admission, ownership, plan, and shell assembly rather than adding a second topology compiler. The next appropriate milestone is an explicitly witnessed two-edge corner/junction replacement, not a broader edge-selection expansion.
+
+Historical evidence: [localized planar chamfer A1](localized-planar-single-edge-chamfer-a1.md) and [localized fillet M1](../air-fillet-localized-m1.md).
diff --git a/docs/air/localized-planar-single-edge-chamfer-a1.md b/docs/air/localized-planar-single-edge-chamfer-a1.md
index 71cdd640..e0458c2e 100644
--- a/docs/air/localized-planar-single-edge-chamfer-a1.md
+++ b/docs/air/localized-planar-single-edge-chamfer-a1.md
@@ -25,3 +25,6 @@ Utility scoring remains unused: the admitted single-edge context has exactly one
The reusable fillet infrastructure is semantic selection, retained/replacement ownership,
endpoint policy, authoritative plan emission, admission, preflight, and STEP proof. Fillets still
need tangent arc/blend geometry, cylindrical/toroidal surfaces, and continuity/radius admission.
+## Status note
+
+This historical planar-route evidence is now implemented through the shared [AIR edge-finish consolidation M2](air-edge-finish-consolidation-m2.md) topology authority. The exact planar replacement geometry and existing compatibility report remain unchanged.