Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Add shaft hole semantics and curved face domain bounds
Yuechen Lic343bea2a6ea
diff --git a/Aetheris.CLI/CliRunner.cs b/Aetheris.CLI/CliRunner.csindex 02f2c7e7..9423b745 100644--- a/Aetheris.CLI/CliRunner.cs+++ b/Aetheris.CLI/CliRunner.cs@@ -550,7 +550,8 @@ public static class CliRunnername = stack.Feature.Name, frame = stack.Feature.Frame, axis = stack.Feature.Axis,placement = new { stack.Feature.Placement.Name, anchor = new[] { stack.Feature.Placement.AnchorX, stack.Feature.Placement.AnchorY, stack.Feature.Placement.AnchorZ }, profilePlane = stack.Feature.Placement.ProfilePlane, stack.Feature.Placement.Axis, stack.Feature.Placement.ReferenceDirection, stack.Feature.Placement.IsExplicit },signatures = new { composition = CompositionSignature(stack), profiles = parsed.Profiles.OrderBy(x => x.Key, StringComparer.Ordinal).ToDictionary(x => x.Key, x => ProfileSignature(x.Value), StringComparer.Ordinal) },- operations = stack.Feature.Operations.Select(x => new { x.Name, intent = x.Intent.ToString(), profile = x.ProfileReference, x.From, x.To, x.SemanticRole, x.SourceSpan, signature = Hash($"{x.Intent}|{x.ProfileReference}|{x.From:R}|{x.To:R}|{x.SemanticRole}") }),+ operations = stack.Feature.Operations.Select(x => new { x.Name, intent = x.Intent.ToString(), profile = x.ProfileReference, x.From, x.To, x.SemanticRole, x.SourceSpan, x.SemanticFeatureId, x.SemanticFeatureKind, x.Diameter, signature = Hash($"{x.Intent}|{x.ProfileReference}|{x.From:R}|{x.To:R}|{x.SemanticRole}|{x.SemanticFeatureId}|{x.Diameter:R}") }),+ shaftHoles = (stack.Feature.ShaftHoles ?? []).Select(x => new { x.Name, x.StableId, profile = x.ProfileReference, center = new[] { x.CenterX, x.CenterY }, x.Diameter, x.From, x.To, endCondition = "ThroughAll", x.SemanticRole, x.SourceSpan }),criticalLevels = stack.Feature.CriticalLevels,slabs = stack.Slabs.Select(x => new{diff --git a/Aetheris.Kernel.Core/Brep/Queries/AnalyticDisplayPacket.cs b/Aetheris.Kernel.Core/Brep/Queries/AnalyticDisplayPacket.csindex 81a55676..1715c8af 100644--- a/Aetheris.Kernel.Core/Brep/Queries/AnalyticDisplayPacket.cs+++ b/Aetheris.Kernel.Core/Brep/Queries/AnalyticDisplayPacket.cs@@ -20,7 +20,7 @@ public enum AnalyticDisplayShellRoleUnknown,}-public readonly record struct AnalyticDisplayFaceDomainHint(double? MinV, double? MaxV);+public readonly record struct AnalyticDisplayFaceDomainHint(double? MinU, double? MaxU, double? MinV, double? MaxV);public sealed record AnalyticDisplayFaceEntry(FaceId FaceId,@@ -108,11 +108,13 @@ public static class AnalyticDisplayPacketBuilderswitch (surface.Kind){case SurfaceGeometryKind.Cylinder when surface.Cylinder is CylinderSurface cylinder:- ResolveAxialBounds(body, faceId, cylinder.Axis, cylinder.Origin, out var cylinderMin, out var cylinderMax);- return new AnalyticDisplayFaceDomainHint(cylinderMin, cylinderMax);+ return ResolveFaceDomain(body, faceId, cylinder.Origin, cylinder.Axis, cylinder.XAxis, cylinder.YAxis);case SurfaceGeometryKind.Cone when surface.Cone is ConeSurface cone:- ResolveAxialBounds(body, faceId, cone.Axis, cone.Apex, out var coneMin, out var coneMax);- return new AnalyticDisplayFaceDomainHint(coneMin, coneMax);+ var coneAxis = cone.Axis.ToVector();+ var reference = cone.ReferenceAxis.ToVector();+ var coneX = Direction3D.Create(reference - (coneAxis * reference.Dot(coneAxis)));+ var coneY = Direction3D.Create(coneAxis.Cross(coneX.ToVector()));+ return ResolveFaceDomain(body, faceId, cone.Apex, cone.Axis, coneX, coneY);default:return null;}@@ -144,34 +146,58 @@ public static class AnalyticDisplayPacketBuilderreturn result;}- private static void ResolveAxialBounds(BrepBody body, FaceId sideFaceId, Direction3D axis, Point3D axisOrigin, out double? minV, out double? maxV)+ private static AnalyticDisplayFaceDomainHint ResolveFaceDomain(BrepBody body, FaceId faceId, Point3D origin, Direction3D axis, Direction3D xAxis, Direction3D yAxis){- minV = null;- maxV = null;- var axisVector = axis.ToVector();-- foreach (var faceBinding in body.Bindings.FaceBindings.OrderBy(binding => binding.FaceId.Value))+ var samples = new List<Point3D>();+ var hasFullCircleBoundary = false;+ foreach (var loopId in body.Topology.GetFace(faceId).LoopIds)+ foreach (var coedgeId in body.Topology.GetLoop(loopId).CoedgeIds){- if (faceBinding.FaceId == sideFaceId)- {- continue;- }-- var surface = body.Geometry.GetSurface(faceBinding.SurfaceGeometryId);- if (surface.Kind != SurfaceGeometryKind.Plane || surface.Plane is not PlaneSurface plane)+ var edgeId = body.Topology.GetCoedge(coedgeId).EdgeId;+ var edge = body.Topology.GetEdge(edgeId);+ if (body.TryGetVertexPoint(edge.StartVertexId, out var start)) samples.Add(start);+ if (body.TryGetVertexPoint(edge.EndVertexId, out var end)) samples.Add(end);+ if (!body.Bindings.TryGetEdgeBinding(edgeId, out var binding)+ || binding.TrimInterval is not { } trim+ || !body.Geometry.TryGetCurve(binding.CurveGeometryId, out var curve)+ || curve?.Circle3 is not { } circle){continue;}+ if (trim.End - trim.Start >= (2d * double.Pi) - 1e-7d) hasFullCircleBoundary = true;+ else samples.Add(circle.Evaluate((trim.Start + trim.End) / 2d));+ }- var dot = plane.Normal.ToVector().Dot(axisVector);- if (double.Abs(double.Abs(dot) - 1d) > 1e-6d)+ var axisVector = axis.ToVector();+ var axial = samples.Select(point => (point - origin).Dot(axisVector)).ToArray();+ var minV = axial.Length > 0 ? axial.Min() : (double?)null;+ var maxV = axial.Length > 0 ? axial.Max() : (double?)null;+ if (hasFullCircleBoundary) return new(null, null, minV, maxV);++ var x = xAxis.ToVector();+ var y = yAxis.ToVector();+ var angles = samples.Select(point => point - origin)+ .Select(radial => double.Atan2(radial.Dot(y), radial.Dot(x)))+ .Select(angle => angle < 0d ? angle + (2d * double.Pi) : angle)+ .Order()+ .Aggregate(new List<double>(), (unique, angle) =>{- continue;- }-- var v = (plane.Origin - axisOrigin).Dot(axisVector);- minV = minV.HasValue ? double.Min(minV.Value, v) : v;- maxV = maxV.HasValue ? double.Max(maxV.Value, v) : v;+ if (unique.Count == 0 || double.Abs(unique[^1] - angle) > 1e-7d) unique.Add(angle);+ return unique;+ });+ if (angles.Count < 2) return new(null, null, minV, maxV);++ var largestGap = double.NegativeInfinity;+ var gapIndex = 0;+ for (var i = 0; i < angles.Count; i++)+ {+ var next = i + 1 < angles.Count ? angles[i + 1] : angles[0] + (2d * double.Pi);+ var gap = next - angles[i];+ if (gap > largestGap) { largestGap = gap; gapIndex = i; }}+ var minU = angles[(gapIndex + 1) % angles.Count];+ var maxU = angles[gapIndex];+ if (maxU < minU) maxU += 2d * double.Pi;+ return new(minU, maxU, minV, maxV);}}diff --git a/Aetheris.Kernel.Core/Brep/Tessellation/PlanarPolygonTriangulator.cs b/Aetheris.Kernel.Core/Brep/Tessellation/PlanarPolygonTriangulator.csindex 8773b4e8..379baff3 100644--- a/Aetheris.Kernel.Core/Brep/Tessellation/PlanarPolygonTriangulator.cs+++ b/Aetheris.Kernel.Core/Brep/Tessellation/PlanarPolygonTriangulator.cs@@ -577,6 +577,7 @@ internal static class PlanarPolygonTriangulator}var node = start;+ var end = start;var changed = false;do{@@ -584,23 +585,31 @@ internal static class PlanarPolygonTriangulatorif (PointsAlmostEqual(node.Point, node.Next!.Point)){+ if (node == node.Next) return null;+ var removesEnd = node == end;+ var previous = node.Prev!;RemoveNode(node);- node = node.Prev!;+ node = previous;+ if (removesEnd) end = previous;changed = true;}else if (double.Abs(Orientation(node.Prev!.Point, node.Point, node.Next.Point)) <= Epsilon){+ if (node == node.Next) return null;+ var removesEnd = node == end;+ var previous = node.Prev!;RemoveNode(node);- node = node.Prev!;+ node = previous;+ if (removesEnd) end = previous;changed = true;}else{node = node.Next!;}- } while (changed || node != start);+ } while (changed || node != end);- return node;+ return end;}private static void RemoveNode(Node node)diff --git a/Aetheris.Kernel.Firmament.Tests/PrismaticProfileCompositionRoundTripTests.cs b/Aetheris.Kernel.Firmament.Tests/PrismaticProfileCompositionRoundTripTests.csindex 3d51e9cf..cd5eb597 100644--- a/Aetheris.Kernel.Firmament.Tests/PrismaticProfileCompositionRoundTripTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/PrismaticProfileCompositionRoundTripTests.cs@@ -1,5 +1,6 @@using Aetheris.Kernel.Core.Brep.Verification;using Aetheris.Kernel.Core.Brep.Tessellation;+using Aetheris.Kernel.Core.Brep.Queries;using Aetheris.Kernel.Core.Step242;using Aetheris.Kernel.Firmament.Materializer;@@ -100,6 +101,31 @@ public sealed class PrismaticProfileCompositionRoundTripTestsAssert.InRange(Math.Abs(m8.AbsoluteVolume - stack.AnalyticVolume), 0d, 5d);}+ [Fact]+ public void Ctc01X4_MultipleCurvedInnerLoopsTessellateAndRespectVoidOrientation()+ {+ var source = File.ReadAllText(Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..", "..", "..", "..", "testdata", "firmament", "reconstructions", "nist_ctc_01", "ctc01_prismatic_blockout_x4.firmament")));+ var parsed = PrismaticProfileCompositionParser.Parse(source);+ var stack = Assert.IsType<PrismaticSectionStackConstruction>(PrismaticSectionStackCompiler.Normalize(parsed, out var diagnostics));+ Assert.Empty(diagnostics);++ var emitted = PrismaticSectionStackEmitter.Emit(stack);+ var body = Assert.IsType<Aetheris.Kernel.Core.Brep.BrepBody>(emitted.Body);+ var holeWalls = emitted.Correspondence!.Descendants+ .Where(descendant => descendant.Role == SemanticTopologyRole.HoleWallFace)+ .Select(descendant => descendant.Face!.Value)+ .Distinct()+ .ToArray();+ Assert.Equal(32, holeWalls.Length);+ Assert.All(holeWalls, face => Assert.False(body.Bindings.FaceBindings.Single(binding => binding.FaceId == face).SameSense));++ var m8 = BrepMassProperties.Evaluate(body);+ Assert.NotEqual(BrepMassPropertiesStatus.Unavailable, m8.Status);+ Assert.True(m8.IsEnclosed, string.Join(" | ", m8.Diagnostics));+ Assert.True(m8.IsOrientationConsistent, string.Join(" | ", m8.Diagnostics));+ Assert.InRange(Math.Abs(m8.AbsoluteVolume - stack.AnalyticVolume), 0d, m8.ErrorBound ?? 0d);+ }+[Fact]public void MixedLineArcAdditiveOverlap_PreservesAnalyticCurvesAcrossStepRoundTrip(){@@ -187,6 +213,70 @@ public sealed class PrismaticProfileCompositionRoundTripTestsAssert.Equal(expectedVolume, reimported.AbsoluteVolume, 6);}+ [Fact]+ public void SemanticThroughShaftHoles_UseActualHostBoundaryAndPublishTypedCorrespondence()+ {+ var source = """+ Concept Struct Layout On XY {+ Rect2 BaseGuide { Center: [0mm, 0mm]; Size: [30mm, 20mm]; Role: ProfileGuide }+ Rect2 PadGuide { Center: [0mm, 0mm]; Size: [6mm, 6mm]; Role: ProfileGuide }+ }+ Profile BaseProfile Using Layout { Loop Outer {+ Segment South { Trace: BaseGuide.Bottom; From: BaseGuide.BottomLeft; To: BaseGuide.BottomRight }+ Segment East { Trace: BaseGuide.Right; From: BaseGuide.BottomRight; To: BaseGuide.TopRight }+ Segment North { Trace: BaseGuide.Top; From: BaseGuide.TopRight; To: BaseGuide.TopLeft }+ Segment West { Trace: BaseGuide.Left; From: BaseGuide.TopLeft; To: BaseGuide.BottomLeft }+ } }+ Profile PadProfile Using Layout { Loop Outer {+ Segment South { Trace: PadGuide.Bottom; From: PadGuide.BottomLeft; To: PadGuide.BottomRight }+ Segment East { Trace: PadGuide.Right; From: PadGuide.BottomRight; To: PadGuide.TopRight }+ Segment North { Trace: PadGuide.Top; From: PadGuide.TopRight; To: PadGuide.TopLeft }+ Segment West { Trace: PadGuide.Left; From: PadGuide.TopLeft; To: PadGuide.BottomLeft }+ } }+ Struct Composition { Compose Body {+ Base Stock { Profile: BaseProfile; From: 0mm; To: 10mm; Role: Stock }+ Add Pad { Profile: PadProfile; From: 10mm; To: 15mm; Role: Pad }+ Hole<Shaft> LeftMount { Center: [-10mm, 3mm]; Diameter: 4mm; End: ThroughAll; Role: MountingHole }+ Hole<Shaft> RightMount { Center: [10mm, 3mm]; Diameter: 4mm; End: ThroughAll; Role: MountingHole }+ } }+ """;++ var parsed = PrismaticProfileCompositionParser.Parse(source);+ Assert.Empty(parsed.Diagnostics);+ Assert.Equal(2, parsed.Feature!.ShaftHoles!.Count);+ var normalized = PrismaticSectionStackCompiler.Normalize(parsed, out var diagnostics);+ Assert.True(normalized is not null, string.Join(" | ", diagnostics));+ var stack = normalized!;+ Assert.Empty(diagnostics);+ Assert.Equal(2, Assert.Single(stack.Slabs, slab => slab.From == 0d && slab.To == 10d).Region.Holes.Count);+ Assert.Equal(6180d - 80d * Math.PI, stack.AnalyticVolume, 8);++ var emitted = PrismaticSectionStackEmitter.Emit(stack);+ Assert.DoesNotContain(emitted.Diagnostics, diagnostic => diagnostic.StartsWith("compose-rejected", StringComparison.Ordinal));+ var body = Assert.IsType<Aetheris.Kernel.Core.Brep.BrepBody>(emitted.Body);+ var correspondence = Assert.IsType<SemanticTopologyCorrespondence>(emitted.Correspondence);+ const string sourceId = "hole:Body.LeftMount";+ Assert.Single(correspondence.Descendants, descendant => descendant.SourceStableId == sourceId && descendant.Role == SemanticTopologyRole.HoleEntryLoop);+ Assert.Single(correspondence.Descendants, descendant => descendant.SourceStableId == sourceId && descendant.Role == SemanticTopologyRole.HoleExitLoop);+ Assert.Equal(4, correspondence.Descendants.Count(descendant => descendant.SourceStableId == sourceId && descendant.Role == SemanticTopologyRole.HoleWallFace));+ var wallFaceIds = correspondence.Descendants.Where(descendant => descendant.SourceStableId == sourceId && descendant.Role == SemanticTopologyRole.HoleWallFace).Select(descendant => descendant.Face!.Value).ToHashSet();+ var wallDisplayFaces = AnalyticDisplayPacketBuilder.Build(body).AnalyticFaces.Where(face => wallFaceIds.Contains(face.FaceId)).ToArray();+ Assert.Equal(4, wallDisplayFaces.Length);+ Assert.All(wallDisplayFaces, face =>+ {+ Assert.NotNull(face.DomainHint);+ Assert.Equal(Math.PI / 2d, face.DomainHint!.Value.MaxU!.Value - face.DomainHint.Value.MinU!.Value, 8);+ Assert.Equal(10d, face.DomainHint.Value.MaxV!.Value - face.DomainHint.Value.MinV!.Value, 8);+ });+ var entry = SemanticTopologySelectionResolver.Resolve(body, correspondence,+ new("selection:left-entry", "LeftEntry", "Body", [sourceId], SemanticTopologyRole.HoleEntryLoop, SemanticSelectionRequirement.ClosedLoop, "test"));+ Assert.True(entry.Succeeded, string.Join(" | ", entry.Diagnostics));+ Assert.True(entry.IsClosed);+ var entryEdge = body.Topology.Edges.Single(edge => edge.Id == body.Topology.Coedges.First(coedge => coedge.LoopId == entry.Descendants.Single().Loop).EdgeId);+ Assert.True(body.TryGetVertexPoint(entryEdge.StartVertexId, out var entryPoint));+ Assert.Equal(10d, entryPoint.Z, 8);+ }+private static string Source(string kind) => $$"""Concept Struct Layout On XY {Rect2 Base { Center: [0mm, 0mm]; Size: [20mm, 20mm]; Role: ProfileGuide }diff --git a/Aetheris.Kernel.Firmament/Materializer/PrismaticProfileComposition.cs b/Aetheris.Kernel.Firmament/Materializer/PrismaticProfileComposition.csindex 4ee9748e..383d236d 100644--- a/Aetheris.Kernel.Firmament/Materializer/PrismaticProfileComposition.cs+++ b/Aetheris.Kernel.Firmament/Materializer/PrismaticProfileComposition.cs@@ -10,13 +10,17 @@ namespace Aetheris.Kernel.Firmament.Materializer;public enum PrismaticProfileIntent { Base, Add, Remove }public sealed record PrismaticProfileOperation(string Name, PrismaticProfileIntent Intent, string ProfileReference, double From, double To,- string SemanticRole, string SourceSpan);+ string SemanticRole, string SourceSpan, string? SemanticFeatureId = null, string? SemanticFeatureKind = null,+ double? Diameter = null);+public sealed record PrismaticShaftHoleFeature(+ string Name, string StableId, string ProfileReference, double CenterX, double CenterY, double Diameter,+ double From, double To, string SemanticRole, string SourceSpan);public sealed record PrismaticProfilePlacement(string Name, double AnchorX, double AnchorY, double AnchorZ,string ProfilePlane, string Axis, string ReferenceDirection, bool IsExplicit);public sealed record PrismaticProfileCompositionFeature(string Name, string Frame, string Axis, PrismaticProfilePlacement Placement, IReadOnlyList<PrismaticProfileOperation> Operations,- IReadOnlyList<double> CriticalLevels, string Provenance);+ IReadOnlyList<double> CriticalLevels, string Provenance, IReadOnlyList<PrismaticShaftHoleFeature>? ShaftHoles = null);public sealed record PrismaticSectionRegion(ResolvedProfile2D Outer, IReadOnlyList<ResolvedProfile2D> Holes, IReadOnlyList<string> Provenance);public sealed record PrismaticSectionSlab(@@ -46,6 +50,11 @@ public static class PrismaticProfileCompositionParserprivate static readonly Regex ComposeHead = new(@"\bCompose\s+(?<n>\w+)\s*\{", RegexOptions.CultureInvariant);private static readonly Regex Placement = new(@"\bPlacement\s+(?<n>\w+)\s*\{\s*Anchor\s*:\s*\[(?<x>[-+.\d]+)mm\s*,\s*(?<y>[-+.\d]+)mm\s*,\s*(?<z>[-+.\d]+)mm\]\s*;?\s*ProfilePlane\s*:\s*(?<plane>\w+)\s*;?\s*Axis\s*:\s*(?<axis>[+-][XYZ])\s*;?\s*ReferenceDirection\s*:\s*(?<reference>[+-][XYZ])", RegexOptions.Singleline | RegexOptions.CultureInvariant);private static readonly Regex Operation = new(@"\b(?<intent>Base|Add|Remove)\s+(?<n>\w+)\s*\{\s*Profile\s*:\s*(?<profile>\w+)\s*;?\s*From\s*:\s*(?<from>[-+.\d]+)mm\s*;?\s*To\s*:\s*(?<to>[-+.\d]+)mm(?:\s*;?\s*Role\s*:\s*(?<role>\w+))?", RegexOptions.Singleline | RegexOptions.CultureInvariant);+ private static readonly Regex HoleHeader = new(@"\bHole\s*<\s*(?<variant>\w+)\s*>\s+(?<n>\w+)\s*\{", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);+ private static readonly Regex HoleCenter = new(@"\bCenter\s*:\s*\[(?<x>[-+.\d]+)mm\s*,\s*(?<y>[-+.\d]+)mm\]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);+ private static readonly Regex HoleDiameter = new(@"\bDiameter\s*:\s*(?<d>[-+.\d]+)mm", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);+ private static readonly Regex HoleEnd = new(@"\bEnd\s*:\s*(?<end>\w+)", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);+ private static readonly Regex HoleRole = new(@"\bRole\s*:\s*(?<role>\w+)", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);public static bool IsCompositionSource(string source) => ComposeHead.IsMatch(source);@@ -139,11 +148,49 @@ public static class PrismaticProfileCompositionParseroperations.Add(new(name, Enum.Parse<PrismaticProfileIntent>(match.Groups["intent"].Value), profile, from, to, match.Groups["role"].Success ? match.Groups["role"].Value : match.Groups["intent"].Value, $"offset:{match.Index}"));}if (operations.Count(o => o.Intent == PrismaticProfileIntent.Base) != 1) diagnostics.Add("compose-requires-exactly-one-base-operation");+ var shaftHoles = new List<PrismaticShaftHoleFeature>();+ var materialFrom = operations.Count == 0 ? 0d : operations.Min(x => x.From);+ var materialTo = operations.Count == 0 ? 0d : operations.Max(x => x.To);+ foreach (Match header in HoleHeader.Matches(composeBody))+ {+ var name = header.Groups["n"].Value;+ var body = Block(composeBody, header.Index + header.Length - 1);+ if (body is null) { diagnostics.Add($"compose-hole-unclosed:{name}"); continue; }+ var center = HoleCenter.Match(body); var diameter = HoleDiameter.Match(body); var end = HoleEnd.Match(body); var role = HoleRole.Match(body);+ if (!string.Equals(header.Groups["variant"].Value, "Shaft", StringComparison.OrdinalIgnoreCase)+ || !end.Success || !string.Equals(end.Groups["end"].Value, "ThroughAll", StringComparison.OrdinalIgnoreCase))+ { diagnostics.Add($"compose-hole-unsupported-variant-or-end:{name}"); continue; }+ if (!center.Success || !diameter.Success) { diagnostics.Add($"compose-hole-missing-center-or-diameter:{name}"); continue; }+ var x = N(center, "x"); var y = N(center, "y"); var d = N(diameter, "d");+ if (!double.IsFinite(x) || !double.IsFinite(y) || !double.IsFinite(d) || d <= 0d) { diagnostics.Add($"compose-hole-invalid-center-or-diameter:{name}"); continue; }+ if (!names.Add(name)) { diagnostics.Add($"compose-duplicate-operation:{name}"); continue; }+ var profileName = $"{name}ShaftProfile";+ if (profiles.ContainsKey(profileName)) { diagnostics.Add($"compose-hole-profile-name-collision:{name}:{profileName}"); continue; }+ var stableId = $"hole:{compose.Groups["n"].Value}.{name}";+ var holeProfile = CircleProfile(profileName, x, y, d / 2d, stableId, $"offset:{header.Index}");+ var validation = ResolvedProfile2DValidator.Validate(holeProfile);+ diagnostics.AddRange(validation.Diagnostics);+ if (!validation.IsValid) continue;+ profiles.Add(profileName, holeProfile);+ var semanticRole = role.Success ? role.Groups["role"].Value : "ShaftHole";+ var sourceSpan = $"offset:{header.Index}";+ shaftHoles.Add(new(name, stableId, profileName, x, y, d, materialFrom, materialTo, semanticRole, sourceSpan));+ operations.Add(new(name, PrismaticProfileIntent.Remove, profileName, materialFrom, materialTo, semanticRole, sourceSpan, stableId, "Hole<Shaft>", d));+ }var levels = operations.SelectMany(o => new[] { o.From, o.To }).Distinct().Order().ToArray();- var feature = diagnostics.Count == 0 ? new PrismaticProfileCompositionFeature(compose.Groups["n"].Value, "XY", "+Z", placement, operations, levels, "parser-backed-scaffold-profile-composition") : null;+ var feature = diagnostics.Count == 0 ? new PrismaticProfileCompositionFeature(compose.Groups["n"].Value, "XY", "+Z", placement, operations, levels, "parser-backed-scaffold-profile-composition", shaftHoles) : null;return new(feature, profiles, diagnostics.Distinct().ToArray(), expansion.Evidence);}+ private static ResolvedProfile2D CircleProfile(string profileName, double x, double y, double radius, string holeStableId, string sourceSpan)+ {+ var names = new[] { "EastToNorth", "NorthToWest", "WestToSouth", "SouthToEast" };+ var segments = Enumerable.Range(0, 4).Select(i => new ResolvedProfileSegment2D(+ names[i], new LineArcCircularArc2D((x, y), radius, i * Math.PI / 2d, Math.PI / 2d),+ new($"profile:{profileName}.Outer.{names[i]}", $"{holeStableId}.axis", sourceSpan, $"Hole<Shaft>({holeStableId})", "XY"))).ToArray();+ return new(profileName, "XY", [new ResolvedProfileLoop2D("Outer", true, segments)]);+ }+private static double N(Match match, string name) => double.Parse(match.Groups[name].Value, CultureInfo.InvariantCulture);private static string? Block(string text, int open){diff --git a/Aetheris.Kernel.Firmament/Materializer/PrismaticSectionStackCompiler.cs b/Aetheris.Kernel.Firmament/Materializer/PrismaticSectionStackCompiler.csindex 6d0c3a7b..3b4a0a54 100644--- a/Aetheris.Kernel.Firmament/Materializer/PrismaticSectionStackCompiler.cs+++ b/Aetheris.Kernel.Firmament/Materializer/PrismaticSectionStackCompiler.cs@@ -80,7 +80,7 @@ public static class PrismaticSectionStackEmittervar d = stack.Diagnostics.ToList();var builder = new TopologyBuilder(); var points = new Dictionary<VertexId, Point3D>(); var curves = new Dictionary<EdgeId, CurveGeometry>(); var profileCurves = new Dictionary<EdgeId, LineArcProfileCurve2D>();var vertices = new Dictionary<(long X, long Y, long Z), VertexId>(); var edges = new Dictionary<string, EdgeId>();- var sideFaces = new List<(LoopId Loop, SurfaceGeometry Surface, string Source, string Construction, double From, double To)>(); var capFaces = new List<(FaceId Face, double Z, bool Up)>();+ var sideFaces = new List<(LoopId Loop, SurfaceGeometry Surface, bool SameSense, string Source, string Construction, double From, double To)>(); var capFaces = new List<(FaceId Face, double Z, bool Up)>();var splitPoints = stack.Slabs.SelectMany(s => Loops(s.Region)).Concat(stack.Transitions.SelectMany(t =>t.UpwardRegions.Concat(t.DownwardRegions).SelectMany(Loops))).SelectMany(x => x.Profile.Loops[0].Segments).SelectMany(x => Ends(x.Geometry)).DistinctBy(p => $"{Math.Round(p.X / Tol):F0},{Math.Round(p.Y / Tol):F0}").ToArray();@@ -107,7 +107,7 @@ public static class PrismaticSectionStackEmittervar endpoints = Ends(curve); var a = endpoints[0]; var b = endpoints[1]; var bottom = Edge(curve, slab.From); var top = Edge(curve, slab.To); var v0 = Vertical(a, slab.From, slab.To); var v1 = Vertical(b, slab.From, slab.To);var loop = AddLoop(builder, [new(bottom.Edge, bottom.Reverse), new(v1.Edge, v1.Reverse), new(top.Edge, !top.Reverse), new(v0.Edge, !v0.Reverse)]);var source = SourceId(segment.Provenance.StableId);- sideFaces.Add((loop, SideSurface(curve, slab.From, item.IsHole), source, $"slab:{slab.From:R}..{slab.To:R}:{segment.Provenance.Derivation}", slab.From, slab.To));+ sideFaces.Add((loop, SideSurface(curve, slab.From, item.IsHole), !(item.IsHole && curve is LineArcCircularArc2D), source, $"slab:{slab.From:R}..{slab.To:R}:{segment.Provenance.Derivation}", slab.From, slab.To));}foreach (var transition in stack.Transitions){@@ -129,7 +129,7 @@ public static class PrismaticSectionStackEmitter}var surfaceId = 1;foreach (var cap in capFaces) { geometry.AddSurface(new SurfaceGeometryId(surfaceId), SurfaceGeometry.FromPlane(new PlaneSurface(new Point3D(0, 0, cap.Z), Direction3D.Create(new Vector3D(0, 0, cap.Up ? 1 : -1)), Direction3D.Create(new Vector3D(1, 0, 0))))); bindings.AddFaceBinding(new FaceGeometryBinding(cap.Face, new SurfaceGeometryId(surfaceId++))); }- foreach (var side in sideFaces) { var face = faces[capFaces.Count + sideFaces.IndexOf(side)]; geometry.AddSurface(new SurfaceGeometryId(surfaceId), side.Surface); bindings.AddFaceBinding(new FaceGeometryBinding(face, new SurfaceGeometryId(surfaceId++))); }+ foreach (var side in sideFaces) { var face = faces[capFaces.Count + sideFaces.IndexOf(side)]; geometry.AddSurface(new SurfaceGeometryId(surfaceId), side.Surface); bindings.AddFaceBinding(new FaceGeometryBinding(face, new SurfaceGeometryId(surfaceId++), side.SameSense)); }foreach (var incidence in builder.Model.Coedges.GroupBy(x => x.EdgeId).Where(x => x.Count() != 2)){var edge = builder.Model.Edges.Single(x => x.Id == incidence.Key);@@ -162,7 +162,40 @@ public static class PrismaticSectionStackEmittervar source = fragment.Source.Provenance.StableId;descendants.Add(new($"construction:{stack.Feature.Name}:{fragment.StableId}", "ArrangementFragment", SemanticTopologyRole.Unknown, source, ParentStableId: fragment.Source.StableId));}- var correspondence = new SemanticTopologyCorrespondence(stack.Feature.Name, descendants.DistinctBy(x => x.StableId).ToArray(), ["ProfileArrangement2D", "PrismaticSectionStackConstruction", "PrismaticSectionStackBrepPlan", "AuthoritativeBRepPlan"]);+ foreach (var hole in stack.Feature.ShaftHoles ?? [])+ {+ var profilePrefix = $"profile:{hole.ProfileReference}.Outer.";+ // ThroughAll is declared over the composition interval, but a removal can only exist where+ // its host has material. Derive entry and exit from the retained wall boundary rather than+ // from the declaration's nominal levels (for CTC-01 the host stops at Z=0 although the+ // composition continues to Z=50 elsewhere).+ var holeSides = sideFaces.Select((side, index) => (Side: side, Face: faces[capFaces.Count + index]))+ .Where(x => x.Side.Source.StartsWith(profilePrefix, StringComparison.Ordinal)).ToArray();+ var horizontalEdges = holeSides.SelectMany(x => builder.Model.Loops.Single(loop => loop.Id == x.Side.Loop).CoedgeIds)+ .Select(id => builder.Model.Coedges.Single(coedge => coedge.Id == id).EdgeId).Distinct()+ .Select(id => (Edge: id, Topology: builder.Model.Edges.Single(edge => edge.Id == id)))+ .Where(x => Math.Abs(points[x.Topology.StartVertexId].Z - points[x.Topology.EndVertexId].Z) <= Tol)+ .Select(x => (x.Edge, Z: points[x.Topology.StartVertexId].Z)).ToArray();+ var entryZ = horizontalEdges.Max(x => x.Z);+ var exitZ = horizontalEdges.Min(x => x.Z);+ var entryEdges = horizontalEdges.Where(x => Math.Abs(x.Z - entryZ) <= Tol).Select(x => x.Edge).Distinct().OrderBy(x => x.Value).ToArray();+ var exitEdges = horizontalEdges.Where(x => Math.Abs(x.Z - exitZ) <= Tol).Select(x => x.Edge).Distinct().OrderBy(x => x.Value).ToArray();+ var wallFaces = holeSides.Select(x => x.Face).Distinct().OrderBy(x => x.Value).ToArray();+ foreach (var edge in entryEdges) descendants.Add(new($"material:{hole.StableId}:entry-edge:{edge.Value}", "Edge", SemanticTopologyRole.TopBoundary, hole.StableId, Edge: edge, ParentStableId: hole.StableId, GeometryPreview: $"diameter={hole.Diameter:R}"));+ foreach (var edge in exitEdges) descendants.Add(new($"material:{hole.StableId}:exit-edge:{edge.Value}", "Edge", SemanticTopologyRole.BottomBoundary, hole.StableId, Edge: edge, ParentStableId: hole.StableId, GeometryPreview: $"diameter={hole.Diameter:R}"));+ foreach (var face in wallFaces) descendants.Add(new($"material:{hole.StableId}:wall:{face.Value}", "Face", SemanticTopologyRole.HoleWallFace, hole.StableId, Face: face, ParentStableId: hole.StableId, GeometryPreview: $"diameter={hole.Diameter:R}"));+ LoopId? LoopFor(IReadOnlyList<EdgeId> boundary)+ {+ var expected = boundary.ToHashSet();+ return builder.Model.Loops.Select(loop => (loop.Id, Edges: loop.CoedgeIds.Select(id => builder.Model.Coedges.Single(x => x.Id == id).EdgeId).ToHashSet()))+ .Where(x => x.Edges.SetEquals(expected)).Select(x => (LoopId?)x.Id).SingleOrDefault();+ }+ if (entryEdges.Length > 0 && LoopFor(entryEdges) is { } entryLoop) descendants.Add(new($"material:{hole.StableId}:entry-loop", "Loop", SemanticTopologyRole.HoleEntryLoop, hole.StableId, Loop: entryLoop, ParentStableId: hole.StableId, GeometryPreview: $"diameter={hole.Diameter:R}"));+ if (exitEdges.Length > 0 && LoopFor(exitEdges) is { } exitLoop) descendants.Add(new($"material:{hole.StableId}:exit-loop", "Loop", SemanticTopologyRole.HoleExitLoop, hole.StableId, Loop: exitLoop, ParentStableId: hole.StableId, GeometryPreview: $"diameter={hole.Diameter:R}"));+ }+ var provenance = new List<string> { "ProfileArrangement2D", "PrismaticSectionStackConstruction", "PrismaticSectionStackBrepPlan", "AuthoritativeBRepPlan" };+ if ((stack.Feature.ShaftHoles?.Count ?? 0) > 0) provenance.Insert(0, "SemanticHoleComposeLowering");+ var correspondence = new SemanticTopologyCorrespondence(stack.Feature.Name, descendants.DistinctBy(x => x.StableId).ToArray(), provenance);var plan = new PrismaticSectionStackBrepPlan($"compose:{stack.Feature.Name}:slabs={stack.Slabs.Count}:transitions={stack.Transitions.Count}", points.Count, builder.Model.Edges.Count(), faces.Count, "deterministic-slab-partitions", true, correspondence);d.Add("compose-authoritative-section-stack-brep-plan"); d.Add("compose-no-3d-boolean-used");return new(body, plan, d.Distinct().ToArray(), correspondence);diff --git a/Aetheris.Kernel.Firmament/Materializer/ProfileArrangement2D.cs b/Aetheris.Kernel.Firmament/Materializer/ProfileArrangement2D.csindex 34d453d5..b2f647d1 100644--- a/Aetheris.Kernel.Firmament/Materializer/ProfileArrangement2D.cs+++ b/Aetheris.Kernel.Firmament/Materializer/ProfileArrangement2D.cs@@ -147,7 +147,7 @@ public static class ProfileArrangementBuilderprivate static IEnumerable<ArrangementSourceCurve2D> RegionSources(string name, PrismaticSectionRegion region){- foreach (var item in new[] { (region.Outer, "Outer") }.Concat(region.Holes.Select(x => (x, "Inner"))))+ foreach (var item in new[] { (region.Outer, "Outer") }.Concat(region.Holes.Select((x, index) => (x, $"Inner{index}"))))foreach (var segment in item.Item1.Loops[0].Segments)yield return new ArrangementSourceCurve2D($"transition:{name}.{item.Item2}.{segment.Name}", name, PrismaticProfileIntent.Base, item.Item1.Name, item.Item2,segment.Name, segment.Geometry, segment.Provenance);diff --git a/Aetheris.Kernel.Firmament/Materializer/SemanticTopologySelections.cs b/Aetheris.Kernel.Firmament/Materializer/SemanticTopologySelections.csindex 79c09d81..75e5eae1 100644--- a/Aetheris.Kernel.Firmament/Materializer/SemanticTopologySelections.cs+++ b/Aetheris.Kernel.Firmament/Materializer/SemanticTopologySelections.cs@@ -125,7 +125,8 @@ public static class SemanticSelectionSourceParserprivate static readonly Regex Header = new(@"\bSelection\s+(?<name>\w+)\s*\{", RegexOptions.CultureInvariant);private static readonly Regex Source = new(@"\bSource\s*:\s*(?<profile>\w+)\.ProfileSegments\s*\(\s*\[(?<members>[\w\s,]+)\]\s*\)", RegexOptions.Singleline | RegexOptions.CultureInvariant);private static readonly Regex LoopSource = new(@"\bSource\s*:\s*(?<profile>\w+)\.ProfileLoop\s*\(\s*(?<loop>\w+)\s*\)", RegexOptions.Singleline | RegexOptions.CultureInvariant);- private static readonly Regex Target = new(@"\bTarget\s*:\s*(?<role>TopBoundary|BottomBoundary|SideBoundary)", RegexOptions.CultureInvariant);+ private static readonly Regex HoleSource = new(@"\bSource\s*:\s*Hole\s*\(\s*(?<hole>\w+)\s*\)", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);+ private static readonly Regex Target = new(@"\bTarget\s*:\s*(?<role>TopBoundary|BottomBoundary|SideBoundary|HoleEntry|HoleExit|HoleWall)", RegexOptions.CultureInvariant);private static readonly Regex Require = new(@"\bRequire\s*:\s*(?<shape>ExactlyOne|OneOrMore|ConnectedChain|ClosedLoop|NonEmptyFaceSet)", RegexOptions.CultureInvariant);public static IReadOnlyList<SemanticSelectionRequest> Parse(string source, ResolvedProfile2D profile, string bodyStableId, out IReadOnlyList<string> diagnostics)@@ -135,18 +136,22 @@ public static class SemanticSelectionSourceParser{var body = Block(source, header.Index + header.Length - 1);if (body is null) { errors.Add($"selection-unclosed:{header.Groups["name"].Value}"); continue; }- var sourceMatches = Source.Matches(body); var loopMatch = LoopSource.Match(body); var target = Target.Match(body); var require = Require.Match(body);- if (!target.Success || !require.Success || (sourceMatches.Count == 0 && !loopMatch.Success)) { errors.Add($"selection-invalid:{header.Groups["name"].Value}"); continue; }+ var sourceMatches = Source.Matches(body); var loopMatch = LoopSource.Match(body); var holeMatch = HoleSource.Match(body); var target = Target.Match(body); var require = Require.Match(body);+ if (!target.Success || !require.Success || (sourceMatches.Count == 0 && !loopMatch.Success && !holeMatch.Success)) { errors.Add($"selection-invalid:{header.Groups["name"].Value}"); continue; }var boundary = target.Groups["role"].Value;- var role = loopMatch.Success+ var role = holeMatch.Success+ ? boundary switch { "HoleEntry" => SemanticTopologyRole.HoleEntryLoop, "HoleExit" => SemanticTopologyRole.HoleExitLoop, "HoleWall" => SemanticTopologyRole.HoleWallFace, _ => SemanticTopologyRole.Unknown }+ : loopMatch.Success? boundary switch { "TopBoundary" => SemanticTopologyRole.TopFaceBoundaryLoop, "BottomBoundary" => SemanticTopologyRole.BottomFaceBoundaryLoop, _ => SemanticTopologyRole.ExtrusionSideFace }: boundary switch { "TopBoundary" => SemanticTopologyRole.TopBoundary, "BottomBoundary" => SemanticTopologyRole.BottomBoundary, _ => SemanticTopologyRole.ExtrusionSideFace };- var sources = sourceMatches.Count > 0+ var sources = holeMatch.Success+ ? new[] { $"hole:{bodyStableId}.{holeMatch.Groups["hole"].Value}" }+ : sourceMatches.Count > 0? sourceMatches.SelectMany(match => match.Groups["members"].Value.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries).Select(x => $"profile:{match.Groups["profile"].Value}.Outer.{x}")).ToArray(): [$"profile:{loopMatch.Groups["profile"].Value}.{loopMatch.Groups["loop"].Value}"];// Compose selections may name any one of the parsed profiles; body context is checked by the resolver.output.Add(new($"selection:{header.Groups["name"].Value}", header.Groups["name"].Value, bodyStableId, sources, role,- Enum.Parse<SemanticSelectionRequirement>(require.Groups["shape"].Value), $"offset:{header.Index}", "EdgeFinish"));+ Enum.Parse<SemanticSelectionRequirement>(require.Groups["shape"].Value), $"offset:{header.Index}", holeMatch.Success ? "Hole" : "EdgeFinish"));}diagnostics = errors; return output;}diff --git a/Aetheris.Kernel.Firmament/Materializer/StaticGeometryExpansion.cs b/Aetheris.Kernel.Firmament/Materializer/StaticGeometryExpansion.csindex cc497102..cd6f98b4 100644--- a/Aetheris.Kernel.Firmament/Materializer/StaticGeometryExpansion.cs+++ b/Aetheris.Kernel.Firmament/Materializer/StaticGeometryExpansion.cs@@ -70,7 +70,7 @@ internal static class StaticGeometryExpansion}scaffold.Append("}\n");// Keep the non-repetitive primary/mid/hex declarations authored in the source.- var suffixStart = source.IndexOf("// X3 static expansion keeps", StringComparison.Ordinal);+ var suffixStart = source.IndexOf("Profile PrimaryWeb", StringComparison.Ordinal);var suffix = suffixStart >= 0 ? source[suffixStart..] : string.Empty;var result = scaffold + profiles.ToString() + suffix;// A group is source-only. Its members retain the data key in the lowereddiff --git a/Aetheris.Server.Tests/KernelApiIntegrationTests.cs b/Aetheris.Server.Tests/KernelApiIntegrationTests.csindex 1f82d5e0..0f5a3e12 100644--- a/Aetheris.Server.Tests/KernelApiIntegrationTests.cs+++ b/Aetheris.Server.Tests/KernelApiIntegrationTests.cs@@ -879,6 +879,7 @@ public sealed class KernelApiIntegrationTests : IClassFixture<WebApplicationFact[InlineData("semantic-shaft-hole", "hole:base.mount")][InlineData("split-compose-chamfer", "profile:BaseProfile.Outer.South")][InlineData("ctc-01-x3", "profile:CentralHex.Outer.SouthEast")]+ [InlineData("ctc-01-x4", "hole:Ctc01PrismaticBlockoutX4.LeftTopMount")]public async Task CadmataFixture_LoadsCompilerBodyAndPublishedCorrespondence(string fixtureId, string expectedEntityId){var document = await CreateDocumentAsync("/api/v1/documents");diff --git a/Aetheris.Server/Api/ApiMappings.cs b/Aetheris.Server/Api/ApiMappings.csindex 3e558c06..c94cf4ae 100644--- a/Aetheris.Server/Api/ApiMappings.cs+++ b/Aetheris.Server/Api/ApiMappings.cs@@ -80,7 +80,7 @@ public static class ApiMappingsface.SurfaceGeometryId.Value,face.SurfaceKind.ToString(),face.LoopCount,- face.DomainHint is { } hint ? new AnalyticDisplayFaceDomainHintDto(hint.MinV, hint.MaxV) : null,+ face.DomainHint is { } hint ? new AnalyticDisplayFaceDomainHintDto(hint.MinU, hint.MaxU, hint.MinV, hint.MaxV) : null,face.SurfaceGeometry.Plane is { } plane ? new AnalyticDisplayPlaneGeometryDto(ToPointDto(plane.Origin),ToVectorDto(plane.Normal.ToVector()),diff --git a/Aetheris.Server/Api/CadmataFixtureService.cs b/Aetheris.Server/Api/CadmataFixtureService.csindex 6ef77772..5580ade4 100644--- a/Aetheris.Server/Api/CadmataFixtureService.cs+++ b/Aetheris.Server/Api/CadmataFixtureService.cs@@ -15,6 +15,7 @@ internal static class CadmataFixtureService["split-compose-chamfer"] = "fixtures/FirmamentV2/ProfileComposition/valid/semantic-split-compose-chamfer.firmament",["semantic-shaft-hole"] = "fixtures/FirmamentV2/Hole/valid/semantic-shaft-selection.firmament",["ctc-01-x3"] = "testdata/firmament/reconstructions/nist_ctc_01/ctc01_prismatic_blockout_x3.firmament",+ ["ctc-01-x4"] = "testdata/firmament/reconstructions/nist_ctc_01/ctc01_prismatic_blockout_x4.firmament",};public static bool TryLoad(string fixtureId, DocumentSession document, out CadmataFixtureLoadResponseDto? response, out string error)@@ -24,7 +25,7 @@ internal static class CadmataFixtureServicevar sourcePath = Path.Combine(FindRepositoryRoot(), relative);if (!File.Exists(sourcePath)) { error = $"Cadmata fixture source is unavailable: {relative}."; return false; }var source = File.ReadAllText(sourcePath);- BrepBody? body = null; SemanticTopologyCorrespondence? correspondence = null; IReadOnlyList<ResolvedProfile2D> profiles = [];+ BrepBody? body = null; SemanticTopologyCorrespondence? correspondence = null; IReadOnlyList<ResolvedProfile2D> profiles = []; IReadOnlyList<PrismaticShaftHoleFeature> shaftHoles = [];var diagnostics = new List<string>();if (fixtureId == "semantic-shaft-hole"){@@ -39,7 +40,11 @@ internal static class CadmataFixtureServicevar stack = PrismaticSectionStackCompiler.Normalize(parsed, out var normalizationDiagnostics);if (stack is null) { error = string.Join("; ", normalizationDiagnostics); return false; }var emitted = PrismaticSectionStackEmitter.Emit(stack);- body = emitted.Body; correspondence = emitted.Correspondence; profiles = parsed.Profiles.Values.ToArray(); diagnostics.AddRange(emitted.Diagnostics);+ shaftHoles = stack.Feature.ShaftHoles ?? [];+ // Synthetic circle Profiles are a compiler lowering detail. Cadmata publishes the authored+ // HoleFeature and its exact descendants instead of duplicating four axis guides per hole.+ profiles = parsed.Profiles.Values.Where(profile => !shaftHoles.Any(hole => hole.ProfileReference == profile.Name)).ToArray();+ body = emitted.Body; correspondence = emitted.Correspondence; diagnostics.AddRange(emitted.Diagnostics);}else{@@ -50,12 +55,12 @@ internal static class CadmataFixtureService}if (body is null) { error = "The compiler did not materialize a body for this Cadmata fixture."; return false; }var added = document.AddBody(body, $"Cadmata: {fixtureId}");- var artifact = BuildArtifact(fixtureId, relative, profiles, correspondence, diagnostics, body);+ var artifact = BuildArtifact(fixtureId, relative, profiles, shaftHoles, correspondence, diagnostics, body);response = new(document.Id.ToString(), added.OccurrenceId.ToString(), added.DefinitionId.ToString(), fixtureId, artifact);return true;}- private static CadmataVisualizationArtifactDto BuildArtifact(string fixtureId, string sourcePath, IReadOnlyList<ResolvedProfile2D> profiles, SemanticTopologyCorrespondence? correspondence, IReadOnlyList<string> diagnostics, BrepBody body)+ private static CadmataVisualizationArtifactDto BuildArtifact(string fixtureId, string sourcePath, IReadOnlyList<ResolvedProfile2D> profiles, IReadOnlyList<PrismaticShaftHoleFeature> shaftHoles, SemanticTopologyCorrespondence? correspondence, IReadOnlyList<string> diagnostics, BrepBody body){var entities = new List<CadmataVisualizationEntityDto>();foreach (var profile in profiles)@@ -72,12 +77,30 @@ internal static class CadmataFixtureServiceentities.Add(new(id, "HoleFeature", "mount", "conceptAxes", "SemanticHole", new("circle", Center: new(1.5, -1, 5), Radius: 2), "offset:0", null, null, null, correspondence?.Descendants.Select(d => d.StableId).ToArray(), null, null, "AirHoleSimpleShaftMaterializer", null, new Dictionary<string, string> { ["diameter"] = "4 mm", ["axis"] = "+Z", ["endCondition"] = "throughAll" }));entities.Add(new("concept:base.mount.axis", "ConceptAxis", "mount axis", "conceptAxes", "HoleAxis", new("polyline", [new(1.5, -1, -5), new(1.5, -1, 5)]), "offset:0", [id], null, null, null, null, null, null, null, null));}+ foreach (var hole in shaftHoles)+ {+ double BoundaryZ(SemanticTopologyRole role, double fallback)+ {+ var loopId = correspondence?.Descendants.FirstOrDefault(d => d.SourceStableId == hole.StableId && d.Role == role)?.Loop;+ if (loopId is null) return fallback;+ var loop = body.Topology.Loops.Single(x => x.Id == loopId.Value);+ var coedge = body.Topology.Coedges.Single(x => x.Id == loop.CoedgeIds[0]);+ var edge = body.Topology.Edges.Single(x => x.Id == coedge.EdgeId);+ return body.TryGetVertexPoint(edge.StartVertexId, out var point) ? point.Z : fallback;+ }+ var entryZ = BoundaryZ(SemanticTopologyRole.HoleEntryLoop, hole.To);+ var exitZ = BoundaryZ(SemanticTopologyRole.HoleExitLoop, hole.From);+ var descendants = correspondence?.Descendants.Where(d => d.SourceStableId == hole.StableId).Select(d => d.StableId).ToArray() ?? [];+ entities.Add(new(hole.StableId, "HoleFeature", hole.Name, "conceptAxes", "SemanticHole", new("circle", Center: new(hole.CenterX, hole.CenterY, entryZ), Radius: hole.Diameter / 2d), hole.SourceSpan, null, null, null, descendants, null, null, "SemanticHoleComposeLowering", null, new Dictionary<string, string> { ["diameter"] = $"{hole.Diameter:R} mm", ["axis"] = "+Z", ["endCondition"] = "throughAll", ["materialInterval"] = $"{exitZ:R}..{entryZ:R} mm" }));+ entities.Add(new($"{hole.StableId}.axis", "ConceptAxis", $"{hole.Name} axis", "conceptAxes", "HoleAxis", new("polyline", [new(hole.CenterX, hole.CenterY, exitZ), new(hole.CenterX, hole.CenterY, entryZ)]), hole.SourceSpan, [hole.StableId], null, null, null, null, null, null, null, null));+ }foreach (var descendant in correspondence?.Descendants ?? []){entities.Add(new(descendant.StableId, $"BRep{descendant.Kind}", descendant.Role.ToString(), descendant.Kind == "Face" ? "selections" : "brepEdges", descendant.Role.ToString(), null, null, [descendant.SourceStableId], null, null, null, new(descendant.Face is { } face ? [face.Value] : null, descendant.Edge is { } edge ? [edge.Value] : null, descendant.Loop is { } loop ? [loop.Value] : null, descendant.Vertex is { } vertex ? [vertex.Value] : null), null, null, null, null));}- var selectionSourceIds = fixtureId == "semantic-shaft-hole" ? new[] { "hole:base.mount" } : entities.Where(e => e.Kind == "ProfileSegment").Select(e => e.StableId).ToArray();- var selection = new CadmataVisualizationSelectionDto($"selection:{fixtureId}", fixtureId == "semantic-shaft-hole" ? "mount semantic shaft" : "compiler-published profile boundary", fixtureId == "semantic-shaft-hole" ? "FaceSet" : "LoopSet", selectionSourceIds, selectionSourceIds, fixtureId != "semantic-shaft-hole", []);+ var hasSemanticHoles = fixtureId == "semantic-shaft-hole" || shaftHoles.Count > 0;+ var selectionSourceIds = fixtureId == "semantic-shaft-hole" ? new[] { "hole:base.mount" } : shaftHoles.Count > 0 ? shaftHoles.Select(hole => hole.StableId).ToArray() : entities.Where(e => e.Kind == "ProfileSegment").Select(e => e.StableId).ToArray();+ var selection = new CadmataVisualizationSelectionDto($"selection:{fixtureId}", hasSemanticHoles ? "semantic shaft holes" : "compiler-published profile boundary", hasSemanticHoles ? "FaceSet" : "LoopSet", selectionSourceIds, selectionSourceIds, !hasSemanticHoles, []);return new("cadmata-concept-viz-x1", fixtureId, sourcePath, entities, [selection], diagnostics.Select(d => new CadmataVisualizationDiagnosticDto("Compiler.Trace", d, "info")).ToArray(), new Dictionary<string, double> { ["entityCount"] = entities.Count, ["faceCount"] = body.Topology.Faces.Count(), ["edgeCount"] = body.Topology.Edges.Count() });}private static CadmataGeometryDto Geometry(LineArcProfileCurve2D curve) => curve switchdiff --git a/Aetheris.Server/Contracts/ApiContracts.cs b/Aetheris.Server/Contracts/ApiContracts.csindex c8f9a968..ae3859f3 100644--- a/Aetheris.Server/Contracts/ApiContracts.cs+++ b/Aetheris.Server/Contracts/ApiContracts.cs@@ -89,7 +89,7 @@ public sealed record CadmataVisualizationSelectionDto(string StableId, string Lapublic sealed record CadmataVisualizationArtifactDto(string SchemaVersion, string FixtureId, string SourcePath, IReadOnlyList<CadmataVisualizationEntityDto> Entities, IReadOnlyList<CadmataVisualizationSelectionDto> Selections, IReadOnlyList<CadmataVisualizationDiagnosticDto> Diagnostics, IReadOnlyDictionary<string, double> Metrics);public sealed record CadmataFixtureLoadResponseDto(string DocumentId, string BodyId, string DefinitionId, string FixtureId, CadmataVisualizationArtifactDto Visualization);-public sealed record AnalyticDisplayFaceDomainHintDto(double? MinV, double? MaxV);+public sealed record AnalyticDisplayFaceDomainHintDto(double? MinU, double? MaxU, double? MinV, double? MaxV);public sealed record AnalyticDisplayPlaneGeometryDto(Point3Dto Origin,diff --git a/aetheris.client/src/App.tsx b/aetheris.client/src/App.tsxindex e5d3a578..7c34be6f 100644--- a/aetheris.client/src/App.tsx+++ b/aetheris.client/src/App.tsx@@ -709,7 +709,7 @@ function App() {<section className="tool-section cadmata-inspector"><h2 className="section-title">Cadmata compiler evidence</h2><div className="stack-row">- {['direct-profile', 'split-compose-chamfer', 'semantic-shaft-hole', 'ctc-01-x3'].map((fixtureId) => <Button key={fixtureId} type="button" variant="outline" onClick={() => void handleLoadCadmataFixture(fixtureId)} disabled={!documentId || status === 'loading'}>{fixtureId}</Button>)}+ {['direct-profile', 'split-compose-chamfer', 'semantic-shaft-hole', 'ctc-01-x3', 'ctc-01-x4'].map((fixtureId) => <Button key={fixtureId} type="button" variant="outline" onClick={() => void handleLoadCadmataFixture(fixtureId)} disabled={!documentId || status === 'loading'}>{fixtureId}</Button>)}</div>{cadmataArtifact ? <><p><strong>{cadmataArtifact.fixtureId}</strong> · {cadmataArtifact.metrics?.entityCount ?? 0} evidence entities</p>diff --git a/aetheris.client/src/__tests__/displayRenderables.test.ts b/aetheris.client/src/__tests__/displayRenderables.test.tsindex 3b74fcdb..42b0015b 100644--- a/aetheris.client/src/__tests__/displayRenderables.test.ts+++ b/aetheris.client/src/__tests__/displayRenderables.test.ts@@ -176,4 +176,46 @@ describe('DisplayIRMapper', () => {expect(scene?.renderables[0].materializationLane).toBe('BoundedMesh');expect(scene?.renderables[0].status).toBe('Mesh');});++ it('BuildsAnalyticCylinderPreviewOnlyOverPublishedAngularTrim', () => {+ const scene = mapDisplayPreparationToDisplayScene(prepWithFaces([{+ faceId: 13,+ shellId: 1,+ surfaceKind: 'Cylinder',+ status: 'Analytic',+ patchKind: 'AnalyticPatch',+ materializationLane: 'AnalyticPatch',+ diagnostics: [],+ wirePatch: null,+ meshPatch: null,+ analyticPatch: {+ faceId: 13,+ shellId: 1,+ shellRole: 'Outer',+ surfaceGeometryId: 15,+ surfaceKind: 'Cylinder',+ loopCount: 1,+ domainHint: { minU: 0, maxU: Math.PI / 2, minV: 0, maxV: 2 },+ planeGeometry: null,+ coneGeometry: null,+ sphereGeometry: null,+ torusGeometry: null,+ cylinderGeometry: {+ origin: { x: 0, y: 0, z: 0 },+ axis: { x: 0, y: 0, z: 1 },+ xAxis: { x: 1, y: 0, z: 0 },+ yAxis: { x: 0, y: 1, z: 0 },+ radius: 1,+ },+ },+ }]));++ const renderable = scene?.renderables[0];+ expect(renderable?.kind).toBe('AnalyticPatch');+ if (renderable?.kind !== 'AnalyticPatch') throw new Error('Expected analytic patch.');+ expect(renderable.previewMesh.positions).toHaveLength(42); // seven points, bottom and top+ const values = [...renderable.previewMesh.positions];+ expect(Math.min(...values.filter((_, index) => index % 3 === 0))).toBeGreaterThanOrEqual(-1e-6);+ expect(Math.min(...values.filter((_, index) => index % 3 === 1))).toBeGreaterThanOrEqual(-1e-6);+ });});diff --git a/aetheris.client/src/api/aetherisApi.ts b/aetheris.client/src/api/aetherisApi.tsindex 796007db..4e037c2f 100644--- a/aetheris.client/src/api/aetherisApi.ts+++ b/aetheris.client/src/api/aetherisApi.ts@@ -104,6 +104,8 @@ export interface TessellationResponseDto {}export interface AnalyticDisplayFaceDomainHintDto {+ minU?: number | null;+ maxU?: number | null;minV: number | null;maxV: number | null;}diff --git a/aetheris.client/src/viewer/analyticMapper.ts b/aetheris.client/src/viewer/analyticMapper.tsindex 89a29006..9409f116 100644--- a/aetheris.client/src/viewer/analyticMapper.ts+++ b/aetheris.client/src/viewer/analyticMapper.ts@@ -160,16 +160,18 @@ function buildCylinderPatch(face: AnalyticDisplayFaceDto): RenderFacePatch | nulconst xAxis = toArray(face.cylinderGeometry.xAxis);const yAxis = toArray(face.cylinderGeometry.yAxis);const radius = face.cylinderGeometry.radius;+ const minU = face.domainHint?.minU ?? 0;+ const maxU = face.domainHint?.maxU ?? TAU;const minV = face.domainHint?.minV ?? -0.5;const maxV = face.domainHint?.maxV ?? 0.5;- const angularSegments = 24;+ const angularSegments = Math.max(1, Math.ceil(24 * Math.abs(maxU - minU) / TAU));const positions: number[] = [];const normals: number[] = [];const indices: number[] = [];for (let i = 0; i <= angularSegments; i += 1) {- const u = (i / angularSegments) * TAU;+ const u = minU + ((i / angularSegments) * (maxU - minU));const cosU = Math.cos(u);const sinU = Math.sin(u);const radial = add(mul(xAxis, radius * cosU), mul(yAxis, radius * sinU));@@ -213,15 +215,17 @@ function buildConePatch(face: AnalyticDisplayFaceDto): RenderFacePatch | null {const yAxis = toArray(face.coneGeometry.yAxis);const minV = Math.max(face.domainHint?.minV ?? 0.1, 0.001);const maxV = Math.max(face.domainHint?.maxV ?? 1, minV + 0.001);+ const minU = face.domainHint?.minU ?? 0;+ const maxU = face.domainHint?.maxU ?? TAU;const tanSemi = Math.tan(face.coneGeometry.semiAngleRadians);- const angularSegments = 24;+ const angularSegments = Math.max(1, Math.ceil(24 * Math.abs(maxU - minU) / TAU));const positions: number[] = [];const normals: number[] = [];const indices: number[] = [];for (let i = 0; i <= angularSegments; i += 1) {- const u = (i / angularSegments) * TAU;+ const u = minU + ((i / angularSegments) * (maxU - minU));const cosU = Math.cos(u);const sinU = Math.sin(u);const radialDirection = normalize(add(mul(xAxis, cosU), mul(yAxis, sinU)));diff --git a/docs/cadmata/concept-visualization-x1.md b/docs/cadmata/concept-visualization-x1.mdindex 8c93008b..7b2b2d4a 100644--- a/docs/cadmata/concept-visualization-x1.md+++ b/docs/cadmata/concept-visualization-x1.md@@ -14,13 +14,15 @@ only those links; it never guesses a BRep match from rendered triangles.real compiler fixtures directly through the existing Profile, composition, andsemantic-hole materializers, adds the resulting body to the document, and returnsthe matching artifact. Available fixture IDs are `direct-profile`,-`split-compose-chamfer`, `semantic-shaft-hole`, and `ctc-01-x3`.+`split-compose-chamfer`, `semantic-shaft-hole`, `ctc-01-x3`, and `ctc-01-x4`.The bridge uses the compiler's `SemanticTopologyCorrespondence`. In particular,the shaft-hole route exposes the authored `hole:base.mount`, its axis and entrycircle, entry/exit loops and edges, and its wall face. Composition routes exposeProfile guides/segments plus arrangement/materialized descendants from the-authoritative section-stack plan.+authoritative section-stack plan. CTC-01 X4 additionally exposes each authored+composed-host shaft Hole as one `HoleFeature`; its erased four-arc lowering+Profiles are deliberately omitted from the author-facing scene.## Viewport architecture@@ -60,13 +62,15 @@ surface identity and normals.The existing renderer keeps one mesh per face, so smooth normals cannot bridgereal BRep face boundaries. Cylindrical/conical faces may use the analytic preview-or bounded fallback mesh according to DisplayIR. Exact trim/silhouette curves,-analytic-normal shaders, and display LOD remain future work.+or bounded fallback mesh according to DisplayIR. DisplayIR publishes face-local+angular and axial domain hints for trimmed cylinders and cones, and the preview+tessellates only that bounded `(u,v)` domain. Exact trim/silhouette curve+rendering, analytic-normal shaders, and display LOD remain future work.## Evidence and limitsThe fixture bridge has been compiled against direct Profile extrusion,-split-compose, semantic shaft-hole, and CTC-01 X3 sources. CTC X3 supplies the+split-compose, semantic shaft-hole, and CTC-01 X3/X4 sources. CTC X3 supplies theexpanded lobe/scaffold/Profile/Compose evidence emitted by the compositionmaterializer. The split-compose fixture currently visualizes the source-groundedpre-finish composition correspondence; its EdgeFinish consumer is recorded by@@ -75,7 +79,8 @@ post-finish correspondence producer before it can truthfully claim descendantfaces. This is intentionally surfaced as a current limitation rather thanheuristically mapped.-The next reconstruction pressure test should be CTC-01 with the central hex top-loop and one lobe outer-arc selection carried through a real feature consumer,-so arrangement fragments, an ordered selection, and replacement topology can be-validated together.+CTC X4 carries the four Ø35 semantic shaft holes through arrangement and the+authoritative section stack. Selecting a Hole follows its compiler-published+entry/exit loops, boundary edges, and all slab-split wall faces. The next+visualization pressure case remains post-EdgeFinish replacement correspondence;+replacement faces must not be inferred heuristically.diff --git a/docs/firmament/profile-composition-x1.md b/docs/firmament/profile-composition-x1.mdindex 87064332..454af66d 100644--- a/docs/firmament/profile-composition-x1.md+++ b/docs/firmament/profile-composition-x1.md@@ -45,3 +45,20 @@ The CTC-01 blockout remains one `PrismaticSectionStackBrepPlan` with three norma`Rect2` may replace manually declared rectangular corners and sides in this source route. It uses `Center: [xmm, ymm]` and `Size: [wmm, hmm]`; derived finite sides are traced as `Base.Bottom`, `Base.Right`, `Base.Top`, and `Base.Left` with corresponding named corners.Profiles are a bounded planar blockout and escape-hatch mechanism. Higher-level semantic CNC features remain preferred where they express the actual intent.++## Semantic shaft holes in a composition++`Compose` admits one bounded semantic subtractive form when a circle Profile would hide manufacturing intent:++```firmament+Hole<Shaft> Mount {+ Center: [25mm, 10mm]+ Diameter: 8mm+ End: ThroughAll+ Role: MountingHole+}+```++This X1 route accepts `Shaft` and `ThroughAll` only. It statically lowers the declaration to an erased four-arc removal Profile across the composition interval, participates in the same exact arrangement/set semantics, and emits no 3D Boolean tool. The semantic Hole stable ID remains the source for entry/exit loops and edges plus all cylindrical wall-face descendants. Entry and exit are derived from the retained host boundary, so `ThroughAll` remains correct when material at the hole center occupies only part of the composition's global axial range.++Use `inspect-compose --json` for the compact `shaftHoles` table and `inspect-selections --json` with `Source: Hole(Name)` plus `Target: HoleEntry`, `HoleExit`, or `HoleWall`. Stepped, blind, counterbored, countersunk, or non-`+Z` composed-host holes remain outside this bounded route.diff --git a/docs/reconstruction/ctc01-llm-pressure-x4.md b/docs/reconstruction/ctc01-llm-pressure-x4.mdnew file mode 100644index 00000000..88910c1d--- /dev/null+++ b/docs/reconstruction/ctc01-llm-pressure-x4.md@@ -0,0 +1,169 @@+# CTC-01 LLM pressure X4++Milestone: `CTC-01-LLM-PRESSURE-X4`++## Outcome++X4 preserves the X3 scaffold, seven authored Profiles, and three-slab composition, then adds the four reference-backed Ø35 mounting holes as semantic `Hole<Shaft>` declarations. The declarations lower statically into exact circular removal regions inside the one authoritative `PrismaticSectionStackBrepPlan`; they do not create Boolean tool bodies or bypass BRepPlan.++The updated source is `testdata/firmament/reconstructions/nist_ctc_01/ctc01_prismatic_blockout_x4.firmament`.++| Feature | Center XY (mm) | Diameter | Material span | Evidence |+| --- | ---: | ---: | ---: | --- |+| LeftTopMount | (-325, 175) | 35 mm | Z=-100..0 | PMI Ø35 plus exact reference cylinders |+| RightTopMount | (325, 175) | 35 mm | Z=-100..0 | PMI Ø35 plus exact reference cylinders |+| LeftBottomMount | (-325, -175) | 35 mm | Z=-100..0 | PMI Ø35 plus exact reference cylinders |+| RightBottomMount | (325, -175) | 35 mm | Z=-100..0 | PMI Ø35 plus exact reference cylinders |++`ThroughAll` is declared over the composition, but correspondence is derived from the retained host wall. The composition reaches Z=50 at the central hex while material at each mounting-hole center ends at Z=0. Entry loops are therefore correctly published at Z=0 rather than the nominal composition maximum.++## Evidence used++### Tooling actually used++- Firmament source inspection: X3/X4 source, Profile resolver, composition normalization, static expansion, and compiler signatures.+- `inspect-profile --json`: exact line/arc counts and stable Profile provenance.+- `inspect-compose --json`: operation intervals, arrangement fragments, loop roles, areas, transitions, semantic shaft-hole table, and analytic volume.+- `inspect-selections --json`: Profile descendants plus typed Hole entry-loop and wall-face selections.+- STEP `analyze`: exact topology counts, analytic surface families, bounds, and per-face cylinder/cone parameters for all 117 reference faces.+- STEP `sections`: Below/At/Above evidence at Z=-100, -60, 0, and 50, cross-checked with the earlier reference section packet.+- STEP export, reimport, `canon`, SHA-256 linkage, and independent M8 verification.+- Cadmata in-app browser: reference STEP, X3 compiler overlays, X4 semantic Hole entity, Profile/semantic layers, and source-to-descendant highlighting.+- Repository restore/build/test and frontend test/build/lint validation.++### Existing tooling not useful for this decision++- The legacy checkpoint Boolean chain was not used: it does not preserve the X3 semantic composition and its bounded subtract failure is already documented.+- `match` was not used to infer the holes. Its present Concept matching cases do not group a reference cylinder family into four semantic holes, while direct analytic faces plus PMI were stronger evidence.+- Generic Firmament `validate` adds little to this Profile-composition artifact because its relevant invariants are arrangement, topology correspondence, STEP round-trip, and M8 enclosure.+- M8 was deliberately withheld from the exploratory loop; it is final evidence, not a feature-recognition instrument.+- Raw At-level reference section fragments were not treated as material loops when normalization rejected conflicting coincident ownership.++## Reference and X3 comparison++The reference STEP contains one body and one shell with 117 faces, 318 edges, and 206 vertices. Its analytic surface inventory is 56 planes, 57 cylinders, and 4 cones; its embedded analytic volume is 14,644,822.6361138 mm³. X3 has the correct global bounds and a strong prismatic scaffold, but is intentionally over-material: 27,503,809.028687116 mm³ before the mounting holes.++The Ø35 family is supported independently by PMI diameter evidence; reference cylinders at radius 17.5 mm; four unique axes at `(±325, ±175)` parallel to Z; exact reference spans from Z=-100 to Z=0; and visible agreement between analytic reference display and the trusted R50 lobe centers. No screenshot measurement was used to author a coordinate.++## Ranked remaining feature candidates++Scores are 1 (low) to 5 (high). Cost is reversed: 5 means inexpensive. Pressure value estimates how much the candidate teaches about LLM-native authoring.++| Rank | Candidate | Confidence | Semantic importance | Manufacturing relevance | Capability fit | Cost | Pressure value | Decision |+| ---: | --- | ---: | ---: | ---: | ---: | ---: | ---: | --- |+| 1 | Four Ø35 through mounting holes | 5 | 5 | 5 | 4 | 4 | 5 | Selected and completed |+| 2 | Four Ø25 local holes at `(±160, ±45)` | 5 | 5 | 5 | 3 | 3 | 4 | Defer until the true Z=-50 relief floor is modeled |+| 3 | Left capsule slot, R20 ends, 80 mm center spacing | 4 | 4 | 5 | 4 | 3 | 5 | Strong next subtractive Profile candidate |+| 4 | Right rounded rectangular opening, R10 corners | 4 | 4 | 5 | 4 | 3 | 5 | Closely related to the capsule and relief stack |+| 5 | Paired side Ø20 holes with conical entries | 5 | 5 | 5 | 1 | 1 | 5 | Needs face-normal composite Hole construction on a composed host |+| 6 | Z=-50 relief/pocket family | 3 | 5 | 5 | 3 | 2 | 5 | Semantically central; grouping remains ambiguous in current sections |+| 7 | Central R5 finish transition at Z=0..5 | 4 | 4 | 4 | 2 | 2 | 4 | Defer until post-finish replacement correspondence is complete |++The R25 circular family around `(±225, ±150)` is real analytic geometry, but whether each circle is best grouped as a hole, boss boundary, or relief artifact remains less certain.++## Authoring route and smallest capability++The first attempt used the existing semantic `Hole<Shaft>` route. That route only admitted primitive/Box hosts; it could not consume the composed X3 body. Anonymous circular Profiles would have produced geometry but lost Hole identity, entry/exit meaning, consumer role, and pressure-test value.++The smallest production addition is bounded syntax inside `Compose`:++```firmament+Hole<Shaft> LeftTopMount {+ Center: [-325mm, 175mm]+ Diameter: 35mm+ End: ThroughAll+ Role: ObservedMountingHole+}+```++Only `Shaft` plus `ThroughAll` is admitted. The compiler validates name, center, diameter, role, and collisions; creates an erased exact four-arc circle Profile; contributes a `Remove` operation across the composition interval; and preserves the Hole stable ID through arrangement, slab topology, entry/exit edges and loops, and cylindrical wall faces. The route remains `(Base ∪ Adds) − Removes` in 2D sections followed by one exact section-stack BRep emission.++Five adjacent defects surfaced under X4 and were fixed locally:++- Static expansion used an X3 comment as a parse anchor; it now anchors structurally on `Profile PrimaryWeb`.+- Multiple inner loops reused transition source IDs; inner-loop IDs now include deterministic indices.+- A nominal `ThroughAll` maximum outside local host material suppressed the entry loop; entry/exit now come from extrema of retained Hole wall boundaries.+- Curved inner walls were bound with the cylinder's outward `SameSense`, making M8 add two-thirds of each void volume even though topology was enclosed. Inner circular side faces now bind `SameSense=false`; STEP reimport preserves the inward material normal.+- Earcut-style point filtering retained a removed ring anchor while bridging several curved holes and could loop forever. Its mutable end anchor is now updated when a node is removed, with X4 as the regression case.++## Composition and selection evidence++| Slab (mm) | Outer loops | Inner loops | Area (mm²) |+| --- | ---: | ---: | ---: |+| -100..-60 | 1 | 4 | 251,859.51226730144 |+| -60..0 | 1 | 4 | 276,859.51226730144 |+| 0..50 | 1 | 0 | 8,660.254037844385 |++The analytic volume is 27,118,963.928622365 mm³. The X3-to-X4 delta is 384,845.100064751 mm³, equal to `4 × π × 17.5² × 100` within floating-point tolerance.++`LeftTopMountEntry` resolves exactly one connected, closed `HoleEntryLoop`. `LeftTopMountWall` resolves eight `HoleWallFace` descendants: four quarter-cylinder faces in each of two host slabs. This partition is compiler structure, not eight authored holes.++The X4 STEP section packet reports five closed loops immediately above Z=-100 and on both sides of Z=-60, five below Z=0 and one above it, and one below Z=50. At Z=-60, normalization leaves transition ownership diagnostic rather than manufacturing a false loop.++## Cadmata observations++Cadmata answered two concrete questions. On X3, selecting `profile:LeftTopEar.Outer.OuterArc` linked one authored arc to arrangement and final descendants, establishing that the intended hole center lies inside the trusted R50 lobe. On X4, selecting `hole:Ctc01PrismaticBlockoutX4.LeftTopMount` reports 18 material descendants: eight boundary edges, eight wall faces, and entry/exit loops. It highlights all split faces without a geometric search.++The initial X4 screenshot exposed a genuine analytic-display defect. DisplayIR published only axial hints, derived from unrelated global planes. Each quarter-cylinder face was rendered as a complete cylinder, so eight coincident previews z-fought and appeared clipped. DisplayIR now publishes face-local `(minU,maxU,minV,maxV)` bounds derived from the actual boundary, and the cylinder/cone preview mapper respects them. The corrected view shows four clean holes and a stable semantic highlight.++Evidence images:++- `artifacts/reconstruction/ctc01-llm-pressure-x4/cadmata-reference.png`+- `artifacts/reconstruction/ctc01-llm-pressure-x4/cadmata-x3-left-top-outer-arc.png`+- `artifacts/reconstruction/ctc01-llm-pressure-x4/cadmata-x4-left-top-mount-hole-fixed.png`++## LLM friction log++| Task | Tool | Input representation | Output representation | Reliable inference | Remaining ambiguity/friction | Workaround | Category | Smallest improvement | Implemented |+| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |+| Retain X3 intent | source + `inspect-profile` | Named guides/Profiles | Stable IDs, spans, curve table | Exact trusted structure | None material | Preserve X3 in X4 | Representation | Stable source identity | Already worked |+| Understand sections | `inspect-compose` | Compose operations | Compact slabs, loops, areas | Interval structure and volume | Lowered Profiles can clutter | Compact `shaftHoles` table | Representation | Report semantic records | Yes |+| Find next feature | STEP `analyze --face` | 117 exact faces | Per-face parameters | Radius, axis, center, Z span | Manual split-face/PMI correlation | Batch and group analytically | Perception/context | Analytic feature-family table | Not yet |+| Cross-check levels | `sections` | STEP + levels | Deep Below/At/Above graphs | Closed loops away from transitions | Verbose; coincident At ownership | Use Below/Above and prior packet | Representation/performance | Compact section difference | Not yet |+| Inspect provenance | Cadmata | Compiler artifact | Source/material overlay | Exact descendants | Reference lacks semantic source | Cross-check face table | Perception | Reference/source bundle | Not yet |+| Author on Compose | Hole + Compose | Hole intent/host | Initially no route | Primitive Hole semantics fit | Host capability gap | Bounded static lowering | Authoring/compiler | Compose Shaft/ThroughAll | Yes |+| Emit inner loops | arrangement/emitter | Four circles | Duplicate transition IDs | Geometry was valid | Collision blocked result | Deterministic loop index | Compiler | Unique inner provenance | Yes |+| Resolve entry | selections | ThroughAll | Initially no entry | Wall faces proved existence | Global extent differed locally | Retained boundary extrema | Provenance | Host-relative entry/exit | Yes |+| View walls | analytic facade | Eight trimmed faces | Initially eight full cylinders | Family/radius exact | UV trim absent/global | Add face-local UV bounds | Visualization | Publish/honor trim domain | Yes |+| Iterate CLI | `dotnet run`/binary | Repeated commands | CLI JSON | Correctness | Build contention/latency | Built executable, sequential calls | Performance | Document fast loop | Workaround |+| Materialize four holes | M8 tessellation | Exact multi-inner-loop BRep | Initially hung | Failure localized to planar cap filtering | Removed ring anchor remained the loop sentinel | Trace CPU-bound verifier and compare X3 | Verification/performance | Mutable earcut end anchor + regression | Yes |+| Verify void orientation | `verify`/M8 | STEP + analytic volume | Initially `+511,914 mm³`, outside bound | Error was exactly consistent with outward void cylinders | Topological orientation alone did not expose surface sense | Compare X3/X4 boundary-integral contributions | Verification/compiler | Bind curved inner walls `SameSense=false` | Yes |+| Verify final | `verify`/M8 | STEP + expected volume | Hash-linked report | Independent mass/topology | Too expensive for exploration | Run once at final stage | Verification/performance | Staged ladder | Existing doctrine |++## Artifact evidence++- Firmament: `testdata/firmament/reconstructions/nist_ctc_01/ctc01_prismatic_blockout_x4.firmament`.+- Route: semantic Compose Hole → exact arc removal Profiles → `ProfileArrangement2D` → `PrismaticSectionStackConstruction` → authoritative BRepPlan → BRep → STEP AP242.+- STEP SHA-256: `9F868B75A36C68D377F269F2E7AB6922A23312A49C14EF5C54EF78BDF1B9AE39`.+- Canonical re-export SHA-256: `10D1E6DE4EC51A6455B6CCCCED1AAB71634840B1202A7D1B54F0E1E8B782ABA0`.+- Reimport topology: 1 body, 1 shell, 95 faces, 232 edges, 140 vertices.+- Analytic surfaces: 47 planes and 48 cylinders; no cones, spheres, tori, splines, or mesh-only construction.+- Bounds: `[-400,-225,-100]..[400,225,50]` mm.+- Structural analysis: enclosed manifold.+- Analytic volume: 27,118,963.928622365 mm³.+- M8: `NumericalWithBound`; 27,118,117.403542258 mm³, surface area 881,817.6884389693 mm², centroid approximately `(0, -0.00000043, -47.6961545)` mm.+- M8 comparison: -846.5250801406801 mm³ (-0.00312%) from the analytic volume, inside the reported 352,727.07537558774 mm³ bound; enclosed and orientation-consistent.+- External verification: pending; no configured external CAD Assistant was invoked.++## Known omissions and recommendation++X4 still omits the Z=-50 relief system, Ø25 local holes, capsule and rounded-rectangle openings, side Ø20 holes and conical entries, R25 family interpretation, local pads/bosses, and central R5/other edge finishes.++The next milestone should reconstruct the Z=-50 relief together with one unambiguous opening, starting with the left R20 capsule if section ownership can be summarized cleanly. First add a bounded analytic feature-family/section-difference report grouping reference faces by shared axis, radius, center, and support interval. If the side-hole family is chosen instead, the explicit construction blocker is a semantic face-normal shaft/countersink on a composed host—not generic Boolean subtraction.++## Validation status++- `dotnet restore Aetheris.slnx` and the final solution build pass; the build has 11 existing JavaScript dependency-audit warnings and no errors.+- Focused final tests pass: 36 analytic-display/planar-triangulation tests, 2 X4 semantic-hole tests, 3 inspect-compose CLI tests, all 40 server tests, and all 55 Cadmata tests.+- Cadmata's production build and targeted lint for the changed analytic mapper/API/test files pass.+- The solution-wide test invocation remains red in unrelated existing suites: 21 Core NIST audit/snapshot tests, 4 Firmament static-logic/legacy M8-tolerance tests, and 5 CLI help/corpus tests. The two legacy geometry failures reproduce with the X4 surface-sense and triangulator changes locally reverted; the CLI help assertion expects an obsolete command list. No X4-focused test fails.+- Full frontend lint remains red on six existing errors in `App.tsx`, `StepImportDropzone.tsx`, `button.tsx`, `AetherisViewport.tsx`, `CadmataOverlay.tsx`, and `tailwind.config.ts`; the changed trim files are clean.+- `git diff --check` passes.++## Direct research answers++**Did the toolchain let GPT reason about and author the next feature without human-style visual drafting?** Yes. Exact reference surfaces and PMI selected it; Firmament authored it; arrangement, provenance, STEP, and M8 validated it. Cadmata answered alignment and descendant questions, not measurements. Manual reference-face grouping remains costly.++**Which representation most improved GPT mechanical reasoning?** A compact analytic feature tuple `(center, axis, radius, support interval)` combined with stable source-to-material correspondence. It converted a visual circle into a manufacturing-relevant Ø35 ThroughAll Hole with verifiable entry, exit, and wall topology.++**Which missing capability is the largest remaining LLM bottleneck?** For reasoning, a compact semantic difference packet that groups reference analytic faces and section regions into feature candidates. For construction, face-normal composite Hole support on composed hosts, needed for the exact side holes and conical entries.diff --git a/testdata/firmament/reconstructions/nist_ctc_01/README.md b/testdata/firmament/reconstructions/nist_ctc_01/README.mdindex deab869a..92e5e00d 100644--- a/testdata/firmament/reconstructions/nist_ctc_01/README.md+++ b/testdata/firmament/reconstructions/nist_ctc_01/README.md@@ -30,3 +30,11 @@ rectangular primary-plate subset, and two exact four-hole patterns through thecurrent production route. The full audit, comparison, M8 contradiction, and gapledger are in `docs/reconstruction/ctc01-reconstruction-a1.md` and`artifacts/reconstruction/ctc01/`.++## Semantic prismatic reconstruction++- `ctc01_prismatic_blockout_x2.firmament`: initial exact Profile/Compose blockout.+- `ctc01_prismatic_blockout_x3.firmament`: shared Concept/template scaffold, exact lobe arcs, mid-level web, central hex, and stable semantic selections.+- `ctc01_prismatic_blockout_x4.firmament`: preserves X3 and adds the four reference-backed Ø35 mounting holes as semantic `Hole<Shaft>/ThroughAll` features inside the composition.++The X4 investigation, feature ranking, Cadmata evidence, verification, and LLM-authoring friction log are in `docs/reconstruction/ctc01-llm-pressure-x4.md`.diff --git a/testdata/firmament/reconstructions/nist_ctc_01/ctc01_prismatic_blockout_x4.firmament b/testdata/firmament/reconstructions/nist_ctc_01/ctc01_prismatic_blockout_x4.firmamentnew file mode 100644index 00000000..6abd318a--- /dev/null+++ b/testdata/firmament/reconstructions/nist_ctc_01/ctc01_prismatic_blockout_x4.firmament@@ -0,0 +1,67 @@+// CTC-01 X4: preserve the X3 prismatic blockout and add the four observed+// diameter-35 mounting shaft holes through the full lobe/web thickness.+Record LobeSpec { Key: Symbol; Path: Point2[]; InnerCenter: Point2; OuterCenter: Point2; Radius: Length; InnerStart: Point2; InnerEnd: Point2; OuterStart: Point2; OuterEnd: Point2; Sweep: ArcSweep; Role: ConceptRole }+Let Lobes: LobeSpec[] = [+ LobeSpec { Key: LeftTop; Path: [[-400mm,125mm],[-250mm,125mm],[-250mm,175mm],[-300mm,225mm],[-350mm,225mm],[-400mm,175mm]]; InnerCenter: [-300mm,175mm]; OuterCenter: [-350mm,175mm]; Radius: 50mm; InnerStart: [-250mm,175mm]; InnerEnd: [-300mm,225mm]; OuterStart: [-350mm,225mm]; OuterEnd: [-400mm,175mm]; Sweep: CounterClockwise; Role: StrongInferenceR50Lobe }+ LobeSpec { Key: RightTop; Path: [[250mm,125mm],[400mm,125mm],[400mm,175mm],[350mm,225mm],[300mm,225mm],[250mm,175mm]]; InnerCenter: [300mm,175mm]; OuterCenter: [350mm,175mm]; Radius: 50mm; InnerStart: [300mm,225mm]; InnerEnd: [250mm,175mm]; OuterStart: [400mm,175mm]; OuterEnd: [350mm,225mm]; Sweep: CounterClockwise; Role: StrongInferenceR50Lobe }+ LobeSpec { Key: LeftBottom; Path: [[-350mm,-225mm],[-300mm,-225mm],[-250mm,-175mm],[-250mm,-125mm],[-400mm,-125mm],[-400mm,-175mm]]; InnerCenter: [-300mm,-175mm]; OuterCenter: [-350mm,-175mm]; Radius: 50mm; InnerStart: [-300mm,-225mm]; InnerEnd: [-250mm,-175mm]; OuterStart: [-400mm,-175mm]; OuterEnd: [-350mm,-225mm]; Sweep: CounterClockwise; Role: StrongInferenceR50Lobe }+ LobeSpec { Key: RightBottom; Path: [[300mm,-225mm],[350mm,-225mm],[400mm,-175mm],[400mm,-125mm],[250mm,-125mm],[250mm,-175mm]]; InnerCenter: [300mm,-175mm]; OuterCenter: [350mm,-175mm]; Radius: 50mm; InnerStart: [250mm,-175mm]; InnerEnd: [300mm,-225mm]; OuterStart: [350mm,-225mm]; OuterEnd: [400mm,-175mm]; Sweep: CounterClockwise; Role: StrongInferenceR50Lobe }+]+Template RoundedLobe<Spec: LobeSpec> { Concept Struct Layout { } Profile Shape { } }+Expand Lobes With RoundedLobe++Profile PrimaryWeb Using Ctc01BlockoutScaffold { Loop Outer {+ Segment South { Trace: PrimaryWebGuide.Bottom; From: PrimaryWebGuide.BottomLeft; To: PrimaryWebGuide.BottomRight }+ Segment East { Trace: PrimaryWebGuide.Right; From: PrimaryWebGuide.BottomRight; To: PrimaryWebGuide.TopRight }+ Segment North { Trace: PrimaryWebGuide.Top; From: PrimaryWebGuide.TopRight; To: PrimaryWebGuide.TopLeft }+ Segment West { Trace: PrimaryWebGuide.Left; From: PrimaryWebGuide.TopLeft; To: PrimaryWebGuide.BottomLeft }+} }+Profile MidLevelWeb Using Ctc01BlockoutScaffold { Loop Outer {+ Segment South { Trace: MidLevelGuide.Bottom; From: MidLevelGuide.BottomLeft; To: MidLevelGuide.BottomRight }+ Segment East { Trace: MidLevelGuide.Right; From: MidLevelGuide.BottomRight; To: MidLevelGuide.TopRight }+ Segment North { Trace: MidLevelGuide.Top; From: MidLevelGuide.TopRight; To: MidLevelGuide.TopLeft }+ Segment West { Trace: MidLevelGuide.Left; From: MidLevelGuide.TopLeft; To: MidLevelGuide.BottomLeft }+} }+Concept Struct Ctc01HexGuide On XY {+ Point2 HexSouth { Position: [0mm,-57.7350538379252mm] } Point2 HexSouthEast { Position: [50mm,-28.8675403784439mm] } Point2 HexNorthEast { Position: [50mm,28.8674865405187mm] } Point2 HexNorth { Position: [0mm,57.735mm] } Point2 HexNorthWest { Position: [-50mm,28.8674865405186mm] } Point2 HexSouthWest { Position: [-50mm,-28.8675403784438mm] }+ Line2 HexSE { From: HexSouth; To: HexSouthEast } Line2 HexE { From: HexSouthEast; To: HexNorthEast } Line2 HexNE { From: HexNorthEast; To: HexNorth } Line2 HexNW { From: HexNorth; To: HexNorthWest } Line2 HexW { From: HexNorthWest; To: HexSouthWest } Line2 HexSW { From: HexSouthWest; To: HexSouth }+}+Profile CentralHex Using Ctc01HexGuide { Loop Outer {+ Segment SouthEast { Trace: HexSE; From: HexSouth; To: HexSouthEast } Segment East { Trace: HexE; From: HexSouthEast; To: HexNorthEast } Segment NorthEast { Trace: HexNE; From: HexNorthEast; To: HexNorth } Segment NorthWest { Trace: HexNW; From: HexNorth; To: HexNorthWest } Segment West { Trace: HexW; From: HexNorthWest; To: HexSouthWest } Segment SouthWest { Trace: HexSW; From: HexSouthWest; To: HexSouth }+} }++Struct Composition { Compose Ctc01PrismaticBlockoutX4 {+ Placement ReferenceWorld { Anchor: [0mm,0mm,0mm]; ProfilePlane: XY; Axis: +Z; ReferenceDirection: +X }+ Base PrimaryPlate { Profile: PrimaryWeb; From: -100mm; To: 0mm; Role: ObservedPrimaryWeb }+ Add Lobes { Profiles: [LeftTopEar, RightTopEar, LeftBottomEar, RightBottomEar]; From: -100mm; To: 0mm; Role: StrongInferenceR50Lobe }+ Add MidLevelPlate { Profile: MidLevelWeb; From: -60mm; To: 0mm; Role: StrongInferenceMidLevel }+ Add CentralRaisedRegion { Profile: CentralHex; From: 0mm; To: 50mm; Role: StrongInferenceCentralRaisedRegion }++ // Reference STEP faces 72..77 and 90..91 prove four split cylindrical walls,+ // radius 17.5 mm, axis -Z, spanning Z=-100..0; AP242 PMI independently gives diameter 35 mm.+ Hole<Shaft> LeftTopMount { Center: [-325mm,175mm]; Diameter: 35mm; End: ThroughAll; Role: ObservedMountingHole }+ Hole<Shaft> RightTopMount { Center: [325mm,175mm]; Diameter: 35mm; End: ThroughAll; Role: ObservedMountingHole }+ Hole<Shaft> LeftBottomMount { Center: [-325mm,-175mm]; Diameter: 35mm; End: ThroughAll; Role: ObservedMountingHole }+ Hole<Shaft> RightBottomMount { Center: [325mm,-175mm]; Diameter: 35mm; End: ThroughAll; Role: ObservedMountingHole }+} }++Selection LeftTopLobeOuterArc {+ Target: TopBoundary+ Source: LeftTopEar.ProfileSegments([OuterArc])+ Require: ConnectedChain+}+Selection CentralHexTopLoop {+ Target: TopBoundary+ Source: CentralHex.ProfileSegments([SouthEast, East, NorthEast, NorthWest, West, SouthWest])+ Require: ClosedLoop+}+Selection LeftTopMountEntry {+ Target: HoleEntry+ Source: Hole(LeftTopMount)+ Require: ClosedLoop+}+Selection LeftTopMountWall {+ Target: HoleWall+ Source: Hole(LeftTopMount)+ Require: NonEmptyFaceSet+}