Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
utensil holder.
Yuechen Lib505d9bb673b
diff --git a/Aetheris.Kernel.Core.Tests/Brep/BrepHollowRadialCutPatternTests.cs b/Aetheris.Kernel.Core.Tests/Brep/BrepHollowRadialCutPatternTests.csnew file mode 100644index 00000000..f9485882--- /dev/null+++ b/Aetheris.Kernel.Core.Tests/Brep/BrepHollowRadialCutPatternTests.cs@@ -0,0 +1,144 @@+using Aetheris.Kernel.Core.Brep;+using Aetheris.Kernel.Core.Brep.Features;+using Aetheris.Kernel.Core.Brep.Tessellation;+using Aetheris.Kernel.Core.Brep.Verification;+using Aetheris.Kernel.Core.Step242;++namespace Aetheris.Kernel.Core.Tests.Brep;++public sealed class BrepHollowRadialCutPatternTests+{+ [Fact]+ public void CoupledBottomBlend_PreservesThicknessAndPerforationRoundTrip()+ {+ const double blend = 8;+ const double thickness = 0.8;+ var hollow = ThinWalledBodyBRepPlanner.CreateCylinder(56, 142, thickness, blend);+ Assert.True(hollow.IsSuccess, string.Join(" | ", hollow.Diagnostics.Select(d => d.Message)));+ Assert.Equal(7, hollow.Value.Body.Topology.Faces.Count());+ var result = BrepHollowRadialCutPattern.Build(hollow.Value,+ [new("Vents.Row0.Col0", 4.5, 30, 0), new("Vents.Row0.Col1", 4.5, 30, 0.4)]);+ Assert.True(result.IsSuccess, string.Join(" | ", result.Diagnostics.Select(d => $"{d.Source}: {d.Message}")));+ var body = result.Value.Body;+ Assert.Equal(9, body.Topology.Faces.Count());+ var tori = body.Geometry.Surfaces.Where(s => s.Value.Kind == Aetheris.Kernel.Core.Geometry.SurfaceGeometryKind.Torus)+ .Select(s => s.Value.Torus!.Value).ToArray();+ Assert.Equal(2, tori.Length);+ Assert.All(tori, torus => Assert.Equal(48, torus.MajorRadius, 8));+ Assert.Equal(thickness, tori.Max(t => t.MinorRadius) - tori.Min(t => t.MinorRadius), 8);+ var mass = BrepMassProperties.Evaluate(body);+ Assert.True(mass.IsEnclosed && mass.IsOrientationConsistent && mass.SignedVolume > 0);+ var step = Step242Exporter.ExportBody(body);+ Assert.True(step.IsSuccess, string.Join(" | ", step.Diagnostics.Select(d => d.Message)));+ var imported = Step242Importer.ImportBody(step.Value);+ Assert.True(imported.IsSuccess, string.Join(" | ", imported.Diagnostics.Select(d => d.Message)));+ Assert.Equal(9, imported.Value.Topology.Faces.Count());+ var importedTori = imported.Value.Geometry.Surfaces.Where(s => s.Value.Kind == Aetheris.Kernel.Core.Geometry.SurfaceGeometryKind.Torus)+ .Select(s => s.Value.Torus!.Value).ToArray();+ Assert.Equal(2, importedTori.Length);+ Assert.All(importedTori, torus => Assert.Equal(48, torus.MajorRadius, 6));+ Assert.Equal(thickness, importedTori.Max(t => t.MinorRadius) - importedTori.Min(t => t.MinorRadius), 6);+ var importedMass = BrepMassProperties.Evaluate(imported.Value);+ Assert.True(importedMass.IsEnclosed && importedMass.IsOrientationConsistent && importedMass.SignedVolume > 0);+ }++ [Theory]+ [InlineData(0.8)]+ [InlineData(56)]+ [InlineData(142)]+ public void CoupledBottomBlend_RejectsCollapsedProfile(double blendRadius)+ {+ var hollow = ThinWalledBodyBRepPlanner.CreateCylinder(56, 142, 0.8, blendRadius);+ Assert.False(hollow.IsSuccess);+ Assert.Contains(hollow.Diagnostics, d => d.Message == "CylinderBottomBlendInvalid");+ }++ [Fact]+ public void CoupledBottomBlend_RejectsHoleAtJunction()+ {+ var hollow = ThinWalledBodyBRepPlanner.CreateCylinder(56, 142, 0.8, 8).Value;+ var cut = BrepHollowRadialCutPattern.Build(hollow, [new("Vents.Row0.Col0", 4.5, 12, 0)]);+ Assert.False(cut.IsSuccess);+ Assert.Contains(cut.Diagnostics, d => d.Source == "Brep.HollowRadialCutPattern.InvalidPlacement");+ }++ [Fact]+ public void TwoLocalHoles_ShareOneTrimmedHostAndRoundTrip()+ {+ var hollow = ThinWalledBodyBRepPlanner.CreateCylinder(56, 142, 0.8).Value;+ var result = BrepHollowRadialCutPattern.Build(hollow,+ [new("Vents.Row0.Col0", 4.5, 40, 0), new("Vents.Row0.Col1", 4.5, 40, 0.4)]);+ Assert.True(result.IsSuccess, string.Join(" | ", result.Diagnostics.Select(d => $"{d.Source}: {d.Message}")));+ var body = result.Value.Body;+ Assert.Equal(7, body.Topology.Faces.Count());+ Assert.Equal(4, result.Value.TopologyMap.Loops.Count);+ var mass = BrepMassProperties.Evaluate(body);+ Assert.True(mass.IsEnclosed && mass.IsOrientationConsistent && mass.SignedVolume > 0);+ var step = Step242Exporter.ExportBody(body);+ Assert.True(step.IsSuccess, string.Join(" | ", step.Diagnostics.Select(d => d.Message)));+ var imported = Step242Importer.ImportBody(step.Value);+ Assert.True(imported.IsSuccess, string.Join(" | ", imported.Diagnostics.Select(d => d.Message)));+ var importedMass = BrepMassProperties.Evaluate(imported.Value);+ Assert.True(importedMass.IsEnclosed && importedMass.IsOrientationConsistent && importedMass.SignedVolume > 0);+ var wrapped = BrepHollowRadialCutPattern.Build(hollow,+ [new("Vents.Row0.Col0", 4.5, 40, 2 * System.Math.PI), new("Vents.Row0.Col1", 4.5, 40, 0.4)]);+ Assert.True(wrapped.IsSuccess);+ Assert.Equal(step.Value, Step242Exporter.ExportBody(wrapped.Value.Body).Value);+ var display = BrepDisplayTessellator.TessellateBounded(body, executionTimeout: TimeSpan.FromSeconds(10));+ Assert.True(display.IsSuccess, string.Join(" | ", display.Diagnostics.Select(d => d.Message)));+ Assert.Equal(7, display.Value.FacePatches.Count);+ }++ [Fact]+ public void TwentyFourOpenings_AreLocalAndDisplayTessellates()+ {+ var hollow = ThinWalledBodyBRepPlanner.CreateCylinder(24, 60, 0.8).Value;+ var holes = (from row in Enumerable.Range(0, 3)+ from column in Enumerable.Range(0, 8)+ select new HollowRadialCutPlacement($"Vents.Row{row}.Col{column}", 2.5,+ 16 + 14 * row, column * 2 * System.Math.PI / 8)).ToArray();+ var result = BrepHollowRadialCutPattern.Build(hollow, holes);+ Assert.True(result.IsSuccess, string.Join(" | ", result.Diagnostics.Select(d => $"{d.Source}: {d.Message}")));+ var body = result.Value.Body;+ Assert.Equal(29, body.Topology.Faces.Count());+ Assert.Equal(48, result.Value.TopologyMap.Loops.Count);+ Assert.All(holes, placement =>+ {+ Assert.Contains($"{placement.StableId}.Wall", result.Value.TopologyMap.Faces.Keys);+ Assert.Contains($"{placement.StableId}.OuterOpening", result.Value.TopologyMap.Loops.Keys);+ Assert.Contains($"{placement.StableId}.InnerOpening", result.Value.TopologyMap.Loops.Keys);+ foreach (var opening in new[] { "OuterOpening", "InnerOpening" })+ foreach (var edgeId in result.Value.TopologyMap.Edges[$"{placement.StableId}.{opening}"])+ {+ var edge = body.Topology.GetEdge(edgeId);+ foreach (var vertexId in new[] { edge.StartVertexId, edge.EndVertexId })+ {+ Assert.True(body.TryGetVertexPoint(vertexId, out var point));+ var radial = point.X * System.Math.Cos(placement.AngleRadians) ++ point.Y * System.Math.Sin(placement.AngleRadians);+ Assert.True(radial > 0, $"{placement.StableId} reached the opposite wall");+ }+ }+ });+ Assert.All(body.Topology.Edges, edge => Assert.Equal(2, body.Topology.Coedges.Count(coedge => coedge.EdgeId == edge.Id)));+ var mass = BrepMassProperties.Evaluate(body);+ Assert.True(mass.IsEnclosed && mass.IsOrientationConsistent && mass.SignedVolume > 0);+ var display = BrepDisplayTessellator.TessellateBounded(body, executionTimeout: TimeSpan.FromSeconds(30));+ Assert.True(display.IsSuccess, string.Join(" | ", display.Diagnostics.Select(d => d.Message)));+ Assert.Equal(29, display.Value.FacePatches.Count);+ var output = Environment.GetEnvironmentVariable("AETHERIS_CYLINDRICAL_PERFORATION_OBJ_OUTPUT");+ if (!string.IsNullOrWhiteSpace(output))+ {+ var lines = new List<string>(); var offset = 1;+ foreach (var patch in display.Value.FacePatches)+ {+ lines.Add($"g Face{patch.FaceId.Value}");+ lines.AddRange(patch.Positions.Select(p => FormattableString.Invariant($"v {p.X:R} {p.Y:R} {p.Z:R}")));+ for (var k = 0; k < patch.TriangleIndices.Count; k += 3)+ lines.Add($"f {offset + patch.TriangleIndices[k]} {offset + patch.TriangleIndices[k + 1]} {offset + patch.TriangleIndices[k + 2]}");+ offset += patch.Positions.Count;+ }+ File.WriteAllLines(output, lines);+ }+ }+}diff --git a/Aetheris.Kernel.Core.Tests/Brep/BrepHollowRadialCutTests.cs b/Aetheris.Kernel.Core.Tests/Brep/BrepHollowRadialCutTests.csnew file mode 100644index 00000000..61e6fe1b--- /dev/null+++ b/Aetheris.Kernel.Core.Tests/Brep/BrepHollowRadialCutTests.cs@@ -0,0 +1,171 @@+using Aetheris.Kernel.Core.Brep;+using Aetheris.Kernel.Core.Brep.Features;+using Aetheris.Kernel.Core.Brep.Tessellation;+using Aetheris.Kernel.Core.Brep.Verification;+using Aetheris.Kernel.Core.Geometry;+using Aetheris.Kernel.Core.Geometry.Surfaces;+using Aetheris.Kernel.Core.Math;+using Aetheris.Kernel.Core.Step242;+using System.Diagnostics;+using System.Text.Json;++namespace Aetheris.Kernel.Core.Tests.Brep;++public sealed class BrepHollowRadialCutTests+{+ [Fact]+ public void CanonicalLocalHole_IsManifoldAndRoundTrips()+ {+ var hollow = ThinWalledBodyBRepPlanner.CreateCylinder(56, 142, 0.8).Value;+ var buildStart = Stopwatch.GetTimestamp();+ var built = BrepHollowRadialCut.Build(hollow, 4.5, 71, 0.4);+ var buildTime = Stopwatch.GetElapsedTime(buildStart);+ Assert.True(built.IsSuccess, string.Join("; ", built.Diagnostics.Select(d => $"{d.Source}: {d.Message}")));+ var body = built.Value.Body;+ Assert.Equal(6, body.Topology.Faces.Count());+ Assert.Equal(11, body.Topology.Edges.Count());+ Assert.Equal(8, body.Topology.Vertices.Count());+ Assert.Equal(3, body.Bindings.FaceBoundaryRoleBindings.Count(binding => binding.Role == FaceBoundaryRole.Inner));+ Assert.Equal("RadialHole.OuterOpening", built.Value.Identity.OuterOpening);+ Assert.Equal("RadialHole.InnerOpening", built.Value.Identity.InnerOpening);+ Assert.Equal("RadialHole.Wall", built.Value.Identity.Wall);+ Assert.Contains(body.Topology.Faces, face => face.Id == built.Value.TopologyMap.Faces[built.Value.Identity.Wall]);+ foreach (var name in new[] { built.Value.Identity.OuterOpening, built.Value.Identity.InnerOpening })+ {+ var loop = built.Value.TopologyMap.Loops[name];+ Assert.Contains(body.Bindings.FaceBoundaryRoleBindings, binding => binding.LoopId == loop && binding.Role == FaceBoundaryRole.Inner);+ Assert.Equal(2, built.Value.TopologyMap.Edges[name].Count);+ }+ Assert.Equal(2, body.Bindings.EdgeBindings.Count(binding => body.Geometry.GetCurve(binding.CurveGeometryId).CertifiedIntersection?.Authority.Host.Radius == 56));+ Assert.Equal(2, body.Bindings.EdgeBindings.Count(binding => body.Geometry.GetCurve(binding.CurveGeometryId).CertifiedIntersection?.Authority.Host.Radius == 55.2));+ Assert.All(body.Topology.Edges, edge => Assert.Equal(2, body.Topology.Coedges.Count(coedge => coedge.EdgeId == edge.Id)));+ Assert.All(body.Topology.Vertices.Skip(4), vertex =>+ {+ Assert.True(body.TryGetVertexPoint(vertex.Id, out var point));+ Assert.True(point.X * double.Cos(0.4) + point.Y * double.Sin(0.4) > 0);+ });+ Assert.InRange(built.Value.Certificate.OuterCurveBoundMm, 0, 1e-6);+ Assert.InRange(built.Value.Certificate.InnerCurveBoundMm, 0, 1e-6);+ Assert.InRange(built.Value.Certificate.OuterHostPcurveBoundMm, 0, 1e-6);+ Assert.InRange(built.Value.Certificate.InnerHostPcurveBoundMm, 0, 1e-6);+ Assert.True(BrepPcurveValidator.Validate(body, requireEveryCoedge: true).IsValid);+ Assert.True(BrepExportPreflight.Validate(body).IsValid);+ var mass = BrepMassProperties.Evaluate(body);+ Assert.True(mass.IsEnclosed, string.Join("; ", mass.Topology.Messages));+ Assert.True(mass.IsOrientationConsistent, string.Join("; ", mass.Topology.Messages));+ Assert.True(mass.SignedVolume > 0);+ var uncutMass = BrepMassProperties.Evaluate(hollow.Body);+ Assert.True(mass.AbsoluteVolume < uncutMass.AbsoluteVolume);+ Assert.True(uncutMass.AbsoluteVolume - mass.AbsoluteVolume > 0,+ $"uncut={uncutMass.AbsoluteVolume:R};cut={mass.AbsoluteVolume:R};method={mass.EvaluationMethod}");+ var tessellationStart = Stopwatch.GetTimestamp();+ var display = BrepDisplayTessellator.TessellateBounded(body, executionTimeout: TimeSpan.FromSeconds(10));+ var tessellationTime = Stopwatch.GetElapsedTime(tessellationStart);+ Assert.True(display.IsSuccess, string.Join("; ", display.Diagnostics.Select(d => d.Message)));+ Assert.Equal(6, display.Value.FacePatches.Count);+ Assert.All(display.Value.FacePatches, patch => Assert.NotEmpty(patch.TriangleIndices));+ var displayOutput = Environment.GetEnvironmentVariable("AETHERIS_HOLLOW_RADIAL_CUT_DISPLAY_OBJ_OUTPUT");+ if (!string.IsNullOrWhiteSpace(displayOutput))+ {+ var lines = new List<string>();+ var offset = 1;+ foreach (var patch in display.Value.FacePatches)+ {+ lines.Add($"g Face{patch.FaceId.Value}");+ lines.AddRange(patch.Positions.Select(p => FormattableString.Invariant($"v {p.X:R} {p.Y:R} {p.Z:R}")));+ for (var k = 0; k < patch.TriangleIndices.Count; k += 3)+ lines.Add($"f {offset + patch.TriangleIndices[k]} {offset + patch.TriangleIndices[k + 1]} {offset + patch.TriangleIndices[k + 2]}");+ offset += patch.Positions.Count;+ }+ File.WriteAllLines(displayOutput, lines);+ }+ var exportStart = Stopwatch.GetTimestamp();+ var step = Step242Exporter.ExportBody(body);+ var exportTime = Stopwatch.GetElapsedTime(exportStart);+ Assert.True(step.IsSuccess, string.Join("; ", step.Diagnostics.Select(d => d.Message)));+ var debugOutput = Environment.GetEnvironmentVariable("AETHERIS_HOLLOW_RADIAL_CUT_STEP_OUTPUT");+ if (!string.IsNullOrWhiteSpace(debugOutput)) File.WriteAllText(debugOutput, step.Value);+ var importStart = Stopwatch.GetTimestamp();+ var imported = Step242Importer.ImportBody(step.Value);+ var importTime = Stopwatch.GetElapsedTime(importStart);+ Assert.True(imported.IsSuccess, string.Join("; ", imported.Diagnostics.Select(d => d.Message)));+ var reportOutput = Environment.GetEnvironmentVariable("AETHERIS_HOLLOW_RADIAL_CUT_REPORT_OUTPUT");+ if (!string.IsNullOrWhiteSpace(reportOutput))+ {+ var fineOptions = new BrepMassPropertiesOptions(0.005, double.Pi / 48, 1,+ MinimumSegments: 64, MaximumSegments: 256);+ var fineUncut = BrepMassProperties.Evaluate(hollow.Body, fineOptions);+ var fineCut = BrepMassProperties.Evaluate(body, fineOptions);+ File.WriteAllText(reportOutput, JsonSerializer.Serialize(new+ {+ buildMs = buildTime.TotalMilliseconds,+ tessellationMs = tessellationTime.TotalMilliseconds,+ stepExportMs = exportTime.TotalMilliseconds,+ stepImportMs = importTime.TotalMilliseconds,+ stepBytes = System.Text.Encoding.UTF8.GetByteCount(step.Value),+ faceCount = body.Topology.Faces.Count(), edgeCount = body.Topology.Edges.Count(), vertexCount = body.Topology.Vertices.Count(),+ holeCount = 1, certificate = built.Value.Certificate, phaseTimings = built.Value.Timings,+ massSanity = new { uncutVolume = uncutMass.AbsoluteVolume, cutVolume = mass.AbsoluteVolume, method = mass.EvaluationMethod },+ fineMassSanity = new { uncutVolume = fineUncut.AbsoluteVolume, cutVolume = fineCut.AbsoluteVolume,+ decrease = fineUncut.AbsoluteVolume - fineCut.AbsoluteVolume, uncutError = fineUncut.ErrorBound,+ cutError = fineCut.ErrorBound, method = fineCut.EvaluationMethod }+ }, new JsonSerializerOptions { WriteIndented = true }));+ }+ var importedMass = BrepMassProperties.Evaluate(imported.Value);+ Assert.True(importedMass.IsEnclosed && importedMass.IsOrientationConsistent);+ Assert.True(importedMass.SignedVolume > 0);+ Assert.Equal(3, imported.Value.Bindings.FaceBoundaryRoleBindings.Count(binding => binding.Role == FaceBoundaryRole.Inner));+ Assert.True(BrepPcurveValidator.Validate(imported.Value, requireEveryCoedge: true).IsValid);+ var radii = imported.Value.Bindings.FaceBindings+ .Select(binding => imported.Value.Geometry.GetSurface(binding.SurfaceGeometryId))+ .Where(surface => surface.Kind == SurfaceGeometryKind.Cylinder)+ .Select(surface => surface.Cylinder!.Value.Radius).OrderBy(radius => radius).ToArray();+ Assert.Equal(new[] { 4.5, 55.2, 56d }, radii);+ }++ [Theory]+ [InlineData(0.8, 4.5, 71, 0)] // authored +X seam, relocated to a clear quarter-turn+ [InlineData(0.8, 4.5, 40, 0.9)]+ [InlineData(0.8, 0.8, 71, 2.1)]+ [InlineData(0.8, 12, 71, 5.4)]+ [InlineData(3, 4.5, 71, 0.4)]+ public void PlacementAndWallVariation_StayLocalAndManifold(double thickness, double holeRadius, double z, double angle)+ {+ var hollow = ThinWalledBodyBRepPlanner.CreateCylinder(56, 142, thickness).Value;+ var built = BrepHollowRadialCut.Build(hollow, holeRadius, z, angle);+ Assert.True(built.IsSuccess, string.Join("; ", built.Diagnostics.Select(d => $"{d.Source}: {d.Message}")));+ Assert.Equal(2, built.Value.Body.Bindings.FaceBoundaryRoleBindings.Count(binding => binding.Role == FaceBoundaryRole.Inner &&+ built.Value.Body.Geometry.GetSurface(built.Value.Body.Bindings.FaceBindings.Single(face => face.FaceId == binding.FaceId).SurfaceGeometryId).Kind == SurfaceGeometryKind.Cylinder));+ var mass = BrepMassProperties.Evaluate(built.Value.Body);+ Assert.True(mass.IsEnclosed && mass.IsOrientationConsistent);+ Assert.True(mass.SignedVolume > 0);+ }++ [Fact]+ public void InvalidPlacementAndExtent_FailWithControlledDiagnostics()+ {+ var hollow = ThinWalledBodyBRepPlanner.CreateCylinder(56, 142, 0.8).Value;+ Assert.Contains(BrepHollowRadialCut.Build(hollow, 4.5, 4, 0).Diagnostics,+ d => d.Source == "Brep.HollowRadialCut.EndCollision");+ Assert.Contains(BrepHollowRadialCut.Build(hollow, 55.2, 71, 0).Diagnostics,+ d => d.Source == "Brep.HollowRadialCut.TangentOrOversize");+ Assert.Contains(BrepHollowRadialCut.Build(hollow, 4.5, 71, 0, insideRadialCoordinate: 56.1).Diagnostics,+ d => d.Source == "Brep.HollowRadialCut.IncompleteCutterExtent");+ Assert.Contains(BrepHollowRadialCut.Build(hollow, 4.5, 71, 0, outsideRadialCoordinate: 56).Diagnostics,+ d => d.Source == "Brep.HollowRadialCut.IncompleteCutterExtent");+ Assert.Contains(BrepHollowRadialCut.Build(hollow, 4.5, 71, 0, insideRadialCoordinate: -56).Diagnostics,+ d => d.Source == "Brep.HollowRadialCut.InvalidCutterExtent");+ }++ [Fact]+ public void PeriodicAngle_UsesOneOpeningAndByteStableStep()+ {+ var hollow = ThinWalledBodyBRepPlanner.CreateCylinder(56, 142, 0.8).Value;+ var seam = BrepHollowRadialCut.Build(hollow, 4.5, 71, 0).Value.Body;+ var wrapped = BrepHollowRadialCut.Build(hollow, 4.5, 71, 2d * double.Pi).Value.Body;+ Assert.Equal(2, seam.Bindings.FaceBoundaryRoleBindings.Count(binding =>+ binding.Role == FaceBoundaryRole.Inner && seam.Geometry.GetSurface(+ seam.Bindings.FaceBindings.Single(face => face.FaceId == binding.FaceId).SurfaceGeometryId).Kind == SurfaceGeometryKind.Cylinder));+ Assert.Equal(Step242Exporter.ExportBody(seam).Value, Step242Exporter.ExportBody(wrapped).Value);+ }+}diff --git a/Aetheris.Kernel.Core.Tests/ThinWalledBodyBRepPlanTests.cs b/Aetheris.Kernel.Core.Tests/ThinWalledBodyBRepPlanTests.csindex e56172c9..34e29cd9 100644--- a/Aetheris.Kernel.Core.Tests/ThinWalledBodyBRepPlanTests.cs+++ b/Aetheris.Kernel.Core.Tests/ThinWalledBodyBRepPlanTests.cs@@ -36,6 +36,30 @@ public sealed class ThinWalledBodyBRepPlanTestsAssert.Null(value.Body.SafeBooleanComposition);}+ [Fact]+ public void CylinderHollow_HasExactPairedWallsClosedBottomAndOpenTop()+ {+ var result = ThinWalledBodyBRepPlanner.CreateCylinder(56, 142, 0.8);+ Assert.True(result.IsSuccess, string.Join(", ", result.Diagnostics.Select(x => x.Message)));+ var value = result.Value;+ Assert.Equal("CoaxialCylindricalOffset", value.Feature.Witness.Kind);+ Assert.Equal(5, value.Body.Topology.Faces.Count());+ Assert.Equal(2, value.Body.Geometry.Surfaces.Count(x => x.Value.Kind == SurfaceGeometryKind.Cylinder));+ Assert.Equal(0.8, value.Construction.ThicknessWitnesses[0].Distance);+ Assert.Equal(0.8, value.Construction.ThicknessWitnesses[1].Distance);+ Assert.Single(value.Plan.RimFaces);+ Assert.Null(value.Body.SafeBooleanComposition);+ var step = Step242Exporter.ExportBody(value.Body, new Step242ExportOptions { BrepExportPreflightMode = BrepExportPreflightMode.Enforce });+ Assert.True(step.IsSuccess, string.Join(", ", step.Diagnostics.Select(x => x.Message)));+ Assert.True(Step242Importer.ImportBody(step.Value).IsSuccess);+ }++ [Theory]+ [InlineData(56, 142, 56)]+ [InlineData(56, 0.8, 0.8)]+ public void CylinderHollow_RejectsCollapsedInnerBoundary(double radius, double height, double thickness)+ => Assert.False(ThinWalledBodyBRepPlanner.CreateCylinder(radius, height, thickness).IsSuccess);+[Theory][InlineData(120, 80, 24, 12)][InlineData(120, 80, 2, 2)]diff --git a/Aetheris.Kernel.Core/Brep/Features/BrepHollowRadialCut.cs b/Aetheris.Kernel.Core/Brep/Features/BrepHollowRadialCut.csnew file mode 100644index 00000000..8a90910a--- /dev/null+++ b/Aetheris.Kernel.Core/Brep/Features/BrepHollowRadialCut.cs@@ -0,0 +1,248 @@+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.Numerics;+using Aetheris.Kernel.Core.Results;+using Aetheris.Kernel.Core.Topology;+using System.Diagnostics;++namespace Aetheris.Kernel.Core.Brep.Features;++/// <summary>Stable, feature-local identities; topology indices are deliberately not public identities.</summary>+public sealed record HollowRadialCutIdentity(string Hole, string OuterOpening, string InnerOpening, string Wall)+{+ public static HollowRadialCutIdentity Single { get; } = new("RadialHole", "RadialHole.OuterOpening", "RadialHole.InnerOpening", "RadialHole.Wall");+}++public sealed record HollowRadialCutCertificate(+ double OuterCurveBoundMm, double InnerCurveBoundMm,+ double OuterHostPcurveBoundMm, double OuterToolPcurveBoundMm,+ double InnerHostPcurveBoundMm, double InnerToolPcurveBoundMm,+ int OuterSegments, int InnerSegments);++public sealed record HollowRadialCutBuildTimings(double IntersectionsMs, double CurveRealizationMs,+ double PcurveRealizationMs, double TopologyMs, double ValidationMs);++/// <summary>Semantic names resolve to this particular realization's topology; numeric IDs are never the feature identity.</summary>+public sealed record HollowRadialCutTopologyMap(+ IReadOnlyDictionary<string, FaceId> Faces,+ IReadOnlyDictionary<string, LoopId> Loops,+ IReadOnlyDictionary<string, IReadOnlyList<EdgeId>> Edges);++public sealed record HollowRadialCutResult(BrepBody Body, HollowRadialCutIdentity Identity,+ HollowRadialCutCertificate Certificate, double InsideRadialCoordinate, double OutsideRadialCoordinate,+ HollowRadialCutBuildTimings Timings, HollowRadialCutTopologyMap TopologyMap);++/// <summary>+/// Constructive local through-wall hole on the positive radial side of a semantic+/// cylindrical Hollow vessel. This is one wall only, with no Boolean subtraction.+/// The host seam is placed a quarter turn from the opening. Each non-conic+/// intersection loop has two finite certified edges; one cutter seam joins them.+/// </summary>+public static class BrepHollowRadialCut+{+ public static KernelResult<HollowRadialCutResult> Build(+ ThinWalledBodyRealization hollow, double holeRadius, double axialPosition,+ double angleRadians, double? insideRadialCoordinate = null,+ double? outsideRadialCoordinate = null, ToleranceContext? tolerance = null)+ {+ ArgumentNullException.ThrowIfNull(hollow);+ var tol = tolerance ?? ToleranceContext.Default;+ if (hollow.Feature.PrimitiveKind != "Cylinder" || hollow.Feature.Openings.Count != 1 || hollow.Feature.Openings[0] != "Top")+ return Failure("Only a top-open Cylinder<Hollow> authority is admitted.", "Brep.HollowRadialCut.UnsupportedHost");+ var radius = hollow.Feature.PrimitiveParameters["Radius"];+ var height = hollow.Feature.PrimitiveParameters["Height"];+ var thickness = hollow.Feature.WallThickness;+ var innerRadius = radius - thickness;+ if (!double.IsFinite(holeRadius) || holeRadius <= 0 || !double.IsFinite(axialPosition) || !double.IsFinite(angleRadians))+ return Failure("Hole radius, axial position, and angle must be finite; radius must be positive.", "Brep.HollowRadialCut.InvalidDimension");+ angleRadians %= 2d * double.Pi;+ if (angleRadians < 0d) angleRadians += 2d * double.Pi;+ if (angleRadians <= tol.Angular || 2d * double.Pi - angleRadians <= tol.Angular) angleRadians = 0d;+ if (holeRadius >= innerRadius - tol.Linear)+ return Failure("The hole must clear the inner cylinder's tangent case.", "Brep.HollowRadialCut.TangentOrOversize");+ if (axialPosition - holeRadius <= thickness + tol.Linear || height - axialPosition - holeRadius <= tol.Linear)+ return Failure("The complete openings must clear the inner bottom and top rim.", "Brep.HollowRadialCut.EndCollision");+ var overshoot = double.Min(innerRadius / 2d, double.Max(thickness, 0.5d));+ var innerIntersectionNearSide = double.Sqrt(innerRadius * innerRadius - holeRadius * holeRadius);+ var inside = insideRadialCoordinate ?? double.Max(innerIntersectionNearSide / 2d, innerIntersectionNearSide - overshoot);+ var outside = outsideRadialCoordinate ?? (radius + overshoot);+ if (!double.IsFinite(inside) || !double.IsFinite(outside) || inside <= 0d || outside <= 0d || inside >= outside)+ return Failure("Finite cutter extent must stay on one radial side and run inward to outward.", "Brep.HollowRadialCut.InvalidCutterExtent");+ if (inside >= innerIntersectionNearSide - tol.Linear || outside <= radius + tol.Linear)+ return Failure("Finite cutter must overrun both local wall intersections.", "Brep.HollowRadialCut.IncompleteCutterExtent");++ var z = Direction3D.Create(new Vector3D(0, 0, 1));+ var x = Direction3D.Create(new Vector3D(double.Cos(angleRadians), double.Sin(angleRadians), 0));+ var seamDirection = Direction3D.Create(z.ToVector().Cross(x.ToVector()));+ var y = seamDirection.ToVector();+ var origin = new Point3D(0, 0, 0);+ var center = new Point3D(0, 0, axialPosition);+ var outer = new CylinderSurface(origin, z, radius, seamDirection);+ var inner = new CylinderSurface(new Point3D(0, 0, thickness), z, innerRadius, seamDirection);+ var tool = new CylinderSurface(center, x, holeRadius, seamDirection);+ var full = new ParameterInterval(0d, 2d * double.Pi);+ var first = new ParameterInterval(0d, double.Pi);+ var second = new ParameterInterval(double.Pi, 2d * double.Pi);+ var intersectionStart = Stopwatch.GetTimestamp();+ var outerAuthority = CylinderCylinderIntersectionCurve.Create(outer, tool, center, CylinderIntersectionBranch.PositiveCutterAxis, full, tolerance: tol);+ if (!outerAuthority.IsSuccess) return KernelResult<HollowRadialCutResult>.Failure(outerAuthority.Diagnostics);+ var innerAuthority = CylinderCylinderIntersectionCurve.Create(inner, tool, center, CylinderIntersectionBranch.PositiveCutterAxis, full, tolerance: tol);+ if (!innerAuthority.IsSuccess) return KernelResult<HollowRadialCutResult>.Failure(innerAuthority.Diagnostics);+ var intersectionEnd = Stopwatch.GetTimestamp();+ var outerCurve = CylinderIntersectionCurveRealizer.Realize(outerAuthority.Value, tol);+ if (!outerCurve.IsSuccess) return KernelResult<HollowRadialCutResult>.Failure(outerCurve.Diagnostics);+ var innerCurve = CylinderIntersectionCurveRealizer.Realize(innerAuthority.Value, tol);+ if (!innerCurve.IsSuccess) return KernelResult<HollowRadialCutResult>.Failure(innerCurve.Diagnostics);+ var curveEnd = Stopwatch.GetTimestamp();+ var outerUv = CylinderIntersectionPcurveRealizer.Realize(outerCurve.Value, tol);+ if (!outerUv.IsSuccess) return KernelResult<HollowRadialCutResult>.Failure(outerUv.Diagnostics);+ var innerUv = CylinderIntersectionPcurveRealizer.Realize(innerCurve.Value, tol);+ if (!innerUv.IsSuccess) return KernelResult<HollowRadialCutResult>.Failure(innerUv.Diagnostics);+ var pcurveEnd = Stopwatch.GetTimestamp();++ var b = new TopologyBuilder();+ var points = new Dictionary<VertexId, Point3D>();+ VertexId Vertex(Point3D p) { var id = b.AddVertex(); points.Add(id, p); return id; }+ var ob = Vertex(origin + y * radius); var ot = Vertex(new Point3D(0, 0, height) + y * radius);+ var ib = Vertex(new Point3D(0, 0, thickness) + y * innerRadius);+ var it = Vertex(new Point3D(0, 0, height) + y * innerRadius);+ var o0 = Vertex(outerAuthority.Value.Evaluate(0d)); var oPi = Vertex(outerAuthority.Value.Evaluate(double.Pi));+ var i0 = Vertex(innerAuthority.Value.Evaluate(0d)); var iPi = Vertex(innerAuthority.Value.Evaluate(double.Pi));+ var outerSeam = b.AddEdge(ob, ot); var innerSeam = b.AddEdge(ib, it);+ var outerBottom = b.AddEdge(ob, ob); var outerTop = b.AddEdge(ot, ot);+ var innerBottom = b.AddEdge(ib, ib); var innerTop = b.AddEdge(it, it);+ var outerFirst = b.AddEdge(o0, oPi); var outerSecond = b.AddEdge(oPi, o0);+ var innerFirst = b.AddEdge(i0, iPi); var innerSecond = b.AddEdge(iPi, i0);+ var toolSeam = b.AddEdge(o0, i0);++ var outerEnvelope = AddLoop(b, [new(outerSeam), new(outerTop), new(outerSeam, true), new(outerBottom, true)]);+ var outerOpening = AddLoop(b, [new(outerSecond, true), new(outerFirst, true)]);+ var innerEnvelope = AddLoop(b, [new(innerSeam), new(innerTop), new(innerSeam, true), new(innerBottom, true)]);+ var innerOpening = AddLoop(b, [new(innerFirst), new(innerSecond)]);+ var outerFace = b.AddFace([outerEnvelope.Id, outerOpening.Id]);+ var innerFace = b.AddFace([innerEnvelope.Id, innerOpening.Id]);+ var bottomOutside = AddLoop(b, [new(outerBottom)]); var outerBottomFace = b.AddFace([bottomOutside.Id]);+ var bottomInside = AddLoop(b, [new(innerBottom)]); var innerBottomFace = b.AddFace([bottomInside.Id]);+ var rimOuter = AddLoop(b, [new(outerTop, true)]);+ var rimInner = AddLoop(b, [new(innerTop, true)]);+ var rimFace = b.AddFace([rimOuter.Id, rimInner.Id]);+ var wall = AddLoop(b, [new(outerFirst), new(outerSecond), new(toolSeam),+ new(innerSecond, true), new(innerFirst, true), new(toolSeam, true)]);+ var wallFace = b.AddFace([wall.Id]);+ var shell = b.AddShell([outerFace, innerFace, outerBottomFace, innerBottomFace, rimFace, wallFace]);+ b.AddBody([shell]);++ var g = new BrepGeometryStore();+ g.AddCurve(new CurveGeometryId(1), CurveGeometry.FromLine(new Line3Curve(points[ob], z)));+ g.AddCurve(new CurveGeometryId(2), CurveGeometry.FromLine(new Line3Curve(points[ib], z)));+ g.AddCurve(new CurveGeometryId(3), CurveGeometry.FromCircle(new Circle3Curve(origin, z, radius, seamDirection)));+ g.AddCurve(new CurveGeometryId(4), CurveGeometry.FromCircle(new Circle3Curve(new Point3D(0, 0, height), z, radius, seamDirection)));+ g.AddCurve(new CurveGeometryId(5), CurveGeometry.FromCircle(new Circle3Curve(new Point3D(0, 0, thickness), z, innerRadius, seamDirection)));+ g.AddCurve(new CurveGeometryId(6), CurveGeometry.FromCircle(new Circle3Curve(new Point3D(0, 0, height), z, innerRadius, seamDirection)));+ g.AddCurve(new CurveGeometryId(7), CurveGeometry.FromCertifiedIntersection(outerCurve.Value));+ g.AddCurve(new CurveGeometryId(8), CurveGeometry.FromCertifiedIntersection(innerCurve.Value));+ var seamLength = (points[o0] - points[i0]).Length;+ g.AddCurve(new CurveGeometryId(9), CurveGeometry.FromLine(new Line3Curve(points[o0], Direction3D.Create(points[i0] - points[o0]))));+ g.AddSurface(new SurfaceGeometryId(1), SurfaceGeometry.FromCylinder(outer));+ g.AddSurface(new SurfaceGeometryId(2), SurfaceGeometry.FromCylinder(inner));+ g.AddSurface(new SurfaceGeometryId(3), SurfaceGeometry.FromPlane(new PlaneSurface(origin, Direction3D.Create(-z.ToVector()), seamDirection)));+ g.AddSurface(new SurfaceGeometryId(4), SurfaceGeometry.FromPlane(new PlaneSurface(new Point3D(0, 0, thickness), z, seamDirection)));+ g.AddSurface(new SurfaceGeometryId(5), SurfaceGeometry.FromPlane(new PlaneSurface(new Point3D(0, 0, height), z, seamDirection)));+ g.AddSurface(new SurfaceGeometryId(6), SurfaceGeometry.FromCylinder(tool));++ var bindings = new BrepBindingModel();+ void Edge(EdgeId edge, int curve, ParameterInterval interval) => bindings.AddEdgeBinding(new EdgeGeometryBinding(edge, new CurveGeometryId(curve), interval));+ Edge(outerSeam, 1, new(0d, height)); Edge(innerSeam, 2, new(0d, height - thickness));+ Edge(outerBottom, 3, full); Edge(outerTop, 4, full); Edge(innerBottom, 5, full); Edge(innerTop, 6, full);+ Edge(outerFirst, 7, first); Edge(outerSecond, 7, second); Edge(innerFirst, 8, first); Edge(innerSecond, 8, second);+ Edge(toolSeam, 9, new(0d, seamLength));+ bindings.AddFaceBinding(new FaceGeometryBinding(outerFace, new SurfaceGeometryId(1)));+ bindings.AddFaceBinding(new FaceGeometryBinding(innerFace, new SurfaceGeometryId(2), IsAlignedWithSurface: false));+ bindings.AddFaceBinding(new FaceGeometryBinding(outerBottomFace, new SurfaceGeometryId(3)));+ bindings.AddFaceBinding(new FaceGeometryBinding(innerBottomFace, new SurfaceGeometryId(4)));+ bindings.AddFaceBinding(new FaceGeometryBinding(rimFace, new SurfaceGeometryId(5)));+ bindings.AddFaceBinding(new FaceGeometryBinding(wallFace, new SurfaceGeometryId(6), IsAlignedWithSurface: false));+ void Role(FaceId face, LoopId loop, FaceBoundaryRole role) => bindings.AddFaceBoundaryRoleBinding(new FaceBoundaryRoleBinding(face, loop, role));+ Role(outerFace, outerEnvelope.Id, FaceBoundaryRole.Outer); Role(outerFace, outerOpening.Id, FaceBoundaryRole.Inner);+ Role(innerFace, innerEnvelope.Id, FaceBoundaryRole.Outer); Role(innerFace, innerOpening.Id, FaceBoundaryRole.Inner);+ Role(outerBottomFace, bottomOutside.Id, FaceBoundaryRole.Outer); Role(innerBottomFace, bottomInside.Id, FaceBoundaryRole.Outer);+ Role(rimFace, rimOuter.Id, FaceBoundaryRole.Outer); Role(rimFace, rimInner.Id, FaceBoundaryRole.Inner);+ Role(wallFace, wall.Id, FaceBoundaryRole.Outer);++ void Bind(CoedgeId id, FaceId face, int surface, PcurveGeometry uv)+ => bindings.AddPcurveBinding(new CoedgePcurveBinding(id, face, new SurfaceGeometryId(surface), uv));+ void HostEnvelope((LoopId Id, CoedgeId[] Coedges) loop, FaceId face, int surface, double bottomZ)+ {+ var length = height - bottomZ;+ Bind(loop.Coedges[0], face, surface, PcurveGeometry.Line(new(0d, length), new(0d, 0d), new(0d, length)));+ Bind(loop.Coedges[1], face, surface, PcurveGeometry.Line(full, new(0d, length), new(2d * double.Pi, length)));+ Bind(loop.Coedges[2], face, surface, PcurveGeometry.Line(new(0d, length), new(2d * double.Pi, 0d), new(2d * double.Pi, length)));+ Bind(loop.Coedges[3], face, surface, PcurveGeometry.Line(full, new(0d, 0d), new(2d * double.Pi, 0d)));+ }+ HostEnvelope(outerEnvelope, outerFace, 1, 0d);+ HostEnvelope(innerEnvelope, innerFace, 2, thickness);+ Bind(outerOpening.Coedges[0], outerFace, 1, PcurveGeometry.Polynomial(second, outerUv.Value.Host));+ Bind(outerOpening.Coedges[1], outerFace, 1, PcurveGeometry.Polynomial(first, outerUv.Value.Host));+ Bind(innerOpening.Coedges[0], innerFace, 2, PcurveGeometry.Polynomial(first, innerUv.Value.Host));+ Bind(innerOpening.Coedges[1], innerFace, 2, PcurveGeometry.Polynomial(second, innerUv.Value.Host));+ Bind(bottomOutside.Coedges[0], outerBottomFace, 3, PcurveGeometry.Circle(full, new(0d, 0d), radius, -radius));+ Bind(bottomInside.Coedges[0], innerBottomFace, 4, PcurveGeometry.Circle(full, new(0d, 0d), innerRadius, innerRadius));+ Bind(rimOuter.Coedges[0], rimFace, 5, PcurveGeometry.Circle(full, new(0d, 0d), radius, radius));+ Bind(rimInner.Coedges[0], rimFace, 5, PcurveGeometry.Circle(full, new(0d, 0d), innerRadius, innerRadius));+ Bind(wall.Coedges[0], wallFace, 6, PcurveGeometry.Polynomial(first, outerUv.Value.Tool));+ Bind(wall.Coedges[1], wallFace, 6, PcurveGeometry.Polynomial(second, outerUv.Value.Tool));+ Bind(wall.Coedges[2], wallFace, 6, PcurveGeometry.Line(new(0d, seamLength), new(2d * double.Pi, (points[o0] - center).Dot(x.ToVector())), new(2d * double.Pi, (points[i0] - center).Dot(x.ToVector()))));+ Bind(wall.Coedges[3], wallFace, 6, PcurveGeometry.Polynomial(second, innerUv.Value.Tool));+ Bind(wall.Coedges[4], wallFace, 6, PcurveGeometry.Polynomial(first, innerUv.Value.Tool));+ Bind(wall.Coedges[5], wallFace, 6, PcurveGeometry.Line(new(0d, seamLength), new(0d, (points[o0] - center).Dot(x.ToVector())), new(0d, (points[i0] - center).Dot(x.ToVector()))));++ var body = new BrepBody(b.Model, g, bindings, points);+ var topologyEnd = Stopwatch.GetTimestamp();+ var bindingValidation = BrepBindingValidator.Validate(body, requireAllEdgeAndFaceBindings: true);+ if (!bindingValidation.IsSuccess) return KernelResult<HollowRadialCutResult>.Failure(bindingValidation.Diagnostics);+ var pcurveValidation = BrepPcurveValidator.Validate(body, tol.Linear, requireEveryCoedge: true, samples: 129);+ if (!pcurveValidation.IsValid) return Failure(string.Join("; ", pcurveValidation.Diagnostics), "Brep.HollowRadialCut.PcurveValidation");+ var preflight = BrepExportPreflight.Validate(body);+ if (!preflight.IsValid) return Failure(string.Join("; ", preflight.Diagnostics.Where(d => d.Severity == BrepExportPreflightSeverity.Error).Select(d => $"{d.Code}: {d.Message}")), "Brep.HollowRadialCut.Preflight");+ var validationEnd = Stopwatch.GetTimestamp();+ var identity = HollowRadialCutIdentity.Single;+ var topologyMap = new HollowRadialCutTopologyMap(+ new Dictionary<string, FaceId> { [identity.Wall] = wallFace },+ new Dictionary<string, LoopId> { [identity.OuterOpening] = outerOpening.Id, [identity.InnerOpening] = innerOpening.Id },+ new Dictionary<string, IReadOnlyList<EdgeId>>+ {+ [identity.OuterOpening] = [outerFirst, outerSecond],+ [identity.InnerOpening] = [innerFirst, innerSecond]+ });+ return KernelResult<HollowRadialCutResult>.Success(new(body, identity,+ new(outerCurve.Value.CertifiedDeviationBoundMm, innerCurve.Value.CertifiedDeviationBoundMm,+ outerUv.Value.HostEdgeMismatchBoundMm, outerUv.Value.ToolEdgeMismatchBoundMm,+ innerUv.Value.HostEdgeMismatchBoundMm, innerUv.Value.ToolEdgeMismatchBoundMm,+ outerCurve.Value.SegmentCount, innerCurve.Value.SegmentCount), inside, outside,+ new(Stopwatch.GetElapsedTime(intersectionStart, intersectionEnd).TotalMilliseconds,+ Stopwatch.GetElapsedTime(intersectionEnd, curveEnd).TotalMilliseconds,+ Stopwatch.GetElapsedTime(curveEnd, pcurveEnd).TotalMilliseconds,+ Stopwatch.GetElapsedTime(pcurveEnd, topologyEnd).TotalMilliseconds,+ Stopwatch.GetElapsedTime(topologyEnd, validationEnd).TotalMilliseconds), topologyMap));+ }++ private static (LoopId Id, CoedgeId[] Coedges) AddLoop(TopologyBuilder builder, IReadOnlyList<Use> 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].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, coedges);+ }++ private static KernelResult<HollowRadialCutResult> Failure(string message, string source)+ => KernelResult<HollowRadialCutResult>.Failure([+ new KernelDiagnostic(KernelDiagnosticCode.ValidationFailed, KernelDiagnosticSeverity.Error, message, source)]);++ private readonly record struct Use(EdgeId Edge, bool Reversed = false);+}diff --git a/Aetheris.Kernel.Core/Brep/Features/BrepHollowRadialCutPattern.cs b/Aetheris.Kernel.Core/Brep/Features/BrepHollowRadialCutPattern.csnew file mode 100644index 00000000..a0c49fd3--- /dev/null+++ b/Aetheris.Kernel.Core/Brep/Features/BrepHollowRadialCutPattern.cs@@ -0,0 +1,295 @@+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.Numerics;+using Aetheris.Kernel.Core.Results;+using Aetheris.Kernel.Core.Topology;+++namespace Aetheris.Kernel.Core.Brep.Features;++public sealed record HollowRadialCutPlacement(string StableId, double Radius, double Z, double AngleRadians);+public sealed record HollowRadialCutPatternResult(BrepBody Body, HollowRadialCutTopologyMap TopologyMap,+ IReadOnlyDictionary<string, HollowRadialCutCertificate> Certificates, double HostSeamAngleRadians);++/// <summary>Compose qualified local radial cuts on one analytic Hollow wall.+/// The stock faces are constructed once; each instance contributes two trim loops+/// and one cylindrical connector face. No Boolean or faceted topology is involved.</summary>+public static class BrepHollowRadialCutPattern+{+ public static KernelResult<HollowRadialCutPatternResult> Build(ThinWalledBodyRealization hollow,+ IReadOnlyList<HollowRadialCutPlacement> placements, ToleranceContext? tolerance = null)+ {+ ArgumentNullException.ThrowIfNull(hollow);+ ArgumentNullException.ThrowIfNull(placements);+ var tol = tolerance ?? ToleranceContext.Default;+ KernelResult<HollowRadialCutPatternResult> Reject(string code, string message) =>+ KernelResult<HollowRadialCutPatternResult>.Failure([+ new KernelDiagnostic(KernelDiagnosticCode.ValidationFailed, KernelDiagnosticSeverity.Error, message, code)]);+ if (hollow.Feature.PrimitiveKind != "Cylinder" || hollow.Feature.Openings.Count != 1 || hollow.Feature.Openings[0] != "Top")+ return Reject("Brep.HollowRadialCutPattern.UnsupportedHost", "A top-open Cylinder<Hollow> is required.");+ if (placements.Count == 0 || placements.Count > 1000 || placements.Select(p => p.StableId).Distinct(StringComparer.Ordinal).Count() != placements.Count)+ return Reject("Brep.HollowRadialCutPattern.InvalidInstances", "Provide one to 1000 uniquely identified local holes.");+ var radius = hollow.Feature.PrimitiveParameters["Radius"];+ var height = hollow.Feature.PrimitiveParameters["Height"];+ var thickness = hollow.Feature.WallThickness;+ var innerRadius = radius - thickness;+ var blendRadius = hollow.Feature.PrimitiveParameters.GetValueOrDefault("BottomBlendRadius");+ var blended = blendRadius > 0;+ var wallStart = blended ? blendRadius : 0d;+ if (placements.Any(p => !double.IsFinite(p.Radius) || !double.IsFinite(p.Z) || !double.IsFinite(p.AngleRadians) ||+ p.Radius <= 0 || p.Radius >= innerRadius - tol.Linear || p.Z - p.Radius <= wallStart + tol.Linear ||+ p.Z + p.Radius >= height - tol.Linear))+ return Reject("Brep.HollowRadialCutPattern.InvalidPlacement", "Every opening must clear the inner bottom, top rim, and inner-cylinder tangent case.");+ // The current single-loop pcurve representation needs a host seam outside+ // every opening. Choose the midpoint of the largest free angular gap.+ var centers = placements.Select(p => Normalize(p.AngleRadians)).Distinct().Order().ToArray();+ var bestGap = -1d; var seamAngle = 0d;+ for (var i = 0; i < centers.Length; i++)+ {+ var next = i + 1 < centers.Length ? centers[i + 1] : centers[0] + 2 * System.Math.PI;+ var gap = next - centers[i];+ if (gap > bestGap) { bestGap = gap; seamAngle = Normalize(centers[i] + gap / 2); }+ }+ if (placements.Any(p => AngularDistance(seamAngle, Normalize(p.AngleRadians)) <= System.Math.Asin(p.Radius / innerRadius) + tol.Angular))+ return Reject("Brep.HollowRadialCutPattern.SeamClearance", "No host seam clears all local opening loops; periodic seam splitting is required.");+ for (var i = 0; i < placements.Count; i++)+ for (var j = i + 1; j < placements.Count; j++)+ {+ var arc = innerRadius * AngularDistance(Normalize(placements[i].AngleRadians), Normalize(placements[j].AngleRadians));+ var dz = placements[i].Z - placements[j].Z;+ if (System.Math.Sqrt(arc * arc + dz * dz) <= placements[i].Radius + placements[j].Radius + tol.Linear)+ return Reject("Brep.HollowRadialCutPattern.Overlap", $"Openings {placements[i].StableId} and {placements[j].StableId} overlap.");+ }++ var z = Direction3D.Create(new Vector3D(0, 0, 1));+ var hostReference = Direction3D.Create(new Vector3D(System.Math.Cos(seamAngle), System.Math.Sin(seamAngle), 0));+ var origin = new Point3D(0, 0, 0);+ var outer = new CylinderSurface(origin, z, radius, hostReference);+ var inner = new CylinderSurface(new Point3D(0, 0, thickness), z, innerRadius, hostReference);+ var full = new ParameterInterval(0, 2 * System.Math.PI);+ var first = new ParameterInterval(0, System.Math.PI);+ var second = new ParameterInterval(System.Math.PI, 2 * System.Math.PI);+ var builder = new TopologyBuilder();+ var points = new Dictionary<VertexId, Point3D>();+ VertexId V(Point3D point) { var id = builder.AddVertex(); points.Add(id, point); return id; }+ var ob = V(new Point3D(0, 0, wallStart) + hostReference.ToVector() * radius);+ var ot = V(new Point3D(0, 0, height) + hostReference.ToVector() * radius);+ var ib = V(new Point3D(0, 0, wallStart > 0 ? wallStart : thickness) + hostReference.ToVector() * innerRadius);+ var it = V(new Point3D(0, 0, height) + hostReference.ToVector() * innerRadius);+ var outerSeam = builder.AddEdge(ob, ot); var innerSeam = builder.AddEdge(ib, it);+ var outerBottom = builder.AddEdge(ob, ob); var outerTop = builder.AddEdge(ot, ot);+ var innerBottom = builder.AddEdge(ib, ib); var innerTop = builder.AddEdge(it, it);+ var floorRadius = blended ? radius - blendRadius : radius;+ var outerFloorVertex = blended ? V(origin + hostReference.ToVector() * floorRadius) : ob;+ var innerFloorVertex = blended ? V(new Point3D(0, 0, thickness) + hostReference.ToVector() * floorRadius) : ib;+ var outerFloor = blended ? builder.AddEdge(outerFloorVertex, outerFloorVertex) : outerBottom;+ var innerFloor = blended ? builder.AddEdge(innerFloorVertex, innerFloorVertex) : innerBottom;+ var outerEnvelope = AddLoop(builder, [new(outerSeam), new(outerTop), new(outerSeam, true), new(outerBottom, true)]);+ var innerEnvelope = AddLoop(builder, [new(innerSeam), new(innerTop), new(innerSeam, true), new(innerBottom, true)]);+ var geometry = new BrepGeometryStore();+ geometry.AddCurve(new CurveGeometryId(1), CurveGeometry.FromLine(new Line3Curve(points[ob], z)));+ geometry.AddCurve(new CurveGeometryId(2), CurveGeometry.FromLine(new Line3Curve(points[ib], z)));+ geometry.AddCurve(new CurveGeometryId(3), CurveGeometry.FromCircle(new Circle3Curve(new Point3D(0, 0, wallStart), z, radius, hostReference)));+ geometry.AddCurve(new CurveGeometryId(4), CurveGeometry.FromCircle(new Circle3Curve(new Point3D(0, 0, height), z, radius, hostReference)));+ geometry.AddCurve(new CurveGeometryId(5), CurveGeometry.FromCircle(new Circle3Curve(new Point3D(0, 0, blended ? wallStart : thickness), z, innerRadius, hostReference)));+ geometry.AddCurve(new CurveGeometryId(6), CurveGeometry.FromCircle(new Circle3Curve(new Point3D(0, 0, height), z, innerRadius, hostReference)));+ if (blended)+ {+ geometry.AddCurve(new CurveGeometryId(7), CurveGeometry.FromCircle(new Circle3Curve(origin, z, floorRadius, hostReference)));+ geometry.AddCurve(new CurveGeometryId(8), CurveGeometry.FromCircle(new Circle3Curve(new Point3D(0, 0, thickness), z, floorRadius, hostReference)));+ }+ geometry.AddSurface(new SurfaceGeometryId(1), SurfaceGeometry.FromCylinder(outer));+ geometry.AddSurface(new SurfaceGeometryId(2), SurfaceGeometry.FromCylinder(inner));+ geometry.AddSurface(new SurfaceGeometryId(3), SurfaceGeometry.FromPlane(new PlaneSurface(origin, Direction3D.Create(-z.ToVector()), hostReference)));+ geometry.AddSurface(new SurfaceGeometryId(4), SurfaceGeometry.FromPlane(new PlaneSurface(new Point3D(0, 0, thickness), z, hostReference)));+ geometry.AddSurface(new SurfaceGeometryId(5), SurfaceGeometry.FromPlane(new PlaneSurface(new Point3D(0, 0, height), z, hostReference)));+ if (blended)+ {+ var blendCenter = new Point3D(0, 0, blendRadius);+ geometry.AddSurface(new SurfaceGeometryId(6), SurfaceGeometry.FromTorus(new TorusSurface(blendCenter, z, floorRadius, blendRadius, hostReference)));+ geometry.AddSurface(new SurfaceGeometryId(7), SurfaceGeometry.FromTorus(new TorusSurface(blendCenter, z, floorRadius, blendRadius - thickness, hostReference)));+ }+ var bindings = new BrepBindingModel();+ void Edge(EdgeId edge, int curve, ParameterInterval interval) => bindings.AddEdgeBinding(new EdgeGeometryBinding(edge, new CurveGeometryId(curve), interval));+ Edge(outerSeam, 1, new(0, height - wallStart)); Edge(innerSeam, 2, new(0, height - (blended ? wallStart : thickness)));+ Edge(outerBottom, 3, full); Edge(outerTop, 4, full); Edge(innerBottom, 5, full); Edge(innerTop, 6, full);+ if (blended) { Edge(outerFloor, 7, full); Edge(innerFloor, 8, full); }+ void Bind(CoedgeId id, FaceId face, int surface, PcurveGeometry uv) =>+ bindings.AddPcurveBinding(new CoedgePcurveBinding(id, face, new SurfaceGeometryId(surface), uv));+ void Role(FaceId face, LoopId loop, FaceBoundaryRole role) =>+ bindings.AddFaceBoundaryRoleBinding(new FaceBoundaryRoleBinding(face, loop, role));+ var holes = new List<Hole>();+ var faceNames = new Dictionary<string, FaceId>(StringComparer.Ordinal);+ var loopNames = new Dictionary<string, LoopId>(StringComparer.Ordinal);+ var edgeNames = new Dictionary<string, IReadOnlyList<EdgeId>>(StringComparer.Ordinal);+ var certificates = new Dictionary<string, HollowRadialCutCertificate>(StringComparer.Ordinal);+ var nextCurve = blended ? 9 : 7; var nextSurface = blended ? 8 : 6;+ foreach (var placement in placements)+ {+ var canonicalAngle = Normalize(placement.AngleRadians);+ if (canonicalAngle <= tol.Angular || 2 * System.Math.PI - canonicalAngle <= tol.Angular)+ canonicalAngle = 0;+ var radial = Direction3D.Create(new Vector3D(System.Math.Cos(canonicalAngle), System.Math.Sin(canonicalAngle), 0));+ var toolReference = Direction3D.Create(z.ToVector().Cross(radial.ToVector()));+ var center = new Point3D(0, 0, placement.Z);+ var tool = new CylinderSurface(center, radial, placement.Radius, toolReference);+ var outerAuthority = CylinderCylinderIntersectionCurve.Create(outer, tool, center, CylinderIntersectionBranch.PositiveCutterAxis, full, tolerance: tol);+ if (!outerAuthority.IsSuccess) return InstanceFailure(placement, outerAuthority.Diagnostics);+ var innerAuthority = CylinderCylinderIntersectionCurve.Create(inner, tool, center, CylinderIntersectionBranch.PositiveCutterAxis, full, tolerance: tol);+ if (!innerAuthority.IsSuccess) return InstanceFailure(placement, innerAuthority.Diagnostics);+ var outerCurve = CylinderIntersectionCurveRealizer.Realize(outerAuthority.Value, tol);+ if (!outerCurve.IsSuccess) return InstanceFailure(placement, outerCurve.Diagnostics);+ var innerCurve = CylinderIntersectionCurveRealizer.Realize(innerAuthority.Value, tol);+ if (!innerCurve.IsSuccess) return InstanceFailure(placement, innerCurve.Diagnostics);+ var outerUv = CylinderIntersectionPcurveRealizer.Realize(outerCurve.Value, tol);+ if (!outerUv.IsSuccess) return InstanceFailure(placement, outerUv.Diagnostics);+ var innerUv = CylinderIntersectionPcurveRealizer.Realize(innerCurve.Value, tol);+ if (!innerUv.IsSuccess) return InstanceFailure(placement, innerUv.Diagnostics);+ var o0 = V(outerAuthority.Value.Evaluate(0)); var oPi = V(outerAuthority.Value.Evaluate(System.Math.PI));+ var i0 = V(innerAuthority.Value.Evaluate(0)); var iPi = V(innerAuthority.Value.Evaluate(System.Math.PI));+ var outerFirst = builder.AddEdge(o0, oPi); var outerSecond = builder.AddEdge(oPi, o0);+ var innerFirst = builder.AddEdge(i0, iPi); var innerSecond = builder.AddEdge(iPi, i0);+ var toolSeam = builder.AddEdge(o0, i0);+ var outerOpening = AddLoop(builder, [new(outerSecond, true), new(outerFirst, true)]);+ var innerOpening = AddLoop(builder, [new(innerFirst), new(innerSecond)]);+ var wall = AddLoop(builder, [new(outerFirst), new(outerSecond), new(toolSeam),+ new(innerSecond, true), new(innerFirst, true), new(toolSeam, true)]);+ var wallFace = builder.AddFace([wall.Id]);+ var outerCurveId = nextCurve++; var innerCurveId = nextCurve++; var toolSeamCurveId = nextCurve++;+ geometry.AddCurve(new CurveGeometryId(outerCurveId), CurveGeometry.FromCertifiedIntersection(outerCurve.Value));+ geometry.AddCurve(new CurveGeometryId(innerCurveId), CurveGeometry.FromCertifiedIntersection(innerCurve.Value));+ geometry.AddCurve(new CurveGeometryId(toolSeamCurveId), CurveGeometry.FromLine(new Line3Curve(points[o0], Direction3D.Create(points[i0] - points[o0]))));+ var seamLength = (points[o0] - points[i0]).Length;+ Edge(outerFirst, outerCurveId, first); Edge(outerSecond, outerCurveId, second);+ Edge(innerFirst, innerCurveId, first); Edge(innerSecond, innerCurveId, second);+ Edge(toolSeam, toolSeamCurveId, new(0, seamLength));+ var surface = nextSurface++;+ geometry.AddSurface(new SurfaceGeometryId(surface), SurfaceGeometry.FromCylinder(tool));+ bindings.AddFaceBinding(new FaceGeometryBinding(wallFace, new SurfaceGeometryId(surface), IsAlignedWithSurface: false));+ Role(wallFace, wall.Id, FaceBoundaryRole.Outer);+ Bind(wall.Coedges[0], wallFace, surface, PcurveGeometry.Polynomial(first, outerUv.Value.Tool));+ Bind(wall.Coedges[1], wallFace, surface, PcurveGeometry.Polynomial(second, outerUv.Value.Tool));+ Bind(wall.Coedges[2], wallFace, surface, PcurveGeometry.Line(new(0, seamLength),+ new(2 * System.Math.PI, (points[o0] - center).Dot(radial.ToVector())),+ new(2 * System.Math.PI, (points[i0] - center).Dot(radial.ToVector()))));+ Bind(wall.Coedges[3], wallFace, surface, PcurveGeometry.Polynomial(second, innerUv.Value.Tool));+ Bind(wall.Coedges[4], wallFace, surface, PcurveGeometry.Polynomial(first, innerUv.Value.Tool));+ Bind(wall.Coedges[5], wallFace, surface, PcurveGeometry.Line(new(0, seamLength),+ new(0, (points[o0] - center).Dot(radial.ToVector())),+ new(0, (points[i0] - center).Dot(radial.ToVector()))));+ var identity = placement.StableId;+ faceNames[$"{identity}.Wall"] = wallFace;+ loopNames[$"{identity}.OuterOpening"] = outerOpening.Id;+ loopNames[$"{identity}.InnerOpening"] = innerOpening.Id;+ edgeNames[$"{identity}.OuterOpening"] = [outerFirst, outerSecond];+ edgeNames[$"{identity}.InnerOpening"] = [innerFirst, innerSecond];+ certificates[identity] = new(outerCurve.Value.CertifiedDeviationBoundMm, innerCurve.Value.CertifiedDeviationBoundMm,+ outerUv.Value.HostEdgeMismatchBoundMm, outerUv.Value.ToolEdgeMismatchBoundMm,+ innerUv.Value.HostEdgeMismatchBoundMm, innerUv.Value.ToolEdgeMismatchBoundMm,+ outerCurve.Value.SegmentCount, innerCurve.Value.SegmentCount);+ holes.Add(new(outerOpening, innerOpening, wallFace, outerUv.Value, innerUv.Value));+ }+ var outerFace = builder.AddFace([outerEnvelope.Id, .. holes.Select(h => h.Outer.Id)]);+ var innerFace = builder.AddFace([innerEnvelope.Id, .. holes.Select(h => h.Inner.Id)]);+ var bottomOutside = AddLoop(builder, [new(outerFloor)]); var outerBottomFace = builder.AddFace([bottomOutside.Id]);+ var bottomInside = AddLoop(builder, [new(innerFloor)]); var innerBottomFace = builder.AddFace([bottomInside.Id]);+ var outerBlendFloor = blended ? AddLoop(builder, [new(outerFloor, true)]) : default;+ var outerBlendWall = blended ? AddLoop(builder, [new(outerBottom, true)]) : default;+ var innerBlendFloor = blended ? AddLoop(builder, [new(innerFloor, true)]) : default;+ var innerBlendWall = blended ? AddLoop(builder, [new(innerBottom, true)]) : default;+ var outerBlendFace = blended ? builder.AddFace([outerBlendFloor.Id, outerBlendWall.Id]) : default;+ var innerBlendFace = blended ? builder.AddFace([innerBlendFloor.Id, innerBlendWall.Id]) : default;+ var rimOuter = AddLoop(builder, [new(outerTop, true)]); var rimInner = AddLoop(builder, [new(innerTop, true)]);+ var rimFace = builder.AddFace([rimOuter.Id, rimInner.Id]);+ var shell = builder.AddShell(blended+ ? [outerFace, innerFace, outerBottomFace, innerBottomFace, rimFace, outerBlendFace, innerBlendFace, .. holes.Select(h => h.WallFace)]+ : [outerFace, innerFace, outerBottomFace, innerBottomFace, rimFace, .. holes.Select(h => h.WallFace)]);+ builder.AddBody([shell]);+ bindings.AddFaceBinding(new FaceGeometryBinding(outerFace, new SurfaceGeometryId(1)));+ bindings.AddFaceBinding(new FaceGeometryBinding(innerFace, new SurfaceGeometryId(2), IsAlignedWithSurface: false));+ bindings.AddFaceBinding(new FaceGeometryBinding(outerBottomFace, new SurfaceGeometryId(3)));+ bindings.AddFaceBinding(new FaceGeometryBinding(innerBottomFace, new SurfaceGeometryId(4)));+ bindings.AddFaceBinding(new FaceGeometryBinding(rimFace, new SurfaceGeometryId(5)));+ if (blended)+ {+ bindings.AddFaceBinding(new FaceGeometryBinding(outerBlendFace, new SurfaceGeometryId(6)));+ bindings.AddFaceBinding(new FaceGeometryBinding(innerBlendFace, new SurfaceGeometryId(7), IsAlignedWithSurface: false));+ }+ Role(outerFace, outerEnvelope.Id, FaceBoundaryRole.Outer);+ Role(innerFace, innerEnvelope.Id, FaceBoundaryRole.Outer);+ foreach (var h in holes)+ {+ Role(outerFace, h.Outer.Id, FaceBoundaryRole.Inner);+ Role(innerFace, h.Inner.Id, FaceBoundaryRole.Inner);+ Bind(h.Outer.Coedges[0], outerFace, 1, PcurveGeometry.Polynomial(second, h.OuterUv.Host));+ Bind(h.Outer.Coedges[1], outerFace, 1, PcurveGeometry.Polynomial(first, h.OuterUv.Host));+ Bind(h.Inner.Coedges[0], innerFace, 2, PcurveGeometry.Polynomial(first, h.InnerUv.Host));+ Bind(h.Inner.Coedges[1], innerFace, 2, PcurveGeometry.Polynomial(second, h.InnerUv.Host));+ }+ Role(outerBottomFace, bottomOutside.Id, FaceBoundaryRole.Outer);+ Role(innerBottomFace, bottomInside.Id, FaceBoundaryRole.Outer);+ Role(rimFace, rimOuter.Id, FaceBoundaryRole.Outer); Role(rimFace, rimInner.Id, FaceBoundaryRole.Inner);+ if (blended)+ {+ Role(outerBlendFace, outerBlendFloor.Id, FaceBoundaryRole.Outer);+ Role(outerBlendFace, outerBlendWall.Id, FaceBoundaryRole.Inner);+ Role(innerBlendFace, innerBlendFloor.Id, FaceBoundaryRole.Outer);+ Role(innerBlendFace, innerBlendWall.Id, FaceBoundaryRole.Inner);+ }+ void HostEnvelope((LoopId Id, CoedgeId[] Coedges) loop, FaceId face, int surface, double startZ, double originZ)+ {+ var length = height - startZ; var uvStart = startZ - originZ; var uvEnd = height - originZ;+ Bind(loop.Coedges[0], face, surface, PcurveGeometry.Line(new(0, length), new(0, uvStart), new(0, uvEnd)));+ Bind(loop.Coedges[1], face, surface, PcurveGeometry.Line(full, new(0, uvEnd), new(2 * System.Math.PI, uvEnd)));+ Bind(loop.Coedges[2], face, surface, PcurveGeometry.Line(new(0, length), new(2 * System.Math.PI, uvStart), new(2 * System.Math.PI, uvEnd)));+ Bind(loop.Coedges[3], face, surface, PcurveGeometry.Line(full, new(0, uvStart), new(2 * System.Math.PI, uvStart)));+ }+ HostEnvelope(outerEnvelope, outerFace, 1, wallStart, 0);+ HostEnvelope(innerEnvelope, innerFace, 2, blended ? wallStart : thickness, thickness);+ Bind(bottomOutside.Coedges[0], outerBottomFace, 3, PcurveGeometry.Circle(full, new(0, 0), floorRadius, -floorRadius));+ Bind(bottomInside.Coedges[0], innerBottomFace, 4, PcurveGeometry.Circle(full, new(0, 0), blended ? floorRadius : innerRadius, blended ? floorRadius : innerRadius));+ Bind(rimOuter.Coedges[0], rimFace, 5, PcurveGeometry.Circle(full, new(0, 0), radius, radius));+ Bind(rimInner.Coedges[0], rimFace, 5, PcurveGeometry.Circle(full, new(0, 0), innerRadius, innerRadius));+ if (blended)+ {+ void TorusCircle((LoopId Id, CoedgeId[] Coedges) loop, FaceId face, int surface, double minorAngle) =>+ Bind(loop.Coedges[0], face, surface, PcurveGeometry.Line(full,+ new(0, minorAngle), new(2 * System.Math.PI, minorAngle)));+ TorusCircle(outerBlendFloor, outerBlendFace, 6, -System.Math.PI / 2);+ TorusCircle(outerBlendWall, outerBlendFace, 6, 0);+ TorusCircle(innerBlendFloor, innerBlendFace, 7, -System.Math.PI / 2);+ TorusCircle(innerBlendWall, innerBlendFace, 7, 0);+ }+ var body = new BrepBody(builder.Model, geometry, bindings, points);+ var bindingValidation = BrepBindingValidator.Validate(body, requireAllEdgeAndFaceBindings: true);+ if (!bindingValidation.IsSuccess) return KernelResult<HollowRadialCutPatternResult>.Failure(bindingValidation.Diagnostics);+ var pcurveValidation = BrepPcurveValidator.Validate(body, tol.Linear, requireEveryCoedge: true, samples: 129);+ if (!pcurveValidation.IsValid) return Reject("Brep.HollowRadialCutPattern.PcurveValidation", string.Join("; ", pcurveValidation.Diagnostics));+ var preflight = BrepExportPreflight.Validate(body);+ if (!preflight.IsValid) return Reject("Brep.HollowRadialCutPattern.Preflight", string.Join("; ", preflight.Diagnostics.Where(d => d.Severity == BrepExportPreflightSeverity.Error).Select(d => $"{d.Code}: {d.Message}")));+ return KernelResult<HollowRadialCutPatternResult>.Success(new(body,+ new HollowRadialCutTopologyMap(faceNames, loopNames, edgeNames), certificates, seamAngle));+ }++ private static double Normalize(double value) { value %= 2 * System.Math.PI; return value < 0 ? value + 2 * System.Math.PI : value; }+ private static double AngularDistance(double a, double b) { var d = System.Math.Abs(a - b); return System.Math.Min(d, 2 * System.Math.PI - d); }+ private static KernelResult<HollowRadialCutPatternResult> InstanceFailure(HollowRadialCutPlacement placement,+ IReadOnlyList<KernelDiagnostic> diagnostics) => KernelResult<HollowRadialCutPatternResult>.Failure(+ diagnostics.Select(d => d with { Message = $"{placement.StableId}: {d.Message}" }).ToArray());+ private static (LoopId Id, CoedgeId[] Coedges) AddLoop(TopologyBuilder builder, IReadOnlyList<Use> 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].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, coedges);+ }+ private sealed record Hole((LoopId Id, CoedgeId[] Coedges) Outer, (LoopId Id, CoedgeId[] Coedges) Inner,+ FaceId WallFace, QualifiedCylinderIntersectionPcurves OuterUv, QualifiedCylinderIntersectionPcurves InnerUv);+ private readonly record struct Use(EdgeId Edge, bool Reversed = false);+}diff --git a/Aetheris.Kernel.Core/Brep/ThinWalledBodyBRepPlan.cs b/Aetheris.Kernel.Core/Brep/ThinWalledBodyBRepPlan.csindex aa19f5cf..ea07aad0 100644--- a/Aetheris.Kernel.Core/Brep/ThinWalledBodyBRepPlan.cs+++ b/Aetheris.Kernel.Core/Brep/ThinWalledBodyBRepPlan.cs@@ -96,6 +96,36 @@ public static class ThinWalledBodyBRepPlannerreturn Validate(feature, construction, plan, body);}+ public static KernelResult<ThinWalledBodyRealization> CreateCylinder(double radius, double height, double wallThickness, double bottomBlendRadius = 0)+ {+ if (!FinitePositive(radius, height, wallThickness) || radius <= wallThickness + Tol || height <= wallThickness + Tol)+ return Failure("CylinderInnerBoundaryDegenerate");+ if (!double.IsFinite(bottomBlendRadius) || bottomBlendRadius < 0 ||+ (bottomBlendRadius > 0 && (bottomBlendRadius <= wallThickness + Tol || bottomBlendRadius >= radius - Tol || bottomBlendRadius >= height - Tol)))+ return Failure("CylinderBottomBlendInvalid");+ var blended = bottomBlendRadius > 0;+ var witness = new HollowConstructionWitness("CoaxialCylindricalOffset", true,+ blended ? "innerRadius=outerRadius-T; innerBottom=T; paired bottom torus radii=Rblend and Rblend-T; common major radius=outerRadius-Rblend" :+ "innerRadius=outerRadius-T; innerBottom=outerBottom+T; innerTop=outerTop",+ blended ? ["OuterCylindricalWall -> InnerCylindricalWall", "OuterBottomBlend -> InnerBottomBlend", "OuterBottomPlane -> InnerBottomPlane"] :+ ["OuterCylindricalWall -> InnerCylindricalWall", "OuterBottomPlane -> InnerBottomPlane"],+ blended ? ["T>0", "radius>Rblend>T", "height>Rblend"] : ["T>0", "radius>T", "height>T"]);+ var feature = new HollowBodyFeature("Cylinder", new Dictionary<string, double> { ["Radius"] = radius, ["Height"] = height, ["BottomBlendRadius"] = bottomBlendRadius },+ wallThickness, ["Top"], "ConstantNormalThickness", witness, "Firmament Primitive<Hollow>");+ ThinWallThicknessWitness[] thickness =+ [+ new("CylindricalWall", "Cylinder", "Cylinder", wallThickness, "coaxial radial inward"),+ new("Bottom", "Plane", "Plane", wallThickness, "+Z")+ ];+ if (blended) thickness = [.. thickness, new("BottomBlend", "Torus", "Torus", wallThickness, "paired normal offset")];+ var construction = new ThinWalledBodyConstruction(feature,+ blended ? ["OuterCylindricalWall", "OuterBottomBlend", "OuterBottom"] : ["OuterCylindricalWall", "OuterBottom"],+ blended ? ["InnerCylindricalWall", "InnerBottomBlend", "InnerBottom"] : ["InnerCylindricalWall", "InnerBottom"],+ ["TopAnnularRim"], ["OuterBottom", "InnerBottom"], thickness);+ var plan = MakePlan("Cylinder", construction, blended ? 3 : 2, blended ? 3 : 2, 1, 2, $"{radius:R}|{height:R}|{wallThickness:R}|{bottomBlendRadius:R}");+ return Validate(feature, construction, plan, BuildCylinder(radius, height, wallThickness, bottomBlendRadius));+ }+private static KernelResult<ThinWalledBodyRealization> Validate(HollowBodyFeature feature, ThinWalledBodyConstruction construction, ThinWalledBodyBRepPlan plan, BrepBody body){var preflight = BrepExportPreflight.Validate(body);@@ -152,6 +182,54 @@ public static class ThinWalledBodyBRepPlannervar shell = b.AddShell([outerCone, innerCone, outerBottom, innerBottomFace, rim]); b.AddBody([shell]); return new BrepBody(b.Model, g, bindings, points);}+ private static BrepBody BuildCylinder(double radius, double height, double thickness, double blendRadius)+ {+ if (blendRadius > 0) return BuildBlendedCylinder(radius, height, thickness, blendRadius);+ var b = new TopologyBuilder(); var g = new BrepGeometryStore(); var bindings = new BrepBindingModel(); var points = new Dictionary<VertexId, Point3D>();+ var radii = new[] { radius, radius, radius - thickness, radius - thickness };+ var zs = new[] { 0d, height, thickness, height }; var vertices = new VertexId[4]; var circles = new EdgeId[4];+ for (var i = 0; i < 4; i++) { vertices[i] = b.AddVertex(); points[vertices[i]] = new Point3D(radii[i], 0, zs[i]); circles[i] = AddCircle(vertices[i], radii[i], zs[i], b, g, bindings); }+ var outerWall = AddFace(b, [Forward([circles[0]]), Reverse([circles[1]])]);+ var innerWall = AddFace(b, [Forward([circles[2]]), Reverse([circles[3]])]);+ var outerBottom = AddFace(b, [Reverse([circles[0]])]);+ var innerBottom = AddFace(b, [Forward([circles[2]])]);+ var rim = AddFace(b, [Forward([circles[1]]), Reverse([circles[3]])]);+ BindSurface(outerWall, SurfaceGeometry.FromCylinder(new CylinderSurface(new Point3D(0, 0, 0), PlusZ, radius, PlusX)), g, bindings);+ BindSurface(innerWall, SurfaceGeometry.FromCylinder(new CylinderSurface(new Point3D(0, 0, thickness), PlusZ, radius - thickness, PlusX)), g, bindings, false);+ BindPlane(outerBottom, new Point3D(0, 0, 0), MinusZ, g, bindings);+ BindPlane(innerBottom, new Point3D(0, 0, thickness), PlusZ, g, bindings);+ BindPlane(rim, new Point3D(0, 0, height), PlusZ, g, bindings);+ var shell = b.AddShell([outerWall, innerWall, outerBottom, innerBottom, rim]); b.AddBody([shell]);+ return new BrepBody(b.Model, g, bindings, points);+ }++ private static BrepBody BuildBlendedCylinder(double radius, double height, double thickness, double blendRadius)+ {+ var b = new TopologyBuilder(); var g = new BrepGeometryStore(); var bindings = new BrepBindingModel(); var points = new Dictionary<VertexId, Point3D>();+ var major = radius - blendRadius;+ var radii = new[] { radius, radius, radius - thickness, radius - thickness, major, major };+ var zs = new[] { blendRadius, height, blendRadius, height, 0d, thickness };+ var vertices = new VertexId[6]; var circles = new EdgeId[6];+ for (var i = 0; i < 6; i++) { vertices[i] = b.AddVertex(); points[vertices[i]] = new Point3D(radii[i], 0, zs[i]); circles[i] = AddCircle(vertices[i], radii[i], zs[i], b, g, bindings); }+ var outerWall = AddFace(b, [Forward([circles[0]]), Reverse([circles[1]])]);+ var innerWall = AddFace(b, [Forward([circles[2]]), Reverse([circles[3]])]);+ var outerBlend = AddFace(b, [Forward([circles[4]]), Reverse([circles[0]])]);+ var innerBlend = AddFace(b, [Forward([circles[5]]), Reverse([circles[2]])]);+ var outerBottom = AddFace(b, [Reverse([circles[4]])]);+ var innerBottom = AddFace(b, [Forward([circles[5]])]);+ var rim = AddFace(b, [Forward([circles[1]]), Reverse([circles[3]])]);+ BindSurface(outerWall, SurfaceGeometry.FromCylinder(new CylinderSurface(new Point3D(0, 0, 0), PlusZ, radius, PlusX)), g, bindings);+ BindSurface(innerWall, SurfaceGeometry.FromCylinder(new CylinderSurface(new Point3D(0, 0, thickness), PlusZ, radius - thickness, PlusX)), g, bindings, false);+ var center = new Point3D(0, 0, blendRadius);+ BindSurface(outerBlend, SurfaceGeometry.FromTorus(new TorusSurface(center, PlusZ, major, blendRadius, PlusX)), g, bindings);+ BindSurface(innerBlend, SurfaceGeometry.FromTorus(new TorusSurface(center, PlusZ, major, blendRadius - thickness, PlusX)), g, bindings, false);+ BindPlane(outerBottom, new Point3D(0, 0, 0), MinusZ, g, bindings);+ BindPlane(innerBottom, new Point3D(0, 0, thickness), PlusZ, g, bindings);+ BindPlane(rim, new Point3D(0, 0, height), PlusZ, g, bindings);+ var shell = b.AddShell([outerWall, innerWall, outerBlend, innerBlend, outerBottom, innerBottom, rim]); b.AddBody([shell]);+ return new BrepBody(b.Model, g, bindings, points);+ }+private static ConeSurface Cone(double intercept, double slope){var apex = new Point3D(0, 0, -intercept / slope); var axis = slope > 0 ? PlusZ : MinusZ;diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentHollowPolicyTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentHollowPolicyTests.csindex 054a5046..2e9df5e8 100644--- a/Aetheris.Kernel.Firmament.Tests/FirmamentHollowPolicyTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentHollowPolicyTests.cs@@ -4,6 +4,46 @@ namespace Aetheris.Kernel.Firmament.Tests;public sealed class FirmamentHollowPolicyTests{+ [Fact]+ public void CylinderHollow_BuildsAndReimportsThroughProductionPath()+ {+ const string source = """+ Struct UtensilHolderBody {+ Cylinder<Hollow> Body {+ Radius: 56mm+ Height: 142mm+ WallThickness: 0.8mm+ Openings: [Top]+ }+ }+ """;+ var parsed = FirmamentV2Parser.Parse(source);+ Assert.True(parsed.IsSuccess, string.Join(", ", parsed.Diagnostics));+ var built = FirmamentBuildAndExport.CompileSource(source);+ Assert.True(built.IsSuccess, string.Join(", ", built.Diagnostics.Select(x => x.Message)));+ Assert.Equal("Cylinder", built.Value.Hollow!.Primitive);+ Assert.Equal(2, built.Value.Hollow.Cylinders);+ Assert.True(built.Value.Hollow.ReimportedManifold);+ }++ [Fact]+ public void CylinderHollow_RejectsUnloweredPerforationRatherThanExportingPlainBody()+ {+ const string source = """+ Struct UtensilHolder {+ Cylinder<Hollow> Body {+ Radius: 56mm Height: 142mm WallThickness: 0.8mm Openings: [Top]+ }+ Modify Body {+ Perforation Vents { On: +Z; Diameter: 9mm; Layout: Grid; Pitch: 13mm; Margin: 12mm }+ }+ }+ """;+ var parsed = FirmamentV2Parser.Parse(source);+ Assert.False(parsed.IsSuccess);+ Assert.Contains("firmament-v2-hollow-modify-unsupported", parsed.Diagnostics);+ }+[Fact]public void RoundedBoxHollow_ParsesAsConstrainedConstructionPolicy(){diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentPerforationTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentPerforationTests.csindex f818cf93..64acf6a0 100644--- a/Aetheris.Kernel.Firmament.Tests/FirmamentPerforationTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentPerforationTests.cs@@ -1,4 +1,7 @@using Aetheris.Kernel.Firmament.FirmamentV2;+using Aetheris.Kernel.Core.Brep.Tessellation;+using System.Diagnostics;+using System.Text.Json;namespace Aetheris.Kernel.Firmament.Tests;@@ -20,6 +23,30 @@ public sealed class FirmamentPerforationTests}""";+ private const string CylindricalSource = """+ Struct PerforatedSleeve {+ Cylinder<Hollow> Body {+ Radius: 56mm+ Height: 142mm+ WallThickness: 0.8mm+ Openings: [Top]+ }+ Modify Body {+ Perforation Vents {+ On: OuterWall+ Diameter: 9mm+ Layout: CylindricalGrid+ Pitch: 15mm+ CircumferentialPitch: 18mm+ MarginTop: 12mm+ MarginBottom: 20mm+ MinimumLigament: 2mm+ StartAngle: 9deg+ }+ }+ }+ """;+[Fact]public void Grid_BuildsManifoldStepAndPerInstanceWallCorrespondence(){@@ -56,6 +83,168 @@ public sealed class FirmamentPerforationTests});}+ [Fact]+ public void CylindricalPlanner_WrapsWithoutDuplicateAndKeepsStableGridIdentity()+ {+ var parsed = FirmamentV2Parser.Parse(CylindricalSource);+ Assert.True(parsed.IsSuccess, string.Join(" | ", parsed.Diagnostics));+ var feature = Assert.Single(Assert.Single(parsed.Document!.ModifyBlocks!).Perforations!);+ var plan = FirmamentCylindricalPerforationPlanner.Plan(56, 142, 0.8, feature);+ Assert.True(plan.Succeeded, plan.Diagnostic);+ Assert.Equal(plan.Rows * plan.Columns, plan.Instances.Count);+ Assert.Equal(plan.Instances.Count, plan.Instances.Select(instance => instance.StableId("Body.Vents")).Distinct().Count());+ Assert.All(plan.Instances, instance => Assert.InRange(instance.AngleRadians, 0, 2 * Math.PI));+ Assert.All(plan.Instances, instance => Assert.InRange(instance.Z, 20 + 4.5, 142 - 12 - 4.5));+ Assert.Equal(2 * Math.PI / plan.Columns, plan.AngularPitchRadians, 10);+ Assert.Equal("Body.Vents.Row0.Col0", plan.Instances[0].StableId("Body.Vents"));+ var again = FirmamentCylindricalPerforationPlanner.Plan(56, 142, 0.8, feature);+ Assert.Equal(plan.Instances, again.Instances);+ var wrappedPhase = FirmamentCylindricalPerforationPlanner.Plan(56, 142, 0.8,+ feature with { StartAngleDegrees = feature.StartAngleDegrees + 360 });+ Assert.Equal(plan.Instances, wrappedPhase.Instances);+ }++ [Fact]+ public void CylindricalPlanner_StaggerAndInvalidClearanceAreDeterministic()+ {+ var parsed = FirmamentV2Parser.Parse(CylindricalSource.Replace("CylindricalGrid", "CylindricalStaggered", StringComparison.Ordinal));+ Assert.True(parsed.IsSuccess, string.Join(" | ", parsed.Diagnostics));+ var feature = Assert.Single(Assert.Single(parsed.Document!.ModifyBlocks!).Perforations!);+ var plan = FirmamentCylindricalPerforationPlanner.Plan(56, 142, 0.8, feature);+ Assert.True(plan.Succeeded, plan.Diagnostic);+ Assert.Equal(plan.AngularPitchRadians / 2, plan.Instances[plan.Columns].AngleRadians - plan.Instances[0].AngleRadians, 10);+ Assert.Equal("perforation-hole-overlap", FirmamentCylindricalPerforationPlanner.Plan(56, 142, 0.8,+ feature with { Pitch = 9 }).Diagnostic);+ Assert.Equal("perforation-no-admissible-holes", FirmamentCylindricalPerforationPlanner.Plan(56, 142, 0.8,+ feature with { MarginTop = 75, MarginBottom = 75 }).Diagnostic);+ Assert.Equal("perforation-hole-overlap", FirmamentCylindricalPerforationPlanner.Plan(56, 142, 0.8,+ feature with { CircumferentialPitch = 9 }).Diagnostic);+ Assert.Equal("perforation-cylindrical-tangent-or-oversize", FirmamentCylindricalPerforationPlanner.Plan(56, 142, 0.8,+ feature with { Diameter = 111 }).Diagnostic);+ Assert.Equal("perforation-cylindrical-offset-unsupported", FirmamentCylindricalPerforationPlanner.Plan(56, 142, 0.8,+ feature with { OffsetX = 1 }).Diagnostic);+ }++ [Fact]+ public void CylindricalPlanner_ParameterEditsRetainPatternCoordinates()+ {+ var parsed = FirmamentV2Parser.Parse(CylindricalSource);+ var feature = Assert.Single(Assert.Single(parsed.Document!.ModifyBlocks!).Perforations!);+ var original = FirmamentCylindricalPerforationPlanner.Plan(56, 142, 0.8, feature);+ var smallerHole = FirmamentCylindricalPerforationPlanner.Plan(56, 142, 0.8, feature with { Diameter = 8 });+ var thickerWall = FirmamentCylindricalPerforationPlanner.Plan(56, 142, 1.2, feature);+ Assert.True(smallerHole.Succeeded && thickerWall.Succeeded);+ Assert.Equal(original.Instances.Select(i => (i.Row, i.Column)),+ smallerHole.Instances.Select(i => (i.Row, i.Column)));+ Assert.Equal(original.Instances.Select(i => (i.Row, i.Column)),+ thickerWall.Instances.Select(i => (i.Row, i.Column)));+ }++ [Fact]+ public void CylindricalPerforation_DiameterAndThicknessEditsRebuildStep()+ {+ var diameter = FirmamentBuildAndExport.CompileSource(CylindricalSource.Replace("Diameter: 9mm", "Diameter: 8mm", StringComparison.Ordinal));+ var thickness = FirmamentBuildAndExport.CompileSource(CylindricalSource.Replace("WallThickness: 0.8mm", "WallThickness: 1.2mm", StringComparison.Ordinal));+ Assert.True(diameter.IsSuccess, string.Join(" | ", diameter.Diagnostics.Select(d => d.Message)));+ Assert.True(thickness.IsSuccess, string.Join(" | ", thickness.Diagnostics.Select(d => d.Message)));+ Assert.Equal(133, diameter.Value.Perforation!.InstanceCount);+ Assert.Equal(133, thickness.Value.Perforation!.InstanceCount);+ Assert.NotEqual(diameter.Value.Perforation.StepSha256, thickness.Value.Perforation.StepSha256);+ Assert.Equal(diameter.Value.Perforation.InstanceIds, thickness.Value.Perforation.InstanceIds);+ }++ [Fact]+ public void CylindricalPerforation_ExportsOneManifoldPatternWithStableWalls()+ {+ var buildStart = Stopwatch.GetTimestamp();+ var built = FirmamentBuildAndExport.CompileSource(CylindricalSource);+ var buildMilliseconds = Stopwatch.GetElapsedTime(buildStart).TotalMilliseconds;+ Assert.True(built.IsSuccess, string.Join(" | ", built.Diagnostics.Select(d => d.Message)));+ var report = Assert.IsType<FirmamentPerforationReport>(built.Value.Perforation);+ Assert.Equal(report.Rows * report.Columns, report.InstanceCount);+ Assert.Equal(133, report.InstanceCount);+ Assert.Equal(report.InstanceCount * 3, built.Value.RuntimeCorrespondence!.Descendants.Count);+ var first = built.Value.RuntimeCorrespondence.Descendants.Where(d => d.SourceStableId == "perforation:Body.Vents.Row0.Col0").ToArray();+ Assert.Contains(first, d => d.Role == Aetheris.Kernel.Firmament.Materializer.SemanticTopologyRole.HoleWallFace && d.Face is not null);+ Assert.Contains(first, d => d.Role == Aetheris.Kernel.Firmament.Materializer.SemanticTopologyRole.HoleEntryLoop && d.Loop is not null);+ Assert.Contains(first, d => d.Role == Aetheris.Kernel.Firmament.Materializer.SemanticTopologyRole.HoleExitLoop && d.Loop is not null);+ Assert.Equal(report.InstanceCount + 5, report.Faces);+ Assert.True(report.Manifold && report.StepReimportedManifold);+ Assert.NotEmpty(built.Value.StepText);+ var output = Environment.GetEnvironmentVariable("AETHERIS_CYLINDRICAL_ORDNING_OBJ_OUTPUT");+ var displayOptions = string.IsNullOrWhiteSpace(output) ? DisplayTessellationOptions.Default+ : new DisplayTessellationOptions(System.Math.PI / 24, 0.01, 24, 1024);+ var displayStart = Stopwatch.GetTimestamp();+ var display = BrepDisplayTessellator.TessellateBounded(built.Value.RuntimeBody!, displayOptions,+ executionTimeout: TimeSpan.FromSeconds(string.IsNullOrWhiteSpace(output) ? 60 : 120));+ var displayMilliseconds = Stopwatch.GetElapsedTime(displayStart).TotalMilliseconds;+ Assert.True(display.IsSuccess, string.Join(" | ", display.Diagnostics.Select(d => d.Message)));+ Assert.Equal(report.Faces, display.Value.FacePatches.Count);+ var perfOutput = Environment.GetEnvironmentVariable("AETHERIS_CYLINDRICAL_PERF_REPORT_OUTPUT");+ if (!string.IsNullOrWhiteSpace(perfOutput))+ File.WriteAllText(perfOutput, JsonSerializer.Serialize(new+ {+ buildExportReimportMs = buildMilliseconds, displayTessellationMs = displayMilliseconds,+ displayOptions, stepBytes = System.Text.Encoding.UTF8.GetByteCount(built.Value.StepText),+ report.InstanceCount, report.Faces, report.Edges, report.Vertices,+ report.MaximumCurveBoundMm, report.MaximumPcurveBoundMm+ }, new JsonSerializerOptions { WriteIndented = true }));+ if (!string.IsNullOrWhiteSpace(output))+ {+ var lines = new List<string>(); var offset = 1;+ foreach (var patch in display.Value.FacePatches)+ {+ lines.Add($"g Face{patch.FaceId.Value}");+ lines.AddRange(patch.Positions.Select(p => FormattableString.Invariant($"v {p.X:R} {p.Y:R} {p.Z:R}")));+ for (var k = 0; k < patch.TriangleIndices.Count; k += 3)+ lines.Add($"f {offset + patch.TriangleIndices[k]} {offset + patch.TriangleIndices[k + 1]} {offset + patch.TriangleIndices[k + 2]}");+ offset += patch.Positions.Count;+ }+ File.WriteAllLines(output, lines);+ }+ }++ [Fact]+ public void BlendedOrdningBlank_PreservesOneHundredThirtyThreeHoles()+ {+ var source = CylindricalSource.Replace("WallThickness: 0.8mm", "WallThickness: 0.8mm; BottomBlendRadius: 8mm", StringComparison.Ordinal);+ var built = FirmamentBuildAndExport.CompileSource(source);+ Assert.True(built.IsSuccess, string.Join(" | ", built.Diagnostics.Select(d => d.Message)));+ var report = Assert.IsType<FirmamentPerforationReport>(built.Value.Perforation);+ Assert.Equal(133, report.InstanceCount);+ Assert.Equal(140, report.Faces);+ Assert.True(report.Manifold && report.StepReimportedManifold);+ Assert.Equal(2, built.Value.RuntimeBody!.Geometry.Surfaces.Count(s => s.Value.Kind == Aetheris.Kernel.Core.Geometry.SurfaceGeometryKind.Torus));+ var output = Environment.GetEnvironmentVariable("AETHERIS_HOLLOW_BLEND_OBJ_OUTPUT");+ if (string.IsNullOrWhiteSpace(output)) return;+ var display = BrepDisplayTessellator.TessellateBounded(built.Value.RuntimeBody,+ new DisplayTessellationOptions(System.Math.PI / 24, 0.01, 24, 1024), executionTimeout: TimeSpan.FromSeconds(120));+ Assert.True(display.IsSuccess, string.Join(" | ", display.Diagnostics.Select(d => d.Message)));+ Assert.Equal(140, display.Value.FacePatches.Count);+ var lines = new List<string>(); var offset = 1;+ foreach (var patch in display.Value.FacePatches)+ {+ lines.Add($"g Face{patch.FaceId.Value}");+ lines.AddRange(patch.Positions.Select(p => FormattableString.Invariant($"v {p.X:R} {p.Y:R} {p.Z:R}")));+ for (var k = 0; k < patch.TriangleIndices.Count; k += 3)+ lines.Add($"f {offset + patch.TriangleIndices[k]} {offset + patch.TriangleIndices[k + 1]} {offset + patch.TriangleIndices[k + 2]}");+ offset += patch.Positions.Count;+ }+ File.WriteAllLines(output, lines);+ }++ [Fact]+ public void HollowBottomBlend_RejectsInvalidRadiusAndUnit()+ {+ var source = CylindricalSource.Replace("WallThickness: 0.8mm", "WallThickness: 0.8mm; BottomBlendRadius: 0.8mm", StringComparison.Ordinal);+ var radius = FirmamentV2Parser.Parse(source);+ Assert.False(radius.IsSuccess);+ Assert.Contains("firmament-v2-hollow-bottom-blend-invalid", radius.Diagnostics);+ var unit = FirmamentV2Parser.Parse(source.Replace("BottomBlendRadius: 0.8mm", "BottomBlendRadius: 8cm", StringComparison.Ordinal));+ Assert.False(unit.IsSuccess);+ Assert.Contains("firmament-v2-hollow-bottom-blend-invalid", unit.Diagnostics);+ }+[Fact]public void InvalidPitchAndNoRoomFailWithSpecificDiagnostics(){@@ -65,6 +254,9 @@ public sealed class FirmamentPerforationTestsvar noRoom = FirmamentBuildAndExport.CompileSource(GridSource.Replace("Margin: 3mm", "Margin: 15mm", StringComparison.Ordinal));Assert.False(noRoom.IsSuccess);Assert.Contains(noRoom.Diagnostics, d => d.Message.Contains("perforation-support-too-small", StringComparison.Ordinal));+ var cylindricalFieldOnPanel = FirmamentBuildAndExport.CompileSource(GridSource.Replace("Margin: 3mm", "Margin: 3mm; CircumferentialPitch: 12mm", StringComparison.Ordinal));+ Assert.False(cylindricalFieldOnPanel.IsSuccess);+ Assert.Contains(cylindricalFieldOnPanel.Diagnostics, d => d.Message.Contains("perforation-planar-cylindrical-field-unsupported", StringComparison.Ordinal));}[Fact]@@ -90,9 +282,15 @@ public sealed class FirmamentPerforationTestsvar schema = Assert.IsType<FirmamentConstructSchema>(FirmamentSemanticSchemas.Get("Perforation"));Assert.Contains(schema.Fields, field => field.Name == "Diameter" && field.Required);Assert.Contains(schema.Fields, field => field.Name == "Layout" && field.Choices.Contains("Hex"));+ Assert.Contains(schema.Fields, field => field.Name == "Layout" && field.Choices.Contains("CylindricalStaggered"));+ Assert.Contains(schema.Fields, field => field.Name == "CircumferentialPitch");const string source = "Model X { Units: mm Box Body { Size: [30mm,30mm,2mm] } Modify Body { Perforation Vent {\n Dia";var completion = FirmamentLanguageService.Complete(source, "x", "r1", source.Length);Assert.Equal("Perforation", completion.Context);Assert.Contains(completion.Fields, field => field.Name == "Diameter");+ const string cylindricalSource = "Struct X { Cylinder<Hollow> Body { Radius: 20mm Height: 60mm WallThickness: 0.8mm Openings: [Top] } Modify Body { Perforation Vent {\n Circ";+ var cylindricalCompletion = FirmamentLanguageService.Complete(cylindricalSource, "x", "r1", cylindricalSource.Length);+ Assert.Equal("Perforation", cylindricalCompletion.Context);+ Assert.Contains(cylindricalCompletion.Fields, field => field.Name == "CircumferentialPitch");}}diff --git a/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs b/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.csindex a6f634ac..fae049a8 100644--- a/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs+++ b/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs@@ -1,6 +1,7 @@using System.Text;using System.Security.Cryptography;using System.Text.RegularExpressions;+using System.Diagnostics;using Aetheris.Kernel.Core.Air;using Aetheris.Kernel.Core.Results;using Aetheris.Kernel.Core.Diagnostics;@@ -1502,6 +1503,9 @@ public static class FirmamentBuildAndExport{if (document.Solids.Count != 1 || document.Solid.ConstructionPolicy != FirmamentV2ConstructionPolicy.Hollow)return null;+ // A parsed Perforation must reach its own topology route. Exporting the+ // unmodified Hollow here would silently lose the authored openings.+ if ((document.ModifyBlocks ?? []).Any(block => (block.Perforations?.Count ?? 0) > 0)) return null;var solid = document.Solid;if (solid.Hollow is null || solid.Hollow.Openings.Count != 1 || solid.Hollow.Openings[0] != "Top")return HollowFailure("UnsupportedOpening");@@ -1510,6 +1514,7 @@ public static class FirmamentBuildAndExport{FirmamentV2RoundedBoxRecord rounded when rounded.Size.Count == 3 => ThinWalledBodyBRepPlanner.CreateRoundedBox(rounded.Size[0], rounded.Size[1], rounded.Size[2], rounded.CornerRadius, solid.Hollow.WallThickness),FirmamentV2FrustumRecord frustum => ThinWalledBodyBRepPlanner.CreateFrustum(frustum.BottomRadius, frustum.TopRadius, frustum.Height, solid.Hollow.WallThickness),+ FirmamentV2CylinderRecord cylinder => ThinWalledBodyBRepPlanner.CreateCylinder(cylinder.Radius, cylinder.Height, solid.Hollow.WallThickness, solid.Hollow.BottomBlendRadius),_ => throw new InvalidOperationException("Parser admitted a Hollow policy without a HollowConstructible witness.")};if (!realization.IsSuccess || realization.Value is null) return KernelResult<FirmamentStepExportResult>.Failure(realization.Diagnostics);@@ -1531,9 +1536,13 @@ public static class FirmamentBuildAndExportif (!reimportedManifold) return HollowFailure("VerificationFailure: STEP reimport vessel boundary is not manifold");var surfaces = body.Geometry.Surfaces.Select(x => x.Value.Kind).ToArray();var r = realization.Value;- var volume = r.Feature.PrimitiveKind == "RoundedBox"- ? RoundedHollowVolume((FirmamentV2RoundedBoxRecord)solid.Primitive, r.Feature.WallThickness)- : FrustumHollowVolume((FirmamentV2FrustumRecord)solid.Primitive, r.Feature.WallThickness);+ var volume = solid.Primitive switch+ {+ FirmamentV2RoundedBoxRecord rounded => RoundedHollowVolume(rounded, r.Feature.WallThickness),+ FirmamentV2FrustumRecord frustum => FrustumHollowVolume(frustum, r.Feature.WallThickness),+ FirmamentV2CylinderRecord cylinder => CylinderHollowVolume(cylinder, r.Feature.WallThickness, solid.Hollow.BottomBlendRadius),+ _ => throw new InvalidOperationException("Unsupported Hollow volume witness.")+ };var report = new FirmamentHollowBodyReport(r.Feature.PrimitiveKind, "Hollow", r.Feature.WallThickness, r.Feature.Openings, r.Feature.Witness.Kind, r.Feature.Witness.Exact,r.Feature.ThicknessPolicy, r.Construction.ThicknessWitnesses.All(w => w.Exact && double.Abs(w.Distance - r.Feature.WallThickness) <= 1e-9), r.Plan.Kind, r.Plan.IsAuthoritative, r.Plan.DeterministicSignature,body.Topology.Vertices.Count(), body.Topology.Edges.Count(), body.Topology.Faces.Count(), surfaces.Count(x => x == SurfaceGeometryKind.Plane), surfaces.Count(x => x == SurfaceGeometryKind.Cylinder), surfaces.Count(x => x == SurfaceGeometryKind.Cone), r.Plan.RimFaces.Count,@@ -1551,6 +1560,25 @@ public static class FirmamentBuildAndExportreturn FormattableString.Invariant($"analytic={analytic:R};numericalSimpson={numerical:R};delta={double.Abs(analytic - numerical):R}");}+ private static string CylinderHollowVolume(FirmamentV2CylinderRecord cylinder, double t, double blendRadius)+ {+ var innerRadius = cylinder.Radius - t;+ var analytic = blendRadius == 0+ ? double.Pi * (cylinder.Radius * cylinder.Radius * cylinder.Height - innerRadius * innerRadius * (cylinder.Height - t))+ : BlendedCylinderVolume(cylinder.Radius, innerRadius, cylinder.Height, t, blendRadius);+ return FormattableString.Invariant($"analytic={analytic:R}");+ }++ private static double BlendedCylinderVolume(double outerRadius, double innerRadius, double height, double thickness, double blendRadius)+ {+ var major = outerRadius - blendRadius;+ static double QuarterProfileIntegral(double majorRadius, double minorRadius) =>+ majorRadius * majorRadius * minorRadius + majorRadius * double.Pi * minorRadius * minorRadius / 2d ++ 2d * minorRadius * minorRadius * minorRadius / 3d;+ return double.Pi * (QuarterProfileIntegral(major, blendRadius) - QuarterProfileIntegral(major, blendRadius - thickness) ++ (outerRadius * outerRadius - innerRadius * innerRadius) * (height - blendRadius));+ }+private static string FrustumHollowVolume(FirmamentV2FrustumRecord frustum, double t){var k = (frustum.TopRadius - frustum.BottomRadius) / frustum.Height;@@ -2064,6 +2092,103 @@ public static class FirmamentBuildAndExportif (features.Length != 1 || document.Solids.Count != 1 || document.ModifyBlocks!.Any(block => block.SemanticHoles.Count > 0 || (block.EdgeFinishes?.Count ?? 0) > 0))return Failure("perforation-composition-unsupported: X0 admits one Perforation on one Box without other Modify features");var (target, feature) = features[0];+ if (document.Solid.Name == target && document.Solid.ConstructionPolicy == FirmamentV2ConstructionPolicy.Hollow &&+ document.Solid.Cylinder is { } cylinder && document.Solid.Hollow is { } hollow)+ {+ var cylindrical = FirmamentCylindricalPerforationPlanner.Plan(cylinder.Radius, cylinder.Height,+ hollow.WallThickness, feature);+ if (!cylindrical.Succeeded) return Failure(cylindrical.Diagnostic!);+ var patternBuildStart = Stopwatch.GetTimestamp();+ var hollowBody = ThinWalledBodyBRepPlanner.CreateCylinder(cylinder.Radius, cylinder.Height, hollow.WallThickness, hollow.BottomBlendRadius);+ if (!hollowBody.IsSuccess || hollowBody.Value is null)+ return Failure("perforation-cylindrical-host-invalid: " + string.Join(" | ", hollowBody.Diagnostics.Select(d => d.Message)));+ var cylindricalFeatureId = $"{target}.{feature.Name}";+ var placements = cylindrical.Instances.Select(instance => new HollowRadialCutPlacement(+ instance.StableId(cylindricalFeatureId), feature.Diameter / 2, instance.Z, instance.AngleRadians)).ToArray();+ var cut = BrepHollowRadialCutPattern.Build(hollowBody.Value, placements);+ if (!cut.IsSuccess || cut.Value is null)+ return Failure("perforation-cylindrical-brep-failed: " + string.Join(" | ", cut.Diagnostics.Select(d => $"{d.Source}: {d.Message}")));+ var patternBuildMilliseconds = Stopwatch.GetElapsedTime(patternBuildStart).TotalMilliseconds;+ var cylindricalBody = cut.Value.Body;+ if (!FirmamentManifoldChecker.IsManifold(cylindricalBody))+ return Failure("perforation-cylindrical-topology-invalid: the composed shell is not manifold");+ var stepExportStart = Stopwatch.GetTimestamp();+ var cylindricalStep = Step242Exporter.ExportBody(cylindricalBody, new Step242ExportOptions+ {+ ProductName = cylindricalFeatureId,+ ApplicationName = "Aetheris.Firmament.Perforation.Cylindrical",+ BrepExportPreflightMode = BrepExportPreflightMode.Enforce,+ BrepExportPreflightPolicy = BrepExportPreflightPolicy.TrustedProductionRoute,+ });+ if (!cylindricalStep.IsSuccess || cylindricalStep.Value is null)+ return Failure("perforation-cylindrical-step-export-failed: " + string.Join(" | ", cylindricalStep.Diagnostics.Select(d => d.Message)));+ var stepExportMilliseconds = Stopwatch.GetElapsedTime(stepExportStart).TotalMilliseconds;+ var stepReimportStart = Stopwatch.GetTimestamp();+ var cylindricalImport = Step242Importer.ImportBody(cylindricalStep.Value);+ if (!cylindricalImport.IsSuccess || cylindricalImport.Value is null || !FirmamentManifoldChecker.IsManifold(cylindricalImport.Value))+ return Failure("perforation-cylindrical-step-reimport-invalid: " + string.Join(" | ", cylindricalImport.Diagnostics.Select(d => d.Message)));+ var stepReimportMilliseconds = Stopwatch.GetElapsedTime(stepReimportStart).TotalMilliseconds;+ var importedCylinders = cylindricalImport.Value.Geometry.Surfaces+ .Where(pair => pair.Value.Kind == SurfaceGeometryKind.Cylinder)+ .Select(pair => pair.Value.Cylinder!.Value.Radius).ToArray();+ var importedPlanes = cylindricalImport.Value.Geometry.Surfaces+ .Where(pair => pair.Value.Kind == SurfaceGeometryKind.Plane)+ .Select(pair => pair.Value.Plane!.Value.Origin.Z).ToArray();+ var importedTori = cylindricalImport.Value.Geometry.Surfaces+ .Where(pair => pair.Value.Kind == SurfaceGeometryKind.Torus)+ .Select(pair => pair.Value.Torus!.Value).ToArray();+ if (cylindricalImport.Value.Topology.Faces.Count() != placements.Length + (hollow.BottomBlendRadius > 0 ? 7 : 5) ||+ importedCylinders.Length != placements.Length + 2 ||+ importedPlanes.Length != 3 ||+ importedTori.Length != (hollow.BottomBlendRadius > 0 ? 2 : 0) ||+ (hollow.BottomBlendRadius > 0 &&+ (importedTori.Any(torus => System.Math.Abs(torus.MajorRadius - (cylinder.Radius - hollow.BottomBlendRadius)) > 1e-6) ||+ !importedTori.Any(torus => System.Math.Abs(torus.MinorRadius - hollow.BottomBlendRadius) < 1e-6) ||+ !importedTori.Any(torus => System.Math.Abs(torus.MinorRadius - (hollow.BottomBlendRadius - hollow.WallThickness)) < 1e-6))) ||+ !new[] { 0d, hollow.WallThickness, cylinder.Height }.All(z => importedPlanes.Any(p => System.Math.Abs(p - z) < 1e-6)) ||+ importedCylinders.Count(r => System.Math.Abs(r - feature.Diameter / 2) < 1e-6) != placements.Length ||+ importedCylinders.Count(r => System.Math.Abs(r - cylinder.Radius) < 1e-6) != 1 ||+ importedCylinders.Count(r => System.Math.Abs(r - (cylinder.Radius - hollow.WallThickness)) < 1e-6) != 1)+ return Failure("perforation-cylindrical-step-reimport-invalid: opening count or analytic radii changed");+ var cylindricalDescendants = placements.SelectMany(placement => new[]+ {+ new SemanticTopologyDescendant($"material:perforation:{placement.StableId}:wall", "Face", SemanticTopologyRole.HoleWallFace,+ $"perforation:{placement.StableId}", Face: cut.Value.TopologyMap.Faces[$"{placement.StableId}.Wall"],+ ParentStableId: cylindricalFeatureId, Addressability: SemanticTopologyAddressability.DerivedStable),+ new SemanticTopologyDescendant($"material:perforation:{placement.StableId}:outer-opening", "Loop", SemanticTopologyRole.HoleEntryLoop,+ $"perforation:{placement.StableId}", Loop: cut.Value.TopologyMap.Loops[$"{placement.StableId}.OuterOpening"],+ ParentStableId: cylindricalFeatureId, Addressability: SemanticTopologyAddressability.DerivedStable),+ new SemanticTopologyDescendant($"material:perforation:{placement.StableId}:inner-opening", "Loop", SemanticTopologyRole.HoleExitLoop,+ $"perforation:{placement.StableId}", Loop: cut.Value.TopologyMap.Loops[$"{placement.StableId}.InnerOpening"],+ ParentStableId: cylindricalFeatureId, Addressability: SemanticTopologyAddressability.DerivedStable),+ }).ToArray();+ var cylindricalCorrespondence = new SemanticTopologyCorrespondence(cylindricalFeatureId, cylindricalDescendants,+ ["Perforation", "BrepHollowRadialCutPattern"])+ {+ SourceSpans = new Dictionary<string, FirmamentV2SourceSpan> { [cylindricalFeatureId] = feature.SourceSpan }+ };+ var cylindricalHash = Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(cylindricalStep.Value)));+ var realizedPitch = 2 * System.Math.PI * (cylinder.Radius - hollow.WallThickness / 2) / cylindrical.Columns;+ var cylindricalReport = new FirmamentPerforationReport(cylindricalFeatureId, feature.SupportFace, feature.Layout,+ feature.Diameter, feature.Pitch, feature.Margin, feature.MinimumLigament, placements.Length,+ placements.Select(p => p.StableId).ToArray(), cylindricalBody.Topology.Vertices.Count(),+ cylindricalBody.Topology.Edges.Count(), cylindricalBody.Topology.Faces.Count(), true, true, cylindricalHash)+ {+ Rows = cylindrical.Rows, Columns = cylindrical.Columns,+ AngularPitchRadians = cylindrical.AngularPitchRadians,+ RealizedCircumferentialPitch = realizedPitch,+ MarginTop = feature.MarginTop ?? feature.Margin, MarginBottom = feature.MarginBottom ?? feature.Margin,+ MaximumCurveBoundMm = cut.Value.Certificates.Values.Max(c => System.Math.Max(c.OuterCurveBoundMm, c.InnerCurveBoundMm)),+ MaximumPcurveBoundMm = cut.Value.Certificates.Values.Max(c => new[] { c.OuterHostPcurveBoundMm, c.OuterToolPcurveBoundMm,+ c.InnerHostPcurveBoundMm, c.InnerToolPcurveBoundMm }.Max()),+ PatternBuildMilliseconds = patternBuildMilliseconds,+ StepExportMilliseconds = stepExportMilliseconds,+ StepReimportMilliseconds = stepReimportMilliseconds+ };+ return KernelResult<FirmamentStepExportResult>.Success(new FirmamentStepExportResult(cylindricalStep.Value,+ cylindricalFeatureId, 0, "perforation-cylindrical", "local-radial-through-wall", Perforation: cylindricalReport)+ { RuntimeBody = cylindricalBody, RuntimeCorrespondence = cylindricalCorrespondence });+ }if (document.Solid.Name != target || document.Solid.Box is not { Size.Count: 3 } box)return Failure("perforation-cylindrical-topology-unavailable: the piping authority constructs constant-thickness annular stock, but the current BRep Boolean route does not materialize radial cylinder-to-cylinder intersections on its wall");var plan = FirmamentPerforationPlanner.Plan(box.Size[0], box.Size[1], feature);diff --git a/Aetheris.Kernel.Firmament/FirmamentStepExportResult.cs b/Aetheris.Kernel.Firmament/FirmamentStepExportResult.csindex cf3c5937..2506c257 100644--- a/Aetheris.Kernel.Firmament/FirmamentStepExportResult.cs+++ b/Aetheris.Kernel.Firmament/FirmamentStepExportResult.cs@@ -46,7 +46,20 @@ public sealed record FirmamentPerforationReport(string FeatureId, string Support, string Layout, double Diameter, double Pitch,double Margin, double MinimumLigament, int InstanceCount,IReadOnlyList<string> InstanceIds, int Vertices, int Edges, int Faces,- bool Manifold, bool StepReimportedManifold, string StepSha256);+ bool Manifold, bool StepReimportedManifold, string StepSha256)+{+ public int? Rows { get; init; }+ public int? Columns { get; init; }+ public double? AngularPitchRadians { get; init; }+ public double? RealizedCircumferentialPitch { get; init; }+ public double? MarginTop { get; init; }+ public double? MarginBottom { get; init; }+ public double? MaximumCurveBoundMm { get; init; }+ public double? MaximumPcurveBoundMm { get; init; }+ public double? PatternBuildMilliseconds { get; init; }+ public double? StepExportMilliseconds { get; init; }+ public double? StepReimportMilliseconds { get; init; }+}public sealed record FirmamentGearItemReport(string Name,diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentCylindricalPerforationPlanner.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentCylindricalPerforationPlanner.csnew file mode 100644index 00000000..f6c0b8c2--- /dev/null+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentCylindricalPerforationPlanner.cs@@ -0,0 +1,81 @@+namespace Aetheris.Kernel.Firmament.FirmamentV2;++public sealed record FirmamentCylindricalPerforationInstance(int Row, int Column, double Z, double AngleRadians)+{+ public string StableId(string featureId) => $"{featureId}.Row{Row}.Col{Column}";+}++public sealed record FirmamentCylindricalPerforationPlan(+ IReadOnlyList<FirmamentCylindricalPerforationInstance> Instances,+ int Rows, int Columns, double AxialPitch, double AngularPitchRadians,+ string? Diagnostic)+{+ public bool Succeeded => Diagnostic is null;+}++/// <summary>+/// Source-space placement only. The full circumference always has an integer+/// column count, so the periodic seam never owns a duplicate instance.+/// </summary>+public static class FirmamentCylindricalPerforationPlanner+{+ private const int MaximumInstances = 1000;+ private const double Epsilon = 1e-9;++ public static FirmamentCylindricalPerforationPlan Plan(+ double outerRadius, double height, double wallThickness, FirmamentV2PerforationDecl feature)+ {+ FirmamentCylindricalPerforationPlan Reject(string code) => new([], 0, 0, 0, 0, code);+ if (feature.SupportFace != "OuterWall") return Reject("perforation-cylindrical-support-unsupported");+ if (feature.Layout is not ("CylindricalGrid" or "CylindricalStaggered"))+ return Reject("perforation-cylindrical-layout-invalid");+ if (System.Math.Abs(feature.OffsetX) > Epsilon || System.Math.Abs(feature.OffsetY) > Epsilon)+ return Reject("perforation-cylindrical-offset-unsupported");+ var axialPitch = feature.Pitch;+ var circumferentialPitch = feature.CircumferentialPitch ?? feature.Pitch;+ var top = feature.MarginTop ?? feature.Margin;+ var bottom = feature.MarginBottom ?? feature.Margin;+ var values = new[] { outerRadius, height, wallThickness, feature.Diameter, axialPitch,+ circumferentialPitch, top, bottom, feature.MinimumLigament, feature.StartAngleDegrees };+ if (values.Any(value => !double.IsFinite(value)) || outerRadius <= wallThickness || wallThickness <= 0 ||+ height <= wallThickness || feature.Diameter <= 0 || axialPitch <= 0 || circumferentialPitch <= 0 ||+ top < 0 || bottom < 0 || feature.MinimumLigament < 0)+ return Reject("perforation-cylindrical-dimension-invalid");+ var radius = feature.Diameter / 2;+ var innerRadius = outerRadius - wallThickness;+ if (radius >= innerRadius) return Reject("perforation-cylindrical-tangent-or-oversize");+ var minZ = Math.Max(wallThickness, bottom) + radius;+ var maxZ = height - top - radius;+ if (maxZ < minZ - Epsilon) return Reject("perforation-no-admissible-holes");+ if (axialPitch + Epsilon < feature.Diameter + feature.MinimumLigament)+ return Reject("perforation-hole-overlap");+ var midRadius = outerRadius - wallThickness / 2;+ var idealColumns = 2 * Math.PI * midRadius / circumferentialPitch;+ if (!double.IsFinite(idealColumns) || idealColumns < 2 || idealColumns > MaximumInstances * 2)+ return Reject("perforation-cylindrical-column-count-invalid");+ var columns = Math.Max(2, (int)Math.Round(idealColumns, MidpointRounding.AwayFromZero));+ var angularPitch = 2 * Math.PI / columns;+ // Clearance is checked at the smaller inner wall, where adjacent+ // radial cutters approach most closely.+ var chord = 2 * innerRadius * Math.Sin(angularPitch / 2);+ if (chord + Epsilon < feature.Diameter + feature.MinimumLigament)+ return Reject("perforation-hole-overlap");+ var rows = (int)Math.Floor((maxZ - minZ + Epsilon) / axialPitch) + 1;+ if (rows < 1) return Reject("perforation-no-admissible-holes");+ if ((long)rows * columns > MaximumInstances) return Reject("perforation-count-exceeded");+ var firstZ = minZ + (maxZ - minZ - (rows - 1) * axialPitch) / 2;+ var start = (feature.StartAngleDegrees % 360d) * Math.PI / 180;+ var instances = new List<FirmamentCylindricalPerforationInstance>(rows * columns);+ for (var row = 0; row < rows; row++)+ {+ var shift = feature.Layout == "CylindricalStaggered" && row % 2 == 1 ? 0.5 : 0;+ for (var column = 0; column < columns; column++)+ {+ var angle = (start + (column + shift) * angularPitch) % (2 * Math.PI);+ if (angle < 0) angle += 2 * Math.PI;+ instances.Add(new(row, column, firstZ + row * axialPitch, angle));+ }+ }+ return new(instances, rows, columns, axialPitch, angularPitch, null);+ }+}diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentPerforationPlanner.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentPerforationPlanner.csindex fe91a3d0..a4ac7a05 100644--- a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentPerforationPlanner.cs+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentPerforationPlanner.cs@@ -20,6 +20,8 @@ public static class FirmamentPerforationPlannerpublic static FirmamentPerforationPlan Plan(double width, double height, FirmamentV2PerforationDecl feature){if (feature.SupportFace != "+Z") return new([], "perforation-support-unsupported: only the planar +Z Box face is currently materialized");+ if (feature.CircumferentialPitch is not null || feature.MarginTop is not null || feature.MarginBottom is not null || feature.StartAngleDegrees != 0)+ return new([], "perforation-planar-cylindrical-field-unsupported: cylindrical-only fields cannot be applied to a planar Box");if (feature.Layout is not ("Grid" or "Hex")) return new([], "perforation-layout-invalid: expected Grid or Hex");if (!double.IsFinite(feature.Diameter) || feature.Diameter <= 0 || !double.IsFinite(feature.Pitch) || feature.Pitch <= 0)return new([], "perforation-dimension-invalid: Diameter and Pitch must be positive finite lengths");diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.csindex ec3e6b22..c18f43a3 100644--- a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs@@ -47,7 +47,7 @@ public sealed record FirmamentV2FeatureConceptDeclaration(string Name, Firmamentpublic enum FirmamentV2ConstructionPolicy { Solid, Hollow }/// <summary>Source-owned hollow intent. This is deliberately not a Boolean tool description.</summary>-public sealed record FirmamentV2HollowIntent(double WallThickness, IReadOnlyList<string> Openings, FirmamentV2SourceSpan SourceSpan);+public sealed record FirmamentV2HollowIntent(double WallThickness, IReadOnlyList<string> Openings, FirmamentV2SourceSpan SourceSpan, double BottomBlendRadius = 0);public sealed record FirmamentV2SolidBinding(string Name, string RecordType, FirmamentV2PrimitiveRecord Primitive, string? DerivedFrom = null, IReadOnlyDictionary<string, IReadOnlyList<double>>? Overrides = null, IReadOnlyDictionary<string, string>? Provenance = null, FirmamentV2ConstructionPolicy ConstructionPolicy = FirmamentV2ConstructionPolicy.Solid, FirmamentV2HollowIntent? Hollow = null, FirmamentV2SourceSpan? SourceSpan = null, IReadOnlyList<FirmamentV2AuthoredField>? AuthoredFields = null){@@ -305,7 +305,9 @@ public enum FirmamentV2ParseDispositionpublic sealed record FirmamentV2PerforationDecl(string Name, string SupportFace, string Layout, double Diameter, double Pitch,double Margin, double MinimumLigament, double OffsetX, double OffsetY,- FirmamentV2SourceSpan SourceSpan);+ FirmamentV2SourceSpan SourceSpan,+ double? CircumferentialPitch = null, double? MarginTop = null,+ double? MarginBottom = null, double StartAngleDegrees = 0);public sealed record FirmamentV2ParseResult(bool IsSuccess,diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.csindex acdd561f..a1680483 100644--- a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs@@ -412,7 +412,7 @@ public static class FirmamentV2ParserfeatureExpansion);}- if (Regex.IsMatch(source, @"\b(?:RoundedBox|Frustum|Box)\s*<\s*[A-Za-z_][A-Za-z0-9_]*\s*>\s+[A-Za-z_]", RegexOptions.CultureInvariant))+ if (Regex.IsMatch(source, @"\b(?:RoundedBox|Frustum|Cylinder|Box)\s*<\s*[A-Za-z_][A-Za-z0-9_]*\s*>\s+[A-Za-z_]", RegexOptions.CultureInvariant))return Recognized(ParsePrimitiveConstructionPolicyDocument(source, diagnostics));if (Regex.IsMatch(source, @"\bRoundedBox\s+[A-Za-z_]", RegexOptions.CultureInvariant))@@ -539,7 +539,7 @@ public static class FirmamentV2ParserModelRegex.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, @"\b(?:RoundedBox|Frustum|Cylinder|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)@@ -1645,7 +1645,7 @@ public static class FirmamentV2Parservar close = FindMatchingBrace(body, open);if (close < 0 || !names.Add(header.Groups["name"].Value)) { diagnostics.Add(CanonicalModifyMalformed); continue; }var featureBody = body[(open + 1)..close];- if (CanonicalBodyHasUnknownField(featureBody, ["On", "Diameter", "Layout", "Pitch", "Margin", "MinimumLigament", "OffsetX", "OffsetY"]))+ if (CanonicalBodyHasUnknownField(featureBody, ["On", "Diameter", "Layout", "Pitch", "Margin", "MinimumLigament", "OffsetX", "OffsetY", "CircumferentialPitch", "MarginTop", "MarginBottom", "StartAngle"])){ diagnostics.Add(CanonicalFieldUnknown); continue; }string? ReadWord(string name) => Regex.Match(featureBody, $@"\b{name}\s*:\s*(?<value>[A-Za-z_+\-][A-Za-z_0-9+\-]*)\b", RegexOptions.CultureInvariant) is { Success: true } match ? match.Groups["value"].Value : null;double ReadLength(string name, double fallback)@@ -1659,10 +1659,23 @@ public static class FirmamentV2Parservar diameter = ReadLength("Diameter", double.NaN); var pitch = ReadLength("Pitch", double.NaN);var margin = ReadLength("Margin", 0); var ligament = ReadLength("MinimumLigament", 0);var offsetX = ReadLength("OffsetX", 0); var offsetY = ReadLength("OffsetY", 0);+ var circumferentialPitch = ReadLength("CircumferentialPitch", double.NaN);+ var marginTop = ReadLength("MarginTop", double.NaN); var marginBottom = ReadLength("MarginBottom", double.NaN);+ var startAngleMatch = Regex.Match(featureBody, @"\bStartAngle\s*:\s*(?<value>[-+0-9.eE]+)deg\b", RegexOptions.CultureInvariant);+ var startAngle = !startAngleMatch.Success ? 0d : double.TryParse(startAngleMatch.Groups["value"].Value, NumberStyles.Float, CultureInfo.InvariantCulture, out var degrees) ? degrees : double.NaN;if (on is null || layout is null || !double.IsFinite(diameter) || diameter <= 0 || !double.IsFinite(pitch) || pitch <= 0 || !double.IsFinite(margin) || margin < 0 || !double.IsFinite(ligament) || ligament < 0 || !double.IsFinite(offsetX) || !double.IsFinite(offsetY)){ diagnostics.Add("perforation-field-invalid"); continue; }+ if (Regex.IsMatch(featureBody, @"\bStartAngle\s*:", RegexOptions.CultureInvariant) && !startAngleMatch.Success || !double.IsFinite(startAngle))+ { diagnostics.Add("perforation-field-invalid"); continue; }+ if (new[] { "CircumferentialPitch", "MarginTop", "MarginBottom" }.Any(name =>+ Regex.IsMatch(featureBody, $@"\b{name}\s*:", RegexOptions.CultureInvariant) &&+ double.IsNaN(name switch { "CircumferentialPitch" => circumferentialPitch, "MarginTop" => marginTop, _ => marginBottom })))+ { diagnostics.Add("perforation-field-invalid"); continue; }result.Add(new(header.Groups["name"].Value, on, layout, diameter, pitch, margin, ligament, offsetX, offsetY,- new FirmamentV2SourceSpan(bodyOffset + header.Index, close - header.Index + 1)));+ new FirmamentV2SourceSpan(bodyOffset + header.Index, close - header.Index + 1),+ double.IsNaN(circumferentialPitch) ? null : circumferentialPitch,+ double.IsNaN(marginTop) ? null : marginTop,+ double.IsNaN(marginBottom) ? null : marginBottom, startAngle));}return result;}@@ -2062,15 +2075,46 @@ public static class FirmamentV2Parser{var model = Regex.Match(source, @"^\s*(?:Struct|Model)\s+(?<name>[A-Za-z_][A-Za-z0-9_]*)", RegexOptions.CultureInvariant);var primitive = Regex.Match(source, @"\b(?<type>[A-Za-z_][A-Za-z0-9_]*)\s*<\s*(?<policy>[A-Za-z_][A-Za-z0-9_]*)\s*>\s+(?<name>[A-Za-z_][A-Za-z0-9_]*)\s*\{", RegexOptions.CultureInvariant);- if (!model.Success || !primitive.Success || Regex.Matches(source, @"\b(?:RoundedBox|Frustum|Box)\s*<\s*[A-Za-z_][A-Za-z0-9_]*\s*>\s+[A-Za-z_]", RegexOptions.CultureInvariant).Count != 1)+ if (!model.Success || !primitive.Success || Regex.Matches(source, @"\b(?:RoundedBox|Frustum|Cylinder|Box)\s*<\s*[A-Za-z_][A-Za-z0-9_]*\s*>\s+[A-Za-z_]", RegexOptions.CultureInvariant).Count != 1)return ConstructionPolicyParseFailure(diagnostics);var type = primitive.Groups["type"].Value;var policy = primitive.Groups["policy"].Value;if (policy != "Hollow") { diagnostics.Add(UnknownConstructionPolicy); return ConstructionPolicyParseFailure(diagnostics); }- if (type is not ("RoundedBox" or "Frustum")) { diagnostics.Add(PrimitiveDoesNotSatisfyHollowConstructible); return ConstructionPolicyParseFailure(diagnostics); }+ if (type is not ("RoundedBox" or "Frustum" or "Cylinder")) { diagnostics.Add(PrimitiveDoesNotSatisfyHollowConstructible); return ConstructionPolicyParseFailure(diagnostics); }var open = source.IndexOf('{', primitive.Index); var close = FindMatchingBrace(source, open);if (close < 0) return ConstructionPolicyParseFailure(diagnostics);+ FirmamentV2ModifyBlock? modification = null;+ var modify = Regex.Match(source[(close + 1)..], @"\bModify\s+(?<target>[A-Za-z_][A-Za-z0-9_]*)\s*\{", RegexOptions.CultureInvariant);+ if (modify.Success)+ {+ var absoluteOpen = close + 1 + modify.Index + modify.Length - 1;+ var modifyClose = FindMatchingBrace(source, absoluteOpen);+ if (type != "Cylinder" || modify.Groups["target"].Value != primitive.Groups["name"].Value || modifyClose < 0 ||+ Regex.Matches(source[(close + 1)..], @"\bModify\s+[A-Za-z_]", RegexOptions.CultureInvariant).Count != 1)+ {+ diagnostics.Add("firmament-v2-hollow-modify-unsupported");+ return ConstructionPolicyParseFailure(diagnostics);+ }+ var modifyBody = source[(absoluteOpen + 1)..modifyClose];+ var perforationHeader = CanonicalPerforationHeaderRegex.Match(modifyBody);+ var perforationOpen = perforationHeader.Success ? modifyBody.IndexOf('{', perforationHeader.Index) : -1;+ var perforationClose = perforationOpen >= 0 ? FindMatchingBrace(modifyBody, perforationOpen) : -1;+ var outsidePerforation = perforationClose < 0 ? modifyBody :+ modifyBody[..perforationHeader.Index] + modifyBody[(perforationClose + 1)..];+ var perforations = ParseCanonicalPerforations(modifyBody, absoluteOpen + 1, diagnostics);+ if (perforations.Count != 1 || perforations[0].SupportFace != "OuterWall" ||+ perforations[0].Layout is not ("CylindricalGrid" or "CylindricalStaggered") ||+ CanonicalPerforationHeaderRegex.Matches(modifyBody).Count != 1 ||+ outsidePerforation.Trim(' ', '\t', '\r', '\n', ';').Length != 0 ||+ Regex.IsMatch(modifyBody, @"\b(?:Hole|Region|EdgeFinish|Fillet|Chamfer)\b", RegexOptions.CultureInvariant) ||+ diagnostics.Any(IsFatalDiagnosticCode))+ {+ diagnostics.Add("firmament-v2-hollow-modify-unsupported");+ return ConstructionPolicyParseFailure(diagnostics);+ }+ modification = new FirmamentV2ModifyBlock(primitive.Groups["name"].Value, [], [], Perforations: perforations);+ }var body = source[(open + 1)..close];var thickness = Regex.Match(body, @"\bWallThickness\s*:\s*(?<value>[-+0-9.eE]+)mm\b", RegexOptions.CultureInvariant);if (!thickness.Success) { diagnostics.Add(WallThicknessRequired); return ConstructionPolicyParseFailure(diagnostics); }@@ -2094,6 +2138,18 @@ public static class FirmamentV2Parserreturn ConstructionPolicyParseFailure(diagnostics);record = new FirmamentV2RoundedBoxRecord(values, radius);}+ else if (type == "Cylinder")+ {+ double Read(string field)+ {+ var m = Regex.Match(body, $@"\b{field}\s*:\s*(?<value>[-+0-9.eE]+)mm\b", RegexOptions.CultureInvariant);+ return m.Success && double.TryParse(m.Groups["value"].Value, NumberStyles.Float, CultureInfo.InvariantCulture, out var value) ? value : double.NaN;+ }+ var radius = Read("Radius"); var height = Read("Height");+ if (!double.IsFinite(radius) || !double.IsFinite(height) || radius <= 0d || height <= 0d)+ return ConstructionPolicyParseFailure(diagnostics);+ record = new FirmamentV2CylinderRecord(radius, height);+ }else{double Read(string field)@@ -2107,10 +2163,28 @@ public static class FirmamentV2Parserrecord = new FirmamentV2FrustumRecord(bottom, top, height);}- var hollow = new FirmamentV2HollowIntent(wall, ["Top"], new FirmamentV2SourceSpan(primitive.Index, close - primitive.Index + 1));+ var bottomBlend = Regex.Match(body, @"\bBottomBlendRadius\s*:\s*(?<value>[-+0-9.eE]+)mm\b", RegexOptions.CultureInvariant);+ var bottomBlendRadius = 0d;+ if (!bottomBlend.Success && Regex.IsMatch(body, @"\bBottomBlendRadius\b", RegexOptions.CultureInvariant))+ {+ diagnostics.Add("firmament-v2-hollow-bottom-blend-invalid");+ return ConstructionPolicyParseFailure(diagnostics);+ }+ if (bottomBlend.Success)+ {+ if (type != "Cylinder" || !double.TryParse(bottomBlend.Groups["value"].Value, NumberStyles.Float, CultureInfo.InvariantCulture, out bottomBlendRadius) ||+ !double.IsFinite(bottomBlendRadius) || bottomBlendRadius <= wall || record is not FirmamentV2CylinderRecord cylinder ||+ bottomBlendRadius >= cylinder.Radius || bottomBlendRadius >= cylinder.Height)+ {+ diagnostics.Add("firmament-v2-hollow-bottom-blend-invalid");+ return ConstructionPolicyParseFailure(diagnostics);+ }+ }+ var hollow = new FirmamentV2HollowIntent(wall, ["Top"], new FirmamentV2SourceSpan(primitive.Index, close - primitive.Index + 1), bottomBlendRadius);var solid = new FirmamentV2SolidBinding(primitive.Groups["name"].Value, type, record, ConstructionPolicy: FirmamentV2ConstructionPolicy.Hollow, Hollow: hollow);diagnostics.Add("firmament-v2-hollow-policy-parsed"); diagnostics.Add("firmament-v2-parse-succeeded"); diagnostics.Sort(StringComparer.Ordinal);- return FirmamentV2ParseResult.Success(new FirmamentV2Document(model.Groups["name"].Value, "mm", [solid]), diagnostics.Distinct(StringComparer.Ordinal).ToArray());+ return FirmamentV2ParseResult.Success(new FirmamentV2Document(model.Groups["name"].Value, "mm", [solid],+ modification is null ? null : [modification]), diagnostics.Distinct(StringComparer.Ordinal).ToArray());}private static FirmamentV2ParseResult ConstructionPolicyParseFailure(List<string> diagnostics)diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/SemanticConstructDeclarations.cs b/Aetheris.Kernel.Firmament/FirmamentV2/SemanticConstructDeclarations.csindex 01bc86bd..709a0817 100644--- a/Aetheris.Kernel.Firmament/FirmamentV2/SemanticConstructDeclarations.cs+++ b/Aetheris.Kernel.Firmament/FirmamentV2/SemanticConstructDeclarations.cs@@ -18,15 +18,19 @@ public static class HoleSemanticDeclarationpublic static double ProjectDiameter(FirmamentV2SemanticHoleDecl instance) => instance.ShaftDiameter;}-[FirmamentConstruct("Perforation", "Perforation", Context = "Modify Box", Entry = "Modify Body { Perforation Vent { On: +Z; Diameter: 6mm; Layout: Hex; Pitch: 9mm; Margin: 8mm } }", Description = "One semantic field of circular through openings on a planar Box face.")]-[FirmamentField("On", "On", FirmamentSchemaValueKind.FaceSelector, Required = true, Description = "Semantic support face; X0 admits +Z on Box.")]+[FirmamentConstruct("Perforation", "Perforation", Context = "Modify body", Entry = "Modify Body { Perforation Vent { On: +Z; Diameter: 6mm; Layout: Hex; Pitch: 9mm; Margin: 8mm } }", Description = "One semantic field of circular through openings on a planar Box or cylindrical Hollow body.")]+[FirmamentField("On", "On", FirmamentSchemaValueKind.FaceSelector, Required = true, Description = "Semantic support face: +Z on Box or OuterWall on Cylinder<Hollow>.")][FirmamentField("Diameter", "Diameter", FirmamentSchemaValueKind.Length, Required = true, Description = "Circular opening diameter.")]-[FirmamentField("Layout", "Layout", FirmamentSchemaValueKind.Choice, Required = true, Choices = ["Grid", "Hex"], Description = "Grid rows or staggered hex rows.")]+[FirmamentField("Layout", "Layout", FirmamentSchemaValueKind.Choice, Required = true, Choices = ["Grid", "Hex", "CylindricalGrid", "CylindricalStaggered"], Description = "Planar or cylindrical grid and staggered layouts.")][FirmamentField("Pitch", "Pitch", FirmamentSchemaValueKind.Length, Required = true, Description = "Center spacing; Hex row spacing is sqrt(3)/2 times Pitch.")][FirmamentField("Margin", "Margin", FirmamentSchemaValueKind.Length, Default = "0mm", Description = "Clear material from each support edge to opening rim.")][FirmamentField("MinimumLigament", "MinimumLigament", FirmamentSchemaValueKind.Length, Default = "0mm", Description = "Additional minimum material between opening rims.")][FirmamentField("OffsetX", "OffsetX", FirmamentSchemaValueKind.Length, Default = "0mm", Description = "Pattern shift in support X.")][FirmamentField("OffsetY", "OffsetY", FirmamentSchemaValueKind.Length, Default = "0mm", Description = "Pattern shift in support Y.")]+[FirmamentField("CircumferentialPitch", "CircumferentialPitch", FirmamentSchemaValueKind.Length, Description = "Nominal circumferential pitch; full wrap is resolved to an integer number of columns.")]+[FirmamentField("MarginTop", "MarginTop", FirmamentSchemaValueKind.Length, Description = "Minimum material between top opening rim and vessel top.")]+[FirmamentField("MarginBottom", "MarginBottom", FirmamentSchemaValueKind.Length, Description = "Minimum material between bottom opening rim and vessel base.")]+[FirmamentField("StartAngle", "StartAngle", FirmamentSchemaValueKind.Angle, Description = "Angular phase of the first cylindrical column.")][FirmamentOutput("InstanceCount", "InstanceCount", "Count")][FirmamentOutput("Wall", "Wall", "Face", SourceRole = nameof(Materializer.SemanticTopologyRole.HoleWallFace))]public static class PerforationSemanticDeclaration { }diff --git a/docs/public/firmament/perforation.md b/docs/public/firmament/perforation.mdindex 690a0c00..8ac12458 100644--- a/docs/public/firmament/perforation.md+++ b/docs/public/firmament/perforation.md@@ -23,7 +23,35 @@ Model FlatHexPanel {`Margin` is material clearance between every hole rim and a box edge. A center outside that inset region is omitted; partial openings are never emitted. `Pitch` must exceed `Diameter` and leave at least `MinimumLigament` between adjacent rims. At most 1000 openings are admitted. The compiler reports the count and pattern-space identities such as `Panel.Vent.Row3.Col7`; every generated wall has source correspondence to the Perforation and its instance.-Current production support is a single Perforation on a Box `+Z` face. Cylindrical supports, including constant-thickness piping sleeves, currently produce `perforation-cylindrical-topology-unavailable`: the BRep Boolean route does not construct radial cylinder-to-cylinder intersections on an annular wall. This source form does not export an unperforated sleeve as if it were complete.+Production STEP support includes one Perforation on a Box `+Z` face or on the `OuterWall` of a `Cylinder<Hollow>`. Cylindrical layout accepts `CylindricalGrid` or `CylindricalStaggered`, axial `Pitch`, optional `CircumferentialPitch`, `MarginTop`, `MarginBottom`, `MinimumLigament`, and `StartAngle` in degrees. The compiler resolves an integer number of columns around the full circumference, centers axial rows in the allowed band, and assigns stable `RowN.ColM` identities. It checks spacing at the inner wall. The constructive BRep has one outer and one inner opening loop plus a local cutter-cylinder wall per instance; the opposite wall is not cut by an instance.++A top-open `Cylinder<Hollow>` may specify `BottomBlendRadius: 8mm` in its body. The lower outer and inner quarter-torus transitions share one major radius; their minor radii differ by `WallThickness`. This keeps the formed bottom transition at constant normal thickness. The radius must exceed wall thickness and remain below the cylinder radius and height. Perforation holes must clear the cylindrical wall's blend junction. The [blended utensil-holder fixture](../../../fixtures/Canonical/Presentation/ordning-utensil-holder-blended.firmament) keeps the 133-hole layout of the sharp-bottom blank.++```firmament+Struct PerforatedSleeve {+ Cylinder<Hollow> Body {+ Radius: 56mm+ Height: 142mm+ WallThickness: 0.8mm+ Openings: [Top]+ }+ Modify Body {+ Perforation Vents {+ On: OuterWall+ Diameter: 9mm+ Layout: CylindricalGrid+ Pitch: 15mm+ CircumferentialPitch: 18mm+ MarginTop: 12mm+ MarginBottom: 20mm+ MinimumLigament: 2mm+ StartAngle: 9deg+ }+ }+}+```++The full-wall pattern currently requires a clear angular location for the host's periodic parameter seam. Dense patterns whose openings cover every possible seam angle fail with `Brep.HollowRadialCutPattern.SeamClearance`; periodic split topology for that case is not yet available. SurfaceMeshIR does not yet support the trimmed cylindrical faces; use the BRep display tessellator or STEP wireframe route for display.Reproduce the flat witness with:diff --git a/docs/release/BREP-HOLLOW-RADIAL-CUT-X0.md b/docs/release/BREP-HOLLOW-RADIAL-CUT-X0.mdnew file mode 100644index 00000000..d655e95c--- /dev/null+++ b/docs/release/BREP-HOLLOW-RADIAL-CUT-X0.md@@ -0,0 +1,54 @@+# BREP-HOLLOW-RADIAL-CUT-X0++**Executive verdict: Accepted for one local radial through-wall hole.** `BrepHollowRadialCut.Build` constructs an exact-support BRep for one circular cut through the near wall of a `Cylinder<Hollow>` body. It creates one outer opening, one inner opening, and one connecting cutter-cylinder face; the opposite wall is retained. Production STEP export and reimport remain enclosed and manifold. This is a kernel feature, with no Firmament pattern or syntax extension.++## Canonical case and topology++The host uses the existing `ThinWalledBodyBRepPlanner.CreateCylinder(56, 142, 0.8)` semantic authority: outer radius 56 mm, inner radius 55.2 mm, height 142 mm, bottom thickness 0.8 mm, open top. One 9 mm diameter hole is centered at axial position 71 mm and angle 0.4 rad. The default finite cutter interval remains on the positive radial side, starts within the cavity, fully crosses both local wall intersections, and ends beyond the outside radius. Admission rejects incomplete extent, an interval reaching the opposite half, tangent/oversize holes, and end collisions.++The result contains **6 faces, 11 edges, 8 vertices, 9 loops, and 22 coedges**. There are 3 analytic cylinders (outer, inner, cutter) and 3 planes (outside bottom, inside bottom, top annulus). Each host cylinder has one opening loop with two certified B-spline edges. The one cutter wall face joins the four intersection edges and uses a single geometric seam edge twice with distinct periodic UV uses. Each edge has two adjacent face uses. The opening vertices have positive coordinate along the chosen radial axis; no opposite-side branch is constructed. Stable feature-local names are `RadialHole`, `RadialHole.OuterOpening`, `RadialHole.InnerOpening`, and `RadialHole.Wall`; `TopologyMap` resolves those names to this realization's loop, edge, and face IDs without making the numeric IDs the feature identity.++The host seam is placed a quarter turn from the opening, so a hole requested at the authored +X seam has one loop with **zero host seam splits**. There is one cutter seam edge with two periodic UV uses. The two exact intersection authorities each contribute one positive branch. Angles normalize modulo 2π; the 0 and 2π cases export byte-identical STEP. This is deterministic seam relocation, not duplicated `U=0`/`U=2π` topology. Face senses are assigned during constructive assembly. The STEP analyzer reports six derived face orientations agreeing with source; its one global shell flip also occurs on the earlier solid CrossHole STEP path, and no new orientation-repair pass was added.++## Exact geometry and certification++Both loops use the existing centerline-crossing, perpendicular cylinder-cylinder intersection authority with its **positive cutter-axis branch**: once at radius 56 mm and once at radius 55.2 mm. Each exact curve is realized as a qualified finite cubic B-spline, then given host and cutter pcurves by the existing adaptive realizer. Production topology does not use polylines, sampled mesh edges, voxels, or generic subtraction.++| Canonical bound | Outer | Inner |+| --- | ---: | ---: |+| 3D realized curve deviation | 9.8753 × 10⁻⁸ mm | 9.8828 × 10⁻⁸ mm |+| Host pcurve edge mismatch | 2.4091 × 10⁻⁷ mm | 2.4117 × 10⁻⁷ mm |+| Cutter pcurve edge mismatch | 4.5383 × 10⁻⁷ mm | 4.5920 × 10⁻⁷ mm |+| Cubic spans | 128 | 128 |++`BrepBindingValidator`, `BrepPcurveValidator` (every coedge), and `BrepExportPreflight` pass. The source and imported bodies have enclosed, consistently oriented shells and positive signed volume. CLI STEP analysis reports one enclosed-manifold body, the original 112 × 112 × 142 mm bounds, 6 faces, 11 edges, 8 vertices, 3 cylinders, 3 planes, 22 pcurves, and 3 seam pcurve pairs. The STEP file is 417,295 bytes.++An independent cross-sectional integral for the drilled region gives approximately **50.94 mm³** removed. The higher-resolution diagnostic triangulation estimates a **59.22 mm³** decrease, but its conservative error bounds are about 2,370 mm³ per body, so it is a trend check rather than an authoritative volume certificate. The default coarse triangulation exaggerates the difference and must not be used as a precise mass claim.++## Display and local artifacts++The supported BRep display tessellator returns nonempty patches for all six faces. The [shaded PNG](../../artifacts/local/hollow-radial-cut-x0/shaded.png) is a diagnostic raster of that display tessellation; it shows the one front-wall opening and an uncut opposite wall. The [wireframe PNG](../../artifacts/local/hollow-radial-cut-x0/wireframe.png) comes from the CLI's trim-aware STEP wireframe. The exact [STEP](../../artifacts/local/hollow-radial-cut-x0/single-hole.step), [SVG](../../artifacts/local/hollow-radial-cut-x0/wireframe.svg), and [analysis JSON](../../artifacts/local/hollow-radial-cut-x0/analysis.json) are local generated artifacts. SurfaceMeshIR still rejects trim topology on a cylindrical face in the `aetheris mesh` command; that path was not changed or used as a geometry fallback.++Reproduce the STEP and display OBJ by setting `AETHERIS_HOLLOW_RADIAL_CUT_STEP_OUTPUT` and `AETHERIS_HOLLOW_RADIAL_CUT_DISPLAY_OBJ_OUTPUT` to absolute paths, then running `dotnet test Aetheris.Kernel.Core.Tests -c Release --filter FullyQualifiedName~CanonicalLocalHole_IsManifoldAndRoundTrips`. Run `aetheris analyze` and `aetheris wireframe` on the STEP. The local `render_display.py` and `raster_wireframe.py` rasterize display output only; they do not construct or modify geometry.++## One-hole performance++One representative Release test run on this machine measured:++| Phase | Time |+| --- | ---: |+| Exact outer + inner intersections | 1.05 ms |+| Certified curve realization | 4.16 ms |+| Host + cutter pcurve realization | 3.87 ms |+| Topology and binding construction | 4.75 ms |+| Binding, pcurve, and export preflight validation | 20.90 ms |+| Complete `Build` including setup | 37.63 ms |+| BRep display tessellation | 725.79 ms |+| STEP export | 37.62 ms |+| STEP reimport | 516.94 ms |++These are single-run wall-clock observations, not throughput benchmarks. The current one-hole curve uses 128 cubic spans on each wall. No high-count optimization or patterning was attempted.++## Regression qualification++Focused Core tests pass for this feature, solid CrossHole, cylinder-cylinder intersection, and Hollow construction (36/36). The Core fast lane passes 970/970. The serial full solution gate completed with 7 failures: 2 CLI tests and 5 CTC03 SheetMetal tests; Core passed 1103/1103 and Firmament passed 1642/1642. The same seven tests fail with identical assertions on an isolated HEAD worktree, confirming they predate this change. They were not modified here. Logs remain under `artifacts/local/hollow-radial-cut-x0/`.diff --git a/docs/release/HOLLOW-BLEND-X0.md b/docs/release/HOLLOW-BLEND-X0.mdnew file mode 100644index 00000000..f44b3ff0--- /dev/null+++ b/docs/release/HOLLOW-BLEND-X0.md@@ -0,0 +1,21 @@+# HOLLOW-BLEND-X0 — coupled bottom transition++**Verdict: Accepted.** Aetheris builds the ORDNING-inspired perforated Hollow blank with a generous, constant-thickness lower transition and roundtrips its production STEP as one enclosed manifold.++## Construction++The authored `BottomBlendRadius: 8mm` is part of `Cylinder<Hollow>` stock. With 56 mm outer radius and 0.8 mm wall, the outer and inner quarter-tori have the same 48 mm major radius and respective 8 mm and 7.2 mm minor radii. They meet the wall at z=8 mm and the bottom planes at z=0 mm and z=0.8 mm. This paired normal offset preserves 0.8 mm through the bend. Invalid radii or holes intersecting the blend junction are rejected. The construction uses analytic cylinders, planes, and tori; it does not shell or independently fillet a finished solid.++The [canonical source](../../fixtures/Canonical/Presentation/ordning-utensil-holder-blended.firmament) retains 112 mm OD, 142 mm height, 0.8 mm wall, and the existing 7 × 19 local perforation grid. The top rim is intentionally outside this milestone.++## Qualification++- CLI build: 133 openings; 140 faces, 673 edges, 538 vertices; enclosed manifold before and after AP242 export/reimport.+- Reimported analytic supports: 135 cylinders, 3 planes, 2 tori. Bounding box: x/y ±56 mm, z 0–142 mm.+- BRep display tessellation produces all 140 face patches. The shaded render under `artifacts/local/hollow-blend-x0/` shows the lower 8 mm transition around the full circumference.+- On the recorded CLI run, pattern/BRep construction took 466 ms, STEP export 828 ms, and STEP reimport 3,960 ms. The STEP file is 57,361,059 bytes.+- `SurfaceMeshIR` still rejects trimmed cylindrical faces; this does not affect BRep display tessellation or STEP.++The Release solution build completed with zero errors. The fast Core lane passed 977 tests. The serial full solution lane passed Core 1110/1110 and Firmament 1649/1649; its seven CLI/SheetMetal failures are the same tests reproduced at parent HEAD in the preceding radial-cut milestone. See `artifacts/local/hollow-blend-x0/full-test-qualified.log` for the final run.++Reproduce with `dotnet run --project Aetheris.CLI -c Release -- build fixtures/Canonical/Presentation/ordning-utensil-holder-blended.firmament --output artifacts/local/hollow-blend-x0/ordning-utensil-holder-blended.step --json`. The ignored `artifacts/local/hollow-blend-x0/` directory contains the STEP, OBJ, and shaded PNG from this run.diff --git a/docs/release/ORDNING-X0.md b/docs/release/ORDNING-X0.mdnew file mode 100644index 00000000..46f6ed4d--- /dev/null+++ b/docs/release/ORDNING-X0.md@@ -0,0 +1,53 @@+# ORDNING-X0 — perforated utensil-holder witness++**Verdict: Meaningful progression.** The production Firmament path now creates a constant-thickness cylindrical Hollow body and exports/reimports it as an enclosed manifold STEP body. The presentation-quality perforated product is **not** accepted: cylindrical Hollow perforation and semantic circular edge finishing are not yet composed in this path. No hero render is claimed.++The visual reference suggests a compact, deep-drawn stainless utensil holder. This is an ORDNING-inspired design, not a dimensional or manufacturing-history reproduction. The intended lower blend would imply formed sheet, the softened rim would remove a sharp handling edge, and unperforated bands would keep holes clear of the formed regions. A 0.8 mm wall is a plausible design choice for a small stainless household vessel; it is not a measured IKEA gauge.++## Realized body++| Parameter | Value / status |+| --- | --- |+| Outer diameter | 112 mm |+| Height | 142 mm |+| Wall thickness | 0.8 mm, exact coaxial radial offset |+| Bottom thickness | 0.8 mm |+| Opening | Top, with planar annular rim |+| Lower blend | Not implemented; current bottom corner is sharp |+| Top edge finish | Not implemented; current rim edges are sharp |+| Perforations | 0; no cylindrical Hollow lowering yet |+| Material | Intended 304 stainless; no material assignment in this witness |++The proposed, **unrealized** presentation field is 8 rows × 20 columns = 160 local wall holes, 9 mm diameter, 15 mm vertical pitch, 18° angular pitch (about 17.6 mm arc pitch at the outside wall). Row centers would run from 22.5 to 127.5 mm, leaving 18 mm bottom and 10 mm top edge-to-hole margins. The intended lower outer blend radius is 8 mm, corresponding inner radius 7.2 mm, with a small rim finish constrained by the 0.8 mm sheet. These numbers are design targets only and have no current BRep or STEP witness.++The source is [ordning-utensil-holder-body-x0.firmament](../../fixtures/Canonical/Presentation/ordning-utensil-holder-body-x0.firmament):++```firmament+Struct OrdningInspiredUtensilHolderBody {+ Cylinder<Hollow> Body {+ Radius: 56mm+ Height: 142mm+ WallThickness: 0.8mm+ Openings: [Top]+ }+}+```++`Cylinder<Hollow>` is compiler-owned paired-boundary construction. The BRep has an outer cylinder, coaxial inner cylinder, two bottom planes, and an annular top face. The bottom is closed as material; the top is open into the cavity. No Boolean or mesh approximation is used.++## Qualification and reproduction++```powershell+dotnet run --project Aetheris.CLI -c Release -- build fixtures/Canonical/Presentation/ordning-utensil-holder-body-x0.firmament --output artifacts/local/ordning-x0/body.step --json+dotnet run --project Aetheris.CLI -c Release -- analyze artifacts/local/ordning-x0/body.step --json+```++The observed STEP reimport reports one enclosed-manifold body and shell, 5 faces, 4 edges, 4 vertices, 2 cylinders, 3 planes, and bounds `[-56,-56,0]` to `[56,56,142]` mm. The generated STEP is 3,811 bytes. The production build command took 1.29 s including CLI startup; this is not a kernel-only benchmark. Tessellation and render times are unavailable because the perforated presentation model does not exist.++Release build completed with 0 errors. Focused Hollow tests passed (7 Core and 4 Firmament); the fast Core lane passed 962/962. The serial solution gate did not pass: 2 CLI tests failed (`MeshObj_HexBolt...` quad count 905 vs 908, and `ValidateRoutesModuleShapedSheetMetal...`), and 5 CTC03 SheetMetal tests failed. Those failures are outside the new cylindrical Hollow route; their baseline status has not been established. The full test log is retained locally at `artifacts/local/ordning-x0/full-test.log`.++## Exact next boundary++The current `FirmamentPerforationPlanner` accepts only `+Z` on a planar Box. `BrepDiametralCrossHole.Build` handles a single diametral cut through a **solid** cylinder, which would create paired opposite wall openings and cannot be applied directly to this Hollow body. A local finite radial cutter must connect one opening on the outer cylinder to one on the inner cylinder, then repeat with deterministic instance topology and seam handling. This requires analytic cylinder-cylinder intersection trims and pcurves for both walls, plus one cutter wall per local hole; it is not a general Boolean.++The Hollow construction parser now rejects a following `Modify` block with `firmament-v2-hollow-modify-unsupported`, so it cannot silently export the unperforated body when a Perforation is requested. Circular lower-blend and rim chains also need compiler-owned edge identities and constant-thickness topology. Until those paths are qualified, the proposed 20-column by 8-row, 9 mm diameter field and 8 mm lower blend remain design intent, not realized geometry. STEP hole count, source provenance, seam quality, top safety, and hero visual quality therefore remain unverified.diff --git a/docs/release/PERFORATION-CYLINDRICAL-X1.md b/docs/release/PERFORATION-CYLINDRICAL-X1.mdnew file mode 100644index 00000000..6914be7c--- /dev/null+++ b/docs/release/PERFORATION-CYLINDRICAL-X1.md@@ -0,0 +1,86 @@+# PERFORATION-CYLINDRICAL-X1++## Executive verdict: Accepted for the admitted cylindrical pattern family++One semantic Firmament `Perforation` now constructs a deterministic field of local circular holes through **one wall** of a `Cylinder<Hollow>`. Grid and staggered layouts build a closed, manifold, exact-surface BRep. The 133-hole ORDNING-inspired blank exports and reimports as one AP242 body with 133 cutter-cylinder wall faces. Its source contains one Perforation declaration. This milestone makes a perforated blank; it does not add the lower formed blend or finished top rim of the later product witness.++The acceptance is bounded: the host-cylinder parameter seam must fit between openings. The builder chooses the largest angular gap and diagnoses layouts with no seam-clear position. Splitting an opening across the host seam remains separate work. The default BRep display mesh is coarse around 133 trims; the high-quality shaded artifact used a tighter display tolerance. Neither limit affects the exact STEP BRep for the accepted fixtures.++## Authoring and placement++The [ORDNING-inspired fixture](../../fixtures/Canonical/Perforation/cylindrical-ordning-blank.firmament) is:++```firmament+Struct OrdningInspiredPerforatedBlank {+ Cylinder<Hollow> Body {+ Radius: 56mm+ Height: 142mm+ WallThickness: 0.8mm+ Openings: [Top]+ }+ Modify Body {+ Perforation SideVents {+ On: OuterWall+ Diameter: 9mm+ Layout: CylindricalGrid+ Pitch: 15mm+ CircumferentialPitch: 18mm+ MarginTop: 12mm+ MarginBottom: 20mm+ MinimumLigament: 2mm+ StartAngle: 9deg+ }+ }+}+```++`Pitch` is axial center spacing in mm. `CircumferentialPitch` is a nominal physical spacing at the **mid-wall radius**. The planner rounds `2π × mid-wall radius / nominal pitch` to an integer column count and distributes those columns evenly over `[0, 2π)`. In this fixture that gives 19 columns and 18.387 mm realized mid-wall arc spacing, or 0.330694 rad angular pitch. The planner checks the minimum adjacent circumferential chord at the inner wall, plus axial pitch, against the diameter and minimum ligament. The valid center band is `bottom + hole radius` through `height − top − hole radius`; axial rows are centered in it. Seven rows × 19 columns yield **133 holes**. Grid rows align; staggered rows shift alternating angular positions by half a column pitch and wrap without a special last column.++Instances are emitted row-major with stable IDs such as `Body.SideVents.Row3.Col7`. No hand-authored hole list, seam duplicate, partial top/bottom hole, generic Boolean, mesh Boolean, or voxel operation is involved. Invalid pitch, overlap, exhausted margins, unsupported host, and count over 1000 return controlled diagnostics. A failed intersection/curve realization reports the instance ID and fails the whole feature.++## Constructive BRep and provenance++`BrepHollowRadialCutPattern` uses the same exact cylinder-cylinder intersection, qualified finite curves, and host/tool pcurve realization authorities as the accepted one-hole radial cut. It constructs the outer and inner host faces once, with one trim loop on each per instance, and creates one bounded cutter-cylinder wall face for each pair. The end caps and rim remain unchanged. A shared host seam is placed in the largest clear angular gap. The hole cutter stays on the positive local radial side; representative outer and inner opening vertices have positive radial coordinates, so no opposite-wall opening is introduced by an instance.++Every wall, outer opening, and inner opening has a deterministic pattern-space topology key. Runtime correspondence emits `HoleWallFace`, `HoleEntryLoop`, and `HoleExitLoop` descendants per instance, linked to the single source Perforation span. Numeric BRep IDs are realization details, not pattern identities. Exact intersection curves remain the authority beneath finite cubic edge representations. For the 133-hole fixture the largest certified curve deviation is **9.89 × 10⁻⁸ mm** and the largest host/tool pcurve mismatch bound is **4.60 × 10⁻⁷ mm**.++The source body's face/edge/vertex counts follow `5 + N`, `6 + 5N`, and `4 + 4N`. Every edge has two coedges. The 133-hole fixture has **138 faces, 671 edges, 536 vertices**. Production STEP reimport verifies one manifold body, the same face and analytic cylinder counts, outer radius 56 mm, inner radius 55.2 mm, 133 cutter radii of 4.5 mm, and planes at 0, 0.8, and 142 mm. CLI STEP analysis confirms one enclosed-manifold body, bounds **112 × 112 × 142 mm**, 135 analytic cylinders, three planes, 532 B-spline trims, and no unsupported surface or edge families. The open top and closed base remain from Hollow authority. The STEP hash is `9A5D3D0BCDDF9BFAD4E3DC63FAFD371D999A53E470801B74E9B75A89A120C132`.++## Witnesses and visual result++| Fixture | Layout | Rows × columns | Holes | STEP roundtrip |+| --- | --- | ---: | ---: | --- |+| `cylindrical-grid-8` | Grid | 1 × 8 | 8 | Manifold |+| `cylindrical-grid-24` | Grid | 3 × 8 | 24 | Manifold |+| `cylindrical-staggered-32` | Staggered | 4 × 8 | 32 | Manifold |+| `cylindrical-ordning-blank` | Grid | 7 × 19 | 133 | Manifold |++The [shaded blank](../../artifacts/local/perforation-cylindrical-x1/cylindrical-ordning-blank-shaded.png) comes from the supported BRep display tessellator at 0.01 mm chord tolerance and 1024 maximum segments. The [isometric wireframe](../../artifacts/local/perforation-cylindrical-x1/cylindrical-ordning-blank.wireframe.svg) comes from `aetheris wireframe` on the production STEP. The silhouette reads as an open, thin-wall utensil-holder blank with clean top and bottom material bands and regular cylindrical spacing. The rim and bottom corner remain primitive in this X1 blank by design.++## Performance and size++One warm-process Release/RyuJIT run on this machine, including in-process STEP export/reimport and default BRep display tessellation, measured:++| Holes | Pattern build | STEP export | STEP reimport | Default tessellation | Faces / edges / vertices | STEP size |+| ---: | ---: | ---: | ---: | ---: | ---: | ---: |+| 1 (accepted one-hole builder) | 47.8 ms | 38.3 ms | 931.4 ms | 417.4 ms | 6 / 11 / 8 | 0.41 MB |+| 8 | 33.8 ms | 38.1 ms | 603.2 ms | 457.6 ms | 13 / 46 / 36 | 3.21 MB |+| 32 | 36.9 ms | 322.6 ms | 1081.9 ms | 645.3 ms | 37 / 166 / 132 | 13.62 MB |+| 133 | 84.6 ms | 559.9 ms | 2748.8 ms | 1221.0 ms | 138 / 671 / 536 | 57.36 MB |++The timings are observations, not throughput guarantees. Reimport and STEP size dominate the 133-hole path. The high-quality 133-hole display tessellation took **14.44 s**; that expense is kept out of the normal test lane and used only for the gallery artifact. A separate CLI run, which includes process startup, build, export and reimport, took 2.4 s for 8 holes, 2.8 s for 32, and 5.9 s for 133. No high-count optimizer was added. WASM AOT was not measured.++## Qualification and remaining boundaries++The Core fast lane passed **972/972**. Focused tests cover seam-equivalent 0/2π placement and byte-stable STEP, two-hole and 24-hole manifold topology, 133-hole Firmament/STEP/display, staggered placement, thickness and diameter edits, overlap, exhausted margins, schema/language service, and source provenance. In the serial solution gate Core passed **1105/1105** and Firmament passed **1647/1647**. The gate had seven failures: two CLI tests (`MeshObj_HexBolt_ExportsStructuredPolygonsDirectlyFromSurfaceMeshIr`, `ValidateRoutesModuleShapedSheetMetalThroughDomainCompiler`) and five CTC03 SheetMetal tests. The same seven were reproduced at parent HEAD during the preceding radial-cut milestone. A Hollow-policy test initially exposed an overly broad parser admission in this change; the parser was corrected and the subsequent gate passed that test. The full run log is under `artifacts/local/perforation-cylindrical-x1/full-test-final.log`.++SurfaceMeshIR still rejects trimmed cylindrical faces (`SurfaceMeshIR does not support trim topology on cylindrical face 134`); the supported BRep display tessellator and STEP wireframe paths succeed. Dense layouts with no angular seam gap return `Brep.HollowRadialCutPattern.SeamClearance`. The exact geometry remains available for admitted layouts, including the ORDNING-scale witness; the kernel does not fabricate a partial or opposite-wall cut. This X1 does not add ORDNING's formed lower blend or safe upper edge.++The CLI analysis currently labels imported length units as assumed mm because unit metadata is not preserved by the STEP importer. The source and reimported coordinates and analytic radii match the authored millimeter dimensions; unit-metadata retention is outside this milestone.++Reproduce the production artifact with:++```text+dotnet run --project Aetheris.CLI -c Release -- build fixtures/Canonical/Perforation/cylindrical-ordning-blank.firmament --output artifacts/local/perforation-cylindrical-x1/cylindrical-ordning-blank.step --json+dotnet run --project Aetheris.CLI -c Release -- wireframe artifacts/local/perforation-cylindrical-x1/cylindrical-ordning-blank.step --out artifacts/local/perforation-cylindrical-x1/cylindrical-ordning-blank.wireframe.svg --view iso --density 4 --json+```diff --git a/fixtures/Canonical/Perforation/cylindrical-grid-24.firmament b/fixtures/Canonical/Perforation/cylindrical-grid-24.firmamentnew file mode 100644index 00000000..2b663a3b--- /dev/null+++ b/fixtures/Canonical/Perforation/cylindrical-grid-24.firmament@@ -0,0 +1,21 @@+Struct CylindricalGrid24 {+ Cylinder<Hollow> Body {+ Radius: 24mm+ Height: 60mm+ WallThickness: 0.8mm+ Openings: [Top]+ }+ Modify Body {+ Perforation Vents {+ On: OuterWall+ Diameter: 5mm+ Layout: CylindricalGrid+ Pitch: 14mm+ CircumferentialPitch: 18.5mm+ MarginTop: 13mm+ MarginBottom: 13mm+ MinimumLigament: 2mm+ StartAngle: 0deg+ }+ }+}diff --git a/fixtures/Canonical/Perforation/cylindrical-grid-8.firmament b/fixtures/Canonical/Perforation/cylindrical-grid-8.firmamentnew file mode 100644index 00000000..bfe975b8--- /dev/null+++ b/fixtures/Canonical/Perforation/cylindrical-grid-8.firmament@@ -0,0 +1,21 @@+Struct CylindricalGrid8 {+ Cylinder<Hollow> Body {+ Radius: 24mm+ Height: 60mm+ WallThickness: 0.8mm+ Openings: [Top]+ }+ Modify Body {+ Perforation Vents {+ On: OuterWall+ Diameter: 5mm+ Layout: CylindricalGrid+ Pitch: 14mm+ CircumferentialPitch: 18.5mm+ MarginTop: 26mm+ MarginBottom: 26mm+ MinimumLigament: 2mm+ StartAngle: 0deg+ }+ }+}diff --git a/fixtures/Canonical/Perforation/cylindrical-ordning-blank.firmament b/fixtures/Canonical/Perforation/cylindrical-ordning-blank.firmamentnew file mode 100644index 00000000..e9e7ccd5--- /dev/null+++ b/fixtures/Canonical/Perforation/cylindrical-ordning-blank.firmament@@ -0,0 +1,21 @@+Struct OrdningInspiredPerforatedBlank {+ Cylinder<Hollow> Body {+ Radius: 56mm+ Height: 142mm+ WallThickness: 0.8mm+ Openings: [Top]+ }+ Modify Body {+ Perforation SideVents {+ On: OuterWall+ Diameter: 9mm+ Layout: CylindricalGrid+ Pitch: 15mm+ CircumferentialPitch: 18mm+ MarginTop: 12mm+ MarginBottom: 20mm+ MinimumLigament: 2mm+ StartAngle: 9deg+ }+ }+}diff --git a/fixtures/Canonical/Perforation/cylindrical-staggered-32.firmament b/fixtures/Canonical/Perforation/cylindrical-staggered-32.firmamentnew file mode 100644index 00000000..754c1f78--- /dev/null+++ b/fixtures/Canonical/Perforation/cylindrical-staggered-32.firmament@@ -0,0 +1,21 @@+Struct CylindricalStaggered32 {+ Cylinder<Hollow> Body {+ Radius: 30mm+ Height: 90mm+ WallThickness: 0.8mm+ Openings: [Top]+ }+ Modify Body {+ Perforation Vents {+ On: OuterWall+ Diameter: 6mm+ Layout: CylindricalStaggered+ Pitch: 17mm+ CircumferentialPitch: 23.25mm+ MarginTop: 12mm+ MarginBottom: 12mm+ MinimumLigament: 2mm+ StartAngle: 0deg+ }+ }+}diff --git a/fixtures/Canonical/Presentation/ordning-utensil-holder-blended.firmament b/fixtures/Canonical/Presentation/ordning-utensil-holder-blended.firmamentnew file mode 100644index 00000000..52bcb12c--- /dev/null+++ b/fixtures/Canonical/Presentation/ordning-utensil-holder-blended.firmament@@ -0,0 +1,23 @@+Struct OrdningInspiredBlendedBlank {+ Cylinder<Hollow> Body {+ Radius: 56mm+ Height: 142mm+ WallThickness: 0.8mm+ BottomBlendRadius: 8mm+ Openings: [Top]+ }+ Modify Body {+ Perforation SideVents {+ On: OuterWall+ Diameter: 9mm+ Layout: CylindricalGrid+ Pitch: 15mm+ CircumferentialPitch: 18mm+ MarginTop: 12mm+ MarginBottom: 20mm+ MinimumLigament: 2mm+ StartAngle: 9deg+ }+ }+}+diff --git a/fixtures/Canonical/Presentation/ordning-utensil-holder-body-x0.firmament b/fixtures/Canonical/Presentation/ordning-utensil-holder-body-x0.firmamentnew file mode 100644index 00000000..27330902--- /dev/null+++ b/fixtures/Canonical/Presentation/ordning-utensil-holder-body-x0.firmament@@ -0,0 +1,8 @@+Struct OrdningInspiredUtensilHolderBody {+ Cylinder<Hollow> Body {+ Radius: 56mm+ Height: 142mm+ WallThickness: 0.8mm+ Openings: [Top]+ }+}