Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Fix revolved volume analysis and chamfered hole topology

Yuechen Li5558c3200c1d
diff --git a/Aetheris.CLI.Tests/ChamferM6FixturePipelineTests.cs b/Aetheris.CLI.Tests/ChamferM6FixturePipelineTests.cs
new file mode 100644
index 00000000..18c9322e
--- /dev/null
+++ b/Aetheris.CLI.Tests/ChamferM6FixturePipelineTests.cs
@@ -0,0 +1,118 @@
+using System.Security.Cryptography;
+using System.Text;
+using System.Text.Json;
+using Aetheris.Kernel.Core.Geometry;
+using Aetheris.Kernel.Core.Step242;
+
+namespace Aetheris.CLI.Tests;
+
+public sealed class ChamferM6FixturePipelineTests
+{
+ [Theory]
+ [InlineData("air-cylinder-top-rim-chamfer.valid.firmament", 20, 50, 1)]
+ [InlineData("air-cylinder-top-rim-variant.valid.firmament", 7.5, 18, 2)]
+ public void CircularRimFixtures_ExportDeterministicChangedReimportableStep(string fixture, double radius, double height, double distance)
+ {
+ var first = BuildFixture(fixture);
+ var second = BuildFixture(fixture);
+ Assert.Equal(first.Hash, second.Hash);
+ using var json = JsonDocument.Parse(first.Json);
+ var air = json.RootElement.GetProperty("air");
+ Assert.Equal("RevolutionProfileRewrite", air.GetProperty("construction").GetProperty("kind").GetString());
+ Assert.True(air.GetProperty("construction").GetProperty("compilerGeneratedWitness").GetBoolean());
+ Assert.Equal("RevolvedProfile", air.GetProperty("bRepPlan").GetProperty("planKind").GetString());
+ Assert.True(air.GetProperty("bRepPlan").GetProperty("authoritative").GetBoolean());
+ Assert.Equal("AirRevolutionProfileTopRimChamfer", air.GetProperty("materialization").GetProperty("route").GetString());
+ Assert.False(air.GetProperty("materialization").GetProperty("legacyFallback").GetBoolean());
+ Assert.Equal(1, air.GetProperty("materialization").GetProperty("cylindricalFaces").GetInt32());
+ Assert.Equal(1, air.GetProperty("materialization").GetProperty("conicalFaces").GetInt32());
+ Assert.Equal(distance, air.GetProperty("materialization").GetProperty("measuredTopInsetX").GetDouble(), 9);
+
+ var imported = Step242Importer.ImportBody(File.ReadAllText(first.StepPath, Encoding.UTF8));
+ Assert.True(imported.IsSuccess, string.Join(Environment.NewLine, imported.Diagnostics.Select(d => d.Message)));
+ Assert.Equal(6, imported.Value.Topology.Vertices.Count());
+ Assert.Equal(5, imported.Value.Topology.Edges.Count());
+ Assert.Equal(4, imported.Value.Topology.Faces.Count());
+ Assert.Equal(1, imported.Value.Geometry.Surfaces.Count(s => s.Value.Kind == SurfaceGeometryKind.Cylinder));
+ Assert.Equal(1, imported.Value.Geometry.Surfaces.Count(s => s.Value.Kind == SurfaceGeometryKind.Cone));
+ var analysis = StepAnalyzer.Analyze(first.StepPath);
+ var bounds = analysis.Summary.BoundingBox!.Value;
+ Assert.Equal(-radius, bounds.Min.X, 9);
+ Assert.Equal(radius, bounds.Max.Y, 9);
+ var volume = StepAnalyzer.AnalyzeVolume(first.StepPath);
+ var topRadius = radius - distance;
+ var expectedVolume = Math.PI * radius * radius * (height - distance)
+ + Math.PI * distance / 3d * (radius * radius + radius * topRadius + topRadius * topRadius);
+ Assert.True(volume.Exact);
+ Assert.Equal("analytic-piecewise-linear-revolved-profile", volume.Method);
+ Assert.Equal(expectedVolume, volume.Volume, 7);
+ var replacement = air.GetProperty("construction").GetProperty("replacementProfile");
+ Assert.Equal(radius - distance, replacement[2][0].GetDouble(), 9);
+ Assert.Equal(height / 2, replacement[2][1].GetDouble(), 9);
+ }
+
+ [Theory]
+ [InlineData("air-hole-entry-chamfer.valid.firmament", 6, 5)]
+ [InlineData("air-hole-entry-chamfer-variant.valid.firmament", 4.5, 4.25)]
+ public void InternalHoleEntryFixture_UsesProfileStackAndContainsRealConeAndShaft(string fixture, double shaftDiameter, double transitionZ)
+ {
+ var built = BuildFixture(fixture);
+ var imported = Step242Importer.ImportBody(File.ReadAllText(built.StepPath, Encoding.UTF8));
+ Assert.True(imported.IsSuccess, string.Join(Environment.NewLine, imported.Diagnostics.Select(d => d.Message)));
+ Assert.Contains(imported.Value.Geometry.Surfaces, s => s.Value.Kind == SurfaceGeometryKind.Cone);
+ Assert.Contains(imported.Value.Geometry.Surfaces, s => s.Value.Kind == SurfaceGeometryKind.Cylinder);
+ Assert.Equal(11, imported.Value.Topology.Vertices.Count());
+ var coneBinding = Assert.Single(imported.Value.Bindings.FaceBindings,
+ binding => imported.Value.Geometry.GetSurface(binding.SurfaceGeometryId).Kind == SurfaceGeometryKind.Cone);
+ var cone = imported.Value.Geometry.GetSurface(coneBinding.SurfaceGeometryId).Cone!.Value;
+ Assert.False(coneBinding.SameSense);
+ Assert.Equal(transitionZ, cone.PlacementOrigin.Z, 9);
+ Assert.Equal(shaftDiameter / 2d, cone.PlacementRadius, 9);
+ Assert.Equal(1d, cone.Axis.ToVector().Z, 9);
+ using var json = JsonDocument.Parse(built.Json);
+ var feature = Assert.Single(json.RootElement.GetProperty("features").EnumerateArray());
+ Assert.Equal("AirHoleSimpleShaftMaterializer", feature.GetProperty("materializationRoute").GetString());
+ Assert.Equal("HoleProfileStack", feature.GetProperty("constructionKind").GetString());
+ Assert.Equal("Countersink", feature.GetProperty("stackKind").GetString());
+ Assert.Contains("conical-entry", feature.GetProperty("witnessSummary").GetString(), StringComparison.Ordinal);
+ Assert.Equal(1, feature.GetProperty("cylindricalFaces").GetInt32());
+ Assert.Equal(1, feature.GetProperty("conicalFaces").GetInt32());
+ Assert.True(feature.GetProperty("stepReimportSucceeded").GetBoolean());
+ Assert.Equal(shaftDiameter, feature.GetProperty("diameter").GetDouble());
+ }
+
+ [Theory]
+ [InlineData("air-cylinder-top-rim-zero.invalid.firmament", "chamfer-invalid-distance:must-be-positive")]
+ [InlineData("air-cylinder-top-rim-oversized.invalid.firmament", "chamfer-distance-too-large:circular-top-rim")]
+ [InlineData("air-hole-entry-chamfer-zero.invalid.firmament", "firmament-v2-hole-countersink-invalid")]
+ public void InvalidChamferFixtures_FailBeforeStepAndNeverFallback(string fixture, string expected)
+ {
+ var sourcePath = FixturePath("invalid", fixture);
+ var outputPath = Path.Combine(Path.GetTempPath(), "aetheris-chamfer-m6", Guid.NewGuid().ToString("N"), "invalid.step");
+ var stdout = new StringWriter();
+ var stderr = new StringWriter();
+ var exit = CliRunner.Run(["build", sourcePath, "--out", outputPath, "--json"], stdout, stderr);
+ var combined = stdout + stderr.ToString();
+ Assert.Equal(1, exit);
+ Assert.Contains(expected, combined, StringComparison.Ordinal);
+ Assert.DoesNotContain("legacyFallback\":true", combined, StringComparison.Ordinal);
+ Assert.False(File.Exists(outputPath));
+ }
+
+ private static (string Hash, string Json, string StepPath) BuildFixture(string fixture)
+ {
+ var directory = Path.Combine(Path.GetTempPath(), "aetheris-chamfer-m6", Guid.NewGuid().ToString("N"));
+ Directory.CreateDirectory(directory);
+ var output = Path.Combine(directory, Path.GetFileNameWithoutExtension(fixture) + ".step");
+ var stdout = new StringWriter();
+ var stderr = new StringWriter();
+ var exit = CliRunner.Run(["build", FixturePath("valid", fixture), "--out", output, "--json"], stdout, stderr);
+ Assert.Equal(0, exit);
+ Assert.True(File.Exists(output));
+ return (Convert.ToHexString(SHA256.HashData(File.ReadAllBytes(output))), stdout + stderr.ToString(), output);
+ }
+
+ private static string FixturePath(string category, string fixture) =>
+ Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "../../../../fixtures/FirmamentV2/Chamfer", category, fixture));
+
+}
diff --git a/Aetheris.CLI/StepAnalyzer.cs b/Aetheris.CLI/StepAnalyzer.cs
index 943c1d02..4931f81b 100644
--- a/Aetheris.CLI/StepAnalyzer.cs
+++ b/Aetheris.CLI/StepAnalyzer.cs
@@ -93,6 +93,15 @@ public sealed record VolumeAnalysisResult(
}
var cylFaces = body.Topology.Faces.Where(f => body.TryGetFaceSurface(f.Id, out var sf) && sf?.Cylinder is not null).ToArray();
+ var coneFaces = body.Topology.Faces.Where(f => body.TryGetFaceSurface(f.Id, out var sf) && sf?.Cone is not null).ToArray();
+ if (cylFaces.Length + coneFaces.Length >= 2
+ && body.Topology.Faces.Count() == cylFaces.Length + coneFaces.Length + 2
+ && TryComputePiecewiseLinearRevolvedProfileVolume(body, out var revolvedVolume, out var revolvedBasis))
+ {
+ notes.Add(revolvedBasis);
+ return new VolumeAnalysisResult(stepPath, true, revolvedVolume, "model-unit", "model-unit^3", new VolumeBoundingBox(bbox.Min, bbox.Max), "analytic-piecewise-linear-revolved-profile", true, false, null, null, null, null, null, null, null, notes);
+ }
+
if (cylFaces.Length == 1 && body.Topology.Faces.Count() == 3)
{
body.TryGetFaceSurface(cylFaces[0].Id, out var cs);
@@ -112,7 +121,6 @@ public sealed record VolumeAnalysisResult(
return new VolumeAnalysisResult(stepPath, true, vol, "model-unit", "model-unit^3", new VolumeBoundingBox(bbox.Min, bbox.Max), "analytic-cylinder", true, false, null, null, null, null, null, null, null, notes);
}
- var coneFaces = body.Topology.Faces.Where(f => body.TryGetFaceSurface(f.Id, out var sf) && sf?.Cone is not null).ToArray();
if (coneFaces.Length == 1 && body.Topology.Faces.Count() == 3)
{
body.TryGetFaceSurface(coneFaces[0].Id, out var coneSurface);
@@ -181,6 +189,31 @@ public sealed record VolumeAnalysisResult(
throw new InvalidOperationException(planarFailureReason ?? "Volume analysis currently supports canonical sphere, single-lateral-face cylinder, and enclosed planar closed-shell bodies only.");
}
+ private static bool TryComputePiecewiseLinearRevolvedProfileVolume(BrepBody body, out double volume, out string basis)
+ {
+ volume = 0;
+ basis = string.Empty;
+ var circles = body.Geometry.Curves.Select(c => c.Value.Circle3).Where(c => c.HasValue).Select(c => c!.Value).ToArray();
+ if (circles.Length < 3) return false;
+ var axis = circles[0].Normal.ToVector();
+ if (circles.Any(c => double.Abs(double.Abs(c.Normal.ToVector().Dot(axis)) - 1d) > 1e-8)) return false;
+ var origin = circles[0].Center;
+ var profile = circles
+ .Select(c => (T: (c.Center - origin).Dot(axis), c.Radius))
+ .OrderBy(p => p.T)
+ .ToArray();
+ if (profile.Zip(profile.Skip(1)).Any(p => p.Second.T - p.First.T <= 1e-9)) return false;
+ for (var i = 0; i < profile.Length - 1; i++)
+ {
+ var h = profile[i + 1].T - profile[i].T;
+ var r0 = profile[i].Radius;
+ var r1 = profile[i + 1].Radius;
+ volume += double.Pi * h / 3d * (r0 * r0 + r0 * r1 + r1 * r1);
+ }
+ basis = $"Exact analytic volume from {profile.Length}-point coaxial circular profile and cylindrical/conical segment integration.";
+ return double.IsFinite(volume) && volume > 0;
+ }
+
private static bool TryComputeAxisAlignedBoxWithXHoleVolume(BrepBody body, BoundingBox3D bbox, out double volume, out string basis)
{
volume = 0d;
@@ -1675,9 +1708,27 @@ public sealed record VolumeAnalysisResult(
.Select(v => body.TryGetVertexPoint(v.Id, out var point) ? (Point3D?)point : null)
.Where(p => p.HasValue)
.Select(p => p!.Value)
- .ToArray();
+ .ToList();
+
+ // Periodic circle edges commonly use one seam vertex, so vertex-only bounds collapse
+ // their radial extent. Include exact axis-aligned extrema for full-circle bindings.
+ var hasAxialCircularSurface = body.Geometry.Surfaces.Any(s => s.Value.Kind is SurfaceGeometryKind.Cylinder or SurfaceGeometryKind.Cone);
+ foreach (var binding in hasAxialCircularSurface ? body.Bindings.EdgeBindings : [])
+ {
+ if (binding.TrimInterval is not { } interval || interval.End - interval.Start < 2d * Math.PI - 1e-9
+ || !body.Geometry.TryGetCurve(binding.CurveGeometryId, out var geometry)
+ || geometry?.Circle3 is not { } circle)
+ continue;
+ var x = circle.XAxis.ToVector();
+ var y = circle.YAxis.ToVector();
+ var dx = circle.Radius * Math.Sqrt(x.X * x.X + y.X * y.X);
+ var dy = circle.Radius * Math.Sqrt(x.Y * x.Y + y.Y * y.Y);
+ var dz = circle.Radius * Math.Sqrt(x.Z * x.Z + y.Z * y.Z);
+ points.Add(new Point3D(circle.Center.X - dx, circle.Center.Y - dy, circle.Center.Z - dz));
+ points.Add(new Point3D(circle.Center.X + dx, circle.Center.Y + dy, circle.Center.Z + dz));
+ }
- if (points.Length > 0)
+ if (points.Count > 0)
{
return ComputeBoundingBox(points);
}
diff --git a/Aetheris.Kernel.Core/Air/AirBRepPlan.cs b/Aetheris.Kernel.Core/Air/AirBRepPlan.cs
index a6ee7fb0..5a284281 100644
--- a/Aetheris.Kernel.Core/Air/AirBRepPlan.cs
+++ b/Aetheris.Kernel.Core/Air/AirBRepPlan.cs
@@ -1,10 +1,11 @@
+using Aetheris.Kernel.Core.Brep.Features;
using Aetheris.Kernel.Core.Brep.Prismatic;
namespace Aetheris.Kernel.Core.Air.BRepPlan;
-internal enum AirBRepPlanKind { PrismaticSectionTransition, Unsupported }
+internal enum AirBRepPlanKind { PrismaticSectionTransition, RevolvedProfile, Unsupported }
internal enum AirBRepPlanElementKind { Vertex, Curve, Edge, Coedge, Loop, Surface, Face, Shell, Body }
-internal enum AirBRepPlanRole { Unknown, SectionVertex, SectionEdge, VerticalTransitionEdge, SectionLoop, CapFace, SideFace, TransitionFace, PrismaticTransitionFace, ChamferFace, BodyShell, Body }
+internal enum AirBRepPlanRole { Unknown, SectionVertex, SectionEdge, VerticalTransitionEdge, SectionLoop, ProfileVertex, ProfileSegment, CircularRim, SeamEdge, CapFace, SideFace, CylindricalFace, ConicalTransitionFace, TransitionFace, PrismaticTransitionFace, ChamferFace, BodyShell, Body }
internal readonly record struct AirBRepPlanId(string Value)
{
@@ -74,9 +75,10 @@ internal sealed record AirBRepPlan(
IReadOnlyList<AirDiagnostic> Diagnostics,
IReadOnlyList<string> Guarantees,
AirBRepPlanFeatureContext? FeatureContext = null,
- PrismaticSectionTransitionTopologyPlan? RealizationPlan = null)
+ PrismaticSectionTransitionTopologyPlan? RealizationPlan = null,
+ RevolvedProfileTopologyPlan? RevolvedRealizationPlan = null)
{
- public bool IsAuthoritative => RealizationPlan is not null;
+ public bool IsAuthoritative => RealizationPlan is not null || RevolvedRealizationPlan is not null;
}
internal sealed record AirBRepPlanResult(AirBRepPlan? Plan, AirBRepPlanValidationResult Validation)
diff --git a/Aetheris.Kernel.Core/Air/AirCylinderTopRimChamferCompiler.cs b/Aetheris.Kernel.Core/Air/AirCylinderTopRimChamferCompiler.cs
new file mode 100644
index 00000000..8540ac96
--- /dev/null
+++ b/Aetheris.Kernel.Core/Air/AirCylinderTopRimChamferCompiler.cs
@@ -0,0 +1,163 @@
+using Aetheris.Kernel.Core.Air.BRepPlan;
+using Aetheris.Kernel.Core.Brep;
+using Aetheris.Kernel.Core.Brep.Features;
+using Aetheris.Kernel.Core.Math;
+
+namespace Aetheris.Kernel.Core.Air;
+
+internal sealed record AirRevolutionProfileWitness(
+ string WitnessId,
+ string Axis,
+ IReadOnlyList<ProfilePoint2D> SharpProfile,
+ IReadOnlyList<ProfilePoint2D> ReplacementProfile,
+ string MaterialSide,
+ bool CompilerGenerated);
+
+internal sealed record AirRevolutionProfileConstruction(
+ string ConstructionId,
+ string SourceFeatureId,
+ AirRevolutionProfileWitness Witness,
+ RevolvedProfileTopologyPlan TopologyPlan);
+
+internal sealed record AirCylinderTopRimChamferCompileRequest(
+ string BodyId,
+ string FeatureId,
+ string FeatureName,
+ double Radius,
+ double Height,
+ string FaceAxis,
+ string Target,
+ string Kind,
+ double Distance,
+ AirSourceSpan SourceSpan,
+ bool HistoryKnown = true);
+
+internal sealed record AirCylinderTopRimChamferCompileResult(
+ bool Succeeded,
+ AirChamferFeature Feature,
+ AirRevolutionProfileConstruction? Construction,
+ AirBRepPlan? BRepPlan,
+ BrepBody? Body,
+ ChamferLoweringError? Error,
+ IReadOnlyList<string> Diagnostics)
+{
+ public const string ProductionRoute = "AirRevolutionProfileTopRimChamfer";
+}
+
+/// <summary>Exact lowering for a complete convex top rim of a history-known right circular cylinder.</summary>
+internal static class AirCylinderTopRimChamferCompiler
+{
+ private const double Tol = 1e-9;
+
+ public static AirCylinderTopRimChamferCompileResult Compile(AirCylinderTopRimChamferCompileRequest input)
+ {
+ var lowered = Lower(input);
+ var feature = Feature(input, lowered.Error);
+ if (!lowered.IsSuccess)
+ return new(false, feature, null, null, null, lowered.Error, [lowered.Error!.Code]);
+
+ var construction = lowered.Value!;
+ var plan = BuildBRepPlan(input, feature, construction);
+ var emitted = RevolvedProfileStackEmitter.Emit(construction.TopologyPlan);
+ if (!emitted.Succeeded || emitted.Body is null)
+ {
+ var error = new ChamferLoweringError(ChamferLoweringErrorKind.BackendMaterializationDefect,
+ "chamfer-backend-revolved-profile-materialization-failed",
+ "The admitted revolution-profile construction did not materialize as a bound BRep.",
+ "BRep", emitted.Diagnostics);
+ return new(false, feature, construction, plan, null, error, [error.Code, .. emitted.Diagnostics]);
+ }
+
+ var coneCount = emitted.Body.Geometry.Surfaces.Count(s => s.Value.Kind == Geometry.SurfaceGeometryKind.Cone);
+ var cylinderCount = emitted.Body.Geometry.Surfaces.Count(s => s.Value.Kind == Geometry.SurfaceGeometryKind.Cylinder);
+ if (coneCount != 1 || cylinderCount != 1)
+ {
+ var error = new ChamferLoweringError(ChamferLoweringErrorKind.VerificationFailure,
+ "chamfer-verification-expected-cylinder-and-cone",
+ "Circular rim output must contain one cylindrical side and one conical chamfer band.",
+ "Verification", [$"cylinders={cylinderCount}", $"cones={coneCount}"]);
+ return new(false, feature, construction, plan, emitted.Body, error, [error.Code]);
+ }
+
+ return new(true, feature, construction, plan, emitted.Body, null,
+ emitted.Diagnostics.Concat([
+ "chamfer-feature-admitted:circular-convex-top-rim",
+ "chamfer-generated-witness:revolution-profile-rewrite",
+ "chamfer-analytic-evidence:cylinder=1,cone=1,planes=2",
+ ]).ToArray());
+ }
+
+ public static ChamferLoweringResult<AirRevolutionProfileConstruction> Lower(AirCylinderTopRimChamferCompileRequest input)
+ {
+ ChamferLoweringResult<AirRevolutionProfileConstruction> Fail(ChamferLoweringErrorKind kind, string code, string message) =>
+ ChamferLoweringResult<AirRevolutionProfileConstruction>.Err(new(kind, code, message, "FeatureAIR->ConstructionAIR"));
+
+ if (!input.HistoryKnown)
+ return Fail(ChamferLoweringErrorKind.UnsupportedHistory, "chamfer-unsupported-history:cylinder-rim-requires-construction-history", "Circular rim lowering requires a history-known right circular cylinder.");
+ if (!string.Equals(input.FaceAxis, "+Z", StringComparison.Ordinal) || !string.Equals(input.Target, "Boundary", StringComparison.Ordinal))
+ return Fail(ChamferLoweringErrorKind.UnsupportedSelection, "chamfer-unsupported-selection:expected-complete-+Z-boundary", "The admitted circular selection is the complete outer boundary of the +Z cap.");
+ if (!string.Equals(input.Kind, "Chamfer", StringComparison.Ordinal))
+ return Fail(ChamferLoweringErrorKind.InvalidAuthoredInput, "chamfer-invalid-kind:expected-chamfer", "This lowerer accepts chamfer intent only.");
+ if (!double.IsFinite(input.Radius) || !double.IsFinite(input.Height) || input.Radius <= Tol || input.Height <= Tol)
+ return Fail(ChamferLoweringErrorKind.InvalidAuthoredInput, "chamfer-invalid-cylinder-dimensions", "Cylinder radius and height must be finite and positive.");
+ if (!double.IsFinite(input.Distance) || input.Distance <= Tol)
+ return Fail(ChamferLoweringErrorKind.InvalidAuthoredInput, "chamfer-invalid-distance:must-be-positive", "Chamfer distance must be finite and positive.");
+ if (input.Distance >= input.Radius - Tol || input.Distance >= input.Height - Tol)
+ return Fail(ChamferLoweringErrorKind.DistanceTooLarge, "chamfer-distance-too-large:circular-top-rim", "Chamfer distance must be smaller than both the cylinder radius and height.");
+
+ var z0 = -input.Height / 2d;
+ var z1 = input.Height / 2d;
+ var sharp = new[] { new ProfilePoint2D(input.Radius, z0), new ProfilePoint2D(input.Radius, z1) };
+ var replacement = new[]
+ {
+ new ProfilePoint2D(input.Radius, z0),
+ new ProfilePoint2D(input.Radius, z1 - input.Distance),
+ new ProfilePoint2D(input.Radius - input.Distance, z1),
+ };
+ var frame = new ExtrudeFrame3D(Point3D.Origin, Direction3D.Create(new Vector3D(0, 0, 1)), Direction3D.Create(new Vector3D(1, 0, 0)));
+ var axis = new RevolveAxis3D(Point3D.Origin, new Vector3D(0, 0, 1));
+ var planned = RevolvedProfileStackEmitter.Plan(replacement, frame, axis);
+ if (!planned.IsSuccess || planned.Value is null)
+ return Fail(ChamferLoweringErrorKind.MissingConstructionWitness, "chamfer-revolution-profile-plan-invalid", string.Join(" | ", planned.Diagnostics.Select(d => d.Message)));
+ var witness = new AirRevolutionProfileWitness($"witness:{input.FeatureId}", "Z@origin", sharp, replacement, "radially-inward/axially-below-cap", true);
+ return ChamferLoweringResult<AirRevolutionProfileConstruction>.Ok(new($"construction:{input.FeatureId}", input.FeatureId, witness, planned.Value));
+ }
+
+ private static AirChamferFeature Feature(AirCylinderTopRimChamferCompileRequest input, ChamferLoweringError? error) => new(
+ input.FeatureId, input.FeatureName, input.BodyId, new AirFaceBoundarySelection(input.FaceAxis), new AirEqualDistanceChamferRule(input.Distance), input.SourceSpan,
+ input.HistoryKnown ? "generated/history-known-right-circular-cylinder" : "imported/no-history",
+ error is null ? AirFeatureAdmissionStatus.Admitted : error.Kind == ChamferLoweringErrorKind.UnsupportedHistory ? AirFeatureAdmissionStatus.Deferred : AirFeatureAdmissionStatus.Rejected,
+ error?.Code ?? "chamfer-bounded-circular-top-rim-admitted");
+
+ private static AirBRepPlan BuildBRepPlan(AirCylinderTopRimChamferCompileRequest input, AirChamferFeature feature, AirRevolutionProfileConstruction construction)
+ {
+ var topology = construction.TopologyPlan;
+ var provenance = new AirProvenance("CHAMFER-FIXTURE-PRESSURE-M6", "Circular rim profile rewrite", input.FeatureName, input.FeatureId,
+ nameof(AirChamferFeature), AirSelectionClass.FaceBoundaryLoop, AirRuleKind.UniformChamfer, feature.ConstructionHistoryKind, true,
+ ["Compiler-generated witness is equivalent to the explicit sharp/replacement radial profile pair."]);
+ var elements = new List<AirBRepPlanElement>();
+ for (var i = 0; i < topology.Profile.Count; i++)
+ {
+ elements.Add(new(new($"profile:v:{i}"), AirBRepPlanElementKind.Vertex, AirBRepPlanRole.ProfileVertex, input.FeatureId, provenance, ProfileVertexIndex: i));
+ elements.Add(new(new($"rim:e:{i}"), AirBRepPlanElementKind.Edge, AirBRepPlanRole.CircularRim, input.FeatureId, provenance, ProfileVertexIndex: i));
+ }
+ for (var i = 0; i < topology.Profile.Count - 1; i++)
+ {
+ var role = System.Math.Abs(topology.Profile[i].X - topology.Profile[i + 1].X) <= Tol ? AirBRepPlanRole.CylindricalFace : AirBRepPlanRole.ConicalTransitionFace;
+ elements.Add(new(new($"profile:segment:{i}"), AirBRepPlanElementKind.Face, role, input.FeatureId, provenance, IntervalIndex: i,
+ SemanticRoles: role == AirBRepPlanRole.ConicalTransitionFace ? [role, AirBRepPlanRole.ChamferFace] : [role]));
+ }
+ elements.Add(new(new("cap:bottom"), AirBRepPlanElementKind.Face, AirBRepPlanRole.CapFace, input.FeatureId, provenance));
+ elements.Add(new(new("cap:top"), AirBRepPlanElementKind.Face, AirBRepPlanRole.CapFace, input.FeatureId, provenance));
+ elements.Add(new(new("shell:body:0"), AirBRepPlanElementKind.Shell, AirBRepPlanRole.BodyShell, input.FeatureId, provenance));
+ elements.Add(new(new("body:0"), AirBRepPlanElementKind.Body, AirBRepPlanRole.Body, input.FeatureId, provenance));
+ var diagnostics = new[] { new AirDiagnostic("chamfer-brep-plan-revolved-profile-authoritative", AirDiagnosticSeverity.Info, "Authoritative revolved-profile plan created before BRep emission.") };
+ var context = new AirBRepPlanFeatureContext(AirNodeKind.TopFaceLoopChamfer, AirRouteKind.Unsupported, AirSelectionClass.FaceBoundaryLoop, AirRuleKind.UniformChamfer,
+ feature.ConstructionHistoryKind, "BoundedProductionAdmission", ["complete +Z circular outer rim", "uniform equal-distance rule"]);
+ var summary = new AirBRepPlanSummary(AirBRepPlanKind.RevolvedProfile, input.FeatureId, topology.ExpectedVertexCount, topology.ExpectedEdgeCount, topology.ExpectedEdgeCount,
+ topology.ExpectedCoedgeCount, topology.ExpectedLoopCount, topology.ExpectedFaceCount, topology.ExpectedFaceCount, 1, 1, 2, 1, 1, 1,
+ $"radius={input.Radius:R};height={input.Height:R}", "preserve-profile-corners", diagnostics,
+ ["no Boolean", "no edge surgery", "no legacy fallback", "analytic cylinder/cone/plane surfaces"], context);
+ return new($"brep-plan:revolved-profile:{input.FeatureId}", AirBRepPlanKind.RevolvedProfile, input.FeatureId, provenance, elements, summary, diagnostics, summary.Guarantees, context, RevolvedRealizationPlan: topology);
+ }
+}
diff --git a/Aetheris.Kernel.Core/Air/AirDeferredChamferLowerer.cs b/Aetheris.Kernel.Core/Air/AirDeferredChamferLowerer.cs
new file mode 100644
index 00000000..4a55b68a
--- /dev/null
+++ b/Aetheris.Kernel.Core/Air/AirDeferredChamferLowerer.cs
@@ -0,0 +1,54 @@
+namespace Aetheris.Kernel.Core.Air;
+
+internal enum AirDeferredChamferFamily
+{
+ RectangularConcavePocketRim,
+ SingleStraightConvexEdge,
+ AdjacentEdgeJunction,
+}
+
+internal sealed record AirDeferredChamferRequest(
+ string FeatureId,
+ AirDeferredChamferFamily Family,
+ string SemanticSelection,
+ double Distance,
+ IReadOnlyList<string> AttemptedWitness);
+
+internal sealed record AirDeferredChamferConstruction(string ConstructionId);
+
+/// <summary>
+/// Executable boundary fixtures for chamfer families whose required topology witness is not yet
+/// representable. These failures intentionally occur before BRepPlan or BRep emission.
+/// </summary>
+internal static class AirDeferredChamferLowerer
+{
+ public static ChamferLoweringResult<AirDeferredChamferConstruction> Lower(AirDeferredChamferRequest request)
+ {
+ if (!double.IsFinite(request.Distance) || request.Distance <= 0)
+ return Error(ChamferLoweringErrorKind.InvalidAuthoredInput, "chamfer-invalid-distance:must-be-positive", "Chamfer distance must be finite and positive.", request);
+ return request.Family switch
+ {
+ AirDeferredChamferFamily.RectangularConcavePocketRim => Error(
+ ChamferLoweringErrorKind.MissingConstructionWitness,
+ "chamfer-missing-construction-witness:section-transition-does-not-support-holes",
+ "Current SectionTransition admits one outer loop only; it cannot own retained host regions plus a transitioning inner loop.", request),
+ AirDeferredChamferFamily.SingleStraightConvexEdge => Error(
+ ChamferLoweringErrorKind.MissingConstructionWitness,
+ "chamfer-missing-construction-witness:localized-planar-replacement-not-implemented",
+ "A bounded support plane is insufficient without an authoritative retained/replacement region topology plan.", request),
+ AirDeferredChamferFamily.AdjacentEdgeJunction => Error(
+ ChamferLoweringErrorKind.CornerPolicyRequired,
+ "chamfer-corner-policy-required:multiple-valid-corner-patches",
+ "The two edge strips admit multiple valid junction patches (miter, setback, or explicit corner face).", request),
+ _ => Error(ChamferLoweringErrorKind.UnsupportedJunction, "chamfer-unsupported-junction", "No bounded construction family is registered.", request),
+ };
+ }
+
+ private static ChamferLoweringResult<AirDeferredChamferConstruction> Error(
+ ChamferLoweringErrorKind kind,
+ string code,
+ string message,
+ AirDeferredChamferRequest request) =>
+ ChamferLoweringResult<AirDeferredChamferConstruction>.Err(new(kind, code, message, "FeatureAIR->ConstructionAIR",
+ [$"selection={request.SemanticSelection}", .. request.AttemptedWitness]));
+}
diff --git a/Aetheris.Kernel.Core/Air/AirTopFaceBoundaryChamferCompiler.cs b/Aetheris.Kernel.Core/Air/AirTopFaceBoundaryChamferCompiler.cs
index 267a2bd4..cc5cb711 100644
--- a/Aetheris.Kernel.Core/Air/AirTopFaceBoundaryChamferCompiler.cs
+++ b/Aetheris.Kernel.Core/Air/AirTopFaceBoundaryChamferCompiler.cs
@@ -76,20 +76,12 @@ internal static class AirTopFaceBoundaryChamferCompiler
if (status != AirFeatureAdmissionStatus.Admitted)
return new(false, feature, null, null, null, null, [reason]);
- var geometricRequest = new PrismaticTopFaceLoopChamferRequest(input.Width, input.Depth, input.Height, input.Distance);
- var sections = PrismaticTopFaceLoopChamferPrototype.CreateSectionStack(geometricRequest);
- var profiles = sections.Select((section, index) => new AirPlanarProfileNode(
- $"{input.FeatureId}:profile:{index}", index, section.Z, section.OuterLoop.ToArray())).ToArray();
- var request = new PrismaticSectionTransitionRequest(
- sections,
- PrismaticCorrespondenceMap.Identity(4),
- new PrismaticSectionTransitionOptions(false, AirTopFaceBoundaryChamferCompileResult.ProductionRoute));
- var transition = new AirSectionTransitionNode(
- $"{input.FeatureId}:section-transition",
- profiles.Select(p => p.NodeId).ToArray(),
- "identity-by-profile-index",
- PrismaticSectionTransitionTopologyPlanner.PreserveSectionSplits);
- var construction = new AirChamferConstruction($"construction:{input.FeatureId}", input.FeatureId, profiles, transition, request);
+ var lowered = Lower(input);
+ if (!lowered.IsSuccess)
+ return new(false, feature, null, null, null, null, [lowered.Error!.Code]);
+ var construction = lowered.Value!;
+ var geometricRequest = construction.Request;
+ var sections = geometricRequest.Sections;
var featureContext = new AirBRepPlanFeatureContext(
AirNodeKind.TopFaceLoopChamfer,
@@ -99,7 +91,7 @@ internal static class AirTopFaceBoundaryChamferCompiler
feature.ConstructionHistoryKind,
"BoundedProductionAdmission",
["complete +Z outer boundary loop", "uniform equal-distance rule"]);
- var planned = AirTopFaceLoopChamferBRepPlanner.Plan(geometricRequest, featureContext, input.FeatureId);
+ var planned = AirTopFaceLoopChamferBRepPlanner.Plan(new PrismaticTopFaceLoopChamferRequest(input.Width, input.Depth, input.Height, input.Distance), featureContext, input.FeatureId);
if (!planned.Succeeded || planned.Plan?.RealizationPlan is null)
return new(false, feature, construction, planned.Plan, null, null, planned.Validation.Diagnostics.Select(d => d.Code).ToArray());
@@ -129,6 +121,35 @@ internal static class AirTopFaceBoundaryChamferCompiler
emitted.Diagnostics.Concat(["air-chamfer-feature-admitted", "air-chamfer-authoritative-brep-plan-consumed", "air-chamfer-top-inset-verified"]).Distinct().Order().ToArray());
}
+ public static ChamferLoweringResult<AirChamferConstruction> Lower(AirTopFaceBoundaryChamferCompileRequest input)
+ {
+ var (status, reason) = Admit(input);
+ if (status != AirFeatureAdmissionStatus.Admitted)
+ {
+ var kind = reason switch
+ {
+ "air-chamfer-distance-too-large-rejected" => ChamferLoweringErrorKind.DistanceTooLarge,
+ "air-chamfer-imported-no-history-body-deferred" => ChamferLoweringErrorKind.UnsupportedHistory,
+ var value when value.StartsWith("air-chamfer-unsupported-selection", StringComparison.Ordinal) || value.StartsWith("air-chamfer-unsupported-face", StringComparison.Ordinal) => ChamferLoweringErrorKind.UnsupportedSelection,
+ _ => ChamferLoweringErrorKind.InvalidAuthoredInput,
+ };
+ return ChamferLoweringResult<AirChamferConstruction>.Err(new(kind, reason, "Rectangular loop chamfer input is outside the exact admitted domain.", "FeatureAIR->ConstructionAIR"));
+ }
+
+ var geometricRequest = new PrismaticTopFaceLoopChamferRequest(input.Width, input.Depth, input.Height, input.Distance);
+ var sections = PrismaticTopFaceLoopChamferPrototype.CreateSectionStack(geometricRequest);
+ var profiles = sections.Select((section, index) => new AirPlanarProfileNode(
+ $"{input.FeatureId}:profile:{index}", index, section.Z, section.OuterLoop.ToArray())).ToArray();
+ var request = new PrismaticSectionTransitionRequest(
+ sections,
+ PrismaticCorrespondenceMap.Identity(4),
+ new PrismaticSectionTransitionOptions(false, AirTopFaceBoundaryChamferCompileResult.ProductionRoute));
+ var transition = new AirSectionTransitionNode(
+ $"{input.FeatureId}:section-transition", profiles.Select(p => p.NodeId).ToArray(), "identity-by-profile-index",
+ PrismaticSectionTransitionTopologyPlanner.PreserveSectionSplits);
+ return ChamferLoweringResult<AirChamferConstruction>.Ok(new($"construction:{input.FeatureId}", input.FeatureId, profiles, transition, request));
+ }
+
private static (AirFeatureAdmissionStatus Status, string Reason) Admit(AirTopFaceBoundaryChamferCompileRequest input)
{
if (!input.HistoryKnown) return (AirFeatureAdmissionStatus.Deferred, "air-chamfer-imported-no-history-body-deferred");
diff --git a/Aetheris.Kernel.Core/Air/ChamferLoweringResult.cs b/Aetheris.Kernel.Core/Air/ChamferLoweringResult.cs
new file mode 100644
index 00000000..eb536606
--- /dev/null
+++ b/Aetheris.Kernel.Core/Air/ChamferLoweringResult.cs
@@ -0,0 +1,41 @@
+namespace Aetheris.Kernel.Core.Air;
+
+internal enum ChamferLoweringErrorKind
+{
+ InvalidAuthoredInput,
+ UnsupportedSurfacePair,
+ UnsupportedSelection,
+ AmbiguousMaterialSide,
+ DistanceTooLarge,
+ OpenEdgeChain,
+ NonManifoldSelection,
+ CornerPolicyRequired,
+ MissingConstructionWitness,
+ MultipleValidCornerPatches,
+ SelfIntersection,
+ DegenerateTransition,
+ UnsupportedHistory,
+ UnsupportedJunction,
+ BackendMaterializationDefect,
+ VerificationFailure,
+}
+
+internal sealed record ChamferLoweringError(
+ ChamferLoweringErrorKind Kind,
+ string Code,
+ string Message,
+ string Stage,
+ IReadOnlyList<string>? Evidence = null);
+
+/// <summary>
+/// Typed boundary between semantic chamfer intent and exact Construction AIR.
+/// A failed lowering never carries a construction value and must not enter topology emission.
+/// </summary>
+internal sealed record ChamferLoweringResult<T>(T? Value, ChamferLoweringError? Error) where T : class
+{
+ public bool IsSuccess => Value is not null && Error is null;
+
+ public static ChamferLoweringResult<T> Ok(T value) => new(value, null);
+
+ public static ChamferLoweringResult<T> Err(ChamferLoweringError error) => new(null, error);
+}
diff --git a/Aetheris.Kernel.Core/Brep/Boolean/BrepBooleanBoxCylinderHoleBuilder.cs b/Aetheris.Kernel.Core/Brep/Boolean/BrepBooleanBoxCylinderHoleBuilder.cs
index 08940073..37197446 100644
--- a/Aetheris.Kernel.Core/Brep/Boolean/BrepBooleanBoxCylinderHoleBuilder.cs
+++ b/Aetheris.Kernel.Core/Brep/Boolean/BrepBooleanBoxCylinderHoleBuilder.cs
@@ -955,16 +955,16 @@ public static class BrepBooleanBoxCylinderHoleBuilder
var entryVertex = builder.AddVertex();
var transitionVertex = builder.AddVertex();
var deepEndVertex = builder.AddVertex();
- var coneSeamStartVertex = builder.AddVertex();
- var coneSeamEndVertex = builder.AddVertex();
- var cylinderSeamStartVertex = builder.AddVertex();
- var cylinderSeamEndVertex = builder.AddVertex();
var entryCircle = builder.AddEdge(entryVertex, entryVertex);
var transitionCircle = builder.AddEdge(transitionVertex, transitionVertex);
var deepEndCircle = builder.AddEdge(deepEndVertex, deepEndVertex);
- var coneSeam = builder.AddEdge(coneSeamStartVertex, coneSeamEndVertex);
- var cylinderSeam = builder.AddEdge(cylinderSeamStartVertex, cylinderSeamEndVertex);
+ // A periodic face seam must meet the circular boundary at the same topological
+ // vertex, not merely at a second vertex with coincident coordinates. Separate
+ // seam vertices produce disconnected EDGE_LOOP wires in STEP even though simple
+ // edge-incidence checks still describe a closed shell.
+ var coneSeam = builder.AddEdge(entryVertex, transitionVertex);
+ var cylinderSeam = builder.AddEdge(transitionVertex, deepEndVertex);
var bottomOuterLoop = AddLoop(builder, [Forward(e1), Forward(e2), Forward(e3), Forward(e4)]);
var topOuterLoop = AddLoop(builder, [Forward(e5), Forward(e6), Forward(e7), Forward(e8)]);
@@ -996,10 +996,10 @@ public static class BrepBooleanBoxCylinderHoleBuilder
var yMinFace = builder.AddFace([AddLoop(builder, [Forward(e4), Forward(e9), Reversed(e8), Reversed(e12)])]);
var countersinkConeFace = builder.AddFace([
- AddLoop(builder, [Forward(coneSeam), Reversed(entryCircle), Reversed(coneSeam), Forward(transitionCircle)])
+ AddLoop(builder, [Forward(coneSeam), Forward(transitionCircle), Reversed(coneSeam), Reversed(entryCircle)])
]);
var continuationCylinderFace = builder.AddFace([
- AddLoop(builder, [Forward(cylinderSeam), Reversed(transitionCircle), Reversed(cylinderSeam), Forward(deepEndCircle)])
+ AddLoop(builder, [Forward(cylinderSeam), Forward(deepEndCircle), Reversed(cylinderSeam), Reversed(transitionCircle)])
]);
FaceId? deepBottomFace = null;
@@ -1098,11 +1098,17 @@ public static class BrepBooleanBoxCylinderHoleBuilder
geometry.AddSurface(new SurfaceGeometryId(5), SurfaceGeometry.FromPlane(new PlaneSurface(new Point3D(0d, box.MaxY, 0d), Direction3D.Create(new Vector3D(0d, 1d, 0d)), Direction3D.Create(new Vector3D(-1d, 0d, 0d)))));
geometry.AddSurface(new SurfaceGeometryId(6), SurfaceGeometry.FromPlane(new PlaneSurface(new Point3D(box.MinX, 0d, 0d), Direction3D.Create(new Vector3D(-1d, 0d, 0d)), yAxis)));
- var cone = countersinkProfile.EntryCone.Surface.Cone!.Value;
- var coneOriginParameter = System.Math.Min(cone.MinAxisParameter, cone.MaxAxisParameter);
- var coneOrigin = cone.PointAtAxisParameter(coneOriginParameter);
- var coneRadius = cone.RadiusAtAxisParameter(coneOriginParameter);
- geometry.AddSurface(new SurfaceGeometryId(7), SurfaceGeometry.FromCone(new ConeSurface(coneOrigin, cone.Axis, coneRadius, cone.SemiAngleRadians, countersinkProfile.EntryCone.ReferenceAxis)));
+ // Construct the support cone directly from the admitted entry profile. The
+ // recognized subtract cone may carry an axis convention chosen for boolean
+ // classification; reusing that convention here previously placed the STEP
+ // cone at radius 3 on z=6 while its trim edge was at radius 4.
+ var coneAxis = countersinkProfile.EntryFromTop ? zAxis : Direction3D.Create(new Vector3D(0d, 0d, -1d));
+ geometry.AddSurface(new SurfaceGeometryId(7), SurfaceGeometry.FromCone(new ConeSurface(
+ transitionCenter,
+ coneAxis,
+ countersinkProfile.ContinuationRadius,
+ countersinkProfile.EntryCone.Surface.Cone!.Value.SemiAngleRadians,
+ countersinkProfile.EntryCone.ReferenceAxis)));
geometry.AddSurface(new SurfaceGeometryId(8), SurfaceGeometry.FromCylinder(new CylinderSurface(deepEndCenter, zAxis, countersinkProfile.ContinuationRadius, xAxis)));
if (deepBottomFace is not null)
{
@@ -1127,8 +1133,11 @@ public static class BrepBooleanBoxCylinderHoleBuilder
bindings.AddFaceBinding(new FaceGeometryBinding(xMaxFace, new SurfaceGeometryId(4)));
bindings.AddFaceBinding(new FaceGeometryBinding(yMaxFace, new SurfaceGeometryId(5)));
bindings.AddFaceBinding(new FaceGeometryBinding(yMinFace, new SurfaceGeometryId(6)));
- bindings.AddFaceBinding(new FaceGeometryBinding(countersinkConeFace, new SurfaceGeometryId(7)));
- bindings.AddFaceBinding(new FaceGeometryBinding(continuationCylinderFace, new SurfaceGeometryId(8)));
+ // The analytic cone/cylinder normals point radially away from the hole axis.
+ // For an internal void the solid's outward normal points toward the axis, so
+ // these faces must reverse the support-surface sense in STEP.
+ bindings.AddFaceBinding(new FaceGeometryBinding(countersinkConeFace, new SurfaceGeometryId(7), SameSense: false));
+ bindings.AddFaceBinding(new FaceGeometryBinding(continuationCylinderFace, new SurfaceGeometryId(8), SameSense: false));
if (deepBottomFace is FaceId deepBottomBinding)
{
bindings.AddFaceBinding(new FaceGeometryBinding(deepBottomBinding, new SurfaceGeometryId(9)));
@@ -1147,10 +1156,6 @@ public static class BrepBooleanBoxCylinderHoleBuilder
[entryVertex] = coneSeamStart,
[transitionVertex] = coneSeamEnd,
[deepEndVertex] = cylinderSeamEnd,
- [coneSeamStartVertex] = coneSeamStart,
- [coneSeamEndVertex] = coneSeamEnd,
- [cylinderSeamStartVertex] = cylinderSeamStart,
- [cylinderSeamEndVertex] = cylinderSeamEnd,
};
var body = new BrepBody(builder.Model, geometry, bindings, vertexPoints, composition);
diff --git a/Aetheris.Kernel.Core/Brep/Features/RevolvedProfileStackEmitter.cs b/Aetheris.Kernel.Core/Brep/Features/RevolvedProfileStackEmitter.cs
new file mode 100644
index 00000000..4fa7381b
--- /dev/null
+++ b/Aetheris.Kernel.Core/Brep/Features/RevolvedProfileStackEmitter.cs
@@ -0,0 +1,205 @@
+using System.Security.Cryptography;
+using System.Text;
+using Aetheris.Kernel.Core.Diagnostics;
+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.Results;
+using Aetheris.Kernel.Core.Topology;
+
+namespace Aetheris.Kernel.Core.Brep.Features;
+
+internal sealed record RevolvedProfileTopologyPlan(
+ IReadOnlyList<ProfilePoint2D> Profile,
+ ExtrudeFrame3D Frame,
+ RevolveAxis3D Axis,
+ int ExpectedVertexCount,
+ int ExpectedEdgeCount,
+ int ExpectedFaceCount,
+ int ExpectedLoopCount,
+ int ExpectedCoedgeCount,
+ string DeterministicSignature);
+
+internal sealed record RevolvedProfileStackResult(
+ BrepBody? Body,
+ int VertexCount,
+ int EdgeCount,
+ int FaceCount,
+ IReadOnlyList<string> Diagnostics)
+{
+ public bool Succeeded => Body is not null;
+}
+
+/// <summary>
+/// Exact full-revolution materializer for a bounded, open, piecewise-linear radial profile.
+/// Each profile segment becomes one analytic cylindrical or conical face; profile corners remain
+/// explicit circular topology. This is construction geometry, not a chamfer feature opcode.
+/// </summary>
+internal static class RevolvedProfileStackEmitter
+{
+ private const double Tol = 1e-12;
+
+ public static KernelResult<RevolvedProfileTopologyPlan> Plan(
+ IReadOnlyList<ProfilePoint2D> profile,
+ ExtrudeFrame3D frame,
+ RevolveAxis3D axis)
+ {
+ var errors = Validate(profile, frame, axis, out _, out _);
+ if (errors.Count != 0) return KernelResult<RevolvedProfileTopologyPlan>.Failure(errors);
+
+ var n = profile.Count;
+ var signatureText = string.Join(";", profile.Select(p => FormattableString.Invariant($"{p.X:R},{p.Y:R}")));
+ var signature = Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(signatureText)));
+ return KernelResult<RevolvedProfileTopologyPlan>.Success(new(
+ profile.ToArray(), frame, axis,
+ ExpectedVertexCount: n * 2,
+ ExpectedEdgeCount: (n - 1) + n,
+ ExpectedFaceCount: (n - 1) + 2,
+ ExpectedLoopCount: (n - 1) + 2,
+ ExpectedCoedgeCount: ((n - 1) * 4) + 2,
+ DeterministicSignature: signature));
+ }
+
+ public static RevolvedProfileStackResult Emit(RevolvedProfileTopologyPlan plan)
+ {
+ var validation = Validate(plan.Profile, plan.Frame, plan.Axis, out var axisDirection, out var radialDirection);
+ if (validation.Count != 0)
+ return new(null, 0, 0, 0, validation.Select(d => d.Message).ToArray());
+
+ var profile = plan.Profile;
+ var centers = profile.Select(p => plan.Axis.Origin + axisDirection.ToVector() * p.Y).ToArray();
+ var rims = profile.Select((p, i) => centers[i] + radialDirection.ToVector() * p.X).ToArray();
+ var builder = new TopologyBuilder();
+ var seamVertices = profile.Select(_ => builder.AddVertex()).ToArray();
+ var rimVertices = profile.Select(_ => builder.AddVertex()).ToArray();
+ var seamEdges = Enumerable.Range(0, profile.Count - 1).Select(i => builder.AddEdge(seamVertices[i], seamVertices[i + 1])).ToArray();
+ var circleEdges = Enumerable.Range(0, profile.Count).Select(i => builder.AddEdge(rimVertices[i], rimVertices[i])).ToArray();
+
+ var sideFaces = new FaceId[profile.Count - 1];
+ for (var i = 0; i < sideFaces.Length; i++)
+ sideFaces[i] = AddFaceWithLoop(builder,
+ [
+ EdgeUse.Forward(seamEdges[i]),
+ EdgeUse.Forward(circleEdges[i + 1]),
+ EdgeUse.Reversed(seamEdges[i]),
+ EdgeUse.Reversed(circleEdges[i]),
+ ]);
+ var bottomFace = AddFaceWithLoop(builder, [EdgeUse.Forward(circleEdges[0])]);
+ var topFace = AddFaceWithLoop(builder, [EdgeUse.Reversed(circleEdges[^1])]);
+ var shell = builder.AddShell([.. sideFaces, bottomFace, topFace]);
+ builder.AddBody([shell]);
+
+ var geometry = new BrepGeometryStore();
+ var bindings = new BrepBindingModel();
+ var curveId = 1;
+ for (var i = 0; i < seamEdges.Length; i++)
+ {
+ var id = new CurveGeometryId(curveId++);
+ geometry.AddCurve(id, CurveGeometry.FromLine(new Line3Curve(rims[i], Direction3D.Create(rims[i + 1] - rims[i]))));
+ bindings.AddEdgeBinding(new EdgeGeometryBinding(seamEdges[i], id, new ParameterInterval(0, (rims[i + 1] - rims[i]).Length)));
+ }
+ for (var i = 0; i < circleEdges.Length; i++)
+ {
+ var id = new CurveGeometryId(curveId++);
+ geometry.AddCurve(id, CurveGeometry.FromCircle(new Circle3Curve(centers[i], axisDirection, profile[i].X, radialDirection)));
+ bindings.AddEdgeBinding(new EdgeGeometryBinding(circleEdges[i], id, new ParameterInterval(0, 2 * double.Pi)));
+ }
+
+ var surfaceId = 1;
+ for (var i = 0; i < sideFaces.Length; i++)
+ {
+ var id = new SurfaceGeometryId(surfaceId++);
+ var a = profile[i];
+ var b = profile[i + 1];
+ if (System.Math.Abs(a.X - b.X) <= Tol)
+ {
+ geometry.AddSurface(id, SurfaceGeometry.FromCylinder(new CylinderSurface(centers[i], axisDirection, a.X, radialDirection)));
+ }
+ else
+ {
+ var slope = (b.X - a.X) / (b.Y - a.Y);
+ var apexY = a.Y - a.X / slope;
+ var apex = plan.Axis.Origin + axisDirection.ToVector() * apexY;
+ var coneAxis = slope > 0 ? axisDirection : Direction3D.Create(-axisDirection.ToVector());
+ geometry.AddSurface(id, SurfaceGeometry.FromCone(new ConeSurface(apex, coneAxis, System.Math.Atan(System.Math.Abs(slope)), radialDirection)));
+ }
+ bindings.AddFaceBinding(new FaceGeometryBinding(sideFaces[i], id));
+ }
+ var bottomSurface = new SurfaceGeometryId(surfaceId++);
+ geometry.AddSurface(bottomSurface, SurfaceGeometry.FromPlane(new PlaneSurface(centers[0], Direction3D.Create(-axisDirection.ToVector()), radialDirection)));
+ bindings.AddFaceBinding(new FaceGeometryBinding(bottomFace, bottomSurface));
+ var topSurface = new SurfaceGeometryId(surfaceId);
+ geometry.AddSurface(topSurface, SurfaceGeometry.FromPlane(new PlaneSurface(centers[^1], axisDirection, radialDirection)));
+ bindings.AddFaceBinding(new FaceGeometryBinding(topFace, topSurface));
+
+ var vertexPoints = new Dictionary<VertexId, Point3D>();
+ for (var i = 0; i < profile.Count; i++)
+ {
+ vertexPoints[seamVertices[i]] = rims[i];
+ vertexPoints[rimVertices[i]] = rims[i];
+ }
+ var body = new BrepBody(builder.Model, geometry, bindings, vertexPoints);
+ var bindingValidation = BrepBindingValidator.Validate(body, requireAllEdgeAndFaceBindings: true);
+ if (!bindingValidation.IsSuccess)
+ return new(null, 0, 0, 0, bindingValidation.Diagnostics.Select(d => d.Message).ToArray());
+
+ var vertices = body.Topology.Vertices.Count();
+ var edges = body.Topology.Edges.Count();
+ var faces = body.Topology.Faces.Count();
+ if (vertices != plan.ExpectedVertexCount || edges != plan.ExpectedEdgeCount || faces != plan.ExpectedFaceCount)
+ return new(null, vertices, edges, faces, ["revolved-profile-materialization-diverged-from-authoritative-plan"]);
+ return new(body, vertices, edges, faces,
+ [
+ "revolved-profile-authoritative-topology-plan-consumed",
+ "revolved-profile-analytic-cylinder-and-cone-surfaces-emitted",
+ "revolved-profile-section-splits-preserved",
+ ]);
+ }
+
+ private static List<KernelDiagnostic> Validate(
+ IReadOnlyList<ProfilePoint2D>? profile,
+ ExtrudeFrame3D frame,
+ RevolveAxis3D axis,
+ out Direction3D axisDirection,
+ out Direction3D radialDirection)
+ {
+ var diagnostics = new List<KernelDiagnostic>();
+ axisDirection = default;
+ radialDirection = default;
+ if (profile is null || profile.Count < 2)
+ diagnostics.Add(Error("Revolved profile requires at least two points."));
+ if (!Direction3D.TryCreate(axis.Direction, out axisDirection))
+ diagnostics.Add(Error("Revolved profile axis must be finite and non-zero."));
+ if (profile is not null && profile.Any(p => !double.IsFinite(p.X) || !double.IsFinite(p.Y) || p.X <= Tol))
+ diagnostics.Add(Error("Revolved profile points require finite positive radii and finite axial coordinates."));
+ if (profile is not null && profile.Zip(profile.Skip(1)).Any(pair => pair.Second.Y <= pair.First.Y + Tol))
+ diagnostics.Add(Error("Revolved profile axial coordinates must be strictly increasing."));
+ if (profile is not null && profile.Zip(profile.Skip(1)).Any(pair => System.Math.Abs(pair.Second.X - pair.First.X) > Tol && System.Math.Abs(pair.Second.Y - pair.First.Y) <= Tol))
+ diagnostics.Add(Error("Revolved profile does not admit radial-only segments."));
+ if (Direction3D.TryCreate(axis.Direction, out axisDirection))
+ {
+ var projected = frame.UAxis.ToVector() - axisDirection.ToVector() * frame.UAxis.ToVector().Dot(axisDirection.ToVector());
+ if (!Direction3D.TryCreate(projected, out radialDirection))
+ diagnostics.Add(Error("Revolved profile frame U axis must not be parallel to its revolution axis."));
+ }
+ return diagnostics;
+ }
+
+ private static FaceId AddFaceWithLoop(TopologyBuilder builder, IReadOnlyList<EdgeUse> uses)
+ {
+ var loop = builder.AllocateLoopId();
+ var coedges = uses.Select(_ => builder.AllocateCoedgeId()).ToArray();
+ for (var i = 0; i < uses.Count; i++)
+ builder.AddCoedge(new Coedge(coedges[i], uses[i].EdgeId, loop, coedges[(i + 1) % uses.Count], coedges[(i + uses.Count - 1) % uses.Count], uses[i].IsReversed));
+ builder.AddLoop(new Loop(loop, coedges));
+ return builder.AddFace([loop]);
+ }
+
+ private static KernelDiagnostic Error(string message) => new(KernelDiagnosticCode.InvalidArgument, KernelDiagnosticSeverity.Error, message);
+ private readonly record struct EdgeUse(EdgeId EdgeId, bool IsReversed)
+ {
+ public static EdgeUse Forward(EdgeId edge) => new(edge, false);
+ public static EdgeUse Reversed(EdgeId edge) => new(edge, true);
+ }
+}
diff --git a/Aetheris.Kernel.Firmament.Tests/ChamferM6LoweringTests.cs b/Aetheris.Kernel.Firmament.Tests/ChamferM6LoweringTests.cs
new file mode 100644
index 00000000..ee5090fb
--- /dev/null
+++ b/Aetheris.Kernel.Firmament.Tests/ChamferM6LoweringTests.cs
@@ -0,0 +1,76 @@
+using Aetheris.Kernel.Core.Air;
+using Aetheris.Kernel.Core.Geometry;
+
+namespace Aetheris.Kernel.Firmament.Tests;
+
+public sealed class ChamferM6LoweringTests
+{
+ [Theory]
+ [InlineData(20, 50, 1)]
+ [InlineData(7.5, 18, 2)]
+ [InlineData(12, 9, 0.75)]
+ public void CircularTopRim_GeneratesExactRevolutionWitnessAndChangedAnalyticBody(double radius, double height, double distance)
+ {
+ var result = AirCylinderTopRimChamferCompiler.Compile(Request(radius, height, distance));
+
+ Assert.True(result.Succeeded, string.Join(Environment.NewLine, result.Diagnostics));
+ Assert.Null(result.Error);
+ Assert.True(result.Construction!.Witness.CompilerGenerated);
+ Assert.Equal([(radius, -height / 2), (radius, height / 2 - distance), (radius - distance, height / 2)],
+ result.Construction.Witness.ReplacementProfile.Select(p => (p.X, p.Y)).ToArray());
+ Assert.True(result.BRepPlan!.IsAuthoritative);
+ Assert.NotNull(result.BRepPlan.RevolvedRealizationPlan);
+ Assert.Equal(6, result.Body!.Topology.Vertices.Count());
+ Assert.Equal(5, result.Body.Topology.Edges.Count());
+ Assert.Equal(4, result.Body.Topology.Faces.Count());
+ Assert.Equal(1, result.Body.Geometry.Surfaces.Count(s => s.Value.Kind == SurfaceGeometryKind.Cylinder));
+ Assert.Equal(1, result.Body.Geometry.Surfaces.Count(s => s.Value.Kind == SurfaceGeometryKind.Cone));
+ Assert.Equal(2, result.Body.Geometry.Surfaces.Count(s => s.Value.Kind == SurfaceGeometryKind.Plane));
+ Assert.Contains("revolved-profile-authoritative-topology-plan-consumed", result.Diagnostics);
+ }
+
+ [Theory]
+ [InlineData(20, 50, 0, "InvalidAuthoredInput", "chamfer-invalid-distance:must-be-positive")]
+ [InlineData(5, 20, 5, "DistanceTooLarge", "chamfer-distance-too-large:circular-top-rim")]
+ [InlineData(20, 0.5, 1, "DistanceTooLarge", "chamfer-distance-too-large:circular-top-rim")]
+ public void CircularTopRim_InvalidDistance_ReturnsTypedErrorBeforeTopology(
+ double radius, double height, double distance, string kind, string code)
+ {
+ var result = AirCylinderTopRimChamferCompiler.Compile(Request(radius, height, distance));
+ Assert.False(result.Succeeded);
+ Assert.Equal(kind, result.Error!.Kind.ToString());
+ Assert.Equal(code, result.Error.Code);
+ Assert.Null(result.BRepPlan);
+ Assert.Null(result.Body);
+ }
+
+ [Theory]
+ [InlineData("RectangularConcavePocketRim", "MissingConstructionWitness", "chamfer-missing-construction-witness:section-transition-does-not-support-holes")]
+ [InlineData("SingleStraightConvexEdge", "MissingConstructionWitness", "chamfer-missing-construction-witness:localized-planar-replacement-not-implemented")]
+ [InlineData("AdjacentEdgeJunction", "CornerPolicyRequired", "chamfer-corner-policy-required:multiple-valid-corner-patches")]
+ public void DeferredFamilies_ReturnPreciseConstructionErrors(
+ string family, string kind, string code)
+ {
+ var result = AirDeferredChamferLowerer.Lower(new("feature", Enum.Parse<AirDeferredChamferFamily>(family), "history-known semantic selection", 1,
+ ["support geometry declared", "material side declared", "retained/replacement ownership attempted"]));
+ Assert.False(result.IsSuccess);
+ Assert.Equal(kind, result.Error!.Kind.ToString());
+ Assert.Equal(code, result.Error.Code);
+ Assert.Equal("FeatureAIR->ConstructionAIR", result.Error.Stage);
+ Assert.NotEmpty(result.Error.Evidence!);
+ }
+
+ [Fact]
+ public void RectangularBaseline_UsesSameTypedLoweringBoundary()
+ {
+ var request = new AirTopFaceBoundaryChamferCompileRequest("Base", "Base.TopBreak", "TopBreak", 10, 8, 6, "+Z", "Boundary", "Chamfer", 1, new AirSourceSpan(0, 1, "test"));
+ var ok = AirTopFaceBoundaryChamferCompiler.Lower(request);
+ var invalid = AirTopFaceBoundaryChamferCompiler.Lower(request with { Distance = 4 });
+ Assert.True(ok.IsSuccess);
+ Assert.Equal(3, ok.Value!.Profiles.Count);
+ Assert.Equal(ChamferLoweringErrorKind.DistanceTooLarge, invalid.Error!.Kind);
+ }
+
+ private static AirCylinderTopRimChamferCompileRequest Request(double radius, double height, double distance) =>
+ new("Base", "Base.TopRim", "TopRim", radius, height, "+Z", "Boundary", "Chamfer", distance, new AirSourceSpan(0, 1, "test"));
+}
diff --git a/Aetheris.Kernel.Firmament.Tests/ChamferedEntryHoleVariantAndExecutorTests.cs b/Aetheris.Kernel.Firmament.Tests/ChamferedEntryHoleVariantAndExecutorTests.cs
index d0c2f601..887360a8 100644
--- a/Aetheris.Kernel.Firmament.Tests/ChamferedEntryHoleVariantAndExecutorTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/ChamferedEntryHoleVariantAndExecutorTests.cs
@@ -62,6 +62,15 @@ public sealed class ChamferedEntryHoleVariantAndExecutorTests
var result = HoleRecoveryExecutor.Execute(plan);
Assert.Equal(HoleRecoveryExecutionStatus.Succeeded, result.Status);
Assert.NotNull(result.Body);
+ AssertAllFaceLoopsAreTopologicallyClosed(result.Body!);
+ var inwardFaces = result.Body!.Bindings.FaceBindings
+ .Where(binding => result.Body.Geometry.GetSurface(binding.SurfaceGeometryId).Kind is
+ Aetheris.Kernel.Core.Geometry.SurfaceGeometryKind.Cone or
+ Aetheris.Kernel.Core.Geometry.SurfaceGeometryKind.Cylinder)
+ .ToArray();
+ Assert.Equal(2, inwardFaces.Length);
+ Assert.All(inwardFaces, binding => Assert.False(binding.SameSense));
+ AssertConeBoundaryVerticesLieOnSupport(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));
}
@@ -151,4 +160,49 @@ public sealed class ChamferedEntryHoleVariantAndExecutorTests
=> new CirSubtractNode(new CirSubtractNode(new CirBoxNode(20d,20d,10d), new CirCylinderNode(2d,20d)), new CirTransformNode(new CirConeNode(2.8d, 2d, 1d), Transform3D.CreateTranslation(new Vector3D(0d, 0d, -4.5d))));
private static CirNode BuildCountersinkBottom()
=> new CirSubtractNode(new CirSubtractNode(new CirBoxNode(20d,20d,10d), new CirCylinderNode(2d,20d)), new CirTransformNode(new CirConeNode(4d, 2d, 4d), Transform3D.CreateTranslation(new Vector3D(0d, 0d, -3d))));
+
+ private static void AssertAllFaceLoopsAreTopologicallyClosed(Aetheris.Kernel.Core.Brep.BrepBody body)
+ {
+ foreach (var loop in body.Topology.Loops)
+ {
+ var coedges = loop.CoedgeIds.Select(body.Topology.GetCoedge).ToArray();
+ for (var i = 0; i < coedges.Length; i++)
+ {
+ var current = coedges[i];
+ var next = coedges[(i + 1) % coedges.Length];
+ var currentEdge = body.Topology.GetEdge(current.EdgeId);
+ var nextEdge = body.Topology.GetEdge(next.EdgeId);
+ var currentEnd = current.IsReversed ? currentEdge.StartVertexId : currentEdge.EndVertexId;
+ var nextStart = next.IsReversed ? nextEdge.EndVertexId : nextEdge.StartVertexId;
+ Assert.True(currentEnd == nextStart,
+ $"Loop {loop.Id.Value} is disconnected between coedges {current.Id.Value} and {next.Id.Value}: " +
+ $"vertex {currentEnd.Value} != {nextStart.Value}.");
+ }
+ }
+ }
+
+ private static void AssertConeBoundaryVerticesLieOnSupport(Aetheris.Kernel.Core.Brep.BrepBody body)
+ {
+ var binding = Assert.Single(body.Bindings.FaceBindings, candidate =>
+ body.Geometry.GetSurface(candidate.SurfaceGeometryId).Kind == Aetheris.Kernel.Core.Geometry.SurfaceGeometryKind.Cone);
+ var cone = body.Geometry.GetSurface(binding.SurfaceGeometryId).Cone!.Value;
+ var face = body.Topology.GetFace(binding.FaceId);
+ foreach (var vertexId in face.LoopIds
+ .Select(body.Topology.GetLoop)
+ .SelectMany(loop => loop.CoedgeIds)
+ .Select(body.Topology.GetCoedge)
+ .SelectMany(coedge =>
+ {
+ var edge = body.Topology.GetEdge(coedge.EdgeId);
+ return new[] { edge.StartVertexId, edge.EndVertexId };
+ })
+ .Distinct())
+ {
+ Assert.True(body.TryGetVertexPoint(vertexId, out var point));
+ var fromApex = point - cone.Apex;
+ var axial = fromApex.Dot(cone.Axis.ToVector());
+ var radialSquared = Math.Max(0d, fromApex.Dot(fromApex) - axial * axial);
+ Assert.Equal(axial * Math.Tan(cone.SemiAngleRadians), Math.Sqrt(radialSquared), 9);
+ }
+ }
}
diff --git a/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs b/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs
index 68fe6575..290bcdf6 100644
--- a/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs
@@ -136,6 +136,21 @@ public static class FirmamentBuildAndExport
"FirmamentV2.InlineStep")).ToArray());
}
+ var fatalV2Diagnostics = v2Parse.Diagnostics.Where(FirmamentV2Parser.IsFatalDiagnosticCode).Distinct(StringComparer.Ordinal).ToArray();
+ var trimmedSource = sourceText.TrimStart();
+ var isV2ModelSource = trimmedSource.StartsWith("model ", StringComparison.Ordinal)
+ || trimmedSource.StartsWith("Model ", StringComparison.Ordinal)
+ || sourceText.Contains("\nmodel ", StringComparison.Ordinal)
+ || sourceText.Contains("\nModel ", StringComparison.Ordinal);
+ if (isV2ModelSource && fatalV2Diagnostics.Length > 0)
+ {
+ return KernelResult<FirmamentStepExportResult>.Failure(fatalV2Diagnostics.Select(code => new Kernel.Core.Diagnostics.KernelDiagnostic(
+ Kernel.Core.Diagnostics.KernelDiagnosticCode.ValidationFailed,
+ Kernel.Core.Diagnostics.KernelDiagnosticSeverity.Error,
+ code,
+ "FirmamentV2.Parse")).ToArray());
+ }
+
return FirmamentStepExporter.Export(new FirmamentCompileRequest(new FirmamentSourceDocument(sourceText)));
}
@@ -149,8 +164,10 @@ public static class FirmamentBuildAndExport
var (modify, finish) = finishes[0];
var solid = document.Solids.SingleOrDefault(s => s.Name == modify.TargetSolid);
+ if (solid?.Primitive is FirmamentV2CylinderRecord cylinder)
+ return ExportV2CircularRimChamfer(document, solid, finish, cylinder);
if (solid?.Primitive is not FirmamentV2BoxRecord box || box.Size.Count != 3)
- return AirChamferFailure("air-chamfer-history-known-rectangular-prism-required");
+ return AirChamferFailure("chamfer-unsupported-history:expected-history-known-box-or-right-circular-cylinder");
var compiled = AirTopFaceBoundaryChamferCompiler.Compile(new(
solid.Name,
@@ -199,6 +216,66 @@ public static class FirmamentBuildAndExport
step.Value, compiled.Feature.FeatureId, 0, "air-chamfer", "top-face-boundary-chamfer", Air: report, ConceptIr: document.ConceptIr));
}
+ private static KernelResult<FirmamentStepExportResult> ExportV2CircularRimChamfer(
+ FirmamentV2Document document,
+ FirmamentV2SolidBinding solid,
+ FirmamentV2EdgeFinishDecl finish,
+ FirmamentV2CylinderRecord cylinder)
+ {
+ var compiled = AirCylinderTopRimChamferCompiler.Compile(new(
+ solid.Name,
+ $"{solid.Name}.{finish.Name}",
+ finish.Name,
+ cylinder.Radius,
+ cylinder.Height,
+ finish.FaceAxis,
+ 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?.RevolvedRealizationPlan is null)
+ return AirChamferFailure(compiled.Error?.Code ?? compiled.Feature.AdmissionReason, compiled.Diagnostics);
+
+ var manifold = FirmamentManifoldChecker.IsManifold(compiled.Body);
+ if (!manifold) return AirChamferFailure("chamfer-backend-circular-rim-body-is-not-manifold", compiled.Diagnostics);
+ var step = Step242Exporter.ExportBody(compiled.Body, new Step242ExportOptions
+ {
+ ProductName = compiled.Feature.FeatureName,
+ ApplicationName = AirCylinderTopRimChamferCompileResult.ProductionRoute,
+ });
+ if (!step.IsSuccess || step.Value is null) return KernelResult<FirmamentStepExportResult>.Failure(step.Diagnostics);
+ var reimport = Step242Importer.ImportBody(step.Value);
+ if (!reimport.IsSuccess || reimport.Value is null) return KernelResult<FirmamentStepExportResult>.Failure(reimport.Diagnostics);
+ var reimportedManifold = FirmamentManifoldChecker.IsManifold(reimport.Value);
+ if (!reimportedManifold) return AirChamferFailure("chamfer-verification-circular-rim-step-reimport-is-not-manifold");
+
+ var topology = compiled.Construction.TopologyPlan;
+ var surfaces = compiled.Body.Geometry.Surfaces.Select(s => s.Value.Kind).ToArray();
+ var sharp = compiled.Construction.Witness.SharpProfile.Select(p => (IReadOnlyList<double>)new[] { p.X, p.Y }).ToArray();
+ var replacement = compiled.Construction.Witness.ReplacementProfile.Select(p => (IReadOnlyList<double>)new[] { p.X, p.Y }).ToArray();
+ var featureProvenance = new Dictionary<string, string>(StringComparer.Ordinal);
+ if (solid.Provenance?.TryGetValue("Bounds", out var boundsProvenance) == true) featureProvenance["Bounds"] = boundsProvenance;
+ if (finish.Provenance?.TryGetValue("Face", out var faceProvenance) == true) featureProvenance["Selection"] = faceProvenance;
+ if (finish.Provenance?.TryGetValue("Distance", out var distanceProvenance) == true) featureProvenance["Distance"] = distanceProvenance;
+ var report = new FirmamentAirChamferReport(
+ new("Chamfer", compiled.Feature.BodyId, compiled.Feature.FeatureId, compiled.Feature.FeatureName, "FaceBoundary(+Z,circular,outer,complete)", compiled.Feature.Rule.Distance, compiled.Feature.Rule.Unit,
+ $"{compiled.Feature.SourceSpan.Start}:{compiled.Feature.SourceSpan.Length}", compiled.Feature.Admission.ToString(), compiled.Feature.AdmissionReason, featureProvenance),
+ new("RevolutionProfileRewrite", 0, [], "ordered-radial-profile", "preserve-profile-corners",
+ $"axis={compiled.Construction.Witness.Axis};materialSide={compiled.Construction.Witness.MaterialSide}", compiled.Construction.Witness.CompilerGenerated, sharp, replacement),
+ new(true, topology.ExpectedVertexCount, topology.ExpectedEdgeCount, topology.ExpectedFaceCount, topology.ExpectedLoopCount, topology.ExpectedCoedgeCount, 1,
+ "preserve-profile-corners", topology.DeterministicSignature, "RevolvedProfile"),
+ new(AirCylinderTopRimChamferCompileResult.ProductionRoute, false, manifold,
+ compiled.Body.Topology.Vertices.Count(), compiled.Body.Topology.Edges.Count(), compiled.Body.Topology.Faces.Count(), CircularBounds(cylinder.Radius, cylinder.Height), finish.Distance, finish.Distance,
+ surfaces.Count(k => k == SurfaceGeometryKind.Cylinder), surfaces.Count(k => k == SurfaceGeometryKind.Cone), surfaces.Count(k => k == SurfaceGeometryKind.Plane)),
+ 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(), CircularBounds(cylinder.Radius, cylinder.Height), reimportedManifold));
+ return KernelResult<FirmamentStepExportResult>.Success(new FirmamentStepExportResult(
+ step.Value, compiled.Feature.FeatureId, 0, "air-chamfer", "circular-top-rim-chamfer", Air: report, ConceptIr: document.ConceptIr));
+ }
+
+ private static string CircularBounds(double radius, double height) =>
+ FormattableString.Invariant($"[{-radius:0.###},{-radius:0.###},{-height / 2d:0.###}]..[{radius:0.###},{radius:0.###},{height / 2d:0.###}]");
+
private static string Bounds(BrepBody body)
{
var points = body.Topology.Vertices.Select(v => body.TryGetVertexPoint(v.Id, out var point) ? point : throw new InvalidOperationException($"Missing point for vertex {v.Id}.")).ToArray();
@@ -501,6 +578,12 @@ public static class FirmamentBuildAndExport
return KernelResult<FirmamentStepExportResult>.Failure(step.Diagnostics);
}
+ var reimport = Step242Importer.ImportBody(step.Value);
+ if (!reimport.IsSuccess || reimport.Value is null)
+ return KernelResult<FirmamentStepExportResult>.Failure(reimport.Diagnostics);
+ var stepHash = Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(step.Value)));
+ var surfaceKinds = body.Geometry.Surfaces.Select(s => s.Value.Kind).ToArray();
+
var featureReports = semanticHoles.Select(h => new FirmamentHoleFeatureReport(
h.Name,
"Hole",
@@ -514,7 +597,21 @@ public static class FirmamentBuildAndExport
h.Placement.ResolvedPoint3?.Ordinal,
h.Placement.ResolvedPoint3?.PlacementFace ?? h.Placement.EntryFaceName,
h.Placement.ResolvedPoint3?.SourceSpan,
- semanticHoles.Count == 1 ? nameof(AirHoleSimpleShaftMaterializer) : nameof(AirHoleCompositeMaterializer))).ToArray();
+ semanticHoles.Count == 1 ? nameof(AirHoleSimpleShaftMaterializer) : nameof(AirHoleCompositeMaterializer),
+ "HoleProfileStack",
+ h.Stack.Kind.ToString(),
+ string.Join(" -> ", h.Stack.Components.Select(component => component switch
+ {
+ AirHoleCountersinkComponent countersink => $"conical-entry(entryRadius={countersink.EntryRadius:R},angle={countersink.AngleDegrees:R})",
+ AirHoleCounterboreComponent counterbore => $"counterbore(radius={counterbore.Radius:R},depth={counterbore.Depth:R})",
+ AirHoleShaftComponent shaft => $"cylindrical-shaft(radius={shaft.Radius:R},{shaft.EndCondition.Kind})",
+ _ => component.Kind.ToString(),
+ })),
+ surfaceKinds.Count(k => k == SurfaceGeometryKind.Cylinder),
+ surfaceKinds.Count(k => k == SurfaceGeometryKind.Cone),
+ surfaceKinds.Count(k => k == SurfaceGeometryKind.Plane),
+ stepHash,
+ true)).ToArray();
return KernelResult<FirmamentStepExportResult>.Success(
new FirmamentStepExportResult(
step.Value,
diff --git a/Aetheris.Kernel.Firmament/FirmamentStepExportResult.cs b/Aetheris.Kernel.Firmament/FirmamentStepExportResult.cs
index f4b2f7a6..b5e0035a 100644
--- a/Aetheris.Kernel.Firmament/FirmamentStepExportResult.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentStepExportResult.cs
@@ -29,7 +29,15 @@ public sealed record FirmamentHoleFeatureReport(
int? PointOrdinal,
string PlacementFace,
string? SourceSpan,
- string MaterializationRoute);
+ string MaterializationRoute,
+ string? ConstructionKind = null,
+ string? StackKind = null,
+ string? WitnessSummary = null,
+ int CylindricalFaces = 0,
+ int ConicalFaces = 0,
+ int PlanarFaces = 0,
+ string? StepSha256 = null,
+ bool StepReimportSucceeded = false);
public sealed record FirmamentAirChamferReport(
FirmamentAirChamferFeatureReport Feature,
@@ -39,9 +47,18 @@ public sealed record FirmamentAirChamferReport(
FirmamentAirChamferStepReport Step);
public sealed record FirmamentAirChamferFeatureReport(string Kind, string Body, string FeatureId, string FeatureName, string Selection, double Distance, string Unit, string SourceSpan, string Admission, string AdmissionReason, IReadOnlyDictionary<string, string>? Provenance = null);
-public sealed record FirmamentAirChamferConstructionReport(string Kind, int SectionCount, IReadOnlyList<double> SectionZ, string Correspondence, string SplitPolicy);
-public sealed record FirmamentAirChamferBRepPlanReport(bool Authoritative, int ExpectedVertices, int ExpectedEdges, int ExpectedFaces, int ExpectedLoops, int ExpectedCoedges, int ChamferFaces, string SplitPolicy, string DeterministicSignature);
-public sealed record FirmamentAirChamferMaterializationReport(string Route, bool LegacyFallback, bool EnclosedManifold, int Vertices, int Edges, int Faces, string Bounds, double MeasuredTopInsetX, double MeasuredTopInsetY);
+public sealed record FirmamentAirChamferConstructionReport(
+ string Kind,
+ int SectionCount,
+ IReadOnlyList<double> SectionZ,
+ string Correspondence,
+ string SplitPolicy,
+ string? WitnessSummary = null,
+ bool CompilerGeneratedWitness = false,
+ IReadOnlyList<IReadOnlyList<double>>? SharpProfile = null,
+ IReadOnlyList<IReadOnlyList<double>>? ReplacementProfile = null);
+public sealed record FirmamentAirChamferBRepPlanReport(bool Authoritative, int ExpectedVertices, int ExpectedEdges, int ExpectedFaces, int ExpectedLoops, int ExpectedCoedges, int ChamferFaces, string SplitPolicy, string DeterministicSignature, string? PlanKind = null);
+public sealed record FirmamentAirChamferMaterializationReport(string Route, bool LegacyFallback, bool EnclosedManifold, int Vertices, int Edges, int Faces, string Bounds, double MeasuredTopInsetX, double MeasuredTopInsetY, int CylindricalFaces = 0, int ConicalFaces = 0, int PlanarFaces = 0);
public sealed record FirmamentAirChamferStepReport(string Schema, string Sha256, bool ReimportSucceeded, int ReimportedVertices, int ReimportedEdges, int ReimportedFaces, string ReimportedBounds, bool ReimportedManifold);
public sealed record FirmamentPmiInspectionDatum(
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs
index ad5e1fe5..af66e2f9 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs
@@ -718,11 +718,11 @@ public static class FirmamentV2Parser
private static FirmamentV2ParseResult ParsePhase3ModelingDocument(string source, List<string> diagnostics)
{
var model = Regex.Match(source, @"^\s*Model\s+(?<name>[A-Za-z_][A-Za-z0-9_]*)\s+(?<units>[A-Za-z_][A-Za-z0-9_]*)\b", RegexOptions.CultureInvariant);
- var box = Regex.Match(source, @"\bBox\s+(?<name>[A-Za-z_][A-Za-z0-9_]*)\s*\{", RegexOptions.CultureInvariant);
+ var primitive = Regex.Match(source, @"\b(?<type>Box|Cylinder)\s+(?<name>[A-Za-z_][A-Za-z0-9_]*)\s*\{", RegexOptions.CultureInvariant);
var modify = Regex.Match(source, @"\bModify\s+(?<target>[A-Za-z_][A-Za-z0-9_]*)\s*\{", RegexOptions.CultureInvariant);
var edge = Regex.Match(source, @"\bEdgeFinish\s+(?<name>[A-Za-z_][A-Za-z0-9_]*)\s*\{", RegexOptions.CultureInvariant);
- if (!model.Success || !box.Success || !modify.Success || !edge.Success || model.Groups["units"].Value != "mm"
- || Regex.Matches(source, @"\bBox\s+[A-Za-z_]", RegexOptions.CultureInvariant).Count != 1
+ if (!model.Success || !primitive.Success || !modify.Success || !edge.Success || model.Groups["units"].Value != "mm"
+ || Regex.Matches(source, @"\b(?:Box|Cylinder)\s+[A-Za-z_]", RegexOptions.CultureInvariant).Count != 1
|| Regex.Matches(source, @"\bModify\s+[A-Za-z_]", RegexOptions.CultureInvariant).Count != 1
|| Regex.Matches(source, @"\bEdgeFinish\s+[A-Za-z_]", RegexOptions.CultureInvariant).Count != 1)
diagnostics.Add(Phase3EdgeFinishSyntaxInvalid);
@@ -730,34 +730,45 @@ public static class FirmamentV2Parser
if (diagnostics.Contains(Phase3EdgeFinishSyntaxInvalid))
return FirmamentV2ParseResult.Failure(diagnostics.Append("firmament-v2-parse-failed").Order().ToArray());
- var boxOpen = source.IndexOf('{', box.Index);
- var boxClose = FindMatchingBrace(source, boxOpen);
+ var primitiveOpen = source.IndexOf('{', primitive.Index);
+ var primitiveClose = FindMatchingBrace(source, primitiveOpen);
var modifyOpen = source.IndexOf('{', modify.Index);
var modifyClose = FindMatchingBrace(source, modifyOpen);
var edgeOpen = source.IndexOf('{', edge.Index);
var edgeClose = FindMatchingBrace(source, edgeOpen);
- if (boxClose < 0 || modifyClose < 0 || edgeClose < 0 || edge.Index < modifyOpen || edgeClose > modifyClose)
+ if (primitiveClose < 0 || modifyClose < 0 || edgeClose < 0 || edge.Index < modifyOpen || edgeClose > modifyClose)
{
diagnostics.Add(Phase3EdgeFinishSyntaxInvalid);
return FirmamentV2ParseResult.Failure(diagnostics.Append("firmament-v2-parse-failed").Order().ToArray());
}
- var sizeMatch = Regex.Match(source[(boxOpen + 1)..boxClose], @"\bSize\s*:\s*\[(?<values>[^\]]+)\]", RegexOptions.CultureInvariant);
+ var primitiveBody = source[(primitiveOpen + 1)..primitiveClose];
+ var sizeMatch = Regex.Match(primitiveBody, @"\bSize\s*:\s*\[(?<values>[^\]]+)\]", RegexOptions.CultureInvariant);
var values = sizeMatch.Success ? sizeMatch.Groups["values"].Value.Split(',').Select(ParsePhase3Length).ToArray() : [];
+ var radiusMatch = Regex.Match(primitiveBody, @"\bRadius\s*:\s*(?<value>[-+0-9.eE]+mm)\b", RegexOptions.CultureInvariant);
+ var heightMatch = Regex.Match(primitiveBody, @"\bHeight\s*:\s*(?<value>[-+0-9.eE]+mm)\b", RegexOptions.CultureInvariant);
+ var radiusValue = radiusMatch.Success ? ParsePhase3Length(radiusMatch.Groups["value"].Value) : double.NaN;
+ var heightValue = heightMatch.Success ? ParsePhase3Length(heightMatch.Groups["value"].Value) : double.NaN;
var edgeBody = source[(edgeOpen + 1)..edgeClose];
var face = Regex.Match(edgeBody, @"\bFace\s*:\s*(?<value>[+-][XYZ])", RegexOptions.CultureInvariant);
var target = Regex.Match(edgeBody, @"\bTarget\s*:\s*(?<value>[A-Za-z_][A-Za-z0-9_]*)", RegexOptions.CultureInvariant);
var kind = Regex.Match(edgeBody, @"\bKind\s*:\s*(?<value>[A-Za-z_][A-Za-z0-9_]*)", RegexOptions.CultureInvariant);
var distance = Regex.Match(edgeBody, @"\bDistance\s*:\s*(?<value>[-+0-9.eE]+)mm\b", RegexOptions.CultureInvariant);
- if (values.Length != 3 || values.Any(v => !double.IsFinite(v) || v <= 0d) || !face.Success || !target.Success || !kind.Success || !distance.Success
+ var primitiveValid = primitive.Groups["type"].Value == "Box"
+ ? values.Length == 3 && values.All(v => double.IsFinite(v) && v > 0d)
+ : double.IsFinite(radiusValue) && radiusValue > 0d && double.IsFinite(heightValue) && heightValue > 0d;
+ if (!primitiveValid || !face.Success || !target.Success || !kind.Success || !distance.Success
|| !double.TryParse(distance.Groups["value"].Value, NumberStyles.Float, CultureInfo.InvariantCulture, out var distanceValue) || !double.IsFinite(distanceValue)
- || box.Groups["name"].Value != modify.Groups["target"].Value)
+ || primitive.Groups["name"].Value != modify.Groups["target"].Value)
{
diagnostics.Add(Phase3EdgeFinishSyntaxInvalid);
return FirmamentV2ParseResult.Failure(diagnostics.Append("firmament-v2-parse-failed").Order().ToArray());
}
- var solid = new FirmamentV2SolidBinding(box.Groups["name"].Value, "Box", new FirmamentV2BoxRecord(values, []));
+ FirmamentV2PrimitiveRecord primitiveRecord = primitive.Groups["type"].Value == "Box"
+ ? new FirmamentV2BoxRecord(values, [])
+ : new FirmamentV2CylinderRecord(radiusValue, heightValue);
+ var solid = new FirmamentV2SolidBinding(primitive.Groups["name"].Value, primitive.Groups["type"].Value, primitiveRecord);
var finish = new FirmamentV2EdgeFinishDecl(edge.Groups["name"].Value, face.Groups["value"].Value, target.Groups["value"].Value, kind.Groups["value"].Value, distanceValue, new FirmamentV2SourceSpan(edge.Index, edgeClose - edge.Index + 1));
var document = new FirmamentV2Document(model.Groups["name"].Value, "mm", [solid], [new FirmamentV2ModifyBlock(solid.Name, [], [], [finish])]);
diagnostics.Add("firmament-v2-phase3-edge-finish-parsed");
diff --git a/docs/implementation/cad-assistant-independent-visual-validation.md b/docs/implementation/cad-assistant-independent-visual-validation.md
new file mode 100644
index 00000000..5f8c8a8b
--- /dev/null
+++ b/docs/implementation/cad-assistant-independent-visual-validation.md
@@ -0,0 +1,70 @@
+# CAD Assistant independent visual validation
+
+CAD Assistant is an independent OCCT-based STEP importer, tessellator, and viewer. Aetheris uses it as a manual visual smoke test after its own build, topology, and STEP reimport checks. This reduces the chance that the same Aetheris assumptions are repeated at every validation layer.
+
+It is deliberately optional: CAD Assistant is not a compiler dependency, does not run in automated .NET tests, and is not a geometric oracle.
+
+## Launcher
+
+The Windows-first launcher defaults to searching `C:\Program Files\CAD Assistant` and uses a deterministic discovery rule: one `CADAssistant.exe` is accepted; otherwise it only accepts a single unambiguous CAD Assistant-named executable. It rejects missing paths and ambiguous candidates.
+
+```powershell
+powershell -NoProfile -ExecutionPolicy Bypass `
+ -File tools/Open-In-CadAssistant.ps1 `
+ -Step artifacts/template-m4b-standard.step
+```
+
+Specify the viewer explicitly when it is installed elsewhere. The precedence is `-CadAssistantPath`, then `AETHERIS_CAD_ASSISTANT_EXE`, then the default installation search.
+
+```powershell
+tools/Open-In-CadAssistant.ps1 -Step 'C:\work\part.step' `
+ -CadAssistantPath 'D:\CAD Assistant\CADAssistant.exe' `
+ -BuildReport 'C:\work\build-report.json' `
+ -AnalyzeReport 'C:\work\analyze-report.json'
+
+$env:AETHERIS_CAD_ASSISTANT_EXE = 'D:\CAD Assistant\CADAssistant.exe'
+tools/Open-In-CadAssistant.ps1 -Step 'C:\work\part.step'
+```
+
+The launcher resolves and prints the STEP artifact path and SHA-256 before launch, as well as any supplied build/analyze report paths. `-NoLaunch` validates and prints the launch specification without opening a GUI; it is useful for tooling tests and review preparation.
+
+## Evidence stack and boundaries
+
+| Layer | Role |
+| --- | --- |
+| Aetheris build/tests | Authoritative compiler-stage correctness, Concept IR and Feature AIR provenance, BRepPlan parity, topology counts/roles, manifold checks, analytic dimensions, volume, semantic PMI, and Aetheris-emitted STEP evidence. |
+| Aetheris STEP reimport/analyze | First-party round-trip verification. |
+| CAD Assistant / OCCT | Independent manual importer, tessellator, and visual smoke test. |
+| Cadmata | Future dedicated Aetheris visual environment. |
+
+CAD Assistant can provide independent evidence that the STEP opens in OCCT, the expected body and silhouette are visible, holes and chamfers appear where expected, faces are not visibly missing or inverted, shell orientation looks sane, and unexpected seams or tessellation artifacts are noticed. Section/clipping tools can be used manually when interior geometry matters.
+
+It does **not** prove original feature history, semantic provenance, exact PMI completeness, every topology identity, full AP242 semantics, or Aetheris compiler correctness. “CAD Assistant opened the file” is never sufficient proof; retain the Aetheris build and analyze evidence.
+
+## Review packet convention
+
+Keep visual evidence alongside the exact artifact, preferably under `artifacts/visual-validation/<case>/`:
+
+```text
+model.step
+build-report.json
+analyze-report.json
+visual-validation.json
+README.md
+cad-assistant.png
+```
+
+`visual-validation.json` may record the STEP filename and hash, report filenames, the discovered viewer executable, `"validationRole": "Independent OCCT visual smoke test"`, and `"status": "PendingManualReview"`. Add `cad-assistant.png` only after a human or Codex has inspected the opened model. The launcher does not copy, transform, or rewrite the STEP file.
+
+## Manual checklist
+
+1. Confirm the expected number of visible bodies.
+2. Spin the model and inspect all sides.
+3. Use shaded-with-edges or equivalent mode.
+4. Inspect chamfer transitions and hole openings.
+5. Check for missing, inverted, or visually collapsed faces.
+6. Use section/clipping tools when internal geometry matters.
+7. Save a screenshot tied to the exact STEP hash.
+8. Record pass/fail notes without replacing machine validation.
+
+Cadmata should eventually consume or emit the same lightweight packet metadata and screenshots, while keeping CAD Assistant a separate, independent visual check rather than coupling compiler work to a desktop CAD installation.
diff --git a/docs/implementation/chamfer-fixture-pressure-m6.md b/docs/implementation/chamfer-fixture-pressure-m6.md
new file mode 100644
index 00000000..e183b0e4
--- /dev/null
+++ b/docs/implementation/chamfer-fixture-pressure-m6.md
@@ -0,0 +1,87 @@
+# CHAMFER-FIXTURE-PRESSURE-M6 — bounded chamfer lowering report
+
+## Outcome
+
+The architecture generalizes across two exact outer-boundary construction families and reuses a third existing semantic-hole construction family:
+
+1. rectangular `+Z` outer loop -> generated three-section witness -> `SectionTransition`;
+2. right-cylinder `+Z` circular rim -> generated radial profile witness -> `RevolutionProfileRewrite`;
+3. history-known through-hole entry -> semantic countersink stack constrained to a 90-degree, equal-radial/axial entry break -> `HoleProfileStack`.
+
+This is meaningful bounded chamfer support, not universal edge finishing. Concave pocket loops, localized single edges, and interacting-edge junctions are rejected before BRep emission with typed errors.
+
+## Fixture matrix
+
+| Family | Semantic input | Construction witness/strategy | Result |
+|---|---|---|---|
+| Rectangular baseline | history-known box, complete `+Z` outer boundary, uniform distance | profiles at `z=0`, `z=H-d`, `z=H`; identity correspondence; `SectionTransition` | supported; authoritative prismatic BRepPlan |
+| Circular convex rim | history-known right cylinder, complete `+Z` outer boundary | axis plus sharp profile `(R,-H/2),(R,H/2)` and replacement `(R,-H/2),(R,H/2-d),(R-d,H/2)`; `RevolutionProfileRewrite` | supported; authoritative revolved-profile BRepPlan |
+| Internal circular entry | history-known `+Z` through hole; shaft `6`, entry `8`, angle `90` | conical entry radius `4` -> cylindrical shaft radius `3`; `HoleProfileStack` | supported through existing semantic-hole materializer; no unified AirBRepPlan yet |
+| Rectangular concave pocket rim | complete inner rectangular loop | attempted outer host, opening inner loop, lowered/inset inner loop | `MissingConstructionWitness`: current section transition admits no holes/inner loops |
+| Single straight convex edge | `+X/+Z` shared edge | attempted retained regions, bounded diagonal support plane, two trim boundaries | `MissingConstructionWitness`: localized retained/replacement region plan absent |
+| Adjacent edge junction | two convex edges sharing a vertex | attempted two bounded support strips | `CornerPolicyRequired`: miter, setback, and explicit corner patch are all valid |
+
+## Compiler changes
+
+`ChamferLoweringResult<T>` is the Result-shaped boundary. Its error carries category, stable code, message, stage, and evidence. Rectangular and circular lowerers use this boundary. Deferred executable cases prove `MissingConstructionWitness` and `CornerPolicyRequired` without constructing a BRepPlan or body.
+
+`RevolvedProfileStackEmitter` is the reusable construction primitive added by the circular fixtures. It consumes an authoritative plan for a bounded open piecewise-linear radial profile and emits one exact cylinder or cone per segment, full circular profile edges, planar end caps, stable counts, and a deterministic profile signature. It is deliberately not named after chamfer and does not replace the narrower public two-point `BrepRevolve` API.
+
+The circular compiler generates the same witness an explicit desugared form would contain: axis, sharp profile, replacement profile, and material side. Build JSON exposes all of these. Firmament Concept Struct syntax was not expanded for radial profiles because this deterministic case does not need authored disambiguation; adding an unproven general radial-profile authoring language would be speculative. The typed witness remains the debug representation and regression oracle.
+
+The Phase 3 parser now admits exactly one `Cylinder` plus one `EdgeFinish` in the same bounded syntax already used for the box route. It does not claim arbitrary cylinder selection or imported history.
+
+The semantic-hole report now exposes `HoleProfileStack`, stack kind, generated witness summary, surface-family counts, STEP hash, and reimport status. This made an architectural inconsistency visible: the hole stack is exact and semantic, but it still materializes through its established specialized path rather than a shared authoritative `AirBRepPlan`. Converging that lane is follow-up work; it was not hidden behind a false plan claim.
+
+## Geometry evidence
+
+| Artifact | Topology V/E/F | Surfaces | Bounds | Exact volume | SHA-256 |
+|---|---:|---|---|---:|---|
+| rectangular top loop | 12/20/10 | 10 planes, including 4 changed chamfer faces | `[-5,-4,0]..[5,4,6]` | planar-shell path remains covered by baseline tests | `1A982C...74AE0` |
+| cylinder top rim (`R=20,H=50,d=1`) | 6/5/4 | 2 planes, 1 cylinder, 1 cone | `[-20,-20,-25]..[20,20,25]` | `62770.068416275266` | `AB37BB...DE6C` |
+| through-hole entry (`shaft=6,entry=8,90deg`) | 15/17/8 | 6 planes, 1 cylinder, 1 cone | `[-15,-12,-6]..[15,12,6]` | `8290.236017900337` | `F3B8AF...1E14` |
+
+The analyzer now includes full-circle curve extrema in body bounds. This corrects the prior collapsed seam-vertex bounds for periodic circular topology. It also exactly integrates admitted piecewise-linear revolved profiles as cylinder/frustum intervals; no voxel approximation is involved.
+
+All three retained artifacts reimport through `Step242Importer` as enclosed manifolds. Parameter changes produce different deterministic hashes and analytic dimensions. Zero and oversized circular distances fail before STEP creation. There is no legacy fallback.
+
+## Independent CAD Assistant smoke
+
+`cylinder-top-rim.step` loaded in CAD Assistant shaded-with-edges. Top-oblique and rotated side views showed a continuous annular conical band, a smaller planar cap, and an unchanged cylindrical wall. There was no four-edge approximation or relabel-only body.
+
+`hole-entry.step` did not complete independent OCCT visualization. CAD Assistant remained at 50% and raised `OSD_Exception_ACCESS_VIOLATION` when the stalled operation was cancelled. This is a backend interoperability/visual-verification failure. It does not invalidate the separate Aetheris reimport and analytic topology evidence, but the fixture is not credited with an independent visual pass.
+
+**A0 correction:** the follow-up investigation proved this was an Aetheris countersink BRep defect, not an OCCT defect. The source used disconnected/misordered periodic loops, incorrect inward face sense, and a conical support surface that did not contain its trim boundaries. The corrected `hole-entry-fixed.step` (`48376D...09B9`) opens and renders in CAD Assistant. See [HOLE-ENTRY-OCCT-INTEROP-A0](hole-entry-occt-interop-a0.md).
+
+## False assumptions discovered
+
+- A single universal chamfer algorithm is the wrong abstraction. Rectangular loops are section transitions; circular rims are profile rewrites and revolutions; hole entries are subtractive profile stacks.
+- The previous two-point revolve limitation did not require generic BRep edge surgery. A bounded piecewise-linear revolution construction was sufficient and reusable.
+- A support plane alone is not a single-edge construction witness. Retained and replacement face regions plus topology ownership are the missing information.
+- Inner-loop section geometry is not merely a correspondence extension. BRepPlan must represent a face with holes and preserve host-versus-pocket material ownership.
+- Junction difficulty is policy, not offset math: multiple valid corner patches exist.
+- Successful Aetheris reimport is not equivalent to independent OCCT interoperability; the hole artifact exposed that gap.
+
+## Fillet readiness
+
+The Result boundary is ready for fillet lowerers. `SectionTransition` can inform constant-profile planar bevel-like families, but true fillets require tangent arc profiles and cylindrical/rolling-ball or swept blend surfaces. `RevolutionProfileRewrite` directly generalizes to circular-rim fillets once the profile emitter admits analytic arc segments and toroidal/surface-of-revolution bands. `HoleProfileStack` similarly generalizes when its radial stack admits tangent arc transitions.
+
+The shared hard problem is corner/junction resolution and retained/replacement region topology. Fillets add continuity constraints and new curve/surface families; they do not remove the need for explicit corner policy.
+
+## Recommended next step
+
+Implement `LocalizedPlanarReplacement` as an authoritative retained/replacement region BRepPlan for one history-known straight convex edge, with explicit support plane, trim boundaries, material side, and end policy. Do not start with multi-edge corners. In parallel, converge `HoleProfileStack` onto a shared BRepPlan seam and investigate why CAD Assistant crashes on its AP242 hole artifact. After one-edge replacement is proven, add a `SupportSurfaceDependencyGraph` plus explicit corner-patch policy for interacting edges.
+
+## Validation record
+
+- `dotnet restore Aetheris.slnx`: succeeded; all projects up to date.
+- `dotnet build Aetheris.slnx -f net10.0 --no-restore /m:1`: succeeded with no compiler errors. The JavaScript project reported its existing package-audit warnings.
+- Firmament requested filter (`Chamfer|Air|Concept|Construction|BRepPlan|SectionTransition|Revolve|Hole|Step`): 413 passed, 0 failed.
+- CLI requested filter (`Chamfer|Air|Concept|Step|Analyze`): 235 passed, 0 failed.
+- Focused M6 tests: Firmament 18 passed; CLI 7 passed.
+- `dotnet run --project Aetheris.CLI -- --help`: succeeded.
+- `git diff --check`: succeeded.
+- Real CLI build/analyze ran for all five valid fixtures. All were enclosed manifolds and independently reimported; hashes for both parameter variants differ from their canonical cases.
+- Three invalid fixtures exited 1, contained their expected diagnostic, and created no STEP file.
+
+An additional Core test run with the broad substring `Step` selected the entire NIST snapshot audit: 415 passed and 17 failed because canonical SHA snapshots differed while topology counts remained equal. None of this milestone's changes touch NIST canonical serialization or its snapshots. The milestone-required Firmament and CLI suites are clean, but the unrelated snapshot drift is recorded rather than hidden.
diff --git a/docs/implementation/hole-entry-occt-interop-a0.md b/docs/implementation/hole-entry-occt-interop-a0.md
new file mode 100644
index 00000000..053b4c86
--- /dev/null
+++ b/docs/implementation/hole-entry-occt-interop-a0.md
@@ -0,0 +1,76 @@
+# HOLE-ENTRY-OCCT-INTEROP-A0 — hole-entry STEP root cause
+
+## Classification
+
+This was an **Aetheris topology/materialization defect**, not a CAD Assistant or OCCT defect. The AP242 serializer faithfully wrote the malformed source BRep it received. Three errors existed in the countersink-specific rebuild:
+
+1. the cone and cylinder seam edges used duplicate coincident vertices instead of the circular boundary vertices, and their coedges were not ordered as a continuous wire;
+2. the inward cone and cylinder faces retained `SameSense=true`, although their analytic normals point away from the hole axis and therefore into the solid material;
+3. the conical support surface did not contain its trim boundaries. The failing STEP placed a radius-3 cone at `z=6` with axis `-Z`, while the seam boundary was radius 4 at `z=6` and radius 3 at `z=5`.
+
+The third error was the decisive CAD Assistant trigger. Wire and face-sense corrections were necessary but continued to stall until the support cone was constructed directly from the admitted hole profile: placement `(0,0,5)`, placement radius `3`, axis `+Z`, semi-angle `pi/4`.
+
+## Reproduction
+
+The retained original is `fixtures/FirmamentV2/Chamfer/evidence/hole-entry.step`, SHA-256 `F3B8AFD4BD55F388475D35751683A915287EF3CD6D2B42F569DB40D658911E14`. `tools/Open-In-CadAssistant.ps1` resolved `C:\Program Files\CAD Assistant\CADAssistant.exe` and launched the exact file twice. Both imports deterministically remained at 50%, `Loading: 1 / 2`. Cancelling changed the UI to `Aborting...` but did not finish within ten seconds. The earlier M6 run produced `OSD_Exception_ACCESS_VIOLATION`; that exception was not reproduced in this run, so only the 50% stall is classified as deterministic.
+
+SolidWorks 2026 imported the original as a surface body and visibly showed cross-hole chord/seam artifacts. That independent result agreed with the STEP graph audit and ruled out an OCCT-only interpretation.
+
+The known-good convex control is `cylinder-top-rim.step`, SHA-256 `AB37BBB068C86AEDFD39A1C998A221B722049E4183F705E57DC1F57EC686DE6C`; CAD Assistant opens and renders it.
+
+## Source BRep and STEP audit
+
+The original countersink body had V/E/F = 15/17/8. Four vertices duplicated the entry, transition, and shaft seam locations. Edge-to-face incidence still counted every edge twice, which is why both the binding validator and `aetheris analyze` called it enclosed-manifold. That assessment did not prove ordered wire closure or curve-on-surface compatibility.
+
+The fixed source BRep has V/E/F = 11/17/8. Cone and cylinder seams now share the circular boundary vertices; every face loop is topologically continuous; the two void-wall face bindings have `SameSense=false`; and every cone boundary vertex satisfies the cone equation.
+
+The original and fixed STEP files have identical coarse entity counts: 8 `ADVANCED_FACE`, 10 bounds/loops, 34 `ORIENTED_EDGE`, 17 `EDGE_CURVE`, 3 `CIRCLE`, 1 `CONICAL_SURFACE`, 1 `CYLINDRICAL_SURFACE`, 6 `PLANE`, 1 `CLOSED_SHELL`, and 1 `MANIFOLD_SOLID_BREP`. Counts alone therefore could not detect the defect.
+
+In the fixed graph, the cone loop is ordered seam -> transition circle -> reversed seam -> entry circle and uses the same STEP vertex references at every junction. Its support is `CONICAL_SURFACE` at `(0,0,5)`, axis `+Z`, radius `3`, angle `0.785398163397448`; the cone and cylinder `ADVANCED_FACE` entities both use `.F.`.
+
+Both artifacts still produce the same exact semantic volume, `8290.236017900337`, through `analytic-box-minus-z-hole`. This demonstrates why exact volume and self-reimport were insufficient proof: neither checked trim boundaries against their support surface.
+
+## Controlled variants
+
+| Variant | Single intended change | SHA-256 | Aetheris reimport | CAD Assistant |
+|---|---|---|---|---|
+| retained original | none | `F3B8AF...1E14` | succeeds, V=15 | deterministic 50% stall |
+| shared seam vertices only | remove four duplicate vertices | `425CFB...133F` | succeeds, V=11 | not credited; loop order still invalid |
+| shared vertices + ordered loops | continuous cone/cylinder wires | `8A2625...6B86` | succeeds | 50% stall |
+| plus inward face sense | cone/cylinder `SameSense=false` | `433380...8F6D` | succeeds | 50% stall |
+| plus profile-derived cone support | correct placement, radius, and axis | `48376D...09B9` | succeeds, V=11 | opens and renders correctly |
+
+Only the original and final artifacts are retained; intermediate hashes document the bounded experiments without adding redundant binaries.
+
+## Fix and regression coverage
+
+`BrepBooleanBoxCylinderHoleBuilder.CreateSteppedCoaxialCountersinkBody` now:
+
+- shares periodic seam endpoints with circle topology;
+- emits continuous coedge order;
+- constructs the support cone from transition center/radius and entry direction;
+- marks internal analytic wall faces opposite-sense.
+
+The source-BRep regression asserts ordered loop closure, inward face sense, and cone-boundary-on-support compatibility. The fixture pipeline regression asserts 11 reimported vertices and the exact cone placement/radius/axis and face sense for both canonical and offset/parameter variants.
+
+## Independent readers and remaining risk
+
+CAD Assistant is the available OCCT reader. No installed `DRAWEXE`, OCCT command-line sample, or other cheap second OCCT path was found, so no large harness was added. SolidWorks supplied the independent non-OCCT evidence for the original malformed artifact. The final artifact's successful CAD Assistant import is the decisive interoperability proof.
+
+The fix is deliberately limited to the stepped coaxial countersink/hole-entry builder. Similar older periodic builders may also use coincident-but-distinct seam vertices; they were not generalized in this milestone. A future bounded validator should promote ordered wire closure and curve-on-surface checks into export preflight after the existing corpus is audited, rather than enabling it globally and breaking unrelated legacy constructions without classification.
+
+## Validation record
+
+- `dotnet restore Aetheris.slnx`: passed.
+- `dotnet build Aetheris.slnx -f net10.0 --no-restore /m:1`: passed with 0 errors; existing project/package warnings remain.
+- Firmament filter `HoleEntry|Chamfer|Cone|Cylinder|Step|Interop|Occt`: 265 passed, 0 failed.
+- CLI filter `HoleEntry|Chamfer|Step|Analyze|Interop`: 136 passed, 0 failed.
+- `aetheris analyze` passed for original, fixed, and convex-control artifacts.
+- `aetheris analyze volume` returned the same exact semantic volume for original and fixed, demonstrating that volume was not a structural validator.
+- `dotnet run --project Aetheris.CLI -- --help`: passed.
+- `git diff --check`: passed.
+- CAD Assistant: original stalled at 50% twice; fixed artifact imported, reached `Loading: 2 / 2 Displaying: finished`, and rendered the box, annular conical entry, and cylindrical shaft.
+
+## Final answer
+
+It was our mistake. CAD Assistant was reacting to an invalid analytic face construction, especially a conical support surface that did not contain its own trim edges. With the source topology, face sense, and cone placement corrected, the exact analytic hole-entry STEP imports and renders in CAD Assistant without an importer-specific workaround.
diff --git a/fixtures/FirmamentV2/Chamfer/README.md b/fixtures/FirmamentV2/Chamfer/README.md
new file mode 100644
index 00000000..eacbc6ed
--- /dev/null
+++ b/fixtures/FirmamentV2/Chamfer/README.md
@@ -0,0 +1,10 @@
+# Chamfer fixture corpus
+
+This corpus is the executable boundary for `CHAMFER-FIXTURE-PRESSURE-M6`.
+
+- `valid/` contains exact history-known construction families that build real changed geometry.
+- `invalid/` contains authored inputs rejected before topology emission.
+- `deferred/` records semantic selections, attempted witnesses, typed error codes, and the missing topology policy. Matching executable assertions live in `ChamferM6LoweringTests`.
+- `evidence/` retains representative AP242 artifacts. See its README for hashes and reimport evidence.
+
+The word *chamfer* in a fixture name never implies arbitrary imported-edge surgery. The admitted domain is recorded in each fixture header.
diff --git a/fixtures/FirmamentV2/Chamfer/deferred/adjacent-edge-junction.deferred.firmfixture b/fixtures/FirmamentV2/Chamfer/deferred/adjacent-edge-junction.deferred.firmfixture
new file mode 100644
index 00000000..a9c4c5aa
--- /dev/null
+++ b/fixtures/FirmamentV2/Chamfer/deferred/adjacent-edge-junction.deferred.firmfixture
@@ -0,0 +1,7 @@
+// fixture-id: chamfer-m6-adjacent-edge-junction
+// semantic-target: two adjacent convex box edges meeting at one vertex
+// attempted-witness: two bounded planar replacement strips sharing a corner
+// expected-error-kind: CornerPolicyRequired
+// expected-error: chamfer-corner-policy-required:multiple-valid-corner-patches
+// ambiguity: miter, setback, or explicit three-face corner patch are all geometrically valid
+// recommended-construction: SupportSurfaceDependencyGraph plus explicit CornerPatch policy
diff --git a/fixtures/FirmamentV2/Chamfer/deferred/rectangular-pocket-inner-rim.deferred.firmfixture b/fixtures/FirmamentV2/Chamfer/deferred/rectangular-pocket-inner-rim.deferred.firmfixture
new file mode 100644
index 00000000..822d8d42
--- /dev/null
+++ b/fixtures/FirmamentV2/Chamfer/deferred/rectangular-pocket-inner-rim.deferred.firmfixture
@@ -0,0 +1,7 @@
+// fixture-id: chamfer-m6-rectangular-pocket-inner-rim
+// semantic-target: complete concave inner loop at a rectangular pocket entry
+// attempted-witness: host outer section + pocket opening inner loop + inset/lowered inner transition loop
+// expected-error-kind: MissingConstructionWitness
+// expected-error: chamfer-missing-construction-witness:section-transition-does-not-support-holes
+// missing-capability: BRepPlan loops-with-holes and retained/replacement region ownership
+// recommended-construction: RegionSectionTransition with explicit outer/inner loop correspondence
diff --git a/fixtures/FirmamentV2/Chamfer/deferred/single-straight-convex-edge.deferred.firmfixture b/fixtures/FirmamentV2/Chamfer/deferred/single-straight-convex-edge.deferred.firmfixture
new file mode 100644
index 00000000..a14517ab
--- /dev/null
+++ b/fixtures/FirmamentV2/Chamfer/deferred/single-straight-convex-edge.deferred.firmfixture
@@ -0,0 +1,7 @@
+// fixture-id: chamfer-m6-single-straight-convex-edge
+// semantic-target: shared edge between history-known +X and +Z box faces
+// attempted-witness: retained face regions + bounded diagonal support plane + two trim boundaries
+// expected-error-kind: MissingConstructionWitness
+// expected-error: chamfer-missing-construction-witness:localized-planar-replacement-not-implemented
+// missing-capability: authoritative localized retained/replacement region topology plan
+// warning: prior cube relabeling/closed-witness chains are explicitly not geometry proof
diff --git a/fixtures/FirmamentV2/Chamfer/evidence/README.md b/fixtures/FirmamentV2/Chamfer/evidence/README.md
new file mode 100644
index 00000000..43ca38ea
--- /dev/null
+++ b/fixtures/FirmamentV2/Chamfer/evidence/README.md
@@ -0,0 +1,14 @@
+# CHAMFER-FIXTURE-PRESSURE-M6 retained STEP evidence
+
+| Artifact | SHA-256 | Independent Aetheris reimport |
+|---|---|---|
+| `rectangular-top-loop.step` | `1A982C1D808392653ABE310184AF6FAD4D8321CF3179C6C3F029955898074AE0` | manifold; V/E/F = 12/20/10 |
+| `cylinder-top-rim.step` | `AB37BBB068C86AEDFD39A1C998A221B722049E4183F705E57DC1F57EC686DE6C` | manifold; V/E/F = 6/5/4; plane/cylinder/cone = 2/1/1 |
+| `hole-entry.step` | `F3B8AFD4BD55F388475D35751683A915287EF3CD6D2B42F569DB40D658911E14` | manifold; V/E/F = 15/17/8; plane/cylinder/cone = 6/1/1 |
+| `hole-entry-fixed.step` | `48376D644226875E8EE0400220994C41D67717E8E9C4DFCD893F728575E509B9` | manifold; V/E/F = 11/17/8; plane/cylinder/cone = 6/1/1 |
+
+The cylinder artifact was also loaded successfully in CAD Assistant in shaded-with-edges mode; its continuous circular chamfer band and reduced planar cap were visible from top-oblique and rotated side views.
+
+`hole-entry.step` is retained as the malformed regression input. Its countersink loops used duplicate seam vertices and invalid ordering, its inward walls had the wrong face sense, and its conical support did not contain its trim edges. CAD Assistant stalls at 50%; SolidWorks displays cross-hole seam/chord artifacts.
+
+`hole-entry-fixed.step` is the corrected compatibility authority. CAD Assistant imports and renders the analytic conical entry and cylindrical shaft. See `docs/implementation/hole-entry-occt-interop-a0.md`.
diff --git a/fixtures/FirmamentV2/Chamfer/evidence/cylinder-top-rim.step b/fixtures/FirmamentV2/Chamfer/evidence/cylinder-top-rim.step
new file mode 100644
index 00000000..645dc087
--- /dev/null
+++ b/fixtures/FirmamentV2/Chamfer/evidence/cylinder-top-rim.step
@@ -0,0 +1,106 @@
+ISO-10303-21;
+HEADER;
+FILE_DESCRIPTION(('Aetheris AP242 subset export'),'2;1');
+FILE_NAME('aetheris_export.step','1970-01-01T00:00:00',('Aetheris'),('Aetheris'),'Aetheris.Kernel','Aetheris.Kernel','');
+FILE_SCHEMA(('AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF'));
+ENDSEC;
+DATA;
+#1=CARTESIAN_POINT($,(0,0,-25));
+#2=DIRECTION($,(0,0,1));
+#3=DIRECTION($,(1,0,0));
+#4=AXIS2_PLACEMENT_3D($,#1,#2,#3);
+#5=CYLINDRICAL_SURFACE($,#4,20);
+#6=CARTESIAN_POINT($,(20,0,-25));
+#7=VERTEX_POINT($,#6);
+#8=CARTESIAN_POINT($,(20,0,24));
+#9=VERTEX_POINT($,#8);
+#10=CARTESIAN_POINT($,(20,0,-25));
+#11=DIRECTION($,(0,0,1));
+#12=VECTOR($,#11,1);
+#13=LINE($,#10,#12);
+#14=EDGE_CURVE($,#7,#9,#13,.T.);
+#15=ORIENTED_EDGE($,$,$,#14,.T.);
+#16=CARTESIAN_POINT($,(20,0,24));
+#17=VERTEX_POINT($,#16);
+#18=CARTESIAN_POINT($,(0,0,24));
+#19=DIRECTION($,(0,0,1));
+#20=DIRECTION($,(1,0,0));
+#21=AXIS2_PLACEMENT_3D($,#18,#19,#20);
+#22=CIRCLE($,#21,20);
+#23=EDGE_CURVE($,#17,#17,#22,.T.);
+#24=ORIENTED_EDGE($,$,$,#23,.T.);
+#25=ORIENTED_EDGE($,$,$,#14,.F.);
+#26=CARTESIAN_POINT($,(20,0,-25));
+#27=VERTEX_POINT($,#26);
+#28=CARTESIAN_POINT($,(0,0,-25));
+#29=DIRECTION($,(0,0,1));
+#30=DIRECTION($,(1,0,0));
+#31=AXIS2_PLACEMENT_3D($,#28,#29,#30);
+#32=CIRCLE($,#31,20);
+#33=EDGE_CURVE($,#27,#27,#32,.T.);
+#34=ORIENTED_EDGE($,$,$,#33,.F.);
+#35=EDGE_LOOP($,(#15,#24,#25,#34));
+#36=FACE_OUTER_BOUND('',#35,.T.);
+#37=ADVANCED_FACE('',(#36),#5,.T.);
+#38=CARTESIAN_POINT($,(0,0,44));
+#39=DIRECTION($,(-0,-0,-1));
+#40=DIRECTION($,(1,0,0));
+#41=AXIS2_PLACEMENT_3D($,#38,#39,#40);
+#42=CONICAL_SURFACE($,#41,0,0.785398163397448);
+#43=CARTESIAN_POINT($,(19,0,25));
+#44=VERTEX_POINT($,#43);
+#45=CARTESIAN_POINT($,(20,0,24));
+#46=DIRECTION($,(-0.707106781186548,0,0.707106781186548));
+#47=VECTOR($,#46,1);
+#48=LINE($,#45,#47);
+#49=EDGE_CURVE($,#9,#44,#48,.T.);
+#50=ORIENTED_EDGE($,$,$,#49,.T.);
+#51=CARTESIAN_POINT($,(19,0,25));
+#52=VERTEX_POINT($,#51);
+#53=CARTESIAN_POINT($,(0,0,25));
+#54=DIRECTION($,(0,0,1));
+#55=DIRECTION($,(1,0,0));
+#56=AXIS2_PLACEMENT_3D($,#53,#54,#55);
+#57=CIRCLE($,#56,19);
+#58=EDGE_CURVE($,#52,#52,#57,.T.);
+#59=ORIENTED_EDGE($,$,$,#58,.T.);
+#60=ORIENTED_EDGE($,$,$,#49,.F.);
+#61=ORIENTED_EDGE($,$,$,#23,.F.);
+#62=EDGE_LOOP($,(#50,#59,#60,#61));
+#63=FACE_OUTER_BOUND('',#62,.T.);
+#64=ADVANCED_FACE('',(#63),#42,.T.);
+#65=CARTESIAN_POINT($,(0,0,-25));
+#66=DIRECTION($,(-0,-0,-1));
+#67=DIRECTION($,(1,0,0));
+#68=AXIS2_PLACEMENT_3D($,#65,#66,#67);
+#69=PLANE($,#68);
+#70=ORIENTED_EDGE($,$,$,#33,.T.);
+#71=EDGE_LOOP($,(#70));
+#72=FACE_OUTER_BOUND('',#71,.T.);
+#73=ADVANCED_FACE('',(#72),#69,.T.);
+#74=CARTESIAN_POINT($,(0,0,25));
+#75=DIRECTION($,(0,0,1));
+#76=DIRECTION($,(1,0,0));
+#77=AXIS2_PLACEMENT_3D($,#74,#75,#76);
+#78=PLANE($,#77);
+#79=ORIENTED_EDGE($,$,$,#58,.F.);
+#80=EDGE_LOOP($,(#79));
+#81=FACE_OUTER_BOUND('',#80,.T.);
+#82=ADVANCED_FACE('',(#81),#78,.T.);
+#83=CLOSED_SHELL($,(#37,#64,#73,#82));
+#84=MANIFOLD_SOLID_BREP('TopRim',#83);
+#85=APPLICATION_CONTEXT('mechanical design');
+#86=PRODUCT_CONTEXT('',#85,'mechanical');
+#87=PRODUCT('AETHERIS','TopRim','',(#86));
+#88=PRODUCT_DEFINITION_FORMATION('','',#87);
+#89=PRODUCT_DEFINITION_CONTEXT('design',#85,'design');
+#90=PRODUCT_DEFINITION('','',#88,#89);
+#91=PRODUCT_DEFINITION_SHAPE('','',#90);
+#92=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.));
+#93=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
+#94=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT());
+#95=(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNIT_ASSIGNED_CONTEXT((#92,#93,#94))REPRESENTATION_CONTEXT('3','3D'));
+#96=SHAPE_REPRESENTATION('TopRim',(#84),#95);
+#97=SHAPE_DEFINITION_REPRESENTATION(#91,#96);
+ENDSEC;
+END-ISO-10303-21;
diff --git a/fixtures/FirmamentV2/Chamfer/evidence/hole-entry-fixed.step b/fixtures/FirmamentV2/Chamfer/evidence/hole-entry-fixed.step
new file mode 100644
index 00000000..62ce1130
--- /dev/null
+++ b/fixtures/FirmamentV2/Chamfer/evidence/hole-entry-fixed.step
@@ -0,0 +1,236 @@
+ISO-10303-21;
+HEADER;
+FILE_DESCRIPTION(('Aetheris AP242 subset export'),'2;1');
+FILE_NAME('aetheris_export.step','1970-01-01T00:00:00',('Aetheris'),('Aetheris'),'Aetheris.Kernel','Aetheris.Kernel','');
+FILE_SCHEMA(('AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF'));
+ENDSEC;
+DATA;
+#1=CARTESIAN_POINT($,(0,0,-6));
+#2=DIRECTION($,(0,0,-1));
+#3=DIRECTION($,(1,0,0));
+#4=AXIS2_PLACEMENT_3D($,#1,#2,#3);
+#5=PLANE($,#4);
+#6=CARTESIAN_POINT($,(-15,-12,-6));
+#7=VERTEX_POINT($,#6);
+#8=CARTESIAN_POINT($,(15,-12,-6));
+#9=VERTEX_POINT($,#8);
+#10=CARTESIAN_POINT($,(-15,-12,-6));
+#11=DIRECTION($,(1,0,0));
+#12=VECTOR($,#11,1);
+#13=LINE($,#10,#12);
+#14=EDGE_CURVE($,#7,#9,#13,.T.);
+#15=ORIENTED_EDGE($,$,$,#14,.T.);
+#16=CARTESIAN_POINT($,(15,12,-6));
+#17=VERTEX_POINT($,#16);
+#18=CARTESIAN_POINT($,(15,-12,-6));
+#19=DIRECTION($,(0,1,0));
+#20=VECTOR($,#19,1);
+#21=LINE($,#18,#20);
+#22=EDGE_CURVE($,#9,#17,#21,.T.);
+#23=ORIENTED_EDGE($,$,$,#22,.T.);
+#24=CARTESIAN_POINT($,(-15,12,-6));
+#25=VERTEX_POINT($,#24);
+#26=CARTESIAN_POINT($,(15,12,-6));
+#27=DIRECTION($,(-1,0,0));
+#28=VECTOR($,#27,1);
+#29=LINE($,#26,#28);
+#30=EDGE_CURVE($,#17,#25,#29,.T.);
+#31=ORIENTED_EDGE($,$,$,#30,.T.);
+#32=CARTESIAN_POINT($,(-15,12,-6));
+#33=DIRECTION($,(0,-1,0));
+#34=VECTOR($,#33,1);
+#35=LINE($,#32,#34);
+#36=EDGE_CURVE($,#25,#7,#35,.T.);
+#37=ORIENTED_EDGE($,$,$,#36,.T.);
+#38=EDGE_LOOP($,(#15,#23,#31,#37));
+#39=FACE_OUTER_BOUND('',#38,.T.);
+#40=CARTESIAN_POINT($,(3,0,-6));
+#41=VERTEX_POINT($,#40);
+#42=CARTESIAN_POINT($,(0,0,-6));
+#43=DIRECTION($,(0,0,1));
+#44=DIRECTION($,(1,0,0));
+#45=AXIS2_PLACEMENT_3D($,#42,#43,#44);
+#46=CIRCLE($,#45,3);
+#47=EDGE_CURVE($,#41,#41,#46,.T.);
+#48=ORIENTED_EDGE($,$,$,#47,.F.);
+#49=EDGE_LOOP($,(#48));
+#50=FACE_BOUND('',#49,.T.);
+#51=ADVANCED_FACE('',(#39,#50),#5,.T.);
+#52=CARTESIAN_POINT($,(0,0,6));
+#53=DIRECTION($,(0,0,1));
+#54=DIRECTION($,(1,0,0));
+#55=AXIS2_PLACEMENT_3D($,#52,#53,#54);
+#56=PLANE($,#55);
+#57=CARTESIAN_POINT($,(-15,-12,6));
+#58=VERTEX_POINT($,#57);
+#59=CARTESIAN_POINT($,(15,-12,6));
+#60=VERTEX_POINT($,#59);
+#61=CARTESIAN_POINT($,(-15,-12,6));
+#62=DIRECTION($,(1,0,0));
+#63=VECTOR($,#62,1);
+#64=LINE($,#61,#63);
+#65=EDGE_CURVE($,#58,#60,#64,.T.);
+#66=ORIENTED_EDGE($,$,$,#65,.T.);
+#67=CARTESIAN_POINT($,(15,12,6));
+#68=VERTEX_POINT($,#67);
+#69=CARTESIAN_POINT($,(15,-12,6));
+#70=DIRECTION($,(0,1,0));
+#71=VECTOR($,#70,1);
+#72=LINE($,#69,#71);
+#73=EDGE_CURVE($,#60,#68,#72,.T.);
+#74=ORIENTED_EDGE($,$,$,#73,.T.);
+#75=CARTESIAN_POINT($,(-15,12,6));
+#76=VERTEX_POINT($,#75);
+#77=CARTESIAN_POINT($,(15,12,6));
+#78=DIRECTION($,(-1,0,0));
+#79=VECTOR($,#78,1);
+#80=LINE($,#77,#79);
+#81=EDGE_CURVE($,#68,#76,#80,.T.);
+#82=ORIENTED_EDGE($,$,$,#81,.T.);
+#83=CARTESIAN_POINT($,(-15,12,6));
+#84=DIRECTION($,(0,-1,0));
+#85=VECTOR($,#84,1);
+#86=LINE($,#83,#85);
+#87=EDGE_CURVE($,#76,#58,#86,.T.);
+#88=ORIENTED_EDGE($,$,$,#87,.T.);
+#89=EDGE_LOOP($,(#66,#74,#82,#88));
+#90=FACE_OUTER_BOUND('',#89,.T.);
+#91=CARTESIAN_POINT($,(4,0,6));
+#92=VERTEX_POINT($,#91);
+#93=CARTESIAN_POINT($,(0,0,6));
+#94=DIRECTION($,(0,0,1));
+#95=DIRECTION($,(1,0,0));
+#96=AXIS2_PLACEMENT_3D($,#93,#94,#95);
+#97=CIRCLE($,#96,4);
+#98=EDGE_CURVE($,#92,#92,#97,.T.);
+#99=ORIENTED_EDGE($,$,$,#98,.T.);
+#100=EDGE_LOOP($,(#99));
+#101=FACE_BOUND('',#100,.T.);
+#102=ADVANCED_FACE('',(#90,#101),#56,.T.);
+#103=CARTESIAN_POINT($,(0,-12,0));
+#104=DIRECTION($,(0,-1,0));
+#105=DIRECTION($,(1,0,0));
+#106=AXIS2_PLACEMENT_3D($,#103,#104,#105);
+#107=PLANE($,#106);
+#108=ORIENTED_EDGE($,$,$,#14,.T.);
+#109=CARTESIAN_POINT($,(15,-12,-6));
+#110=DIRECTION($,(0,0,1));
+#111=VECTOR($,#110,1);
+#112=LINE($,#109,#111);
+#113=EDGE_CURVE($,#9,#60,#112,.T.);
+#114=ORIENTED_EDGE($,$,$,#113,.T.);
+#115=ORIENTED_EDGE($,$,$,#65,.F.);
+#116=CARTESIAN_POINT($,(-15,-12,-6));
+#117=DIRECTION($,(0,0,1));
+#118=VECTOR($,#117,1);
+#119=LINE($,#116,#118);
+#120=EDGE_CURVE($,#7,#58,#119,.T.);
+#121=ORIENTED_EDGE($,$,$,#120,.F.);
+#122=EDGE_LOOP($,(#108,#114,#115,#121));
+#123=FACE_OUTER_BOUND('',#122,.T.);
+#124=ADVANCED_FACE('',(#123),#107,.T.);
+#125=CARTESIAN_POINT($,(15,0,0));
+#126=DIRECTION($,(1,0,0));
+#127=DIRECTION($,(0,1,0));
+#128=AXIS2_PLACEMENT_3D($,#125,#126,#127);
+#129=PLANE($,#128);
+#130=ORIENTED_EDGE($,$,$,#22,.T.);
+#131=CARTESIAN_POINT($,(15,12,-6));
+#132=DIRECTION($,(0,0,1));
+#133=VECTOR($,#132,1);
+#134=LINE($,#131,#133);
+#135=EDGE_CURVE($,#17,#68,#134,.T.);
+#136=ORIENTED_EDGE($,$,$,#135,.T.);
+#137=ORIENTED_EDGE($,$,$,#73,.F.);
+#138=ORIENTED_EDGE($,$,$,#113,.F.);
+#139=EDGE_LOOP($,(#130,#136,#137,#138));
+#140=FACE_OUTER_BOUND('',#139,.T.);
+#141=ADVANCED_FACE('',(#140),#129,.T.);
+#142=CARTESIAN_POINT($,(0,12,0));
+#143=DIRECTION($,(0,1,0));
+#144=DIRECTION($,(-1,0,0));
+#145=AXIS2_PLACEMENT_3D($,#142,#143,#144);
+#146=PLANE($,#145);
+#147=ORIENTED_EDGE($,$,$,#30,.T.);
+#148=CARTESIAN_POINT($,(-15,12,-6));
+#149=DIRECTION($,(0,0,1));
+#150=VECTOR($,#149,1);
+#151=LINE($,#148,#150);
+#152=EDGE_CURVE($,#25,#76,#151,.T.);
+#153=ORIENTED_EDGE($,$,$,#152,.T.);
+#154=ORIENTED_EDGE($,$,$,#81,.F.);
+#155=ORIENTED_EDGE($,$,$,#135,.F.);
+#156=EDGE_LOOP($,(#147,#153,#154,#155));
+#157=FACE_OUTER_BOUND('',#156,.T.);
+#158=ADVANCED_FACE('',(#157),#146,.T.);
+#159=CARTESIAN_POINT($,(-15,0,0));
+#160=DIRECTION($,(-1,0,0));
+#161=DIRECTION($,(0,1,0));
+#162=AXIS2_PLACEMENT_3D($,#159,#160,#161);
+#163=PLANE($,#162);
+#164=ORIENTED_EDGE($,$,$,#36,.T.);
+#165=ORIENTED_EDGE($,$,$,#120,.T.);
+#166=ORIENTED_EDGE($,$,$,#87,.F.);
+#167=ORIENTED_EDGE($,$,$,#152,.F.);
+#168=EDGE_LOOP($,(#164,#165,#166,#167));
+#169=FACE_OUTER_BOUND('',#168,.T.);
+#170=ADVANCED_FACE('',(#169),#163,.T.);
+#171=CARTESIAN_POINT($,(0,0,5));
+#172=DIRECTION($,(0,0,1));
+#173=DIRECTION($,(1,0,0));
+#174=AXIS2_PLACEMENT_3D($,#171,#172,#173);
+#175=CONICAL_SURFACE($,#174,3,0.785398163397448);
+#176=CARTESIAN_POINT($,(3,0,5));
+#177=VERTEX_POINT($,#176);
+#178=CARTESIAN_POINT($,(4,0,6));
+#179=DIRECTION($,(-0.707106781186548,0,-0.707106781186548));
+#180=VECTOR($,#179,1);
+#181=LINE($,#178,#180);
+#182=EDGE_CURVE($,#92,#177,#181,.T.);
+#183=ORIENTED_EDGE($,$,$,#182,.T.);
+#184=CARTESIAN_POINT($,(0,0,5));
+#185=DIRECTION($,(0,0,1));
+#186=DIRECTION($,(1,0,0));
+#187=AXIS2_PLACEMENT_3D($,#184,#185,#186);
+#188=CIRCLE($,#187,3);
+#189=EDGE_CURVE($,#177,#177,#188,.T.);
+#190=ORIENTED_EDGE($,$,$,#189,.T.);
+#191=ORIENTED_EDGE($,$,$,#182,.F.);
+#192=ORIENTED_EDGE($,$,$,#98,.F.);
+#193=EDGE_LOOP($,(#183,#190,#191,#192));
+#194=FACE_OUTER_BOUND('',#193,.T.);
+#195=ADVANCED_FACE('',(#194),#175,.F.);
+#196=CARTESIAN_POINT($,(0,0,-6));
+#197=DIRECTION($,(0,0,1));
+#198=DIRECTION($,(1,0,0));
+#199=AXIS2_PLACEMENT_3D($,#196,#197,#198);
+#200=CYLINDRICAL_SURFACE($,#199,3);
+#201=CARTESIAN_POINT($,(3,0,5));
+#202=DIRECTION($,(0,0,-1));
+#203=VECTOR($,#202,1);
+#204=LINE($,#201,#203);
+#205=EDGE_CURVE($,#177,#41,#204,.T.);
+#206=ORIENTED_EDGE($,$,$,#205,.T.);
+#207=ORIENTED_EDGE($,$,$,#47,.T.);
+#208=ORIENTED_EDGE($,$,$,#205,.F.);
+#209=ORIENTED_EDGE($,$,$,#189,.F.);
+#210=EDGE_LOOP($,(#206,#207,#208,#209));
+#211=FACE_OUTER_BOUND('',#210,.T.);
+#212=ADVANCED_FACE('',(#211),#200,.F.);
+#213=CLOSED_SHELL($,(#51,#102,#124,#141,#158,#170,#195,#212));
+#214=MANIFOLD_SOLID_BREP('AetherisBody',#213);
+#215=APPLICATION_CONTEXT('mechanical design');
+#216=PRODUCT_CONTEXT('',#215,'mechanical');
+#217=PRODUCT('AETHERIS','AetherisBody','',(#216));
+#218=PRODUCT_DEFINITION_FORMATION('','',#217);
+#219=PRODUCT_DEFINITION_CONTEXT('design',#215,'design');
+#220=PRODUCT_DEFINITION('','',#218,#219);
+#221=PRODUCT_DEFINITION_SHAPE('','',#220);
+#222=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.));
+#223=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
+#224=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT());
+#225=(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNIT_ASSIGNED_CONTEXT((#222,#223,#224))REPRESENTATION_CONTEXT('3','3D'));
+#226=SHAPE_REPRESENTATION('AetherisBody',(#214),#225);
+#227=SHAPE_DEFINITION_REPRESENTATION(#221,#226);
+ENDSEC;
+END-ISO-10303-21;
diff --git a/fixtures/FirmamentV2/Chamfer/evidence/hole-entry.step b/fixtures/FirmamentV2/Chamfer/evidence/hole-entry.step
new file mode 100644
index 00000000..7a3cb432
--- /dev/null
+++ b/fixtures/FirmamentV2/Chamfer/evidence/hole-entry.step
@@ -0,0 +1,244 @@
+ISO-10303-21;
+HEADER;
+FILE_DESCRIPTION(('Aetheris AP242 subset export'),'2;1');
+FILE_NAME('aetheris_export.step','1970-01-01T00:00:00',('Aetheris'),('Aetheris'),'Aetheris.Kernel','Aetheris.Kernel','');
+FILE_SCHEMA(('AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF'));
+ENDSEC;
+DATA;
+#1=CARTESIAN_POINT($,(0,0,-6));
+#2=DIRECTION($,(0,0,-1));
+#3=DIRECTION($,(1,0,0));
+#4=AXIS2_PLACEMENT_3D($,#1,#2,#3);
+#5=PLANE($,#4);
+#6=CARTESIAN_POINT($,(-15,-12,-6));
+#7=VERTEX_POINT($,#6);
+#8=CARTESIAN_POINT($,(15,-12,-6));
+#9=VERTEX_POINT($,#8);
+#10=CARTESIAN_POINT($,(-15,-12,-6));
+#11=DIRECTION($,(1,0,0));
+#12=VECTOR($,#11,1);
+#13=LINE($,#10,#12);
+#14=EDGE_CURVE($,#7,#9,#13,.T.);
+#15=ORIENTED_EDGE($,$,$,#14,.T.);
+#16=CARTESIAN_POINT($,(15,12,-6));
+#17=VERTEX_POINT($,#16);
+#18=CARTESIAN_POINT($,(15,-12,-6));
+#19=DIRECTION($,(0,1,0));
+#20=VECTOR($,#19,1);
+#21=LINE($,#18,#20);
+#22=EDGE_CURVE($,#9,#17,#21,.T.);
+#23=ORIENTED_EDGE($,$,$,#22,.T.);
+#24=CARTESIAN_POINT($,(-15,12,-6));
+#25=VERTEX_POINT($,#24);
+#26=CARTESIAN_POINT($,(15,12,-6));
+#27=DIRECTION($,(-1,0,0));
+#28=VECTOR($,#27,1);
+#29=LINE($,#26,#28);
+#30=EDGE_CURVE($,#17,#25,#29,.T.);
+#31=ORIENTED_EDGE($,$,$,#30,.T.);
+#32=CARTESIAN_POINT($,(-15,12,-6));
+#33=DIRECTION($,(0,-1,0));
+#34=VECTOR($,#33,1);
+#35=LINE($,#32,#34);
+#36=EDGE_CURVE($,#25,#7,#35,.T.);
+#37=ORIENTED_EDGE($,$,$,#36,.T.);
+#38=EDGE_LOOP($,(#15,#23,#31,#37));
+#39=FACE_OUTER_BOUND('',#38,.T.);
+#40=CARTESIAN_POINT($,(3,0,-6));
+#41=VERTEX_POINT($,#40);
+#42=CARTESIAN_POINT($,(0,0,-6));
+#43=DIRECTION($,(0,0,1));
+#44=DIRECTION($,(1,0,0));
+#45=AXIS2_PLACEMENT_3D($,#42,#43,#44);
+#46=CIRCLE($,#45,3);
+#47=EDGE_CURVE($,#41,#41,#46,.T.);
+#48=ORIENTED_EDGE($,$,$,#47,.F.);
+#49=EDGE_LOOP($,(#48));
+#50=FACE_BOUND('',#49,.T.);
+#51=ADVANCED_FACE('',(#39,#50),#5,.T.);
+#52=CARTESIAN_POINT($,(0,0,6));
+#53=DIRECTION($,(0,0,1));
+#54=DIRECTION($,(1,0,0));
+#55=AXIS2_PLACEMENT_3D($,#52,#53,#54);
+#56=PLANE($,#55);
+#57=CARTESIAN_POINT($,(-15,-12,6));
+#58=VERTEX_POINT($,#57);
+#59=CARTESIAN_POINT($,(15,-12,6));
+#60=VERTEX_POINT($,#59);
+#61=CARTESIAN_POINT($,(-15,-12,6));
+#62=DIRECTION($,(1,0,0));
+#63=VECTOR($,#62,1);
+#64=LINE($,#61,#63);
+#65=EDGE_CURVE($,#58,#60,#64,.T.);
+#66=ORIENTED_EDGE($,$,$,#65,.T.);
+#67=CARTESIAN_POINT($,(15,12,6));
+#68=VERTEX_POINT($,#67);
+#69=CARTESIAN_POINT($,(15,-12,6));
+#70=DIRECTION($,(0,1,0));
+#71=VECTOR($,#70,1);
+#72=LINE($,#69,#71);
+#73=EDGE_CURVE($,#60,#68,#72,.T.);
+#74=ORIENTED_EDGE($,$,$,#73,.T.);
+#75=CARTESIAN_POINT($,(-15,12,6));
+#76=VERTEX_POINT($,#75);
+#77=CARTESIAN_POINT($,(15,12,6));
+#78=DIRECTION($,(-1,0,0));
+#79=VECTOR($,#78,1);
+#80=LINE($,#77,#79);
+#81=EDGE_CURVE($,#68,#76,#80,.T.);
+#82=ORIENTED_EDGE($,$,$,#81,.T.);
+#83=CARTESIAN_POINT($,(-15,12,6));
+#84=DIRECTION($,(0,-1,0));
+#85=VECTOR($,#84,1);
+#86=LINE($,#83,#85);
+#87=EDGE_CURVE($,#76,#58,#86,.T.);
+#88=ORIENTED_EDGE($,$,$,#87,.T.);
+#89=EDGE_LOOP($,(#66,#74,#82,#88));
+#90=FACE_OUTER_BOUND('',#89,.T.);
+#91=CARTESIAN_POINT($,(4,0,6));
+#92=VERTEX_POINT($,#91);
+#93=CARTESIAN_POINT($,(0,0,6));
+#94=DIRECTION($,(0,0,1));
+#95=DIRECTION($,(1,0,0));
+#96=AXIS2_PLACEMENT_3D($,#93,#94,#95);
+#97=CIRCLE($,#96,4);
+#98=EDGE_CURVE($,#92,#92,#97,.T.);
+#99=ORIENTED_EDGE($,$,$,#98,.T.);
+#100=EDGE_LOOP($,(#99));
+#101=FACE_BOUND('',#100,.T.);
+#102=ADVANCED_FACE('',(#90,#101),#56,.T.);
+#103=CARTESIAN_POINT($,(0,-12,0));
+#104=DIRECTION($,(0,-1,0));
+#105=DIRECTION($,(1,0,0));
+#106=AXIS2_PLACEMENT_3D($,#103,#104,#105);
+#107=PLANE($,#106);
+#108=ORIENTED_EDGE($,$,$,#14,.T.);
+#109=CARTESIAN_POINT($,(15,-12,-6));
+#110=DIRECTION($,(0,0,1));
+#111=VECTOR($,#110,1);
+#112=LINE($,#109,#111);
+#113=EDGE_CURVE($,#9,#60,#112,.T.);
+#114=ORIENTED_EDGE($,$,$,#113,.T.);
+#115=ORIENTED_EDGE($,$,$,#65,.F.);
+#116=CARTESIAN_POINT($,(-15,-12,-6));
+#117=DIRECTION($,(0,0,1));
+#118=VECTOR($,#117,1);
+#119=LINE($,#116,#118);
+#120=EDGE_CURVE($,#7,#58,#119,.T.);
+#121=ORIENTED_EDGE($,$,$,#120,.F.);
+#122=EDGE_LOOP($,(#108,#114,#115,#121));
+#123=FACE_OUTER_BOUND('',#122,.T.);
+#124=ADVANCED_FACE('',(#123),#107,.T.);
+#125=CARTESIAN_POINT($,(15,0,0));
+#126=DIRECTION($,(1,0,0));
+#127=DIRECTION($,(0,1,0));
+#128=AXIS2_PLACEMENT_3D($,#125,#126,#127);
+#129=PLANE($,#128);
+#130=ORIENTED_EDGE($,$,$,#22,.T.);
+#131=CARTESIAN_POINT($,(15,12,-6));
+#132=DIRECTION($,(0,0,1));
+#133=VECTOR($,#132,1);
+#134=LINE($,#131,#133);
+#135=EDGE_CURVE($,#17,#68,#134,.T.);
+#136=ORIENTED_EDGE($,$,$,#135,.T.);
+#137=ORIENTED_EDGE($,$,$,#73,.F.);
+#138=ORIENTED_EDGE($,$,$,#113,.F.);
+#139=EDGE_LOOP($,(#130,#136,#137,#138));
+#140=FACE_OUTER_BOUND('',#139,.T.);
+#141=ADVANCED_FACE('',(#140),#129,.T.);
+#142=CARTESIAN_POINT($,(0,12,0));
+#143=DIRECTION($,(0,1,0));
+#144=DIRECTION($,(-1,0,0));
+#145=AXIS2_PLACEMENT_3D($,#142,#143,#144);
+#146=PLANE($,#145);
+#147=ORIENTED_EDGE($,$,$,#30,.T.);
+#148=CARTESIAN_POINT($,(-15,12,-6));
+#149=DIRECTION($,(0,0,1));
+#150=VECTOR($,#149,1);
+#151=LINE($,#148,#150);
+#152=EDGE_CURVE($,#25,#76,#151,.T.);
+#153=ORIENTED_EDGE($,$,$,#152,.T.);
+#154=ORIENTED_EDGE($,$,$,#81,.F.);
+#155=ORIENTED_EDGE($,$,$,#135,.F.);
+#156=EDGE_LOOP($,(#147,#153,#154,#155));
+#157=FACE_OUTER_BOUND('',#156,.T.);
+#158=ADVANCED_FACE('',(#157),#146,.T.);
+#159=CARTESIAN_POINT($,(-15,0,0));
+#160=DIRECTION($,(-1,0,0));
+#161=DIRECTION($,(0,1,0));
+#162=AXIS2_PLACEMENT_3D($,#159,#160,#161);
+#163=PLANE($,#162);
+#164=ORIENTED_EDGE($,$,$,#36,.T.);
+#165=ORIENTED_EDGE($,$,$,#120,.T.);
+#166=ORIENTED_EDGE($,$,$,#87,.F.);
+#167=ORIENTED_EDGE($,$,$,#152,.F.);
+#168=EDGE_LOOP($,(#164,#165,#166,#167));
+#169=FACE_OUTER_BOUND('',#168,.T.);
+#170=ADVANCED_FACE('',(#169),#163,.T.);
+#171=CARTESIAN_POINT($,(0,0,6));
+#172=DIRECTION($,(0,0,-1));
+#173=DIRECTION($,(1,0,0));
+#174=AXIS2_PLACEMENT_3D($,#171,#172,#173);
+#175=CONICAL_SURFACE($,#174,3,0.785398163397448);
+#176=CARTESIAN_POINT($,(4,0,6));
+#177=VERTEX_POINT($,#176);
+#178=CARTESIAN_POINT($,(3,0,5));
+#179=VERTEX_POINT($,#178);
+#180=CARTESIAN_POINT($,(4,0,6));
+#181=DIRECTION($,(-0.707106781186548,0,-0.707106781186548));
+#182=VECTOR($,#181,1);
+#183=LINE($,#180,#182);
+#184=EDGE_CURVE($,#177,#179,#183,.T.);
+#185=ORIENTED_EDGE($,$,$,#184,.T.);
+#186=ORIENTED_EDGE($,$,$,#98,.F.);
+#187=ORIENTED_EDGE($,$,$,#184,.F.);
+#188=CARTESIAN_POINT($,(3,0,5));
+#189=VERTEX_POINT($,#188);
+#190=CARTESIAN_POINT($,(0,0,5));
+#191=DIRECTION($,(0,0,1));
+#192=DIRECTION($,(1,0,0));
+#193=AXIS2_PLACEMENT_3D($,#190,#191,#192);
+#194=CIRCLE($,#193,3);
+#195=EDGE_CURVE($,#189,#189,#194,.T.);
+#196=ORIENTED_EDGE($,$,$,#195,.T.);
+#197=EDGE_LOOP($,(#185,#186,#187,#196));
+#198=FACE_OUTER_BOUND('',#197,.T.);
+#199=ADVANCED_FACE('',(#198),#175,.T.);
+#200=CARTESIAN_POINT($,(0,0,-6));
+#201=DIRECTION($,(0,0,1));
+#202=DIRECTION($,(1,0,0));
+#203=AXIS2_PLACEMENT_3D($,#200,#201,#202);
+#204=CYLINDRICAL_SURFACE($,#203,3);
+#205=CARTESIAN_POINT($,(3,0,5));
+#206=VERTEX_POINT($,#205);
+#207=CARTESIAN_POINT($,(3,0,-6));
+#208=VERTEX_POINT($,#207);
+#209=CARTESIAN_POINT($,(3,0,5));
+#210=DIRECTION($,(0,0,-1));
+#211=VECTOR($,#210,1);
+#212=LINE($,#209,#211);
+#213=EDGE_CURVE($,#206,#208,#212,.T.);
+#214=ORIENTED_EDGE($,$,$,#213,.T.);
+#215=ORIENTED_EDGE($,$,$,#195,.F.);
+#216=ORIENTED_EDGE($,$,$,#213,.F.);
+#217=ORIENTED_EDGE($,$,$,#47,.T.);
+#218=EDGE_LOOP($,(#214,#215,#216,#217));
+#219=FACE_OUTER_BOUND('',#218,.T.);
+#220=ADVANCED_FACE('',(#219),#204,.T.);
+#221=CLOSED_SHELL($,(#51,#102,#124,#141,#158,#170,#199,#220));
+#222=MANIFOLD_SOLID_BREP('AetherisBody',#221);
+#223=APPLICATION_CONTEXT('mechanical design');
+#224=PRODUCT_CONTEXT('',#223,'mechanical');
+#225=PRODUCT('AETHERIS','AetherisBody','',(#224));
+#226=PRODUCT_DEFINITION_FORMATION('','',#225);
+#227=PRODUCT_DEFINITION_CONTEXT('design',#223,'design');
+#228=PRODUCT_DEFINITION('','',#226,#227);
+#229=PRODUCT_DEFINITION_SHAPE('','',#228);
+#230=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.));
+#231=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
+#232=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT());
+#233=(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNIT_ASSIGNED_CONTEXT((#230,#231,#232))REPRESENTATION_CONTEXT('3','3D'));
+#234=SHAPE_REPRESENTATION('AetherisBody',(#222),#233);
+#235=SHAPE_DEFINITION_REPRESENTATION(#229,#234);
+ENDSEC;
+END-ISO-10303-21;
diff --git a/fixtures/FirmamentV2/Chamfer/evidence/rectangular-top-loop.step b/fixtures/FirmamentV2/Chamfer/evidence/rectangular-top-loop.step
new file mode 100644
index 00000000..d56f989a
--- /dev/null
+++ b/fixtures/FirmamentV2/Chamfer/evidence/rectangular-top-loop.step
@@ -0,0 +1,268 @@
+ISO-10303-21;
+HEADER;
+FILE_DESCRIPTION(('Aetheris AP242 subset export'),'2;1');
+FILE_NAME('aetheris_export.step','1970-01-01T00:00:00',('Aetheris'),('Aetheris'),'Aetheris.Kernel','Aetheris.Kernel','');
+FILE_SCHEMA(('AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF'));
+ENDSEC;
+DATA;
+#1=CARTESIAN_POINT($,(0,0,0));
+#2=DIRECTION($,(0,0,-1));
+#3=DIRECTION($,(1,0,0));
+#4=AXIS2_PLACEMENT_3D($,#1,#2,#3);
+#5=PLANE($,#4);
+#6=CARTESIAN_POINT($,(-5,-4,-0));
+#7=VERTEX_POINT($,#6);
+#8=CARTESIAN_POINT($,(5,-4,-0));
+#9=VERTEX_POINT($,#8);
+#10=CARTESIAN_POINT($,(-5,-4,-0));
+#11=DIRECTION($,(1,0,0));
+#12=VECTOR($,#11,1);
+#13=LINE($,#10,#12);
+#14=EDGE_CURVE($,#7,#9,#13,.T.);
+#15=ORIENTED_EDGE($,$,$,#14,.T.);
+#16=CARTESIAN_POINT($,(5,4,-0));
+#17=VERTEX_POINT($,#16);
+#18=CARTESIAN_POINT($,(5,-4,-0));
+#19=DIRECTION($,(0,1,0));
+#20=VECTOR($,#19,1);
+#21=LINE($,#18,#20);
+#22=EDGE_CURVE($,#9,#17,#21,.T.);
+#23=ORIENTED_EDGE($,$,$,#22,.T.);
+#24=CARTESIAN_POINT($,(-5,4,-0));
+#25=VERTEX_POINT($,#24);
+#26=CARTESIAN_POINT($,(5,4,-0));
+#27=DIRECTION($,(-1,0,0));
+#28=VECTOR($,#27,1);
+#29=LINE($,#26,#28);
+#30=EDGE_CURVE($,#17,#25,#29,.T.);
+#31=ORIENTED_EDGE($,$,$,#30,.T.);
+#32=CARTESIAN_POINT($,(-5,4,-0));
+#33=DIRECTION($,(0,-1,0));
+#34=VECTOR($,#33,1);
+#35=LINE($,#32,#34);
+#36=EDGE_CURVE($,#25,#7,#35,.T.);
+#37=ORIENTED_EDGE($,$,$,#36,.T.);
+#38=EDGE_LOOP($,(#15,#23,#31,#37));
+#39=FACE_OUTER_BOUND('',#38,.T.);
+#40=ADVANCED_FACE('',(#39),#5,.T.);
+#41=CARTESIAN_POINT($,(0,0,6));
+#42=DIRECTION($,(0,0,1));
+#43=DIRECTION($,(1,0,0));
+#44=AXIS2_PLACEMENT_3D($,#41,#42,#43);
+#45=PLANE($,#44);
+#46=CARTESIAN_POINT($,(-4,-3,6));
+#47=VERTEX_POINT($,#46);
+#48=CARTESIAN_POINT($,(4,-3,6));
+#49=VERTEX_POINT($,#48);
+#50=CARTESIAN_POINT($,(-4,-3,6));
+#51=DIRECTION($,(1,0,0));
+#52=VECTOR($,#51,1);
+#53=LINE($,#50,#52);
+#54=EDGE_CURVE($,#47,#49,#53,.T.);
+#55=ORIENTED_EDGE($,$,$,#54,.F.);
+#56=CARTESIAN_POINT($,(4,3,6));
+#57=VERTEX_POINT($,#56);
+#58=CARTESIAN_POINT($,(4,-3,6));
+#59=DIRECTION($,(0,1,0));
+#60=VECTOR($,#59,1);
+#61=LINE($,#58,#60);
+#62=EDGE_CURVE($,#49,#57,#61,.T.);
+#63=ORIENTED_EDGE($,$,$,#62,.F.);
+#64=CARTESIAN_POINT($,(-4,3,6));
+#65=VERTEX_POINT($,#64);
+#66=CARTESIAN_POINT($,(4,3,6));
+#67=DIRECTION($,(-1,0,0));
+#68=VECTOR($,#67,1);
+#69=LINE($,#66,#68);
+#70=EDGE_CURVE($,#57,#65,#69,.T.);
+#71=ORIENTED_EDGE($,$,$,#70,.F.);
+#72=CARTESIAN_POINT($,(-4,3,6));
+#73=DIRECTION($,(0,-1,0));
+#74=VECTOR($,#73,1);
+#75=LINE($,#72,#74);
+#76=EDGE_CURVE($,#65,#47,#75,.T.);
+#77=ORIENTED_EDGE($,$,$,#76,.F.);
+#78=EDGE_LOOP($,(#55,#63,#71,#77));
+#79=FACE_OUTER_BOUND('',#78,.T.);
+#80=ADVANCED_FACE('',(#79),#45,.T.);
+#81=CARTESIAN_POINT($,(-5,-4,0));
+#82=DIRECTION($,(0,-1,0));
+#83=DIRECTION($,(1,0,0));
+#84=AXIS2_PLACEMENT_3D($,#81,#82,#83);
+#85=PLANE($,#84);
+#86=ORIENTED_EDGE($,$,$,#14,.T.);
+#87=CARTESIAN_POINT($,(5,-4,5));
+#88=VERTEX_POINT($,#87);
+#89=CARTESIAN_POINT($,(5,-4,-0));
+#90=DIRECTION($,(0,0,1));
+#91=VECTOR($,#90,1);
+#92=LINE($,#89,#91);
+#93=EDGE_CURVE($,#9,#88,#92,.T.);
+#94=ORIENTED_EDGE($,$,$,#93,.T.);
+#95=CARTESIAN_POINT($,(-5,-4,5));
+#96=VERTEX_POINT($,#95);
+#97=CARTESIAN_POINT($,(-5,-4,5));
+#98=DIRECTION($,(1,0,0));
+#99=VECTOR($,#98,1);
+#100=LINE($,#97,#99);
+#101=EDGE_CURVE($,#96,#88,#100,.T.);
+#102=ORIENTED_EDGE($,$,$,#101,.F.);
+#103=CARTESIAN_POINT($,(-5,-4,-0));
+#104=DIRECTION($,(0,0,1));
+#105=VECTOR($,#104,1);
+#106=LINE($,#103,#105);
+#107=EDGE_CURVE($,#7,#96,#106,.T.);
+#108=ORIENTED_EDGE($,$,$,#107,.F.);
+#109=EDGE_LOOP($,(#86,#94,#102,#108));
+#110=FACE_OUTER_BOUND('',#109,.T.);
+#111=ADVANCED_FACE('',(#110),#85,.T.);
+#112=CARTESIAN_POINT($,(5,-4,0));
+#113=DIRECTION($,(1,0,0));
+#114=DIRECTION($,(0,1,0));
+#115=AXIS2_PLACEMENT_3D($,#112,#113,#114);
+#116=PLANE($,#115);
+#117=ORIENTED_EDGE($,$,$,#22,.T.);
+#118=CARTESIAN_POINT($,(5,4,5));
+#119=VERTEX_POINT($,#118);
+#120=CARTESIAN_POINT($,(5,4,-0));
+#121=DIRECTION($,(0,0,1));
+#122=VECTOR($,#121,1);
+#123=LINE($,#120,#122);
+#124=EDGE_CURVE($,#17,#119,#123,.T.);
+#125=ORIENTED_EDGE($,$,$,#124,.T.);
+#126=CARTESIAN_POINT($,(5,-4,5));
+#127=DIRECTION($,(0,1,0));
+#128=VECTOR($,#127,1);
+#129=LINE($,#126,#128);
+#130=EDGE_CURVE($,#88,#119,#129,.T.);
+#131=ORIENTED_EDGE($,$,$,#130,.F.);
+#132=ORIENTED_EDGE($,$,$,#93,.F.);
+#133=EDGE_LOOP($,(#117,#125,#131,#132));
+#134=FACE_OUTER_BOUND('',#133,.T.);
+#135=ADVANCED_FACE('',(#134),#116,.T.);
+#136=CARTESIAN_POINT($,(5,4,0));
+#137=DIRECTION($,(0,1,-0));
+#138=DIRECTION($,(-1,0,0));
+#139=AXIS2_PLACEMENT_3D($,#136,#137,#138);
+#140=PLANE($,#139);
+#141=ORIENTED_EDGE($,$,$,#30,.T.);
+#142=CARTESIAN_POINT($,(-5,4,5));
+#143=VERTEX_POINT($,#142);
+#144=CARTESIAN_POINT($,(-5,4,-0));
+#145=DIRECTION($,(0,0,1));
+#146=VECTOR($,#145,1);
+#147=LINE($,#144,#146);
+#148=EDGE_CURVE($,#25,#143,#147,.T.);
+#149=ORIENTED_EDGE($,$,$,#148,.T.);
+#150=CARTESIAN_POINT($,(5,4,5));
+#151=DIRECTION($,(-1,0,0));
+#152=VECTOR($,#151,1);
+#153=LINE($,#150,#152);
+#154=EDGE_CURVE($,#119,#143,#153,.T.);
+#155=ORIENTED_EDGE($,$,$,#154,.F.);
+#156=ORIENTED_EDGE($,$,$,#124,.F.);
+#157=EDGE_LOOP($,(#141,#149,#155,#156));
+#158=FACE_OUTER_BOUND('',#157,.T.);
+#159=ADVANCED_FACE('',(#158),#140,.T.);
+#160=CARTESIAN_POINT($,(-5,4,0));
+#161=DIRECTION($,(-1,0,0));
+#162=DIRECTION($,(0,-1,0));
+#163=AXIS2_PLACEMENT_3D($,#160,#161,#162);
+#164=PLANE($,#163);
+#165=ORIENTED_EDGE($,$,$,#36,.T.);
+#166=ORIENTED_EDGE($,$,$,#107,.T.);
+#167=CARTESIAN_POINT($,(-5,4,5));
+#168=DIRECTION($,(0,-1,0));
+#169=VECTOR($,#168,1);
+#170=LINE($,#167,#169);
+#171=EDGE_CURVE($,#143,#96,#170,.T.);
+#172=ORIENTED_EDGE($,$,$,#171,.F.);
+#173=ORIENTED_EDGE($,$,$,#148,.F.);
+#174=EDGE_LOOP($,(#165,#166,#172,#173));
+#175=FACE_OUTER_BOUND('',#174,.T.);
+#176=ADVANCED_FACE('',(#175),#164,.T.);
+#177=CARTESIAN_POINT($,(-5,-4,5));
+#178=DIRECTION($,(0,-0.707106781186547,0.707106781186547));
+#179=DIRECTION($,(1,0,0));
+#180=AXIS2_PLACEMENT_3D($,#177,#178,#179);
+#181=PLANE($,#180);
+#182=ORIENTED_EDGE($,$,$,#101,.T.);
+#183=CARTESIAN_POINT($,(5,-4,5));
+#184=DIRECTION($,(-0.577350269189626,0.577350269189626,0.577350269189626));
+#185=VECTOR($,#184,1);
+#186=LINE($,#183,#185);
+#187=EDGE_CURVE($,#88,#49,#186,.T.);
+#188=ORIENTED_EDGE($,$,$,#187,.T.);
+#189=ORIENTED_EDGE($,$,$,#54,.F.);
+#190=CARTESIAN_POINT($,(-5,-4,5));
+#191=DIRECTION($,(0.577350269189626,0.577350269189626,0.577350269189626));
+#192=VECTOR($,#191,1);
+#193=LINE($,#190,#192);
+#194=EDGE_CURVE($,#96,#47,#193,.T.);
+#195=ORIENTED_EDGE($,$,$,#194,.F.);
+#196=EDGE_LOOP($,(#182,#188,#189,#195));
+#197=FACE_OUTER_BOUND('',#196,.T.);
+#198=ADVANCED_FACE('',(#197),#181,.T.);
+#199=CARTESIAN_POINT($,(5,-4,5));
+#200=DIRECTION($,(0.707106781186547,-0,0.707106781186547));
+#201=DIRECTION($,(0,1,0));
+#202=AXIS2_PLACEMENT_3D($,#199,#200,#201);
+#203=PLANE($,#202);
+#204=ORIENTED_EDGE($,$,$,#130,.T.);
+#205=CARTESIAN_POINT($,(5,4,5));
+#206=DIRECTION($,(-0.577350269189626,-0.577350269189626,0.577350269189626));
+#207=VECTOR($,#206,1);
+#208=LINE($,#205,#207);
+#209=EDGE_CURVE($,#119,#57,#208,.T.);
+#210=ORIENTED_EDGE($,$,$,#209,.T.);
+#211=ORIENTED_EDGE($,$,$,#62,.F.);
+#212=ORIENTED_EDGE($,$,$,#187,.F.);
+#213=EDGE_LOOP($,(#204,#210,#211,#212));
+#214=FACE_OUTER_BOUND('',#213,.T.);
+#215=ADVANCED_FACE('',(#214),#203,.T.);
+#216=CARTESIAN_POINT($,(5,4,5));
+#217=DIRECTION($,(0,0.707106781186547,0.707106781186547));
+#218=DIRECTION($,(-1,0,0));
+#219=AXIS2_PLACEMENT_3D($,#216,#217,#218);
+#220=PLANE($,#219);
+#221=ORIENTED_EDGE($,$,$,#154,.T.);
+#222=CARTESIAN_POINT($,(-5,4,5));
+#223=DIRECTION($,(0.577350269189626,-0.577350269189626,0.577350269189626));
+#224=VECTOR($,#223,1);
+#225=LINE($,#222,#224);
+#226=EDGE_CURVE($,#143,#65,#225,.T.);
+#227=ORIENTED_EDGE($,$,$,#226,.T.);
+#228=ORIENTED_EDGE($,$,$,#70,.F.);
+#229=ORIENTED_EDGE($,$,$,#209,.F.);
+#230=EDGE_LOOP($,(#221,#227,#228,#229));
+#231=FACE_OUTER_BOUND('',#230,.T.);
+#232=ADVANCED_FACE('',(#231),#220,.T.);
+#233=CARTESIAN_POINT($,(-5,4,5));
+#234=DIRECTION($,(-0.707106781186547,0,0.707106781186547));
+#235=DIRECTION($,(0,-1,0));
+#236=AXIS2_PLACEMENT_3D($,#233,#234,#235);
+#237=PLANE($,#236);
+#238=ORIENTED_EDGE($,$,$,#171,.T.);
+#239=ORIENTED_EDGE($,$,$,#194,.T.);
+#240=ORIENTED_EDGE($,$,$,#76,.F.);
+#241=ORIENTED_EDGE($,$,$,#226,.F.);
+#242=EDGE_LOOP($,(#238,#239,#240,#241));
+#243=FACE_OUTER_BOUND('',#242,.T.);
+#244=ADVANCED_FACE('',(#243),#237,.T.);
+#245=CLOSED_SHELL($,(#40,#80,#111,#135,#159,#176,#198,#215,#232,#244));
+#246=MANIFOLD_SOLID_BREP('TopBreak',#245);
+#247=APPLICATION_CONTEXT('mechanical design');
+#248=PRODUCT_CONTEXT('',#247,'mechanical');
+#249=PRODUCT('AETHERIS','TopBreak','',(#248));
+#250=PRODUCT_DEFINITION_FORMATION('','',#249);
+#251=PRODUCT_DEFINITION_CONTEXT('design',#247,'design');
+#252=PRODUCT_DEFINITION('','',#250,#251);
+#253=PRODUCT_DEFINITION_SHAPE('','',#252);
+#254=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.));
+#255=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
+#256=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT());
+#257=(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNIT_ASSIGNED_CONTEXT((#254,#255,#256))REPRESENTATION_CONTEXT('3','3D'));
+#258=SHAPE_REPRESENTATION('TopBreak',(#246),#257);
+#259=SHAPE_DEFINITION_REPRESENTATION(#253,#258);
+ENDSEC;
+END-ISO-10303-21;
diff --git a/fixtures/FirmamentV2/Chamfer/invalid/air-cylinder-top-rim-oversized.invalid.firmament b/fixtures/FirmamentV2/Chamfer/invalid/air-cylinder-top-rim-oversized.invalid.firmament
new file mode 100644
index 00000000..a32a9e6a
--- /dev/null
+++ b/fixtures/FirmamentV2/Chamfer/invalid/air-cylinder-top-rim-oversized.invalid.firmament
@@ -0,0 +1,6 @@
+// fixture-id: chamfer-m6-cylinder-top-rim-oversized
+// expected-error-kind: DistanceTooLarge
+// expected-error: chamfer-distance-too-large:circular-top-rim
+Model ChamferM6CylinderTopRimOversized mm
+Cylinder Base { Radius: 5mm Height: 20mm }
+Modify Base { EdgeFinish TopRim { Face: +Z Target: Boundary Kind: Chamfer Distance: 5mm } }
diff --git a/fixtures/FirmamentV2/Chamfer/invalid/air-cylinder-top-rim-zero.invalid.firmament b/fixtures/FirmamentV2/Chamfer/invalid/air-cylinder-top-rim-zero.invalid.firmament
new file mode 100644
index 00000000..d9fbeb21
--- /dev/null
+++ b/fixtures/FirmamentV2/Chamfer/invalid/air-cylinder-top-rim-zero.invalid.firmament
@@ -0,0 +1,6 @@
+// fixture-id: chamfer-m6-cylinder-top-rim-zero
+// expected-error-kind: InvalidAuthoredInput
+// expected-error: chamfer-invalid-distance:must-be-positive
+Model ChamferM6CylinderTopRimZero mm
+Cylinder Base { Radius: 20mm Height: 50mm }
+Modify Base { EdgeFinish TopRim { Face: +Z Target: Boundary Kind: Chamfer Distance: 0mm } }
diff --git a/fixtures/FirmamentV2/Chamfer/invalid/air-hole-entry-chamfer-zero.invalid.firmament b/fixtures/FirmamentV2/Chamfer/invalid/air-hole-entry-chamfer-zero.invalid.firmament
new file mode 100644
index 00000000..87c28f82
--- /dev/null
+++ b/fixtures/FirmamentV2/Chamfer/invalid/air-hole-entry-chamfer-zero.invalid.firmament
@@ -0,0 +1,16 @@
+// fixture-id: chamfer-m6-through-hole-entry-zero-distance
+// expected-error: firmament-v2-hole-countersink-invalid
+model ChamferM6ThroughHoleEntryZero {
+ units mm
+ solid base: Box { size: [20, 18, 10] }
+ modify base {
+ hole<countersink> chamferedEntry {
+ on: face(+Z)
+ center: [0, 0]
+ shaftDiameter: 6
+ countersinkDiameter: 6
+ countersinkAngle: 90
+ end: throughAll
+ }
+ }
+}
diff --git a/fixtures/FirmamentV2/Chamfer/valid/air-cylinder-top-rim-chamfer.valid.firmament b/fixtures/FirmamentV2/Chamfer/valid/air-cylinder-top-rim-chamfer.valid.firmament
new file mode 100644
index 00000000..e444c641
--- /dev/null
+++ b/fixtures/FirmamentV2/Chamfer/valid/air-cylinder-top-rim-chamfer.valid.firmament
@@ -0,0 +1,16 @@
+// fixture-id: chamfer-m6-cylinder-top-rim-canonical
+// semantic-target: complete convex outer boundary of the +Z circular cap
+// construction-family: RevolutionProfileRewrite
+// admitted-domain: history-known right circular cylinder, uniform equal distance, d < min(radius,height)
+// expected-surfaces: plane=2,cylinder=1,cone=1
+// expected-topology: vertices=6,edges=5,faces=4
+Model ChamferM6CylinderTopRimCanonical mm
+ Cylinder Base { Radius: 20mm Height: 50mm }
+ Modify Base {
+ EdgeFinish TopRim {
+ Face: +Z
+ Target: Boundary
+ Kind: Chamfer
+ Distance: 1mm
+ }
+ }
diff --git a/fixtures/FirmamentV2/Chamfer/valid/air-cylinder-top-rim-variant.valid.firmament b/fixtures/FirmamentV2/Chamfer/valid/air-cylinder-top-rim-variant.valid.firmament
new file mode 100644
index 00000000..74b079f3
--- /dev/null
+++ b/fixtures/FirmamentV2/Chamfer/valid/air-cylinder-top-rim-variant.valid.firmament
@@ -0,0 +1,15 @@
+// fixture-id: chamfer-m6-cylinder-top-rim-variant
+// semantic-target: complete convex outer boundary of the +Z circular cap
+// construction-family: RevolutionProfileRewrite
+// admitted-domain: history-known right circular cylinder
+// expected-surfaces: plane=2,cylinder=1,cone=1
+Model ChamferM6CylinderTopRimVariant mm
+ Cylinder Base { Radius: 7.5mm Height: 18mm }
+ Modify Base {
+ EdgeFinish TopRim {
+ Face: +Z
+ Target: Boundary
+ Kind: Chamfer
+ Distance: 2mm
+ }
+ }
diff --git a/fixtures/FirmamentV2/Chamfer/valid/air-hole-entry-chamfer-variant.valid.firmament b/fixtures/FirmamentV2/Chamfer/valid/air-hole-entry-chamfer-variant.valid.firmament
new file mode 100644
index 00000000..f0288bf7
--- /dev/null
+++ b/fixtures/FirmamentV2/Chamfer/valid/air-hole-entry-chamfer-variant.valid.firmament
@@ -0,0 +1,17 @@
+// fixture-id: chamfer-m6-through-hole-entry-variant
+// semantic-target: equal-distance 0.75mm entry chamfer on a 4.5mm through shaft
+// construction-family: HoleProfileStack (90-degree conical entry)
+model ChamferM6ThroughHoleEntryVariant {
+ units mm
+ solid base: Box { size: [20, 18, 10] }
+ modify base {
+ hole<countersink> chamferedEntry {
+ on: face(+Z)
+ center: [2, -1]
+ shaftDiameter: 4.5
+ countersinkDiameter: 6
+ countersinkAngle: 90
+ end: throughAll
+ }
+ }
+}
diff --git a/fixtures/FirmamentV2/Chamfer/valid/air-hole-entry-chamfer.valid.firmament b/fixtures/FirmamentV2/Chamfer/valid/air-hole-entry-chamfer.valid.firmament
new file mode 100644
index 00000000..3f22aaaf
--- /dev/null
+++ b/fixtures/FirmamentV2/Chamfer/valid/air-hole-entry-chamfer.valid.firmament
@@ -0,0 +1,19 @@
+// fixture-id: chamfer-m6-through-hole-entry
+// semantic-target: equal-distance 1mm entry chamfer on a 6mm through shaft
+// construction-family: HoleProfileStack (90-degree conical entry, entry diameter = shaft diameter + 2d)
+// admitted-domain: history-known +Z semantic through hole in rectangular host
+// expected-surfaces: planar entry face, conical transition wall, cylindrical shaft wall
+model ChamferM6ThroughHoleEntry {
+ units mm
+ solid base: Box { size: [30, 24, 12] }
+ modify base {
+ hole<countersink> chamferedEntry {
+ on: face(+Z)
+ center: [0, 0]
+ shaftDiameter: 6
+ countersinkDiameter: 8
+ countersinkAngle: 90
+ end: throughAll
+ }
+ }
+}
diff --git a/tests/Open-In-CadAssistant.Tests.ps1 b/tests/Open-In-CadAssistant.Tests.ps1
new file mode 100644
index 00000000..528b90bb
--- /dev/null
+++ b/tests/Open-In-CadAssistant.Tests.ps1
@@ -0,0 +1,75 @@
+$ErrorActionPreference = 'Stop'
+Set-StrictMode -Version Latest
+
+. (Join-Path $PSScriptRoot '..\tools\Open-In-CadAssistant.ps1')
+
+$sandbox = Join-Path ([System.IO.Path]::GetTempPath()) ("aetheris-cad-assistant-tests-" + [guid]::NewGuid().ToString('N'))
+New-Item -ItemType Directory -Path $sandbox | Out-Null
+
+function Assert-True([bool]$Condition, [string]$Message) {
+ if (-not $Condition) { throw "Assertion failed: $Message" }
+}
+
+try {
+ $spaceDir = Join-Path $sandbox 'path with spaces'
+ New-Item -ItemType Directory -Path $spaceDir | Out-Null
+ $step = Join-Path $spaceDir 'model.step'
+ Set-Content -LiteralPath $step -Value 'ISO-10303-21;' -NoNewline
+ $viewer = Join-Path $spaceDir 'CADAssistant.exe'
+ New-Item -ItemType File -Path $viewer | Out-Null
+
+ $spec = Get-CadAssistantLaunchSpec -StepPath $step -CadAssistantOverride $viewer
+ Assert-True ($spec.StepPath -eq (Resolve-Path -LiteralPath $step).Path) 'STEP path is resolved exactly.'
+ Assert-True ($spec.CadAssistantExecutable -eq (Resolve-Path -LiteralPath $viewer).Path) 'Explicit executable override resolves correctly.'
+ Assert-True ($spec.Sha256 -eq (Get-FileHash -LiteralPath $step -Algorithm SHA256).Hash) 'SHA-256 is reported correctly.'
+ Assert-True ($spec.StepPath -like '*path with spaces*') 'Paths with spaces remain a single resolved path.'
+
+ $fromDirectory = Resolve-CadAssistantExecutable -OverridePath $spaceDir
+ Assert-True ($fromDirectory -eq (Resolve-Path -LiteralPath $viewer).Path) 'Directory discovery resolves one obvious executable.'
+
+ $otherViewer = Join-Path $spaceDir 'other-viewer.exe'
+ New-Item -ItemType File -Path $otherViewer | Out-Null
+ $priorViewerEnvironment = $env:AETHERIS_CAD_ASSISTANT_EXE
+ try {
+ $env:AETHERIS_CAD_ASSISTANT_EXE = $viewer
+ Assert-True ((Resolve-CadAssistantExecutable) -eq (Resolve-Path -LiteralPath $viewer).Path) 'Environment executable override resolves correctly.'
+ Assert-True ((Resolve-CadAssistantExecutable -OverridePath $otherViewer) -eq (Resolve-Path -LiteralPath $otherViewer).Path) 'Explicit executable override takes precedence over the environment.'
+ }
+ finally {
+ $env:AETHERIS_CAD_ASSISTANT_EXE = $priorViewerEnvironment
+ }
+
+ $script:capturedFilePath = $null
+ $script:capturedArgumentList = $null
+ function Start-Process {
+ param($FilePath, $ArgumentList, [switch]$PassThru, [switch]$ErrorAction)
+ $script:capturedFilePath = $FilePath
+ $script:capturedArgumentList = @($ArgumentList)
+ return [pscustomobject]@{ Id = 12345 }
+ }
+ Invoke-CadAssistantLaunch -LaunchSpec $spec | Out-Null
+ Assert-True ($script:capturedFilePath -eq $spec.CadAssistantExecutable) 'Launch command receives the discovered executable.'
+ Assert-True ($script:capturedArgumentList.Count -eq 1 -and $script:capturedArgumentList[0] -eq $spec.StepPath) 'Launch command receives the exact STEP path as one argument.'
+ Remove-Item -LiteralPath Function:\Start-Process
+
+ $missingStepFailed = $false
+ try { Get-CadAssistantLaunchSpec -StepPath (Join-Path $sandbox 'missing.step') -CadAssistantOverride $viewer | Out-Null } catch { $missingStepFailed = $true }
+ Assert-True $missingStepFailed 'Missing STEP path fails.'
+
+ $missingViewerFailed = $false
+ try { Resolve-CadAssistantExecutable -OverridePath (Join-Path $sandbox 'missing.exe') | Out-Null } catch { $missingViewerFailed = $true }
+ Assert-True $missingViewerFailed 'Missing CAD Assistant executable fails clearly.'
+
+ if (Test-Path -LiteralPath $script:DefaultCadAssistantRoot -PathType Container) {
+ $actualDefault = Resolve-CadAssistantExecutable
+ Assert-True ($actualDefault -eq 'C:\Program Files\CAD Assistant\CADAssistant.exe') 'Current-machine default installation discovery resolves CADAssistant.exe.'
+ }
+ else {
+ Write-Host 'Default installation discovery test skipped: CAD Assistant is not installed in the default location.'
+ }
+
+ Write-Host 'Open-In-CadAssistant tooling tests passed.'
+}
+finally {
+ Remove-Item -LiteralPath $sandbox -Recurse -Force -ErrorAction SilentlyContinue
+}
diff --git a/tools/Open-In-CadAssistant.ps1 b/tools/Open-In-CadAssistant.ps1
new file mode 100644
index 00000000..b30f0f13
--- /dev/null
+++ b/tools/Open-In-CadAssistant.ps1
@@ -0,0 +1,179 @@
+[CmdletBinding()]
+param(
+ [Parameter(Position = 0)]
+ [Alias('StepFile')]
+ [string]$Step,
+
+ [string]$CadAssistantPath,
+
+ [string]$BuildReport,
+
+ [string]$AnalyzeReport,
+
+ [switch]$NoLaunch
+)
+
+Set-StrictMode -Version Latest
+$ErrorActionPreference = 'Stop'
+
+$script:DefaultCadAssistantRoot = 'C:\Program Files\CAD Assistant'
+
+function Resolve-AetherisExistingFile {
+ param(
+ [Parameter(Mandatory = $true)] [string]$Path,
+ [Parameter(Mandatory = $true)] [string]$Description
+ )
+
+ if (-not (Test-Path -LiteralPath $Path -PathType Leaf)) {
+ throw [System.IO.FileNotFoundException]::new("$Description not found: $Path", $Path)
+ }
+
+ return (Resolve-Path -LiteralPath $Path -ErrorAction Stop).Path
+}
+
+function Get-CadAssistantCandidates {
+ param([Parameter(Mandatory = $true)] [string]$Directory)
+
+ if (-not (Test-Path -LiteralPath $Directory -PathType Container)) {
+ throw [System.IO.DirectoryNotFoundException]::new("CAD Assistant directory not found: $Directory")
+ }
+
+ # The documented/current application is CADAssistant.exe. The fallback keeps
+ # discovery useful for versioned distributions without accepting updater or
+ # uninstaller executables as viewer candidates.
+ $exactCandidates = @(Get-ChildItem -LiteralPath $Directory -Recurse -File -Filter 'CADAssistant.exe' |
+ Sort-Object -Property FullName)
+ if ($exactCandidates.Count -eq 1) {
+ return $exactCandidates
+ }
+ if ($exactCandidates.Count -gt 1) {
+ throw "Multiple CAD Assistant executables named CADAssistant.exe were found under '$Directory': $($exactCandidates.FullName -join '; ')"
+ }
+
+ $candidates = @(Get-ChildItem -LiteralPath $Directory -Recurse -File -Filter '*.exe' |
+ Where-Object { $_.BaseName -match '^CAD[ _-]?Assistant(?:[ _-].+)?$' } |
+ Sort-Object -Property FullName)
+ if ($candidates.Count -eq 1) {
+ return $candidates
+ }
+ if ($candidates.Count -eq 0) {
+ throw "No CAD Assistant viewer executable was found under '$Directory'. Expected CADAssistant.exe or one unambiguous CAD Assistant executable."
+ }
+
+ throw "Multiple ambiguous CAD Assistant executable candidates were found under '$Directory': $($candidates.FullName -join '; ')"
+}
+
+function Resolve-CadAssistantExecutable {
+ param([string]$OverridePath)
+
+ $candidatePath = if (-not [string]::IsNullOrWhiteSpace($OverridePath)) {
+ $OverridePath
+ }
+ elseif (-not [string]::IsNullOrWhiteSpace($env:AETHERIS_CAD_ASSISTANT_EXE)) {
+ $env:AETHERIS_CAD_ASSISTANT_EXE
+ }
+ else {
+ $script:DefaultCadAssistantRoot
+ }
+
+ if (Test-Path -LiteralPath $candidatePath -PathType Leaf) {
+ $resolved = (Resolve-Path -LiteralPath $candidatePath -ErrorAction Stop).Path
+ if ([System.IO.Path]::GetExtension($resolved) -ine '.exe') {
+ throw "CAD Assistant executable path must end in .exe: $resolved"
+ }
+ return $resolved
+ }
+
+ if (Test-Path -LiteralPath $candidatePath -PathType Container) {
+ return (Get-CadAssistantCandidates -Directory $candidatePath).FullName
+ }
+
+ throw "CAD Assistant path not found: $candidatePath. Supply -CadAssistantPath <executable-or-directory>, set AETHERIS_CAD_ASSISTANT_EXE, or install under '$script:DefaultCadAssistantRoot'."
+}
+
+function Get-CadAssistantLaunchSpec {
+ param(
+ [Parameter(Mandatory = $true)] [string]$StepPath,
+ [string]$CadAssistantOverride,
+ [string]$BuildReportPath,
+ [string]$AnalyzeReportPath
+ )
+
+ $resolvedStep = Resolve-AetherisExistingFile -Path $StepPath -Description 'STEP file'
+ if ([System.IO.Path]::GetExtension($resolvedStep) -notin '.step', '.stp') {
+ throw "Expected a .step or .stp file: $resolvedStep"
+ }
+
+ $spec = [ordered]@{
+ StepPath = $resolvedStep
+ Sha256 = (Get-FileHash -LiteralPath $resolvedStep -Algorithm SHA256).Hash
+ CadAssistantExecutable = Resolve-CadAssistantExecutable -OverridePath $CadAssistantOverride
+ BuildReportPath = $null
+ AnalyzeReportPath = $null
+ }
+
+ if (-not [string]::IsNullOrWhiteSpace($BuildReportPath)) {
+ $spec.BuildReportPath = Resolve-AetherisExistingFile -Path $BuildReportPath -Description 'Build report'
+ }
+ if (-not [string]::IsNullOrWhiteSpace($AnalyzeReportPath)) {
+ $spec.AnalyzeReportPath = Resolve-AetherisExistingFile -Path $AnalyzeReportPath -Description 'Analyze report'
+ }
+
+ return [pscustomobject]$spec
+}
+
+function Invoke-CadAssistantLaunch {
+ param([Parameter(Mandatory = $true)] $LaunchSpec)
+
+ # ArgumentList is an array: Start-Process receives this exact resolved path as
+ # one argument, including when the artifact path contains spaces.
+ return Start-Process -FilePath $LaunchSpec.CadAssistantExecutable -ArgumentList @($LaunchSpec.StepPath) -PassThru -ErrorAction Stop
+}
+
+function Invoke-OpenInCadAssistant {
+ param(
+ [Parameter(Mandatory = $true)] [string]$StepPath,
+ [string]$CadAssistantOverride,
+ [string]$BuildReportPath,
+ [string]$AnalyzeReportPath,
+ [switch]$SkipLaunch
+ )
+
+ $spec = Get-CadAssistantLaunchSpec -StepPath $StepPath -CadAssistantOverride $CadAssistantOverride -BuildReportPath $BuildReportPath -AnalyzeReportPath $AnalyzeReportPath
+ Write-Host "CAD Assistant executable: $($spec.CadAssistantExecutable)"
+ Write-Host "STEP artifact: $($spec.StepPath)"
+ Write-Host "STEP SHA-256: $($spec.Sha256)"
+ if ($spec.BuildReportPath) { Write-Host "Build report: $($spec.BuildReportPath)" }
+ if ($spec.AnalyzeReportPath) { Write-Host "Analyze report: $($spec.AnalyzeReportPath)" }
+
+ if ($SkipLaunch) {
+ Write-Host 'Launch skipped (-NoLaunch).'
+ return $spec
+ }
+
+ $process = Invoke-CadAssistantLaunch -LaunchSpec $spec
+ Write-Host "CAD Assistant launched successfully (PID $($process.Id))."
+ return $spec
+}
+
+if ($MyInvocation.InvocationName -ne '.') {
+ try {
+ if ([string]::IsNullOrWhiteSpace($Step)) {
+ throw [System.IO.FileNotFoundException]::new('A STEP file is required. Supply -Step <path>.')
+ }
+ Invoke-OpenInCadAssistant -StepPath $Step -CadAssistantOverride $CadAssistantPath -BuildReportPath $BuildReport -AnalyzeReportPath $AnalyzeReport -SkipLaunch:$NoLaunch | Out-Null
+ exit 0
+ }
+ catch [System.IO.FileNotFoundException] {
+ [Console]::Error.WriteLine($_.Exception.Message)
+ exit 2
+ }
+ catch [System.IO.DirectoryNotFoundException] {
+ [Console]::Error.WriteLine($_.Exception.Message)
+ exit 3
+ }
+ catch {
+ [Console]::Error.WriteLine($_.Exception.Message)
+ exit 4
+ }
+}