Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Support combined hole and edge-finish STEP export

Yuechen Li45161244117b
diff --git a/Aetheris.CLI.Tests/FirmamentV2ConceptPoint3HoleStepPipelineTests.cs b/Aetheris.CLI.Tests/FirmamentV2ConceptPoint3HoleStepPipelineTests.cs
index 2cd0c1a7..60d0d3a8 100644
--- a/Aetheris.CLI.Tests/FirmamentV2ConceptPoint3HoleStepPipelineTests.cs
+++ b/Aetheris.CLI.Tests/FirmamentV2ConceptPoint3HoleStepPipelineTests.cs
@@ -74,7 +74,7 @@ public sealed class FirmamentV2ConceptPoint3HoleStepPipelineTests
}
[Fact]
- public void ConceptHolesCombinedWithProductionChamfer_FailsExplicitly()
+ public void ConceptHolesCombinedWithProductionChamfer_ExportsOneAuthoritativeBody()
{
var combined = Source.Replace(" }\r\n }\r\n Expose {", " }\r\n EdgeFinish TopBreak {\r\n Face: BracketConcept.TopPlane\r\n Target: Boundary\r\n Kind: Chamfer\r\n Distance: 1.5mm\r\n }\r\n }\r\n Expose {", StringComparison.Ordinal)
.Replace(" }\n }\n Expose {", " }\n EdgeFinish TopBreak {\n Face: BracketConcept.TopPlane\n Target: Boundary\n Kind: Chamfer\n Distance: 1.5mm\n }\n }\n Expose {", StringComparison.Ordinal);
@@ -85,8 +85,33 @@ public sealed class FirmamentV2ConceptPoint3HoleStepPipelineTests
var exit = CliRunner.Run(["build", sourcePath, "--out", Path.Combine(dir, "combined.step"), "--json"], stdout, new StringWriter());
+ Assert.Equal(0, exit);
+ using var report = JsonDocument.Parse(stdout.ToString());
+ var combinedReport = report.RootElement.GetProperty("combined");
+ Assert.Equal("CombinedHoleEdgeFinish", combinedReport.GetProperty("route").GetString());
+ Assert.Equal("Disjoint", combinedReport.GetProperty("interaction").GetString());
+ Assert.Equal(2, report.RootElement.GetProperty("features").GetArrayLength());
+ Assert.Equal(12, combinedReport.GetProperty("faces").GetInt32());
+
+ var imported = Step242Importer.ImportBody(File.ReadAllText(Path.Combine(dir, "combined.step")));
+ Assert.True(imported.IsSuccess, string.Join(Environment.NewLine, imported.Diagnostics.Select(d => d.Message)));
+ Assert.Equal(2, imported.Value!.Geometry.Surfaces.Count(s => s.Value.Kind == SurfaceGeometryKind.Cylinder));
+ }
+
+ [Fact]
+ public void ConceptHolesThatSplitTheRequestedChamferChain_AreRejectedByCombinedRoute()
+ {
+ var combined = Source.Replace(" }\n }\n Expose {", " }\n EdgeFinish TopBreak {\n Face: BracketConcept.TopPlane\n Target: Boundary\n Kind: Chamfer\n Distance: 6mm\n }\n }\n Expose {", StringComparison.Ordinal)
+ .Replace(" }\r\n }\r\n Expose {", " }\r\n EdgeFinish TopBreak {\r\n Face: BracketConcept.TopPlane\r\n Target: Boundary\r\n Kind: Chamfer\r\n Distance: 6mm\r\n }\r\n }\r\n Expose {", StringComparison.Ordinal);
+ var dir = Path.Combine(Path.GetTempPath(), "aetheris-concept-materialization-m2-combined-invalid", Guid.NewGuid().ToString("N"));
+ Directory.CreateDirectory(dir);
+ var sourcePath = Path.Combine(dir, "combined-invalid.firmament"); File.WriteAllText(sourcePath, combined);
+ var stdout = new StringWriter();
+
+ var exit = CliRunner.Run(["build", sourcePath, "--out", Path.Combine(dir, "combined-invalid.step"), "--json"], stdout, new StringWriter());
+
Assert.Equal(1, exit);
- Assert.Contains("air-chamfer-production-route-requires-one-box-and-one-edge-finish", stdout.ToString(), StringComparison.Ordinal);
+ Assert.Contains("CombinedFeatureInteractionUnsupported", stdout.ToString(), StringComparison.Ordinal);
}
private static string Source => File.ReadAllText(Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "../../../../demos/concept-materialization-m2.firmament")));
diff --git a/Aetheris.CLI.Tests/FirmamentV2DiagnosticRoutingCliTests.cs b/Aetheris.CLI.Tests/FirmamentV2DiagnosticRoutingCliTests.cs
new file mode 100644
index 00000000..89019c5d
--- /dev/null
+++ b/Aetheris.CLI.Tests/FirmamentV2DiagnosticRoutingCliTests.cs
@@ -0,0 +1,32 @@
+using System.Text.Json;
+
+namespace Aetheris.CLI.Tests;
+
+public sealed class FirmamentV2DiagnosticRoutingCliTests
+{
+ [Fact]
+ public void BuildAndValidate_RecognizedMalformedConceptStruct_ExposeTheSameFatalV2DiagnosticsAsJson()
+ {
+ var fixture = FixturePath();
+ var buildOut = new StringWriter();
+ var validateOut = new StringWriter();
+
+ var buildExit = CliRunner.Run(["build", fixture, "--json"], buildOut, new StringWriter());
+ var validateExit = CliRunner.Run(["validate", fixture, "--json"], validateOut, new StringWriter());
+
+ Assert.Equal(1, buildExit);
+ Assert.Equal(1, validateExit);
+ using var build = JsonDocument.Parse(buildOut.ToString());
+ using var validate = JsonDocument.Parse(validateOut.ToString());
+ var buildMessages = build.RootElement.GetProperty("diagnostics").EnumerateArray().Select(diagnostic => diagnostic.GetProperty("message").GetString()).ToArray();
+ var validationDiagnostics = validate.RootElement.GetProperty("firmamentV2Validation").GetProperty("diagnostics").EnumerateArray().ToArray();
+
+ Assert.Contains("HoleLocalCenterInvalid", buildMessages);
+ Assert.Contains("firmament-concept-missing-member:BracketConcept.RequiredExpose", buildMessages);
+ Assert.Contains(validationDiagnostics, diagnostic => diagnostic.GetProperty("code").GetString() == "HoleLocalCenterInvalid" && diagnostic.GetProperty("severity").GetString() == "fatal");
+ Assert.Contains(validationDiagnostics, diagnostic => diagnostic.GetProperty("code").GetString() == "firmament-concept-missing-member:BracketConcept.RequiredExpose" && diagnostic.GetProperty("severity").GetString() == "fatal");
+ Assert.DoesNotContain(buildMessages, message => message!.Contains("FIRM-PARSE-0001", StringComparison.Ordinal) || message.Contains("canonical TOON-style text", StringComparison.Ordinal));
+ }
+
+ private static string FixturePath() => Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "../../../../fixtures/FirmamentV2/Language/invalid/concept-struct-diagnostic-routing-x1.invalid.firmfixture"));
+}
diff --git a/Aetheris.CLI/CliRunner.cs b/Aetheris.CLI/CliRunner.cs
index 1fb98d7b..8685e1e2 100644
--- a/Aetheris.CLI/CliRunner.cs
+++ b/Aetheris.CLI/CliRunner.cs
@@ -390,6 +390,7 @@ public static class CliRunner
roundedBox = build.Value.Export.RoundedBox,
hollow = build.Value.Export.Hollow,
lattice = build.Value.Export.Lattice,
+ combined = build.Value.Export.Combined,
features = build.Value.Export.Features,
inlineStepMigration = build.Value.Export.InlineStepMigration,
inlineStepReplacementAssist = build.Value.Export.InlineStepReplacementAssist,
diff --git a/Aetheris.Kernel.Core/Brep/Features/CombinedTopBoundaryChamferThroughHoleBuilder.cs b/Aetheris.Kernel.Core/Brep/Features/CombinedTopBoundaryChamferThroughHoleBuilder.cs
new file mode 100644
index 00000000..ef39137d
--- /dev/null
+++ b/Aetheris.Kernel.Core/Brep/Features/CombinedTopBoundaryChamferThroughHoleBuilder.cs
@@ -0,0 +1,215 @@
+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;
+
+/// <summary>
+/// Bounded materializer for the composition of the existing rectangular top-boundary
+/// chamfer family and disjoint, world-Z through-hole cylinders. It is deliberately
+/// a final-plan consumer: callers must have already admitted the host, hole, and
+/// semantic finish selections. It performs no topology search or feature recovery.
+/// </summary>
+public sealed record CombinedTopBoundaryChamferThroughHole(
+ string FeatureId,
+ double CenterX,
+ double CenterY,
+ double Radius);
+
+public sealed record CombinedTopBoundaryChamferThroughHolePlan(
+ string PlanId,
+ string? ParentHostPlanId,
+ IReadOnlyList<string> AppliedFeatureIds,
+ double Width,
+ double Depth,
+ double ZMin,
+ double ZMax,
+ double ChamferDistance,
+ IReadOnlyList<CombinedTopBoundaryChamferThroughHole> Holes)
+{
+ public double AnalyticVolume
+ {
+ get
+ {
+ var height = ZMax - ZMin;
+ var lowerHeight = height - ChamferDistance;
+ var bottomArea = Width * Depth;
+ var topArea = (Width - (2d * ChamferDistance)) * (Depth - (2d * ChamferDistance));
+ var chamferedHost = (bottomArea * lowerHeight) + (ChamferDistance / 3d * (bottomArea + topArea + System.Math.Sqrt(bottomArea * topArea)));
+ return chamferedHost - Holes.Sum(h => System.Math.PI * h.Radius * h.Radius * height);
+ }
+ }
+}
+
+public static class CombinedTopBoundaryChamferThroughHoleBuilder
+{
+ private const double Tol = 1e-9;
+
+ public static KernelResult<BrepBody> Build(CombinedTopBoundaryChamferThroughHolePlan plan)
+ {
+ ArgumentNullException.ThrowIfNull(plan);
+ var validation = Validate(plan);
+ if (!validation.IsSuccess)
+ {
+ return KernelResult<BrepBody>.Failure(validation.Diagnostics);
+ }
+
+ var z0 = plan.ZMin;
+ var z1 = plan.ZMax - plan.ChamferDistance;
+ var z2 = plan.ZMax;
+ var x0 = -plan.Width / 2d;
+ var x1 = plan.Width / 2d;
+ var y0 = -plan.Depth / 2d;
+ var y1 = plan.Depth / 2d;
+ var d = plan.ChamferDistance;
+ var bottom = new[] { new Point3D(x0, y0, z0), new Point3D(x1, y0, z0), new Point3D(x1, y1, z0), new Point3D(x0, y1, z0) };
+ var shoulder = new[] { new Point3D(x0, y0, z1), new Point3D(x1, y0, z1), new Point3D(x1, y1, z1), new Point3D(x0, y1, z1) };
+ var top = new[] { new Point3D(x0 + d, y0 + d, z2), new Point3D(x1 - d, y0 + d, z2), new Point3D(x1 - d, y1 - d, z2), new Point3D(x0 + d, y1 - d, z2) };
+ return BuildWithHoleTopology(plan, bottom, shoulder, top);
+ }
+
+ private static KernelResult<BrepBody> BuildWithHoleTopology(
+ CombinedTopBoundaryChamferThroughHolePlan plan,
+ Point3D[] bottom,
+ Point3D[] shoulder,
+ Point3D[] top)
+ {
+ var b = new TopologyBuilder();
+ var vertices = Enumerable.Range(0, 12).Select(_ => b.AddVertex()).ToArray();
+ var bottomEdges = Ring(b, vertices, 0);
+ var shoulderEdges = Ring(b, vertices, 4);
+ var topEdges = Ring(b, vertices, 8);
+ var lowerEdges = Enumerable.Range(0, 4).Select(i => b.AddEdge(vertices[i], vertices[4 + i])).ToArray();
+ var chamferEdges = Enumerable.Range(0, 4).Select(i => b.AddEdge(vertices[4 + i], vertices[8 + i])).ToArray();
+ var holes = plan.Holes.Select(h =>
+ {
+ // The periodic circle and its longitudinal seam share endpoint identities.
+ // Coincident but distinct seam/circle vertices produce invalid STEP wires.
+ var seamTop = b.AddVertex(); var seamBottom = b.AddVertex();
+ return new HoleTopology(h, seamTop, seamBottom,
+ b.AddEdge(seamTop, seamTop), b.AddEdge(seamBottom, seamBottom), b.AddEdge(seamTop, seamBottom));
+ }).ToArray();
+
+ var bottomLoops = new List<LoopId> { AddLoop(b, bottomEdges.Select(Forward).ToArray()) };
+ var topLoops = new List<LoopId> { AddLoop(b, topEdges.Select(Forward).ToArray()) };
+ foreach (var hole in holes)
+ {
+ bottomLoops.Add(AddLoop(b, [Reversed(hole.BottomCircle)]));
+ topLoops.Add(AddLoop(b, [Forward(hole.TopCircle)]));
+ }
+
+ var bottomFace = b.AddFace(bottomLoops);
+ var topFace = b.AddFace(topLoops);
+ var lowerFaces = new FaceId[4];
+ var chamferFaces = new FaceId[4];
+ for (var i = 0; i < 4; i++)
+ {
+ var next = (i + 1) % 4;
+ lowerFaces[i] = b.AddFace([AddLoop(b, [Forward(bottomEdges[i]), Forward(lowerEdges[next]), Reversed(shoulderEdges[i]), Reversed(lowerEdges[i])])]);
+ chamferFaces[i] = b.AddFace([AddLoop(b, [Forward(shoulderEdges[i]), Forward(chamferEdges[next]), Reversed(topEdges[i]), Reversed(chamferEdges[i])])]);
+ }
+ var holeFaces = holes.Select(h => b.AddFace([AddLoop(b, [Forward(h.Seam), Forward(h.BottomCircle), Reversed(h.Seam), Reversed(h.TopCircle)])])).ToArray();
+ var shell = b.AddShell([bottomFace, topFace, .. lowerFaces, .. chamferFaces, .. holeFaces]);
+ b.AddBody([shell]);
+
+ var geometry = new BrepGeometryStore();
+ var bindings = new BrepBindingModel();
+ var points = bottom.Concat(shoulder).Concat(top).ToArray();
+ var vertexPoints = vertices.Select((id, index) => new KeyValuePair<VertexId, Point3D>(id, points[index])).ToDictionary(x => x.Key, x => x.Value);
+ var edgeCurve = 1;
+ foreach (var edge in bottomEdges.Concat(shoulderEdges).Concat(topEdges).Concat(lowerEdges).Concat(chamferEdges))
+ {
+ var start = vertexPoints[edge == default ? vertices[0] : b.Model.Edges.Single(e => e.Id == edge).StartVertexId];
+ var end = vertexPoints[b.Model.Edges.Single(e => e.Id == edge).EndVertexId];
+ var vector = end - start;
+ var id = new CurveGeometryId(edgeCurve++);
+ geometry.AddCurve(id, CurveGeometry.FromLine(new Line3Curve(start, Direction3D.Create(vector))));
+ bindings.AddEdgeBinding(new EdgeGeometryBinding(edge, id, new ParameterInterval(0d, vector.Length)));
+ }
+
+ var zAxis = Direction3D.Create(new Vector3D(0d, 0d, 1d));
+ var xAxis = Direction3D.Create(new Vector3D(1d, 0d, 0d));
+ var surface = 1;
+ BindPlane(bottomFace, bottom[0], new Vector3D(0d, 1d, 0d), new Vector3D(1d, 0d, 0d));
+ BindPlane(topFace, top[0], new Vector3D(1d, 0d, 0d), new Vector3D(0d, 1d, 0d));
+ for (var i = 0; i < 4; i++)
+ {
+ var next = (i + 1) % 4;
+ BindPlane(lowerFaces[i], bottom[i], bottom[next] - bottom[i], shoulder[i] - bottom[i]);
+ BindPlane(chamferFaces[i], shoulder[i], shoulder[next] - shoulder[i], top[i] - shoulder[i]);
+ }
+ foreach (var (hole, index) in holes.Select((h, i) => (h, i)))
+ {
+ var topCurve = new CurveGeometryId(edgeCurve++); var bottomCurve = new CurveGeometryId(edgeCurve++); var seamCurve = new CurveGeometryId(edgeCurve++);
+ var centerTop = new Point3D(hole.Hole.CenterX, hole.Hole.CenterY, plan.ZMax);
+ var centerBottom = new Point3D(hole.Hole.CenterX, hole.Hole.CenterY, plan.ZMin);
+ geometry.AddCurve(topCurve, CurveGeometry.FromCircle(new Circle3Curve(centerTop, zAxis, hole.Hole.Radius, xAxis)));
+ geometry.AddCurve(bottomCurve, CurveGeometry.FromCircle(new Circle3Curve(centerBottom, zAxis, hole.Hole.Radius, xAxis)));
+ geometry.AddCurve(seamCurve, CurveGeometry.FromLine(new Line3Curve(new Point3D(hole.Hole.CenterX + hole.Hole.Radius, hole.Hole.CenterY, plan.ZMin), zAxis)));
+ bindings.AddEdgeBinding(new EdgeGeometryBinding(hole.TopCircle, topCurve, new ParameterInterval(0d, 2d * System.Math.PI)));
+ bindings.AddEdgeBinding(new EdgeGeometryBinding(hole.BottomCircle, bottomCurve, new ParameterInterval(0d, 2d * System.Math.PI)));
+ bindings.AddEdgeBinding(new EdgeGeometryBinding(hole.Seam, seamCurve, new ParameterInterval(0d, plan.ZMax - plan.ZMin)));
+ var sid = new SurfaceGeometryId(surface++);
+ geometry.AddSurface(sid, SurfaceGeometry.FromCylinder(new CylinderSurface(new Point3D(hole.Hole.CenterX, hole.Hole.CenterY, plan.ZMin), zAxis, hole.Hole.Radius, xAxis)));
+ // Hole walls bound void material, so their analytic cylinder sense is
+ // opposite the retained outer shell.
+ bindings.AddFaceBinding(new FaceGeometryBinding(holeFaces[index], sid, SameSense: false));
+ vertexPoints[hole.SeamTopVertex] = new Point3D(hole.Hole.CenterX + hole.Hole.Radius, hole.Hole.CenterY, plan.ZMax);
+ vertexPoints[hole.SeamBottomVertex] = new Point3D(hole.Hole.CenterX + hole.Hole.Radius, hole.Hole.CenterY, plan.ZMin);
+ }
+
+ var body = new BrepBody(b.Model, geometry, bindings, vertexPoints);
+ var brepValidation = BrepBindingValidator.Validate(body, requireAllEdgeAndFaceBindings: true);
+ return brepValidation.IsSuccess ? KernelResult<BrepBody>.Success(body, brepValidation.Diagnostics) : KernelResult<BrepBody>.Failure(brepValidation.Diagnostics);
+
+ void BindPlane(FaceId face, Point3D origin, Vector3D u, Vector3D v)
+ {
+ var normal = Direction3D.Create(u.Cross(v));
+ var uAxis = Direction3D.Create(u);
+ var id = new SurfaceGeometryId(surface++);
+ geometry.AddSurface(id, SurfaceGeometry.FromPlane(new PlaneSurface(origin, normal, uAxis)));
+ bindings.AddFaceBinding(new FaceGeometryBinding(face, id));
+ }
+ }
+
+ private static KernelResult<bool> Validate(CombinedTopBoundaryChamferThroughHolePlan plan)
+ {
+ if (!double.IsFinite(plan.Width) || !double.IsFinite(plan.Depth) || !double.IsFinite(plan.ZMin) || !double.IsFinite(plan.ZMax) || !double.IsFinite(plan.ChamferDistance)
+ || plan.Width <= Tol || plan.Depth <= Tol || plan.ZMax - plan.ZMin <= Tol || plan.ChamferDistance <= Tol
+ || 2d * plan.ChamferDistance >= plan.Width - Tol || 2d * plan.ChamferDistance >= plan.Depth - Tol || plan.ChamferDistance >= plan.ZMax - plan.ZMin - Tol)
+ return Failure("CombinedFeaturePlanChainInvalid: bounded top-boundary chamfer dimensions are invalid.");
+ foreach (var hole in plan.Holes)
+ {
+ if (!double.IsFinite(hole.CenterX) || !double.IsFinite(hole.CenterY) || !double.IsFinite(hole.Radius) || hole.Radius <= Tol)
+ return Failure($"CombinedFeaturePlanChainInvalid: hole '{hole.FeatureId}' has invalid cylinder data.");
+ if (System.Math.Abs(hole.CenterX) + hole.Radius >= plan.Width / 2d - plan.ChamferDistance - Tol || System.Math.Abs(hole.CenterY) + hole.Radius >= plan.Depth / 2d - plan.ChamferDistance - Tol)
+ return Failure($"CombinedFeatureInteractionUnsupported: hole '{hole.FeatureId}' intersects or splits the selected outer top-boundary chamfer chain.");
+ }
+ for (var i = 0; i < plan.Holes.Count; i++)
+ for (var j = i + 1; j < plan.Holes.Count; j++)
+ {
+ var a = plan.Holes[i]; var b = plan.Holes[j];
+ if (System.Math.Sqrt(System.Math.Pow(a.CenterX - b.CenterX, 2d) + System.Math.Pow(a.CenterY - b.CenterY, 2d)) <= a.Radius + b.Radius + Tol)
+ return Failure($"CombinedFeatureInteractionUnsupported: holes '{a.FeatureId}' and '{b.FeatureId}' overlap.");
+ }
+ return KernelResult<bool>.Success(true);
+
+ static KernelResult<bool> Failure(string message) => KernelResult<bool>.Failure([new Aetheris.Kernel.Core.Diagnostics.KernelDiagnostic(Aetheris.Kernel.Core.Diagnostics.KernelDiagnosticCode.ValidationFailed, Aetheris.Kernel.Core.Diagnostics.KernelDiagnosticSeverity.Error, message, "CombinedTopBoundaryChamferThroughHole")]);
+ }
+
+ private static EdgeId[] Ring(TopologyBuilder builder, VertexId[] vertices, int offset) => Enumerable.Range(0, 4).Select(i => builder.AddEdge(vertices[offset + i], vertices[offset + ((i + 1) % 4)])).ToArray();
+ private static LoopId AddLoop(TopologyBuilder builder, IReadOnlyList<Use> uses)
+ {
+ var loop = builder.AllocateLoopId(); var coedges = new CoedgeId[uses.Count];
+ for (var i = 0; i < uses.Count; i++) coedges[i] = builder.AllocateCoedgeId();
+ for (var i = 0; i < uses.Count; i++) builder.AddCoedge(new Coedge(coedges[i], uses[i].Edge, loop, coedges[(i + 1) % uses.Count], coedges[(i + uses.Count - 1) % uses.Count], uses[i].Reversed));
+ builder.AddLoop(new Loop(loop, coedges)); return loop;
+ }
+ private static Use Forward(EdgeId edge) => new(edge, false);
+ private static Use Reversed(EdgeId edge) => new(edge, true);
+ private readonly record struct Use(EdgeId Edge, bool Reversed);
+ private sealed record HoleTopology(CombinedTopBoundaryChamferThroughHole Hole, VertexId SeamTopVertex, VertexId SeamBottomVertex, EdgeId TopCircle, EdgeId BottomCircle, EdgeId Seam);
+}
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentV2DiagnosticRoutingBuildTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentV2DiagnosticRoutingBuildTests.cs
new file mode 100644
index 00000000..7c3923e0
--- /dev/null
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentV2DiagnosticRoutingBuildTests.cs
@@ -0,0 +1,70 @@
+using Aetheris.Kernel.Firmament.FirmamentV2;
+
+namespace Aetheris.Kernel.Firmament.Tests;
+
+public sealed class FirmamentV2DiagnosticRoutingBuildTests
+{
+ [Fact]
+ public void Build_RecognizedMalformedConceptStruct_ReturnsAuthoritativeV2Diagnostics()
+ {
+ var result = FirmamentBuildAndExport.Run(FixturePath());
+
+ Assert.False(result.IsSuccess);
+ Assert.Contains(result.Diagnostics, diagnostic => diagnostic.Message == FirmamentV2Parser.HoleConstructionPlaneCenterMissing);
+ Assert.Contains(result.Diagnostics, diagnostic => diagnostic.Message.StartsWith("firmament-concept-missing-member:", StringComparison.Ordinal));
+ Assert.DoesNotContain(result.Diagnostics, diagnostic => diagnostic.Message.Contains("FIRM-PARSE-0001", StringComparison.Ordinal));
+ Assert.DoesNotContain(result.Diagnostics, diagnostic => diagnostic.Message.Contains("canonical TOON-style text", StringComparison.Ordinal));
+ }
+
+ [Theory]
+ [InlineData("""
+model Broken {
+ units mm
+ solid base: Box { size: [10, 10] }
+}
+""", FirmamentV2Parser.BoxSizeArity)]
+ [InlineData("""
+Model Broken mm
+Box Base { Size: [10mm, 10mm] }
+Modify Base { EdgeFinish Break { Face: +Z Target: Boundary Kind: Chamfer Distance: 1mm } }
+""", FirmamentV2Parser.Phase3EdgeFinishSyntaxInvalid)]
+ public void Build_RecognizedMalformedLowercaseAndPascalCaseModel_ReturnsV2Diagnostics(string source, string expectedDiagnostic)
+ {
+ var path = Path.Combine(Path.GetTempPath(), $"aetheris-v2-diagnostic-routing-{Guid.NewGuid():N}.firmament");
+ File.WriteAllText(path, source);
+ try
+ {
+ var result = FirmamentBuildAndExport.Run(path);
+
+ Assert.False(result.IsSuccess);
+ Assert.Contains(result.Diagnostics, diagnostic => diagnostic.Message == expectedDiagnostic);
+ Assert.DoesNotContain(result.Diagnostics, diagnostic => diagnostic.Message.Contains("FIRM-PARSE-0001", StringComparison.Ordinal));
+ }
+ finally
+ {
+ File.Delete(path);
+ }
+ }
+
+ [Fact]
+ public void Build_ValidLegacyToon_RemainsEligibleForV1Fallback()
+ {
+ var path = Path.Combine(RepoRoot(), "testdata", "firmament", "examples", "box_basic.firmament");
+ var v2 = FirmamentV2Parser.Parse(File.ReadAllText(path));
+ var output = Path.Combine(Path.GetTempPath(), $"aetheris-v1-fallback-{Guid.NewGuid():N}.step");
+ try
+ {
+ var result = FirmamentBuildAndExport.Run(path, output);
+
+ Assert.Equal(FirmamentV2ParseDisposition.NotRecognized, v2.Disposition);
+ Assert.True(result.IsSuccess, string.Join(Environment.NewLine, result.Diagnostics.Select(diagnostic => diagnostic.Message)));
+ }
+ finally
+ {
+ File.Delete(output);
+ }
+ }
+
+ private static string FixturePath() => Path.Combine(RepoRoot(), "fixtures", "FirmamentV2", "Language", "invalid", "concept-struct-diagnostic-routing-x1.invalid.firmfixture");
+ private static string RepoRoot() => Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "../../../../"));
+}
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentV2ParserTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentV2ParserTests.cs
index 85b12edc..933a639b 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentV2ParserTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentV2ParserTests.cs
@@ -919,6 +919,32 @@ model BadPmiDiameter {
Assert.Contains(FirmamentV2Parser.PmiDimensionMissingTolerance, result.Diagnostics);
}
+ [Fact]
+ public void FirmamentV2Parser_RecognizesMalformedConceptStructSource_WithoutV1FallbackAdmission()
+ {
+ var result = FirmamentV2Parser.Parse(Source("Language/invalid/concept-struct-diagnostic-routing-x1.invalid.firmfixture"));
+
+ Assert.False(result.IsSuccess);
+ Assert.Equal(FirmamentV2ParseDisposition.RecognizedInvalid, result.Disposition);
+ Assert.Contains(FirmamentV2Parser.HoleConstructionPlaneCenterMissing, result.Diagnostics);
+ Assert.Contains(result.Diagnostics, diagnostic => diagnostic.StartsWith("firmament-concept-missing-member:", StringComparison.Ordinal));
+ }
+
+ [Fact]
+ public void FirmamentV2Parser_LeavesLegacyToonAndArbitraryText_Unrecognized()
+ {
+ var legacy = FirmamentV2Parser.Parse("""
+firmament:
+ version: 1
+model:
+ name: legacy
+""");
+ var arbitrary = FirmamentV2Parser.Parse("this is not Firmament source");
+
+ Assert.Equal(FirmamentV2ParseDisposition.NotRecognized, legacy.Disposition);
+ Assert.Equal(FirmamentV2ParseDisposition.NotRecognized, arbitrary.Disposition);
+ }
+
[Fact]
public void FirmamentV2P2_ExportDeferredFlatness_IsReportedAndBuildRejectedDeterministically()
{
diff --git a/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs b/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs
index 48662137..f56d2c6e 100644
--- a/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs
@@ -7,6 +7,7 @@ using Aetheris.Kernel.Core.Step242;
using Aetheris.Kernel.Core.Brep;
using Aetheris.Kernel.Core.Brep.Verification;
using Aetheris.Kernel.Core.Brep.Boolean;
+using Aetheris.Kernel.Core.Brep.Features;
using Aetheris.Kernel.Core.Geometry;
using Aetheris.Kernel.Core.Geometry.Curves;
using Aetheris.Kernel.Core.Geometry.Surfaces;
@@ -21,6 +22,13 @@ namespace Aetheris.Kernel.Firmament;
public static class FirmamentBuildAndExport
{
+ private enum ExportRouteDisposition { Declined, Failed, Succeeded }
+ private sealed record ExportRouteResult(string Route, ExportRouteDisposition Disposition, KernelResult<FirmamentStepExportResult>? Artifact = null)
+ {
+ public static ExportRouteResult Decline(string route) => new(route, ExportRouteDisposition.Declined);
+ public static ExportRouteResult Complete(string route, KernelResult<FirmamentStepExportResult> artifact) => new(route, artifact.IsSuccess ? ExportRouteDisposition.Succeeded : ExportRouteDisposition.Failed, artifact);
+ }
+
public static KernelResult<FirmamentBuildAndExportResult> Run(string sourcePath, string? outputPath = null)
{
ArgumentException.ThrowIfNullOrWhiteSpace(sourcePath);
@@ -122,29 +130,16 @@ public static class FirmamentBuildAndExport
"FirmamentV2.LatticeFill")]);
}
- if (TryExportV2AirChamferBody(v2Parse.Document) is { } airChamferExport)
- {
- return airChamferExport;
- }
-
- if (TryExportV2SemanticHoleBody(v2Parse.Document) is { } semanticHoleExport)
+ var routed = DispatchV2Routes(v2Parse.Document,
+ ("CombinedHoleEdgeFinish", TryExportV2CombinedHoleEdgeFinishBody),
+ ("AirChamfer", TryExportV2AirChamferBody),
+ ("SemanticHole", TryExportV2SemanticHoleBody),
+ ("ControlledSideHole", TryExportV2ControlledSideHoleBody),
+ ("InlineStepReplacement", TryExportV2InlineStepReplacementBody),
+ ("InlineStep", TryExportV2InlineStepBody));
+ if (routed is not null)
{
- return semanticHoleExport;
- }
-
- if (TryExportV2ControlledSideHoleBody(v2Parse.Document) is { } sideHoleExport)
- {
- return sideHoleExport;
- }
-
- if (TryExportV2InlineStepReplacementBody(v2Parse.Document) is { } replacementExport)
- {
- return replacementExport;
- }
-
- if (TryExportV2InlineStepBody(v2Parse.Document) is { } inlineStepExport)
- {
- return inlineStepExport;
+ return routed;
}
var lowering = FirmamentV2BuildLowering.LowerPrimitiveBridge(v2Parse.Document);
@@ -202,14 +197,7 @@ public static class FirmamentBuildAndExport
}
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)
- || (trimmedSource.StartsWith("Struct ", StringComparison.Ordinal) && sourceText.Contains("<Hollow>", StringComparison.Ordinal))
- || sourceText.Contains("\nmodel ", StringComparison.Ordinal)
- || sourceText.Contains("\nModel ", StringComparison.Ordinal)
- || (sourceText.Contains("\nStruct ", StringComparison.Ordinal) && sourceText.Contains("<Hollow>", StringComparison.Ordinal));
- if (isV2ModelSource && fatalV2Diagnostics.Length > 0)
+ if (v2Parse.Disposition == FirmamentV2ParseDisposition.RecognizedInvalid && fatalV2Diagnostics.Length > 0)
{
return KernelResult<FirmamentStepExportResult>.Failure(fatalV2Diagnostics.Select(code => new Kernel.Core.Diagnostics.KernelDiagnostic(
Kernel.Core.Diagnostics.KernelDiagnosticCode.ValidationFailed,
@@ -341,10 +329,174 @@ public static class FirmamentBuildAndExport
return KernelResult<FirmamentStepExportResult>.Success(new FirmamentStepExportResult(step.Value, fill.Name, 0, "standalone-lattice", "cubic-truss", Lattice: report));
}
+ /// <summary>
+ /// Converts the historical nullable TryExport routes into one explicit dispatcher
+ /// contract. A null is only a Declined route; a non-null failed result has claimed
+ /// the document and is terminal. This keeps route order from deciding feature
+ /// composition policy.
+ /// </summary>
+ private static KernelResult<FirmamentStepExportResult>? DispatchV2Routes(
+ FirmamentV2Document document,
+ params (string Name, Func<FirmamentV2Document, KernelResult<FirmamentStepExportResult>?> Execute)[] routes)
+ {
+ foreach (var route in routes)
+ {
+ var raw = route.Execute(document);
+ var result = raw is null ? ExportRouteResult.Decline(route.Name) : ExportRouteResult.Complete(route.Name, raw);
+ if (result.Disposition == ExportRouteDisposition.Declined)
+ {
+ continue;
+ }
+
+ return result.Artifact!;
+ }
+
+ return null;
+ }
+
+ private static KernelResult<FirmamentStepExportResult>? TryExportV2CombinedHoleEdgeFinishBody(FirmamentV2Document document)
+ {
+ var modifies = document.ModifyBlocks ?? [];
+ var holesDeclared = modifies.SelectMany(m => m.SemanticHoles).ToArray();
+ var finishes = modifies.SelectMany(m => (m.EdgeFinishes ?? [])).ToArray();
+ if (holesDeclared.Length == 0 || finishes.Length == 0)
+ {
+ return null;
+ }
+
+ if (document.Solids.Count != 1 || modifies.Count != 1 || modifies[0].Regions.Count != 0 || modifies[0].TargetSolid != document.Solids[0].Name)
+ {
+ return CombinedFailure("CombinedFeatureHostUnsupported: CombinedHoleEdgeFinish requires one Box host and one empty-of-Regions Modify context.");
+ }
+
+ var modify = modifies[0];
+ var solid = document.Solids[0];
+ if (solid.Primitive is not FirmamentV2BoxRecord box || box.Size.Count != 3)
+ {
+ return CombinedFailure($"CombinedFeatureHostUnsupported: host '{solid.Name}' is not an admitted Box.");
+ }
+
+ if (finishes.Length != 1)
+ {
+ return CombinedFailure($"CombinedFeatureThirdFamilyUnsupported: CombinedHoleEdgeFinish X1 admits exactly one EdgeFinish (actual={finishes.Length}).");
+ }
+
+ var finish = finishes[0];
+ if (!string.Equals(finish.FaceAxis, "+Z", StringComparison.Ordinal) || !string.Equals(finish.Target, "Boundary", StringComparison.Ordinal) || !string.Equals(finish.Kind, "Chamfer", StringComparison.Ordinal))
+ {
+ return CombinedFailure($"CombinedFeatureSelectionLost: EdgeFinish '{finish.Name}' must select the +Z outer Boundary with Kind Chamfer.");
+ }
+
+ var holes = FirmamentV2SemanticHoleLowering.LowerSemanticHoles(document);
+ if (holes.Count != holesDeclared.Length || holes.Count == 0)
+ {
+ return CombinedFailure("CombinedFeaturePlanChainInvalid: semantic Hole lowering did not preserve the admitted source hole set.");
+ }
+
+ // Hole is intentionally the first construction stage. Existing materialization
+ // is used as the semantic/host proof; the bounded final plan below then consumes
+ // its same source intent alongside the admitted outer-boundary finish.
+ var host = document.ConceptIr is null
+ ? new AirHoleSimpleShaftHost(box.Size[0], box.Size[1], -box.Size[2] / 2d, box.Size[2] / 2d)
+ : new AirHoleSimpleShaftHost(box.Size[0], box.Size[1], 0d, box.Size[2]);
+ var holeStages = holes.Select(h => AirHoleSimpleShaftMaterializer.Execute(h, host)).ToArray();
+ if (holeStages.Any(stage => !stage.Succeeded || stage.Plan is null || stage.Correspondence is null))
+ {
+ return CombinedFailure("CombinedFeatureMaterializerDiverged: admitted semantic Hole stage did not materialize its authoritative plan.", holeStages.SelectMany(stage => stage.Diagnostics));
+ }
+
+ var combinedHoles = new List<CombinedTopBoundaryChamferThroughHole>(holes.Count);
+ foreach (var (hole, stage) in holes.Zip(holeStages))
+ {
+ if (hole.EndCondition is not AirHoleEndCondition.ThroughAll || hole.Stack.Kind != AirHoleStackKind.SimpleShaft || hole.Placement is not AirFaceLocalHolePlacement placement || hole.Axis.Direction.Z < 1d - 1e-9)
+ {
+ return CombinedFailure($"CombinedFeaturePlanChainInvalid: Hole '{hole.FeatureId}' is outside X1; only top/+Z simple-shaft ThroughAll holes are admitted.");
+ }
+ combinedHoles.Add(new CombinedTopBoundaryChamferThroughHole(hole.FeatureId, placement.U, placement.V, hole.Shaft.Radius));
+ }
+
+ // Resolve and admit the exact EdgeFinish family after the Hole stage. X1's
+ // interaction classification is geometric-plan evidence, not a raw BRep ID or
+ // coordinate search: the selected descendant is the known outer boundary role.
+ var compiledFinish = AirTopFaceBoundaryChamferCompiler.Compile(new(
+ solid.Name, $"{solid.Name}.{finish.Name}", finish.Name,
+ box.Size[0], box.Size[1], box.Size[2], finish.FaceAxis, finish.Target, finish.Kind, finish.Distance,
+ new AirSourceSpan(finish.SourceSpan.Start, finish.SourceSpan.Length, document.ModelName)));
+ if (!compiledFinish.Succeeded || compiledFinish.BRepPlan?.RealizationPlan is null)
+ {
+ return CombinedFailure("CombinedFeatureSelectionLost: post-Hole outer boundary selection did not admit the exact chamfer planner.", compiledFinish.Diagnostics);
+ }
+
+ var parentHolePlan = string.Join(",", holeStages.Select(s => s.Plan!.HoleBRepPlan?.StableId ?? s.Plan!.SemanticFeatureId));
+ var finalPlan = new CombinedTopBoundaryChamferThroughHolePlan(
+ $"brep-plan:combined-hole-edgefinish:{solid.Name}:{finish.Name}",
+ $"brep-plan:host:{solid.Name}->[{parentHolePlan}]",
+ ["HostBRepPlan", "HoleChangedBRepPlan", "EdgeFinishChangedBRepPlan"],
+ box.Size[0], box.Size[1], host.ZMin, host.ZMax, finish.Distance, combinedHoles);
+ var materialized = CombinedTopBoundaryChamferThroughHoleBuilder.Build(finalPlan);
+ if (!materialized.IsSuccess || materialized.Value is null)
+ {
+ return CombinedFailure("CombinedFeatureInteractionUnsupported: Hole descendants and EdgeFinish target are not Disjoint in X1.", materialized.Diagnostics.Select(d => d.Message));
+ }
+
+ var body = materialized.Value;
+ if (!FirmamentManifoldChecker.IsManifold(body))
+ {
+ return CombinedFailure("CombinedFeaturePlanChainInvalid: final combined plan did not produce one enclosed manifold body.");
+ }
+ var step = Step242Exporter.ExportBody(body);
+ 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 || !FirmamentManifoldChecker.IsManifold(reimport.Value))
+ {
+ return CombinedFailure("CombinedFeatureMaterializerDiverged: final STEP reimport did not preserve one enclosed manifold body.", reimport.Diagnostics.Select(d => d.Message));
+ }
+
+ var descendants = new List<SemanticTopologyDescendant>();
+ var finalTop = body.Topology.Faces.Single(f => f.Id.Value == 2);
+ var finalBottom = body.Topology.Faces.Single(f => f.Id.Value == 1);
+ for (var i = 0; i < holes.Count; i++)
+ {
+ var source = $"hole:{holes[i].FeatureId}";
+ descendants.Add(new($"combined:{source}:mouth-loop", "Loop", SemanticTopologyRole.HoleEntryLoop, source, Loop: finalTop.LoopIds[i + 1], ParentStableId: holes[i].FeatureId));
+ descendants.Add(new($"combined:{source}:exit-loop", "Loop", SemanticTopologyRole.HoleExitLoop, source, Loop: finalBottom.LoopIds[i + 1], ParentStableId: holes[i].FeatureId));
+ descendants.Add(new($"combined:{source}:wall", "Face", SemanticTopologyRole.HoleWallFace, source, Face: new FaceId(11 + i), ParentStableId: holes[i].FeatureId));
+ }
+ descendants.Add(new($"combined:edgefinish:{finish.Name}:replacement", "Face", SemanticTopologyRole.EdgeFinishReplacementFace, $"edgefinish:{finish.Name}", Face: new FaceId(7), ParentStableId: finish.Name));
+ var correspondence = new SemanticTopologyCorrespondence(solid.Name, descendants, ["HostBRepPlan", "HoleChangedBRepPlan", "EdgeFinishChangedBRepPlan", "AuthoritativeBRepPlan"]);
+ if (correspondence.Descendants.Count(d => d.Role == SemanticTopologyRole.HoleEntryLoop) != holes.Count || correspondence.Descendants.Count(d => d.Role == SemanticTopologyRole.HoleExitLoop) != holes.Count)
+ {
+ return CombinedFailure("CombinedFeaturePlanChainInvalid: final plan lost Hole mouth or exit correspondence.");
+ }
+
+ var holeRemoved = combinedHoles.Sum(h => System.Math.PI * h.Radius * h.Radius * (host.ZMax - host.ZMin));
+ var report = new FirmamentCombinedFeaturePlanReport(
+ "CombinedHoleEdgeFinish", "Succeeded", finalPlan.ParentHostPlanId!, finalPlan.AppliedFeatureIds, finalPlan.PlanId, "Disjoint",
+ descendants.Count(d => d.SourceStableId.StartsWith("hole:", StringComparison.Ordinal)), 1,
+ box.Size[0] * box.Size[1] * (host.ZMax - host.ZMin), holeRemoved, finalPlan.AnalyticVolume,
+ Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(step.Value))), body.Topology.Vertices.Count(), body.Topology.Edges.Count(), body.Topology.Faces.Count(),
+ body.Geometry.Surfaces.Count(s => s.Value.Kind == SurfaceGeometryKind.Plane), body.Geometry.Surfaces.Count(s => s.Value.Kind == SurfaceGeometryKind.Cylinder), true, true);
+ var featureReports = holes.Select(h => new FirmamentHoleFeatureReport(h.Name, "Hole", h.FeatureId, h.Shaft.Diameter, h.Placement.U, h.Placement.V, null, null, null, null, "top", null, nameof(AirHoleSimpleShaftMaterializer), "HoleChangedBRepPlan", h.Stack.Kind.ToString(), "CombinedHoleEdgeFinish", 1, 0, 0, report.StepSha256, true)).ToArray();
+ return KernelResult<FirmamentStepExportResult>.Success(new FirmamentStepExportResult(step.Value, finish.Name, 0, "combined-hole-edgefinish", "CombinedHoleEdgeFinish", ConceptIr: document.ConceptIr, Features: featureReports, Combined: report));
+ }
+
+ private static KernelResult<FirmamentStepExportResult> CombinedFailure(string message, IEnumerable<string>? details = null) =>
+ KernelResult<FirmamentStepExportResult>.Failure((new[] { message }).Concat(details ?? []).Distinct().Select(detail => new Kernel.Core.Diagnostics.KernelDiagnostic(
+ Kernel.Core.Diagnostics.KernelDiagnosticCode.ValidationFailed,
+ Kernel.Core.Diagnostics.KernelDiagnosticSeverity.Error,
+ detail,
+ "FirmamentV2.CombinedHoleEdgeFinish")).ToArray());
+
private static KernelResult<FirmamentStepExportResult>? TryExportV2AirChamferBody(FirmamentV2Document document)
{
var finishes = (document.ModifyBlocks ?? []).SelectMany(m => (m.EdgeFinishes ?? []).Select(f => (Modify: m, Finish: f))).ToArray();
if (finishes.Length == 0) return null;
+ // A narrow finish-only route never owns a document that also has semantic holes.
+ // CombinedHoleEdgeFinish is the only X1 route permitted to claim that shape.
+ if ((document.ModifyBlocks ?? []).Any(m => m.SemanticHoles.Count > 0)) return null;
if (finishes.Length == 2 && finishes.All(x => string.Equals(x.Finish.Kind, "Chamfer", StringComparison.Ordinal)))
{
if (document.Solids.Count != 1 || document.ModifyBlocks!.Count != 1 || document.ModifyBlocks[0].Regions.Count != 0 || document.ModifyBlocks[0].SemanticHoles.Count != 0)
@@ -1031,6 +1183,7 @@ public static class FirmamentBuildAndExport
private static KernelResult<FirmamentStepExportResult>? TryExportV2ControlledSideHoleBody(FirmamentV2Document document)
{
+ if ((document.ModifyBlocks ?? []).Any(m => (m.EdgeFinishes?.Count ?? 0) > 0)) return null;
var intent = document.SideHoleIntent;
if (intent is null)
{
@@ -1148,6 +1301,7 @@ public static class FirmamentBuildAndExport
private static KernelResult<FirmamentStepExportResult>? TryExportV2SemanticHoleBody(FirmamentV2Document document)
{
+ if ((document.ModifyBlocks ?? []).Any(m => (m.EdgeFinishes?.Count ?? 0) > 0)) return null;
if (document.ModifyBlocks is not { Count: > 0 })
{
return null;
diff --git a/Aetheris.Kernel.Firmament/FirmamentStepExportResult.cs b/Aetheris.Kernel.Firmament/FirmamentStepExportResult.cs
index c51919b0..f75e6d7e 100644
--- a/Aetheris.Kernel.Firmament/FirmamentStepExportResult.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentStepExportResult.cs
@@ -17,7 +17,30 @@ public sealed record FirmamentStepExportResult(
IReadOnlyList<FirmamentHoleFeatureReport>? Features = null,
FirmamentRoundedBoxReport? RoundedBox = null,
FirmamentHollowBodyReport? Hollow = null,
- FirmamentStandaloneLatticeReport? Lattice = null);
+ FirmamentStandaloneLatticeReport? Lattice = null,
+ FirmamentCombinedFeaturePlanReport? Combined = null);
+
+/// <summary>Compact inspection evidence for the bounded X1 composed feature route.</summary>
+public sealed record FirmamentCombinedFeaturePlanReport(
+ string Route,
+ string Disposition,
+ string HostPlanId,
+ IReadOnlyList<string> OrderedStages,
+ string FinalPlanId,
+ string Interaction,
+ int HoleDescendantCount,
+ int EdgeFinishDescendantCount,
+ double HostVolume,
+ double HoleRemovedVolume,
+ double FinalAnalyticVolume,
+ string StepSha256,
+ int Vertices,
+ int Edges,
+ int Faces,
+ int Planes,
+ int Cylinders,
+ bool ReimportSucceeded,
+ bool ReimportedManifold);
public sealed record FirmamentStandaloneLatticeReport(
string Template,
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs
index 3486cd90..9cfcffad 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs
@@ -192,8 +192,20 @@ public sealed record FirmamentV2LatticeFillDecl(string Name, string Host, Firmam
/// <summary>M9R's admitted standalone material body. It is intentionally distinct from the deferred host-replacement Fill.</summary>
public sealed record FirmamentV2StandaloneLatticeFillDecl(string Name, FirmamentV2FillRegionDecl Region, string Pattern, int CellsX, int CellsY, int CellsZ, double CellSize, double StrutRadius, double NodeRadius, string Placement, FirmamentV2SourceSpan SourceSpan);
-public sealed record FirmamentV2ParseResult(bool IsSuccess, FirmamentV2Document? Document, IReadOnlyList<string> Diagnostics)
+/// <summary>Whether the V2 parser admitted the source into one of its dialects.</summary>
+public enum FirmamentV2ParseDisposition
{
- public static FirmamentV2ParseResult Success(FirmamentV2Document document, IReadOnlyList<string> diagnostics) => new(true, document, diagnostics);
- public static FirmamentV2ParseResult Failure(IReadOnlyList<string> diagnostics) => new(false, null, diagnostics);
+ NotRecognized,
+ RecognizedInvalid,
+ RecognizedValid
+}
+
+public sealed record FirmamentV2ParseResult(
+ bool IsSuccess,
+ FirmamentV2Document? Document,
+ IReadOnlyList<string> Diagnostics,
+ FirmamentV2ParseDisposition Disposition = FirmamentV2ParseDisposition.NotRecognized)
+{
+ public static FirmamentV2ParseResult Success(FirmamentV2Document document, IReadOnlyList<string> diagnostics) => new(true, document, diagnostics, FirmamentV2ParseDisposition.RecognizedValid);
+ public static FirmamentV2ParseResult Failure(IReadOnlyList<string> diagnostics, FirmamentV2ParseDisposition disposition = FirmamentV2ParseDisposition.RecognizedInvalid) => new(false, null, diagnostics, disposition);
}
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs
index 25b5ba59..3d83a015 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs
@@ -260,28 +260,32 @@ public static class FirmamentV2Parser
ArgumentNullException.ThrowIfNull(sourceText);
var diagnostics = new List<string> { "firmament-v2-parser-invoked" };
var source = StripLineComments(sourceText);
+ var v2AdmissionCandidate = IsV2AdmissionCandidate(source);
conceptCatalog ??= FirmamentV2ForgeConceptRegistry.Catalog;
var templateExpansion = FirmamentV2TemplateExpansion.Expand(source, diagnostics);
if (templateExpansion is null)
{
diagnostics.Add("firmament-v2-parse-failed");
- return FirmamentV2ParseResult.Failure(diagnostics.Distinct(StringComparer.Ordinal).Order().ToArray());
+ return FirmamentV2ParseResult.Failure(
+ diagnostics.Distinct(StringComparer.Ordinal).Order().ToArray(),
+ v2AdmissionCandidate ? FirmamentV2ParseDisposition.RecognizedInvalid : FirmamentV2ParseDisposition.NotRecognized);
}
source = templateExpansion.Source;
+ v2AdmissionCandidate |= IsV2AdmissionCandidate(source);
if (Regex.IsMatch(source, @"\b(?:RoundedBox|Frustum|Box)\s*<\s*[A-Za-z_][A-Za-z0-9_]*\s*>\s+[A-Za-z_]", RegexOptions.CultureInvariant))
- return ParsePrimitiveConstructionPolicyDocument(source, diagnostics);
+ return Recognized(ParsePrimitiveConstructionPolicyDocument(source, diagnostics));
if (Regex.IsMatch(source, @"\bRoundedBox\s+[A-Za-z_]", RegexOptions.CultureInvariant))
- return ParseRoundedBoxModelingDocument(source, diagnostics);
+ return Recognized(ParseRoundedBoxModelingDocument(source, diagnostics));
if (Regex.IsMatch(source, @"\bConcept\s+(?:Struct\s+)?[A-Za-z_]", RegexOptions.CultureInvariant)
|| Regex.IsMatch(source, @"\b(?:Struct|Model)\s+[A-Za-z_][A-Za-z0-9_]*\s*(?::\s*[A-Za-z_][A-Za-z0-9_]*)?\s*\{", RegexOptions.CultureInvariant))
- return ParseConceptModelingDocument(source, diagnostics, templateExpansion.Instantiations);
+ return Recognized(ParseConceptModelingDocument(source, diagnostics, templateExpansion.Instantiations));
if (Regex.IsMatch(source, @"^\s*Model\b", RegexOptions.CultureInvariant))
- return ParsePhase3ModelingDocument(source, diagnostics);
+ return Recognized(ParsePhase3ModelingDocument(source, diagnostics));
if (ContainsRawBackendId(source)) diagnostics.Add(RawBackendIdReferenceForbidden);
if (ContainsUnsupportedConstruct(source)) diagnostics.Add(UnsupportedConstruct);
@@ -342,9 +346,36 @@ public static class FirmamentV2Parser
var hasFatalDiagnostics = diagnostics.Any(IsFatalDiagnosticCode);
diagnostics.Add(document is null || hasFatalDiagnostics ? "firmament-v2-parse-failed" : "firmament-v2-parse-succeeded");
diagnostics.Sort(StringComparer.Ordinal);
- return document is null ? FirmamentV2ParseResult.Failure(diagnostics) : new FirmamentV2ParseResult(!hasFatalDiagnostics, document, diagnostics);
+ if (!v2AdmissionCandidate)
+ return FirmamentV2ParseResult.Failure(diagnostics, FirmamentV2ParseDisposition.NotRecognized);
+
+ return document is null
+ ? FirmamentV2ParseResult.Failure(diagnostics)
+ : new FirmamentV2ParseResult(
+ !hasFatalDiagnostics,
+ document,
+ diagnostics,
+ hasFatalDiagnostics ? FirmamentV2ParseDisposition.RecognizedInvalid : FirmamentV2ParseDisposition.RecognizedValid);
}
+ private static FirmamentV2ParseResult Recognized(FirmamentV2ParseResult result) =>
+ result with
+ {
+ Disposition = result.IsSuccess
+ ? FirmamentV2ParseDisposition.RecognizedValid
+ : FirmamentV2ParseDisposition.RecognizedInvalid
+ };
+
+ private static bool IsV2AdmissionCandidate(string source) =>
+ ModelRegex.IsMatch(source)
+ || Regex.IsMatch(source, @"^\s*model\s+[A-Za-z_][A-Za-z0-9_]*\b", RegexOptions.CultureInvariant)
+ || TemplateHeaderRegex.IsMatch(source)
+ || Regex.IsMatch(source, @"\b(?:RoundedBox|Frustum|Box)\s*<\s*[A-Za-z_][A-Za-z0-9_]*\s*>\s+[A-Za-z_]", RegexOptions.CultureInvariant)
+ || Regex.IsMatch(source, @"\bRoundedBox\s+[A-Za-z_]", RegexOptions.CultureInvariant)
+ || Regex.IsMatch(source, @"\bConcept\s+(?:Struct\s+)?[A-Za-z_]", RegexOptions.CultureInvariant)
+ || Regex.IsMatch(source, @"\b(?:Struct|Model)\s+[A-Za-z_][A-Za-z0-9_]*\s*(?::\s*[A-Za-z_][A-Za-z0-9_]*)?\s*\{", RegexOptions.CultureInvariant)
+ || Regex.IsMatch(source, @"^\s*Model\b", RegexOptions.CultureInvariant);
+
private static IReadOnlyList<FirmamentV2LetRecordDeclaration> ParseLetRecords(string source, IEnumerable<string> topLevelNames, List<string> diagnostics)
{
var records = new List<FirmamentV2LetRecordDeclaration>();
diff --git a/Aetheris.Kernel.Firmament/Materializer/SemanticTopologySelections.cs b/Aetheris.Kernel.Firmament/Materializer/SemanticTopologySelections.cs
index cdc0df7b..bc672878 100644
--- a/Aetheris.Kernel.Firmament/Materializer/SemanticTopologySelections.cs
+++ b/Aetheris.Kernel.Firmament/Materializer/SemanticTopologySelections.cs
@@ -5,7 +5,7 @@ using System.Text.RegularExpressions;
namespace Aetheris.Kernel.Firmament.Materializer;
/// <summary>Stable roles assigned while an authoritative plan is materialized. These are not geometric queries.</summary>
-public enum SemanticTopologyRole { Unknown, ProfileVertex, VerticalExtrusionEdge, LocalStartBoundary, LocalEndBoundary, LocalStartCapLoop, LocalEndCapLoop, TopBoundary, BottomBoundary, ExtrusionSideFace, TopFaceBoundaryLoop, BottomFaceBoundaryLoop, HoleEntryLoop, HoleExitLoop, HoleWallFace, HoleShaftToDrillPointLoop, HoleShaftToDrillPointEdge, HoleDrillPointFace, HoleTipVertex, SlotEntryLoop, SlotExitLoop, SlotWallFace, SlotStraightWallFace, SlotEndWallFace, ComposeTransition }
+public enum SemanticTopologyRole { Unknown, ProfileVertex, VerticalExtrusionEdge, LocalStartBoundary, LocalEndBoundary, LocalStartCapLoop, LocalEndCapLoop, TopBoundary, BottomBoundary, ExtrusionSideFace, TopFaceBoundaryLoop, BottomFaceBoundaryLoop, HoleEntryLoop, HoleExitLoop, HoleWallFace, HoleShaftToDrillPointLoop, HoleShaftToDrillPointEdge, HoleDrillPointFace, HoleTipVertex, SlotEntryLoop, SlotExitLoop, SlotWallFace, SlotStraightWallFace, SlotEndWallFace, ComposeTransition, EdgeFinishReplacementFace }
public enum SemanticSelectionRequirement { ExactlyOne, OneOrMore, ConnectedChain, ClosedLoop, NonEmptyFaceSet }
public enum SemanticSelectionFailure { None, SemanticSourceNotFound, NoMaterializedDescendants, AmbiguousBodyContext, SelectionCardinalityMismatch, DescendantsNotConnected, DescendantsBranch, DescendantsDoNotClose, MixedBoundaryRoles, UnsupportedTopologyChange, SelectionConsumerMismatch }
diff --git a/docs/firmament/combined-hole-edgefinish-export-x1.md b/docs/firmament/combined-hole-edgefinish-export-x1.md
new file mode 100644
index 00000000..4071732d
--- /dev/null
+++ b/docs/firmament/combined-hole-edgefinish-export-x1.md
@@ -0,0 +1,32 @@
+# COMBINED-HOLE-EDGEFINISH-EXPORT-X1
+
+X1 admits one `Box` host, one `Modify` context, one or more top/+Z simple-shaft `ThroughAll` semantic Holes, and exactly one `EdgeFinish` selecting the host's `+Z` outer `Boundary` with an equal-distance `Chamfer`. Regions, other finish kinds, non-through or non-simple-shaft holes, multiple hosts, and mixed third feature families are outside this slice.
+
+Export routes now have three dispositions: `Declined`, `Failed`, and `Succeeded`. A route declines when the complete document shape is not in its admission predicate; it fails only after it has claimed an admitted shape and finds invalid content. Export routes claim complete document shapes, not individual tokens. A narrow exporter must decline a mixed document it cannot materialize.
+
+| Route | Admission | Declines |
+| --- | --- | --- |
+| `CombinedHoleEdgeFinish` | one Box + one Modify + semantic Holes + one admitted outer top chamfer | hole-only and finish-only documents |
+| `AirChamfer` | its existing finish-only family | any document with a semantic Hole |
+| `SemanticHole` | its existing Hole-only family | any document with an `EdgeFinish` |
+| `ControlledSideHole` | its existing Region side-hole family | any document with an `EdgeFinish` |
+
+The route order is no longer the combination policy: the dispatcher converts every legacy nullable `TryExportV2...` result into the explicit disposition contract, and stops only at a claimed failure or success.
+
+## Construction lineage
+
+The feature order is fixed:
+
+`HostBRepPlan -> HoleChangedBRepPlan -> EdgeFinishChangedBRepPlan -> final BRep`.
+
+The existing semantic Hole materializer first proves each Hole against the admitted host and publishes mouth, exit, and shaft-wall descendants. The exact top-boundary chamfer planner is then admitted against the post-Hole semantic context. X1 classifies every Hole/finish pair as `Disjoint`; a Hole approaching the inset outer boundary fails with `CombinedFeatureInteractionUnsupported`. The final bounded plan consumes those admitted intents into one shell and one body; it never STEP-round-trips between features or emits overlapping bodies.
+
+The final correspondence retains each Hole's mouth loop, exit loop, and wall face, plus the finished boundary replacement face. Raw topology IDs are not source selections.
+
+## Fixture and evidence
+
+[`combined-hole-edgefinish-x1.firmament`](../../fixtures/FirmamentV2/Composite/combined-hole-edgefinish-x1.firmament) is the real Concept/Struct proof: an 80 x 50 x 25 Box, two 8.5 mm ThroughAll holes, and a 1.5 mm top outer chamfer. `aetheris build --json` reports `combined.route = CombinedHoleEdgeFinish`, ordered stages, `Disjoint`, plan ID, descendant counts, analytic volume, and STEP SHA-256.
+
+For this fixture the Hole removal is `2 * pi * 4.25^2 * 25 = 2837.250865273282 mm^3`. The final plan's analytic volume is `96874.61608145387 mm^3`, less than both the `100000 mm^3` host and the `97162.74913472672 mm^3` post-Hole body, so the chamfer cannot erase or duplicate the Hole volume. STEP SHA-256 is `38fffde63140f2f845d2fd18e7d8eb2498217f235e7e879d717f4a9205139d02`; production-canonical STEP SHA-256 is `13e27980cc9c1769fbc39b2baf7cc6e126ed3ab0a7058773c005d3cf44c0c988`. STEP reimport reports one enclosed, orientation-consistent manifold body with 16 vertices, 26 edges, 12 faces, 10 planar surfaces, and 2 cylinders. Independent trimmed-face verification returns `96907.04859870145 mm^3` with its conservative `6149.914566321924` numerical bound.
+
+Remaining limits are intentional: chamfering Hole mouths, Hole/finish shared vertices or edges, Hole-split finish chains, arbitrary feature order, other hole stacks, other finish kinds, and grammar unification are deferred. The next major milestone remains Firmament V2 authoring grammar unification, not basic backend feature composition.
diff --git a/docs/firmament/v2-diagnostic-routing-x1.md b/docs/firmament/v2-diagnostic-routing-x1.md
new file mode 100644
index 00000000..30a205f8
--- /dev/null
+++ b/docs/firmament/v2-diagnostic-routing-x1.md
@@ -0,0 +1,31 @@
+# Firmament V2 diagnostic routing X1
+
+## Fixed control flow
+
+Previously `FirmamentBuildAndExport.ExportSource` ran the Firmament V2 parser, but only returned its fatal diagnostics when a build-layer leading-token heuristic guessed that the source was V2. A recognized `Concept`/`Struct` document could therefore produce useful V2 diagnostics and still fall through to the V1 TOON/JSON parser, which reported the unrelated `FIRM-PARSE-0001` canonical-TOON/JSON-root error.
+
+## Parser recognition contract
+
+`FirmamentV2ParseResult` now carries `FirmamentV2ParseDisposition`:
+
+- `NotRecognized`: no V2 grammar entry point admitted the source. V1 fallback remains permitted.
+- `RecognizedInvalid`: a V2 grammar entry point admitted the source and fatal V2 diagnostics prevented a valid V2 document.
+- `RecognizedValid`: V2 admitted and produced a valid document.
+
+Recognition is decided at the V2 parser boundary from the grammar route that is actually selected (including Concept/Struct, construction-policy, rounded-box, Phase 3, and generic V2 model/template admission). It is not decided by `FirmamentBuildAndExport` scanning for raw source keywords.
+
+## Build and validate agreement
+
+When the disposition is `RecognizedInvalid`, build returns the parser's fatal V2 diagnostics in deterministic parser order after its existing ordinal deduplication. Their diagnostic messages remain the original V2 codes and their source remains `FirmamentV2.Parse`; no generic validation wrapper replaces them. The CLI build JSON keeps every returned diagnostic in its `diagnostics` array. `aetheris validate` continues to report the same codes as fatal V2 validation diagnostics.
+
+Once Firmament V2 recognizes a document and produces fatal diagnostics, those diagnostics must never be hidden by legacy-parser fallback.
+
+`NotRecognized` is deliberate: a valid legacy V1 TOON document continues to use the V1 parser, and arbitrary non-V2 text deterministically reaches the V1 parser and receives its normal legacy parse diagnostic. This avoids treating speculative generic V2 failures as authoritative for JSON or V1 input.
+
+## Regression fixture
+
+`fixtures/FirmamentV2/Language/invalid/concept-struct-diagnostic-routing-x1.invalid.firmfixture` is a minimized Concept/Struct document with a malformed construction-plane `Hole<Shaft>` center and an omitted required Concept member. Both `validate` and `build` surface `HoleLocalCenterInvalid` and `firmament-concept-missing-member:BracketConcept.RequiredExpose`; build does not surface `FIRM-PARSE-0001` or the canonical TOON/JSON-root wording.
+
+## Remaining boundary
+
+This change routes diagnostics; it does not unify the existing Firmament V2 dialects, change Hole or EdgeFinish syntax, or materialize combined Hole + EdgeFinish export. The next milestone remains combined Hole + EdgeFinish export.
diff --git a/fixtures/FirmamentV2/Composite/combined-hole-edgefinish-x1.firmament b/fixtures/FirmamentV2/Composite/combined-hole-edgefinish-x1.firmament
new file mode 100644
index 00000000..2ddac4d3
--- /dev/null
+++ b/fixtures/FirmamentV2/Composite/combined-hole-edgefinish-x1.firmament
@@ -0,0 +1,51 @@
+Concept MountingFrame {
+ Bounds: Box3
+ TopPlane: Plane
+ CenterAxis: Axis
+ MountPoints: Point3[]
+}
+
+Concept Struct BracketConcept: MountingFrame {
+ Bounds: Box3 {
+ Size: [80mm, 50mm, 25mm]
+ }
+ TopPlane: Bounds.Face(+Z)
+ CenterAxis: Bounds.Center.Axis(+Z)
+ MountPoints: Grid {
+ Within: Bounds.Face(+Z).Inset(10mm)
+ Columns: 2
+ Rows: 1
+ }
+}
+
+Struct Bracket: MountingFrame {
+ Box Base {
+ Bounds: BracketConcept.Bounds
+ }
+ Modify Base {
+ hole<shaft> LeftMount {
+ on: Base.Top
+ center: BracketConcept.MountPoints[0]
+ diameter: 8.5mm
+ end: throughAll
+ }
+ hole<shaft> RightMount {
+ on: Base.Top
+ center: BracketConcept.MountPoints[1]
+ diameter: 8.5mm
+ end: throughAll
+ }
+ EdgeFinish TopBreak {
+ Face: BracketConcept.TopPlane
+ Target: Boundary
+ Kind: Chamfer
+ Distance: 1.5mm
+ }
+ }
+ Expose {
+ Bounds: BracketConcept.Bounds
+ TopPlane: Base.Top
+ CenterAxis: BracketConcept.CenterAxis
+ MountPoints: BracketConcept.MountPoints
+ }
+}
diff --git a/fixtures/FirmamentV2/Language/invalid/concept-struct-diagnostic-routing-x1.invalid.firmfixture b/fixtures/FirmamentV2/Language/invalid/concept-struct-diagnostic-routing-x1.invalid.firmfixture
new file mode 100644
index 00000000..e957f1d5
--- /dev/null
+++ b/fixtures/FirmamentV2/Language/invalid/concept-struct-diagnostic-routing-x1.invalid.firmfixture
@@ -0,0 +1,33 @@
+// fixture-id: concept-struct-diagnostic-routing-x1
+// category: Language
+// syntax-version: FirmamentV2
+// validity: invalid
+// implementation: parser-backed
+// expected: invalid
+// expected-stage: parser
+// expected-diagnostic: HoleLocalCenterInvalid
+// notes: V2-recognized Concept/Struct source with a malformed construction-plane hole and omitted Concept members.
+Concept BracketFrame {
+ Bounds: Box3
+ TopPlane: Plane
+ RequiredExpose: Plane
+}
+
+Concept Struct BracketConcept: BracketFrame {
+ Bounds: Box3 { Size: [80mm, 50mm, 25mm] }
+ TopPlane: Bounds.Face(+Z)
+}
+
+Construction Plane DrillPlane { Trace: BracketConcept.TopPlane }
+
+Struct Bracket: BracketFrame {
+ Box Base { Bounds: BracketConcept.Bounds }
+ Modify Base {
+ Hole<Shaft> Mount {
+ From: DrillPlane
+ Center: Point2(10mm)
+ Diameter: 8mm
+ End: ThroughAll
+ }
+ }
+}
diff --git a/testdata/firmament/exports/combined-hole-edgefinish-x1.canonical.step b/testdata/firmament/exports/combined-hole-edgefinish-x1.canonical.step
new file mode 100644
index 00000000..847fd080
--- /dev/null
+++ b/testdata/firmament/exports/combined-hole-edgefinish-x1.canonical.step
@@ -0,0 +1,346 @@
+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($,(-40,-25,0));
+#2=DIRECTION($,(0,0,-1));
+#3=DIRECTION($,(0,1,0));
+#4=AXIS2_PLACEMENT_3D($,#1,#2,#3);
+#5=PLANE($,#4);
+#6=CARTESIAN_POINT($,(-40,-25,0));
+#7=VERTEX_POINT($,#6);
+#8=CARTESIAN_POINT($,(40,-25,-0));
+#9=VERTEX_POINT($,#8);
+#10=CARTESIAN_POINT($,(-40,-25,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($,(40,25,-0));
+#17=VERTEX_POINT($,#16);
+#18=CARTESIAN_POINT($,(40,-25,-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($,(-40,25,-0));
+#25=VERTEX_POINT($,#24);
+#26=CARTESIAN_POINT($,(40,25,-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($,(-40,25,-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=CARTESIAN_POINT($,(-25.75,0,0));
+#41=VERTEX_POINT($,#40);
+#42=CARTESIAN_POINT($,(-30,0,0));
+#43=DIRECTION($,(0,0,1));
+#44=DIRECTION($,(1,0,0));
+#45=AXIS2_PLACEMENT_3D($,#42,#43,#44);
+#46=CIRCLE($,#45,4.25);
+#47=EDGE_CURVE($,#41,#41,#46,.T.);
+#48=ORIENTED_EDGE($,$,$,#47,.F.);
+#49=EDGE_LOOP($,(#48));
+#50=FACE_BOUND('',#49,.T.);
+#51=CARTESIAN_POINT($,(34.25,0,0));
+#52=VERTEX_POINT($,#51);
+#53=CARTESIAN_POINT($,(30,0,0));
+#54=DIRECTION($,(0,0,1));
+#55=DIRECTION($,(1,0,0));
+#56=AXIS2_PLACEMENT_3D($,#53,#54,#55);
+#57=CIRCLE($,#56,4.25);
+#58=EDGE_CURVE($,#52,#52,#57,.T.);
+#59=ORIENTED_EDGE($,$,$,#58,.F.);
+#60=EDGE_LOOP($,(#59));
+#61=FACE_BOUND('',#60,.T.);
+#62=ADVANCED_FACE('',(#39,#50,#61),#5,.T.);
+#63=CARTESIAN_POINT($,(-38.5,-23.5,25));
+#64=DIRECTION($,(0,0,1));
+#65=DIRECTION($,(1,0,0));
+#66=AXIS2_PLACEMENT_3D($,#63,#64,#65);
+#67=PLANE($,#66);
+#68=CARTESIAN_POINT($,(-38.5,-23.5,25));
+#69=VERTEX_POINT($,#68);
+#70=CARTESIAN_POINT($,(38.5,-23.5,25));
+#71=VERTEX_POINT($,#70);
+#72=CARTESIAN_POINT($,(-38.5,-23.5,25));
+#73=DIRECTION($,(1,0,0));
+#74=VECTOR($,#73,1);
+#75=LINE($,#72,#74);
+#76=EDGE_CURVE($,#69,#71,#75,.T.);
+#77=ORIENTED_EDGE($,$,$,#76,.T.);
+#78=CARTESIAN_POINT($,(38.5,23.5,25));
+#79=VERTEX_POINT($,#78);
+#80=CARTESIAN_POINT($,(38.5,-23.5,25));
+#81=DIRECTION($,(0,1,0));
+#82=VECTOR($,#81,1);
+#83=LINE($,#80,#82);
+#84=EDGE_CURVE($,#71,#79,#83,.T.);
+#85=ORIENTED_EDGE($,$,$,#84,.T.);
+#86=CARTESIAN_POINT($,(-38.5,23.5,25));
+#87=VERTEX_POINT($,#86);
+#88=CARTESIAN_POINT($,(38.5,23.5,25));
+#89=DIRECTION($,(-1,0,0));
+#90=VECTOR($,#89,1);
+#91=LINE($,#88,#90);
+#92=EDGE_CURVE($,#79,#87,#91,.T.);
+#93=ORIENTED_EDGE($,$,$,#92,.T.);
+#94=CARTESIAN_POINT($,(-38.5,23.5,25));
+#95=DIRECTION($,(0,-1,0));
+#96=VECTOR($,#95,1);
+#97=LINE($,#94,#96);
+#98=EDGE_CURVE($,#87,#69,#97,.T.);
+#99=ORIENTED_EDGE($,$,$,#98,.T.);
+#100=EDGE_LOOP($,(#77,#85,#93,#99));
+#101=FACE_OUTER_BOUND('',#100,.T.);
+#102=CARTESIAN_POINT($,(-25.75,0,25));
+#103=VERTEX_POINT($,#102);
+#104=CARTESIAN_POINT($,(-30,0,25));
+#105=DIRECTION($,(0,0,1));
+#106=DIRECTION($,(1,0,0));
+#107=AXIS2_PLACEMENT_3D($,#104,#105,#106);
+#108=CIRCLE($,#107,4.25);
+#109=EDGE_CURVE($,#103,#103,#108,.T.);
+#110=ORIENTED_EDGE($,$,$,#109,.T.);
+#111=EDGE_LOOP($,(#110));
+#112=FACE_BOUND('',#111,.T.);
+#113=CARTESIAN_POINT($,(34.25,0,25));
+#114=VERTEX_POINT($,#113);
+#115=CARTESIAN_POINT($,(30,0,25));
+#116=DIRECTION($,(0,0,1));
+#117=DIRECTION($,(1,0,0));
+#118=AXIS2_PLACEMENT_3D($,#115,#116,#117);
+#119=CIRCLE($,#118,4.25);
+#120=EDGE_CURVE($,#114,#114,#119,.T.);
+#121=ORIENTED_EDGE($,$,$,#120,.T.);
+#122=EDGE_LOOP($,(#121));
+#123=FACE_BOUND('',#122,.T.);
+#124=ADVANCED_FACE('',(#101,#112,#123),#67,.T.);
+#125=CARTESIAN_POINT($,(-40,-25,0));
+#126=DIRECTION($,(0,-1,0));
+#127=DIRECTION($,(1,0,0));
+#128=AXIS2_PLACEMENT_3D($,#125,#126,#127);
+#129=PLANE($,#128);
+#130=ORIENTED_EDGE($,$,$,#14,.T.);
+#131=CARTESIAN_POINT($,(40,-25,23.5));
+#132=VERTEX_POINT($,#131);
+#133=CARTESIAN_POINT($,(40,-25,-0));
+#134=DIRECTION($,(0,0,1));
+#135=VECTOR($,#134,1);
+#136=LINE($,#133,#135);
+#137=EDGE_CURVE($,#9,#132,#136,.T.);
+#138=ORIENTED_EDGE($,$,$,#137,.T.);
+#139=CARTESIAN_POINT($,(-40,-25,23.5));
+#140=VERTEX_POINT($,#139);
+#141=CARTESIAN_POINT($,(-40,-25,23.5));
+#142=DIRECTION($,(1,0,0));
+#143=VECTOR($,#142,1);
+#144=LINE($,#141,#143);
+#145=EDGE_CURVE($,#140,#132,#144,.T.);
+#146=ORIENTED_EDGE($,$,$,#145,.F.);
+#147=CARTESIAN_POINT($,(-40,-25,0));
+#148=DIRECTION($,(0,0,1));
+#149=VECTOR($,#148,1);
+#150=LINE($,#147,#149);
+#151=EDGE_CURVE($,#7,#140,#150,.T.);
+#152=ORIENTED_EDGE($,$,$,#151,.F.);
+#153=EDGE_LOOP($,(#130,#138,#146,#152));
+#154=FACE_OUTER_BOUND('',#153,.T.);
+#155=ADVANCED_FACE('',(#154),#129,.T.);
+#156=CARTESIAN_POINT($,(-40,-25,23.5));
+#157=DIRECTION($,(0,-0.707106781186548,0.707106781186548));
+#158=DIRECTION($,(1,0,0));
+#159=AXIS2_PLACEMENT_3D($,#156,#157,#158);
+#160=PLANE($,#159);
+#161=ORIENTED_EDGE($,$,$,#145,.T.);
+#162=CARTESIAN_POINT($,(40,-25,23.5));
+#163=DIRECTION($,(-0.577350269189626,0.577350269189626,0.577350269189626));
+#164=VECTOR($,#163,1);
+#165=LINE($,#162,#164);
+#166=EDGE_CURVE($,#132,#71,#165,.T.);
+#167=ORIENTED_EDGE($,$,$,#166,.T.);
+#168=ORIENTED_EDGE($,$,$,#76,.F.);
+#169=CARTESIAN_POINT($,(-40,-25,23.5));
+#170=DIRECTION($,(0.577350269189626,0.577350269189626,0.577350269189626));
+#171=VECTOR($,#170,1);
+#172=LINE($,#169,#171);
+#173=EDGE_CURVE($,#140,#69,#172,.T.);
+#174=ORIENTED_EDGE($,$,$,#173,.F.);
+#175=EDGE_LOOP($,(#161,#167,#168,#174));
+#176=FACE_OUTER_BOUND('',#175,.T.);
+#177=ADVANCED_FACE('',(#176),#160,.T.);
+#178=CARTESIAN_POINT($,(40,-25,0));
+#179=DIRECTION($,(1,0,0));
+#180=DIRECTION($,(0,1,0));
+#181=AXIS2_PLACEMENT_3D($,#178,#179,#180);
+#182=PLANE($,#181);
+#183=ORIENTED_EDGE($,$,$,#22,.T.);
+#184=CARTESIAN_POINT($,(40,25,23.5));
+#185=VERTEX_POINT($,#184);
+#186=CARTESIAN_POINT($,(40,25,-0));
+#187=DIRECTION($,(0,0,1));
+#188=VECTOR($,#187,1);
+#189=LINE($,#186,#188);
+#190=EDGE_CURVE($,#17,#185,#189,.T.);
+#191=ORIENTED_EDGE($,$,$,#190,.T.);
+#192=CARTESIAN_POINT($,(40,-25,23.5));
+#193=DIRECTION($,(0,1,0));
+#194=VECTOR($,#193,1);
+#195=LINE($,#192,#194);
+#196=EDGE_CURVE($,#132,#185,#195,.T.);
+#197=ORIENTED_EDGE($,$,$,#196,.F.);
+#198=ORIENTED_EDGE($,$,$,#137,.F.);
+#199=EDGE_LOOP($,(#183,#191,#197,#198));
+#200=FACE_OUTER_BOUND('',#199,.T.);
+#201=ADVANCED_FACE('',(#200),#182,.T.);
+#202=CARTESIAN_POINT($,(40,-25,23.5));
+#203=DIRECTION($,(0.707106781186548,-0,0.707106781186548));
+#204=DIRECTION($,(0,1,0));
+#205=AXIS2_PLACEMENT_3D($,#202,#203,#204);
+#206=PLANE($,#205);
+#207=ORIENTED_EDGE($,$,$,#196,.T.);
+#208=CARTESIAN_POINT($,(40,25,23.5));
+#209=DIRECTION($,(-0.577350269189626,-0.577350269189626,0.577350269189626));
+#210=VECTOR($,#209,1);
+#211=LINE($,#208,#210);
+#212=EDGE_CURVE($,#185,#79,#211,.T.);
+#213=ORIENTED_EDGE($,$,$,#212,.T.);
+#214=ORIENTED_EDGE($,$,$,#84,.F.);
+#215=ORIENTED_EDGE($,$,$,#166,.F.);
+#216=EDGE_LOOP($,(#207,#213,#214,#215));
+#217=FACE_OUTER_BOUND('',#216,.T.);
+#218=ADVANCED_FACE('',(#217),#206,.T.);
+#219=CARTESIAN_POINT($,(40,25,0));
+#220=DIRECTION($,(0,1,-0));
+#221=DIRECTION($,(-1,0,0));
+#222=AXIS2_PLACEMENT_3D($,#219,#220,#221);
+#223=PLANE($,#222);
+#224=ORIENTED_EDGE($,$,$,#30,.T.);
+#225=CARTESIAN_POINT($,(-40,25,23.5));
+#226=VERTEX_POINT($,#225);
+#227=CARTESIAN_POINT($,(-40,25,-0));
+#228=DIRECTION($,(0,0,1));
+#229=VECTOR($,#228,1);
+#230=LINE($,#227,#229);
+#231=EDGE_CURVE($,#25,#226,#230,.T.);
+#232=ORIENTED_EDGE($,$,$,#231,.T.);
+#233=CARTESIAN_POINT($,(40,25,23.5));
+#234=DIRECTION($,(-1,0,0));
+#235=VECTOR($,#234,1);
+#236=LINE($,#233,#235);
+#237=EDGE_CURVE($,#185,#226,#236,.T.);
+#238=ORIENTED_EDGE($,$,$,#237,.F.);
+#239=ORIENTED_EDGE($,$,$,#190,.F.);
+#240=EDGE_LOOP($,(#224,#232,#238,#239));
+#241=FACE_OUTER_BOUND('',#240,.T.);
+#242=ADVANCED_FACE('',(#241),#223,.T.);
+#243=CARTESIAN_POINT($,(40,25,23.5));
+#244=DIRECTION($,(0,0.707106781186548,0.707106781186548));
+#245=DIRECTION($,(-1,0,0));
+#246=AXIS2_PLACEMENT_3D($,#243,#244,#245);
+#247=PLANE($,#246);
+#248=ORIENTED_EDGE($,$,$,#237,.T.);
+#249=CARTESIAN_POINT($,(-40,25,23.5));
+#250=DIRECTION($,(0.577350269189626,-0.577350269189626,0.577350269189626));
+#251=VECTOR($,#250,1);
+#252=LINE($,#249,#251);
+#253=EDGE_CURVE($,#226,#87,#252,.T.);
+#254=ORIENTED_EDGE($,$,$,#253,.T.);
+#255=ORIENTED_EDGE($,$,$,#92,.F.);
+#256=ORIENTED_EDGE($,$,$,#212,.F.);
+#257=EDGE_LOOP($,(#248,#254,#255,#256));
+#258=FACE_OUTER_BOUND('',#257,.T.);
+#259=ADVANCED_FACE('',(#258),#247,.T.);
+#260=CARTESIAN_POINT($,(-40,25,0));
+#261=DIRECTION($,(-1,0,0));
+#262=DIRECTION($,(0,-1,0));
+#263=AXIS2_PLACEMENT_3D($,#260,#261,#262);
+#264=PLANE($,#263);
+#265=ORIENTED_EDGE($,$,$,#36,.T.);
+#266=ORIENTED_EDGE($,$,$,#151,.T.);
+#267=CARTESIAN_POINT($,(-40,25,23.5));
+#268=DIRECTION($,(0,-1,0));
+#269=VECTOR($,#268,1);
+#270=LINE($,#267,#269);
+#271=EDGE_CURVE($,#226,#140,#270,.T.);
+#272=ORIENTED_EDGE($,$,$,#271,.F.);
+#273=ORIENTED_EDGE($,$,$,#231,.F.);
+#274=EDGE_LOOP($,(#265,#266,#272,#273));
+#275=FACE_OUTER_BOUND('',#274,.T.);
+#276=ADVANCED_FACE('',(#275),#264,.T.);
+#277=CARTESIAN_POINT($,(-40,25,23.5));
+#278=DIRECTION($,(-0.707106781186548,0,0.707106781186548));
+#279=DIRECTION($,(0,-1,0));
+#280=AXIS2_PLACEMENT_3D($,#277,#278,#279);
+#281=PLANE($,#280);
+#282=ORIENTED_EDGE($,$,$,#271,.T.);
+#283=ORIENTED_EDGE($,$,$,#173,.T.);
+#284=ORIENTED_EDGE($,$,$,#98,.F.);
+#285=ORIENTED_EDGE($,$,$,#253,.F.);
+#286=EDGE_LOOP($,(#282,#283,#284,#285));
+#287=FACE_OUTER_BOUND('',#286,.T.);
+#288=ADVANCED_FACE('',(#287),#281,.T.);
+#289=CARTESIAN_POINT($,(-30,0,0));
+#290=DIRECTION($,(0,0,1));
+#291=DIRECTION($,(1,0,0));
+#292=AXIS2_PLACEMENT_3D($,#289,#290,#291);
+#293=CYLINDRICAL_SURFACE($,#292,4.25);
+#294=CARTESIAN_POINT($,(-25.75,0,25));
+#295=DIRECTION($,(0,0,-1));
+#296=VECTOR($,#295,1);
+#297=LINE($,#294,#296);
+#298=EDGE_CURVE($,#103,#41,#297,.T.);
+#299=ORIENTED_EDGE($,$,$,#298,.T.);
+#300=ORIENTED_EDGE($,$,$,#47,.T.);
+#301=ORIENTED_EDGE($,$,$,#298,.F.);
+#302=ORIENTED_EDGE($,$,$,#109,.F.);
+#303=EDGE_LOOP($,(#299,#300,#301,#302));
+#304=FACE_OUTER_BOUND('',#303,.T.);
+#305=ADVANCED_FACE('',(#304),#293,.F.);
+#306=CARTESIAN_POINT($,(30,0,0));
+#307=DIRECTION($,(0,0,1));
+#308=DIRECTION($,(1,0,0));
+#309=AXIS2_PLACEMENT_3D($,#306,#307,#308);
+#310=CYLINDRICAL_SURFACE($,#309,4.25);
+#311=CARTESIAN_POINT($,(34.25,0,25));
+#312=DIRECTION($,(0,0,-1));
+#313=VECTOR($,#312,1);
+#314=LINE($,#311,#313);
+#315=EDGE_CURVE($,#114,#52,#314,.T.);
+#316=ORIENTED_EDGE($,$,$,#315,.T.);
+#317=ORIENTED_EDGE($,$,$,#58,.T.);
+#318=ORIENTED_EDGE($,$,$,#315,.F.);
+#319=ORIENTED_EDGE($,$,$,#120,.F.);
+#320=EDGE_LOOP($,(#316,#317,#318,#319));
+#321=FACE_OUTER_BOUND('',#320,.T.);
+#322=ADVANCED_FACE('',(#321),#310,.F.);
+#323=CLOSED_SHELL($,(#62,#124,#155,#177,#201,#218,#242,#259,#276,#288,#305,#322));
+#324=MANIFOLD_SOLID_BREP('AetherisBody',#323);
+#325=APPLICATION_CONTEXT('mechanical design');
+#326=PRODUCT_CONTEXT('',#325,'mechanical');
+#327=PRODUCT('AETHERIS','AetherisBody','',(#326));
+#328=PRODUCT_DEFINITION_FORMATION('','',#327);
+#329=PRODUCT_DEFINITION_CONTEXT('design',#325,'design');
+#330=PRODUCT_DEFINITION('','',#328,#329);
+#331=PRODUCT_DEFINITION_SHAPE('','',#330);
+#332=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.));
+#333=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
+#334=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT());
+#335=(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNIT_ASSIGNED_CONTEXT((#332,#333,#334))REPRESENTATION_CONTEXT('3','3D'));
+#336=SHAPE_REPRESENTATION('AetherisBody',(#324),#335);
+#337=SHAPE_DEFINITION_REPRESENTATION(#331,#336);
+ENDSEC;
+END-ISO-10303-21;
diff --git a/testdata/firmament/exports/combined-hole-edgefinish-x1.step b/testdata/firmament/exports/combined-hole-edgefinish-x1.step
new file mode 100644
index 00000000..cc6db5a1
--- /dev/null
+++ b/testdata/firmament/exports/combined-hole-edgefinish-x1.step
@@ -0,0 +1,346 @@
+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($,(-40,-25,0));
+#2=DIRECTION($,(0,0,-1));
+#3=DIRECTION($,(0,1,0));
+#4=AXIS2_PLACEMENT_3D($,#1,#2,#3);
+#5=PLANE($,#4);
+#6=CARTESIAN_POINT($,(-40,-25,0));
+#7=VERTEX_POINT($,#6);
+#8=CARTESIAN_POINT($,(40,-25,-0));
+#9=VERTEX_POINT($,#8);
+#10=CARTESIAN_POINT($,(-40,-25,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($,(40,25,-0));
+#17=VERTEX_POINT($,#16);
+#18=CARTESIAN_POINT($,(40,-25,-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($,(-40,25,-0));
+#25=VERTEX_POINT($,#24);
+#26=CARTESIAN_POINT($,(40,25,-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($,(-40,25,-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=CARTESIAN_POINT($,(-25.75,0,0));
+#41=VERTEX_POINT($,#40);
+#42=CARTESIAN_POINT($,(-30,0,0));
+#43=DIRECTION($,(0,0,1));
+#44=DIRECTION($,(1,0,0));
+#45=AXIS2_PLACEMENT_3D($,#42,#43,#44);
+#46=CIRCLE($,#45,4.25);
+#47=EDGE_CURVE($,#41,#41,#46,.T.);
+#48=ORIENTED_EDGE($,$,$,#47,.F.);
+#49=EDGE_LOOP($,(#48));
+#50=FACE_BOUND('',#49,.T.);
+#51=CARTESIAN_POINT($,(34.25,0,0));
+#52=VERTEX_POINT($,#51);
+#53=CARTESIAN_POINT($,(30,0,0));
+#54=DIRECTION($,(0,0,1));
+#55=DIRECTION($,(1,0,0));
+#56=AXIS2_PLACEMENT_3D($,#53,#54,#55);
+#57=CIRCLE($,#56,4.25);
+#58=EDGE_CURVE($,#52,#52,#57,.T.);
+#59=ORIENTED_EDGE($,$,$,#58,.F.);
+#60=EDGE_LOOP($,(#59));
+#61=FACE_BOUND('',#60,.T.);
+#62=ADVANCED_FACE('',(#39,#50,#61),#5,.T.);
+#63=CARTESIAN_POINT($,(-38.5,-23.5,25));
+#64=DIRECTION($,(0,0,1));
+#65=DIRECTION($,(1,0,0));
+#66=AXIS2_PLACEMENT_3D($,#63,#64,#65);
+#67=PLANE($,#66);
+#68=CARTESIAN_POINT($,(-38.5,-23.5,25));
+#69=VERTEX_POINT($,#68);
+#70=CARTESIAN_POINT($,(38.5,-23.5,25));
+#71=VERTEX_POINT($,#70);
+#72=CARTESIAN_POINT($,(-38.5,-23.5,25));
+#73=DIRECTION($,(1,0,0));
+#74=VECTOR($,#73,1);
+#75=LINE($,#72,#74);
+#76=EDGE_CURVE($,#69,#71,#75,.T.);
+#77=ORIENTED_EDGE($,$,$,#76,.T.);
+#78=CARTESIAN_POINT($,(38.5,23.5,25));
+#79=VERTEX_POINT($,#78);
+#80=CARTESIAN_POINT($,(38.5,-23.5,25));
+#81=DIRECTION($,(0,1,0));
+#82=VECTOR($,#81,1);
+#83=LINE($,#80,#82);
+#84=EDGE_CURVE($,#71,#79,#83,.T.);
+#85=ORIENTED_EDGE($,$,$,#84,.T.);
+#86=CARTESIAN_POINT($,(-38.5,23.5,25));
+#87=VERTEX_POINT($,#86);
+#88=CARTESIAN_POINT($,(38.5,23.5,25));
+#89=DIRECTION($,(-1,0,0));
+#90=VECTOR($,#89,1);
+#91=LINE($,#88,#90);
+#92=EDGE_CURVE($,#79,#87,#91,.T.);
+#93=ORIENTED_EDGE($,$,$,#92,.T.);
+#94=CARTESIAN_POINT($,(-38.5,23.5,25));
+#95=DIRECTION($,(0,-1,0));
+#96=VECTOR($,#95,1);
+#97=LINE($,#94,#96);
+#98=EDGE_CURVE($,#87,#69,#97,.T.);
+#99=ORIENTED_EDGE($,$,$,#98,.T.);
+#100=EDGE_LOOP($,(#77,#85,#93,#99));
+#101=FACE_OUTER_BOUND('',#100,.T.);
+#102=CARTESIAN_POINT($,(-25.75,0,25));
+#103=VERTEX_POINT($,#102);
+#104=CARTESIAN_POINT($,(-30,0,25));
+#105=DIRECTION($,(0,0,1));
+#106=DIRECTION($,(1,0,0));
+#107=AXIS2_PLACEMENT_3D($,#104,#105,#106);
+#108=CIRCLE($,#107,4.25);
+#109=EDGE_CURVE($,#103,#103,#108,.T.);
+#110=ORIENTED_EDGE($,$,$,#109,.T.);
+#111=EDGE_LOOP($,(#110));
+#112=FACE_BOUND('',#111,.T.);
+#113=CARTESIAN_POINT($,(34.25,0,25));
+#114=VERTEX_POINT($,#113);
+#115=CARTESIAN_POINT($,(30,0,25));
+#116=DIRECTION($,(0,0,1));
+#117=DIRECTION($,(1,0,0));
+#118=AXIS2_PLACEMENT_3D($,#115,#116,#117);
+#119=CIRCLE($,#118,4.25);
+#120=EDGE_CURVE($,#114,#114,#119,.T.);
+#121=ORIENTED_EDGE($,$,$,#120,.T.);
+#122=EDGE_LOOP($,(#121));
+#123=FACE_BOUND('',#122,.T.);
+#124=ADVANCED_FACE('',(#101,#112,#123),#67,.T.);
+#125=CARTESIAN_POINT($,(-40,-25,0));
+#126=DIRECTION($,(0,-1,0));
+#127=DIRECTION($,(1,0,0));
+#128=AXIS2_PLACEMENT_3D($,#125,#126,#127);
+#129=PLANE($,#128);
+#130=ORIENTED_EDGE($,$,$,#14,.T.);
+#131=CARTESIAN_POINT($,(40,-25,23.5));
+#132=VERTEX_POINT($,#131);
+#133=CARTESIAN_POINT($,(40,-25,-0));
+#134=DIRECTION($,(0,0,1));
+#135=VECTOR($,#134,1);
+#136=LINE($,#133,#135);
+#137=EDGE_CURVE($,#9,#132,#136,.T.);
+#138=ORIENTED_EDGE($,$,$,#137,.T.);
+#139=CARTESIAN_POINT($,(-40,-25,23.5));
+#140=VERTEX_POINT($,#139);
+#141=CARTESIAN_POINT($,(-40,-25,23.5));
+#142=DIRECTION($,(1,0,0));
+#143=VECTOR($,#142,1);
+#144=LINE($,#141,#143);
+#145=EDGE_CURVE($,#140,#132,#144,.T.);
+#146=ORIENTED_EDGE($,$,$,#145,.F.);
+#147=CARTESIAN_POINT($,(-40,-25,0));
+#148=DIRECTION($,(0,0,1));
+#149=VECTOR($,#148,1);
+#150=LINE($,#147,#149);
+#151=EDGE_CURVE($,#7,#140,#150,.T.);
+#152=ORIENTED_EDGE($,$,$,#151,.F.);
+#153=EDGE_LOOP($,(#130,#138,#146,#152));
+#154=FACE_OUTER_BOUND('',#153,.T.);
+#155=ADVANCED_FACE('',(#154),#129,.T.);
+#156=CARTESIAN_POINT($,(-40,-25,23.5));
+#157=DIRECTION($,(0,-0.707106781186547,0.707106781186547));
+#158=DIRECTION($,(1,0,0));
+#159=AXIS2_PLACEMENT_3D($,#156,#157,#158);
+#160=PLANE($,#159);
+#161=ORIENTED_EDGE($,$,$,#145,.T.);
+#162=CARTESIAN_POINT($,(40,-25,23.5));
+#163=DIRECTION($,(-0.577350269189626,0.577350269189626,0.577350269189626));
+#164=VECTOR($,#163,1);
+#165=LINE($,#162,#164);
+#166=EDGE_CURVE($,#132,#71,#165,.T.);
+#167=ORIENTED_EDGE($,$,$,#166,.T.);
+#168=ORIENTED_EDGE($,$,$,#76,.F.);
+#169=CARTESIAN_POINT($,(-40,-25,23.5));
+#170=DIRECTION($,(0.577350269189626,0.577350269189626,0.577350269189626));
+#171=VECTOR($,#170,1);
+#172=LINE($,#169,#171);
+#173=EDGE_CURVE($,#140,#69,#172,.T.);
+#174=ORIENTED_EDGE($,$,$,#173,.F.);
+#175=EDGE_LOOP($,(#161,#167,#168,#174));
+#176=FACE_OUTER_BOUND('',#175,.T.);
+#177=ADVANCED_FACE('',(#176),#160,.T.);
+#178=CARTESIAN_POINT($,(40,-25,0));
+#179=DIRECTION($,(1,0,0));
+#180=DIRECTION($,(0,1,0));
+#181=AXIS2_PLACEMENT_3D($,#178,#179,#180);
+#182=PLANE($,#181);
+#183=ORIENTED_EDGE($,$,$,#22,.T.);
+#184=CARTESIAN_POINT($,(40,25,23.5));
+#185=VERTEX_POINT($,#184);
+#186=CARTESIAN_POINT($,(40,25,-0));
+#187=DIRECTION($,(0,0,1));
+#188=VECTOR($,#187,1);
+#189=LINE($,#186,#188);
+#190=EDGE_CURVE($,#17,#185,#189,.T.);
+#191=ORIENTED_EDGE($,$,$,#190,.T.);
+#192=CARTESIAN_POINT($,(40,-25,23.5));
+#193=DIRECTION($,(0,1,0));
+#194=VECTOR($,#193,1);
+#195=LINE($,#192,#194);
+#196=EDGE_CURVE($,#132,#185,#195,.T.);
+#197=ORIENTED_EDGE($,$,$,#196,.F.);
+#198=ORIENTED_EDGE($,$,$,#137,.F.);
+#199=EDGE_LOOP($,(#183,#191,#197,#198));
+#200=FACE_OUTER_BOUND('',#199,.T.);
+#201=ADVANCED_FACE('',(#200),#182,.T.);
+#202=CARTESIAN_POINT($,(40,-25,23.5));
+#203=DIRECTION($,(0.707106781186547,-0,0.707106781186547));
+#204=DIRECTION($,(0,1,0));
+#205=AXIS2_PLACEMENT_3D($,#202,#203,#204);
+#206=PLANE($,#205);
+#207=ORIENTED_EDGE($,$,$,#196,.T.);
+#208=CARTESIAN_POINT($,(40,25,23.5));
+#209=DIRECTION($,(-0.577350269189626,-0.577350269189626,0.577350269189626));
+#210=VECTOR($,#209,1);
+#211=LINE($,#208,#210);
+#212=EDGE_CURVE($,#185,#79,#211,.T.);
+#213=ORIENTED_EDGE($,$,$,#212,.T.);
+#214=ORIENTED_EDGE($,$,$,#84,.F.);
+#215=ORIENTED_EDGE($,$,$,#166,.F.);
+#216=EDGE_LOOP($,(#207,#213,#214,#215));
+#217=FACE_OUTER_BOUND('',#216,.T.);
+#218=ADVANCED_FACE('',(#217),#206,.T.);
+#219=CARTESIAN_POINT($,(40,25,0));
+#220=DIRECTION($,(0,1,-0));
+#221=DIRECTION($,(-1,0,0));
+#222=AXIS2_PLACEMENT_3D($,#219,#220,#221);
+#223=PLANE($,#222);
+#224=ORIENTED_EDGE($,$,$,#30,.T.);
+#225=CARTESIAN_POINT($,(-40,25,23.5));
+#226=VERTEX_POINT($,#225);
+#227=CARTESIAN_POINT($,(-40,25,-0));
+#228=DIRECTION($,(0,0,1));
+#229=VECTOR($,#228,1);
+#230=LINE($,#227,#229);
+#231=EDGE_CURVE($,#25,#226,#230,.T.);
+#232=ORIENTED_EDGE($,$,$,#231,.T.);
+#233=CARTESIAN_POINT($,(40,25,23.5));
+#234=DIRECTION($,(-1,0,0));
+#235=VECTOR($,#234,1);
+#236=LINE($,#233,#235);
+#237=EDGE_CURVE($,#185,#226,#236,.T.);
+#238=ORIENTED_EDGE($,$,$,#237,.F.);
+#239=ORIENTED_EDGE($,$,$,#190,.F.);
+#240=EDGE_LOOP($,(#224,#232,#238,#239));
+#241=FACE_OUTER_BOUND('',#240,.T.);
+#242=ADVANCED_FACE('',(#241),#223,.T.);
+#243=CARTESIAN_POINT($,(40,25,23.5));
+#244=DIRECTION($,(0,0.707106781186547,0.707106781186547));
+#245=DIRECTION($,(-1,0,0));
+#246=AXIS2_PLACEMENT_3D($,#243,#244,#245);
+#247=PLANE($,#246);
+#248=ORIENTED_EDGE($,$,$,#237,.T.);
+#249=CARTESIAN_POINT($,(-40,25,23.5));
+#250=DIRECTION($,(0.577350269189626,-0.577350269189626,0.577350269189626));
+#251=VECTOR($,#250,1);
+#252=LINE($,#249,#251);
+#253=EDGE_CURVE($,#226,#87,#252,.T.);
+#254=ORIENTED_EDGE($,$,$,#253,.T.);
+#255=ORIENTED_EDGE($,$,$,#92,.F.);
+#256=ORIENTED_EDGE($,$,$,#212,.F.);
+#257=EDGE_LOOP($,(#248,#254,#255,#256));
+#258=FACE_OUTER_BOUND('',#257,.T.);
+#259=ADVANCED_FACE('',(#258),#247,.T.);
+#260=CARTESIAN_POINT($,(-40,25,0));
+#261=DIRECTION($,(-1,0,0));
+#262=DIRECTION($,(0,-1,0));
+#263=AXIS2_PLACEMENT_3D($,#260,#261,#262);
+#264=PLANE($,#263);
+#265=ORIENTED_EDGE($,$,$,#36,.T.);
+#266=ORIENTED_EDGE($,$,$,#151,.T.);
+#267=CARTESIAN_POINT($,(-40,25,23.5));
+#268=DIRECTION($,(0,-1,0));
+#269=VECTOR($,#268,1);
+#270=LINE($,#267,#269);
+#271=EDGE_CURVE($,#226,#140,#270,.T.);
+#272=ORIENTED_EDGE($,$,$,#271,.F.);
+#273=ORIENTED_EDGE($,$,$,#231,.F.);
+#274=EDGE_LOOP($,(#265,#266,#272,#273));
+#275=FACE_OUTER_BOUND('',#274,.T.);
+#276=ADVANCED_FACE('',(#275),#264,.T.);
+#277=CARTESIAN_POINT($,(-40,25,23.5));
+#278=DIRECTION($,(-0.707106781186547,0,0.707106781186547));
+#279=DIRECTION($,(0,-1,0));
+#280=AXIS2_PLACEMENT_3D($,#277,#278,#279);
+#281=PLANE($,#280);
+#282=ORIENTED_EDGE($,$,$,#271,.T.);
+#283=ORIENTED_EDGE($,$,$,#173,.T.);
+#284=ORIENTED_EDGE($,$,$,#98,.F.);
+#285=ORIENTED_EDGE($,$,$,#253,.F.);
+#286=EDGE_LOOP($,(#282,#283,#284,#285));
+#287=FACE_OUTER_BOUND('',#286,.T.);
+#288=ADVANCED_FACE('',(#287),#281,.T.);
+#289=CARTESIAN_POINT($,(-30,0,0));
+#290=DIRECTION($,(0,0,1));
+#291=DIRECTION($,(1,0,0));
+#292=AXIS2_PLACEMENT_3D($,#289,#290,#291);
+#293=CYLINDRICAL_SURFACE($,#292,4.25);
+#294=CARTESIAN_POINT($,(-25.75,0,25));
+#295=DIRECTION($,(0,0,-1));
+#296=VECTOR($,#295,1);
+#297=LINE($,#294,#296);
+#298=EDGE_CURVE($,#103,#41,#297,.T.);
+#299=ORIENTED_EDGE($,$,$,#298,.T.);
+#300=ORIENTED_EDGE($,$,$,#47,.T.);
+#301=ORIENTED_EDGE($,$,$,#298,.F.);
+#302=ORIENTED_EDGE($,$,$,#109,.F.);
+#303=EDGE_LOOP($,(#299,#300,#301,#302));
+#304=FACE_OUTER_BOUND('',#303,.T.);
+#305=ADVANCED_FACE('',(#304),#293,.F.);
+#306=CARTESIAN_POINT($,(30,0,0));
+#307=DIRECTION($,(0,0,1));
+#308=DIRECTION($,(1,0,0));
+#309=AXIS2_PLACEMENT_3D($,#306,#307,#308);
+#310=CYLINDRICAL_SURFACE($,#309,4.25);
+#311=CARTESIAN_POINT($,(34.25,0,25));
+#312=DIRECTION($,(0,0,-1));
+#313=VECTOR($,#312,1);
+#314=LINE($,#311,#313);
+#315=EDGE_CURVE($,#114,#52,#314,.T.);
+#316=ORIENTED_EDGE($,$,$,#315,.T.);
+#317=ORIENTED_EDGE($,$,$,#58,.T.);
+#318=ORIENTED_EDGE($,$,$,#315,.F.);
+#319=ORIENTED_EDGE($,$,$,#120,.F.);
+#320=EDGE_LOOP($,(#316,#317,#318,#319));
+#321=FACE_OUTER_BOUND('',#320,.T.);
+#322=ADVANCED_FACE('',(#321),#310,.F.);
+#323=CLOSED_SHELL($,(#62,#124,#155,#177,#201,#218,#242,#259,#276,#288,#305,#322));
+#324=MANIFOLD_SOLID_BREP('AetherisBody',#323);
+#325=APPLICATION_CONTEXT('mechanical design');
+#326=PRODUCT_CONTEXT('',#325,'mechanical');
+#327=PRODUCT('AETHERIS','AetherisBody','',(#326));
+#328=PRODUCT_DEFINITION_FORMATION('','',#327);
+#329=PRODUCT_DEFINITION_CONTEXT('design',#325,'design');
+#330=PRODUCT_DEFINITION('','',#328,#329);
+#331=PRODUCT_DEFINITION_SHAPE('','',#330);
+#332=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.));
+#333=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
+#334=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT());
+#335=(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNIT_ASSIGNED_CONTEXT((#332,#333,#334))REPRESENTATION_CONTEXT('3','3D'));
+#336=SHAPE_REPRESENTATION('AetherisBody',(#324),#335);
+#337=SHAPE_DEFINITION_REPRESENTATION(#331,#336);
+ENDSEC;
+END-ISO-10303-21;