Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Add capsule and rounded-rectangle slot support

Yuechen Lib9be43f5836e
diff --git a/Aetheris.CLI/CliRunner.cs b/Aetheris.CLI/CliRunner.cs
index 9423b745..ab5538bd 100644
--- a/Aetheris.CLI/CliRunner.cs
+++ b/Aetheris.CLI/CliRunner.cs
@@ -552,6 +552,8 @@ public static class CliRunner
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, 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 }),
+ capsuleSlots = (stack.Feature.CapsuleSlots ?? []).Select(x => new { x.Name, x.StableId, kind = "Slot<Capsule>", profile = x.ProfileReference, center = new[] { x.CenterX, x.CenterY }, direction = new[] { x.DirectionX, x.DirectionY }, x.Length, x.Width, radius = x.Radius, straightSpan = x.StraightSpan, endCenters = new[] { new[] { x.CenterX - x.DirectionX * x.StraightSpan / 2d, x.CenterY - x.DirectionY * x.StraightSpan / 2d }, new[] { x.CenterX + x.DirectionX * x.StraightSpan / 2d, x.CenterY + x.DirectionY * x.StraightSpan / 2d } }, x.From, x.To, x.Extent, x.SemanticRole, x.SourceSpan, segments = parsed.Profiles[x.ProfileReference].Loops.Single().Segments.Select(s => s.Name) }),
+ roundedRectangleSlots = (stack.Feature.RoundedRectangleSlots ?? []).Select(x => new { x.Name, x.StableId, kind = "Slot<RoundedRectangle>", profile = x.ProfileReference, center = new[] { x.CenterX, x.CenterY }, direction = new[] { x.DirectionX, x.DirectionY }, x.Length, x.Width, x.CornerRadius, x.From, x.To, x.Extent, x.SemanticRole, x.SourceSpan, segments = parsed.Profiles[x.ProfileReference].Loops.Single().Segments.Select(s => s.Name) }),
criticalLevels = stack.Feature.CriticalLevels,
slabs = stack.Slabs.Select(x => new
{
diff --git a/Aetheris.Kernel.Firmament.Tests/PrismaticProfileCompositionRoundTripTests.cs b/Aetheris.Kernel.Firmament.Tests/PrismaticProfileCompositionRoundTripTests.cs
index cd5eb597..0058151a 100644
--- a/Aetheris.Kernel.Firmament.Tests/PrismaticProfileCompositionRoundTripTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/PrismaticProfileCompositionRoundTripTests.cs
@@ -8,6 +8,48 @@ namespace Aetheris.Kernel.Firmament.Tests;
public sealed class PrismaticProfileCompositionRoundTripTests
{
+ [Fact]
+ public void SemanticCapsuleSlot_LowersToExactProfileAndPublishesStableDescendants()
+ {
+ var source = File.ReadAllText(CompositionFixture(Path.Combine("valid", "semantic-capsule-slot-through.firmament")));
+ var parsed = PrismaticProfileCompositionParser.Parse(source);
+ Assert.Empty(parsed.Diagnostics);
+ var stack = Assert.IsType<PrismaticSectionStackConstruction>(PrismaticSectionStackCompiler.Normalize(parsed, out var diagnostics));
+ Assert.Empty(diagnostics);
+ var slot = Assert.Single(stack.Feature.CapsuleSlots!);
+ Assert.Equal(20d, slot.Radius); Assert.Equal(40d, slot.StraightSpan);
+ var profile = parsed.Profiles[slot.ProfileReference];
+ Assert.Equal(2, profile.Loops.Single().Segments.Count(x => x.Geometry is LineArcLineSegment2D));
+ Assert.Equal(2, profile.Loops.Single().Segments.Count(x => x.Geometry is LineArcCircularArc2D));
+ Assert.Equal(20d * 40d + Math.PI * 20d * 20d, 2056.6370614359173d, 8);
+ Assert.Equal((200d * 100d - (40d * 40d + Math.PI * 20d * 20d)) * 20d, stack.AnalyticVolume, 8);
+ var emitted = PrismaticSectionStackEmitter.Emit(stack);
+ Assert.NotNull(emitted.Body); Assert.NotNull(emitted.Correspondence);
+ Assert.Contains(emitted.Correspondence!.Descendants, x => x.Role == SemanticTopologyRole.SlotEntryLoop);
+ Assert.Equal(2, emitted.Correspondence.Descendants.Count(x => x.Role == SemanticTopologyRole.SlotStraightWallFace));
+ Assert.Equal(2, emitted.Correspondence.Descendants.Count(x => x.Role == SemanticTopologyRole.SlotEndWallFace));
+ }
+
+ [Fact]
+ public void SemanticRoundedRectangleSlot_LowersToExactProfileAndPublishesStableDescendants()
+ {
+ var source = File.ReadAllText(CompositionFixture(Path.Combine("valid", "semantic-rounded-rectangle-slot-through.firmament")));
+ var parsed = PrismaticProfileCompositionParser.Parse(source);
+ Assert.Empty(parsed.Diagnostics);
+ var stack = Assert.IsType<PrismaticSectionStackConstruction>(PrismaticSectionStackCompiler.Normalize(parsed, out var diagnostics));
+ Assert.Empty(diagnostics);
+ var slot = Assert.Single(stack.Feature.RoundedRectangleSlots!);
+ Assert.Equal(10d, slot.CornerRadius);
+ var segments = parsed.Profiles[slot.ProfileReference].Loops.Single().Segments;
+ Assert.Equal(4, segments.Count(x => x.Geometry is LineArcLineSegment2D));
+ Assert.Equal(4, segments.Count(x => x.Geometry is LineArcCircularArc2D));
+ var expectedArea = 80d * 40d - (4d - Math.PI) * 10d * 10d;
+ Assert.Equal((200d * 100d - expectedArea) * 20d, stack.AnalyticVolume, 8);
+ var emitted = PrismaticSectionStackEmitter.Emit(stack);
+ Assert.Equal(4, emitted.Correspondence!.Descendants.Count(x => x.Role == SemanticTopologyRole.SlotStraightWallFace));
+ Assert.Equal(4, emitted.Correspondence.Descendants.Count(x => x.Role == SemanticTopologyRole.SlotEndWallFace));
+ }
+
[Theory]
[InlineData("add-overlapped-by-remove.firmament", 418d, 4090d, 1)]
[InlineData("overlapping-removes.firmament", 304d, 5520d, 1)]
diff --git a/Aetheris.Kernel.Firmament/Materializer/PrismaticProfileComposition.cs b/Aetheris.Kernel.Firmament/Materializer/PrismaticProfileComposition.cs
index 383d236d..e617ffe0 100644
--- a/Aetheris.Kernel.Firmament/Materializer/PrismaticProfileComposition.cs
+++ b/Aetheris.Kernel.Firmament/Materializer/PrismaticProfileComposition.cs
@@ -15,12 +15,33 @@ public sealed record PrismaticProfileOperation(
public sealed record PrismaticShaftHoleFeature(
string Name, string StableId, string ProfileReference, double CenterX, double CenterY, double Diameter,
double From, double To, string SemanticRole, string SourceSpan);
+/// <summary>Compiler-owned capsule contract; the generated Profile remains lowering detail.</summary>
+public sealed record PrismaticCapsuleSlotFeature(
+ string Name, string StableId, string ProfileReference, double CenterX, double CenterY,
+ double DirectionX, double DirectionY, double Length, double Width, double From, double To,
+ string Extent, string SemanticRole, string SourceSpan)
+{
+ public double Radius => Width / 2d;
+ public double StraightSpan => Length - Width;
+}
+/// <summary>Compiler-owned rounded-rectangle slot contract; corner radii are explicit authored semantics.</summary>
+public sealed record PrismaticRoundedRectangleSlotFeature(
+ string Name, string StableId, string ProfileReference, double CenterX, double CenterY,
+ double DirectionX, double DirectionY, double Length, double Width, double CornerRadius, double From, double To,
+ string Extent, 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<PrismaticShaftHoleFeature>? ShaftHoles = null);
+ IReadOnlyList<double> CriticalLevels, string Provenance, IReadOnlyList<PrismaticShaftHoleFeature>? ShaftHoles = null,
+ IReadOnlyList<PrismaticCapsuleSlotFeature>? CapsuleSlots = null,
+ IReadOnlyList<PrismaticRoundedRectangleSlotFeature>? RoundedRectangleSlots = null)
+{
+ public IEnumerable<(string Name, string StableId, string ProfileReference)> AllSlotProfiles =>
+ (CapsuleSlots ?? []).Select(x => (x.Name, x.StableId, x.ProfileReference))
+ .Concat((RoundedRectangleSlots ?? []).Select(x => (x.Name, x.StableId, x.ProfileReference)));
+}
public sealed record PrismaticSectionRegion(
ResolvedProfile2D Outer, IReadOnlyList<ResolvedProfile2D> Holes, IReadOnlyList<string> Provenance);
public sealed record PrismaticSectionSlab(
@@ -55,6 +76,13 @@ public static class PrismaticProfileCompositionParser
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);
+ private static readonly Regex SlotHeader = new(@"\bSlot\s*<\s*(?<variant>\w+)\s*>\s+(?<n>\w+)\s*\{", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
+ private static readonly Regex SlotCenter = new(@"\bCenter\s*:\s*(?:Point2\s*\()?\[?(?<x>[-+.\d]+)mm\s*,\s*(?<y>[-+.\d]+)mm\]?\)?", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
+ private static readonly Regex SlotDirection = new(@"\bDirection\s*:\s*(?:Vector2\s*\()?\[?(?<x>[-+.\d]+)\s*,\s*(?<y>[-+.\d]+)\]?\)?", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
+ private static readonly Regex SlotLength = new(@"\bLength\s*:\s*(?<v>[-+.\d]+)mm", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
+ private static readonly Regex SlotWidth = new(@"\bWidth\s*:\s*(?<v>[-+.\d]+)mm", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
+ private static readonly Regex SlotCornerRadius = new(@"\bCornerRadius\s*:\s*(?<v>[-+.\d]+)mm", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
+ private static readonly Regex SlotExtent = new(@"\bExtent\s*:\s*(?<v>ThroughAll|Between\s*\(\s*(?<from>[-+.\d]+)mm\s*,\s*(?<to>[-+.\d]+)mm\s*\))", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
public static bool IsCompositionSource(string source) => ComposeHead.IsMatch(source);
@@ -149,6 +177,8 @@ public static class PrismaticProfileCompositionParser
}
if (operations.Count(o => o.Intent == PrismaticProfileIntent.Base) != 1) diagnostics.Add("compose-requires-exactly-one-base-operation");
var shaftHoles = new List<PrismaticShaftHoleFeature>();
+ var capsuleSlots = new List<PrismaticCapsuleSlotFeature>();
+ var roundedRectangleSlots = new List<PrismaticRoundedRectangleSlotFeature>();
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))
@@ -177,8 +207,39 @@ public static class PrismaticProfileCompositionParser
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));
}
+ foreach (Match header in SlotHeader.Matches(composeBody))
+ {
+ var name = header.Groups["n"].Value; var body = Block(composeBody, header.Index + header.Length - 1);
+ if (body is null) { diagnostics.Add($"SlotProfileDegenerate:{name}:unclosed"); continue; }
+ var center = SlotCenter.Match(body); var direction = SlotDirection.Match(body); var length = SlotLength.Match(body); var width = SlotWidth.Match(body); var extent = SlotExtent.Match(body); var role = HoleRole.Match(body);
+ var variant=header.Groups["variant"].Value;
+ if (!string.Equals(variant,"Capsule",StringComparison.OrdinalIgnoreCase) && !string.Equals(variant,"RoundedRectangle",StringComparison.OrdinalIgnoreCase)) { diagnostics.Add($"UnsupportedSlotHostTopology:{name}:supported variants are Capsule and RoundedRectangle"); continue; }
+ if (!center.Success || !direction.Success || !length.Success || !width.Success || !extent.Success) { diagnostics.Add($"SlotProfileDegenerate:{name}:missing Center, Direction, Length, Width, or Extent"); continue; }
+ var x=N(center,"x"); var y=N(center,"y"); var dx=N(direction,"x"); var dy=N(direction,"y"); var l=N(length,"v"); var w=N(width,"v");
+ if (l <= 0 || !double.IsFinite(l)) { diagnostics.Add($"SlotLengthMustBePositive:{name}:length={l:R}"); continue; }
+ if (w <= 0 || !double.IsFinite(w)) { diagnostics.Add($"SlotWidthMustBePositive:{name}:width={w:R}"); continue; }
+ if (string.Equals(variant,"Capsule",StringComparison.OrdinalIgnoreCase) && l < w) { diagnostics.Add($"SlotLengthLessThanWidth:{name}:length={l:R}:width={w:R}"); continue; }
+ if (string.Equals(variant,"Capsule",StringComparison.OrdinalIgnoreCase) && l == w) { diagnostics.Add($"SlotProfileDegenerate:{name}:Length == Width is rejected; use Hole<Shaft> for a circular opening"); continue; }
+ var norm=Math.Sqrt(dx*dx+dy*dy); if (!double.IsFinite(norm) || norm <= 1e-12) { diagnostics.Add($"SlotDirectionDegenerate:{name}:direction=[{dx:R},{dy:R}]"); continue; }
+ if (!names.Add(name)) { diagnostics.Add($"compose-duplicate-operation:{name}"); continue; }
+ var from=materialFrom; var to=materialTo; var extentText=extent.Groups["v"].Value;
+ if (!string.Equals(extentText, "ThroughAll", StringComparison.OrdinalIgnoreCase)) { from=N(extent,"from"); to=N(extent,"to"); if (from >= to) { diagnostics.Add($"SlotExtentInvalid:{name}:entry={from:R}:exit={to:R}"); continue; } if (to <= materialFrom || from >= materialTo) { diagnostics.Add($"SlotDoesNotIntersectMaterial:{name}:host=[{materialFrom:R},{materialTo:R}]"); continue; } from=Math.Max(from,materialFrom); to=Math.Min(to,materialTo); }
+ dx/=norm; dy/=norm; var stableId=$"slot:{compose.Groups["n"].Value}.{name}"; var sourceSpan=$"offset:{header.Index}"; var semanticRole=role.Success ? role.Groups["role"].Value : $"{variant}Slot";
+ if (string.Equals(variant,"Capsule",StringComparison.OrdinalIgnoreCase))
+ {
+ var profileName=$"{name}CapsuleProfile"; var profile=CapsuleProfile(profileName,x,y,dx,dy,l,w,stableId,sourceSpan); var validation=ResolvedProfile2DValidator.Validate(profile); diagnostics.AddRange(validation.Diagnostics); if (!validation.IsValid) { diagnostics.Add($"SlotProfileDegenerate:{name}"); continue; }
+ profiles.Add(profileName,profile); capsuleSlots.Add(new(name,stableId,profileName,x,y,dx,dy,l,w,from,to,extentText,semanticRole,sourceSpan)); operations.Add(new(name,PrismaticProfileIntent.Remove,profileName,from,to,semanticRole,sourceSpan,stableId,"Slot<Capsule>"));
+ }
+ else
+ {
+ var corner=SlotCornerRadius.Match(body); if (!corner.Success) { diagnostics.Add($"SlotProfileDegenerate:{name}:RoundedRectangle requires CornerRadius"); continue; }
+ var r=N(corner,"v"); if (!double.IsFinite(r) || r <= 0 || 2*r > Math.Min(l,w)) { diagnostics.Add($"SlotProfileDegenerate:{name}:CornerRadius={r:R} must be positive and no greater than min(Length,Width)/2"); continue; }
+ var profileName=$"{name}RoundedRectangleProfile"; var profile=RoundedRectangleProfile(profileName,x,y,dx,dy,l,w,r,stableId,sourceSpan); var validation=ResolvedProfile2DValidator.Validate(profile); diagnostics.AddRange(validation.Diagnostics); if (!validation.IsValid) { diagnostics.Add($"SlotProfileDegenerate:{name}"); continue; }
+ profiles.Add(profileName,profile); roundedRectangleSlots.Add(new(name,stableId,profileName,x,y,dx,dy,l,w,r,from,to,extentText,semanticRole,sourceSpan)); operations.Add(new(name,PrismaticProfileIntent.Remove,profileName,from,to,semanticRole,sourceSpan,stableId,"Slot<RoundedRectangle>"));
+ }
+ }
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", shaftHoles) : null;
+ var feature = diagnostics.Count == 0 ? new PrismaticProfileCompositionFeature(compose.Groups["n"].Value, "XY", "+Z", placement, operations, levels, "parser-backed-scaffold-profile-composition", shaftHoles, capsuleSlots, roundedRectangleSlots) : null;
return new(feature, profiles, diagnostics.Distinct().ToArray(), expansion.Evidence);
}
@@ -190,6 +251,26 @@ public static class PrismaticProfileCompositionParser
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 ResolvedProfile2D CapsuleProfile(string profileName, double x, double y, double dx, double dy, double length, double width, string slotId, string sourceSpan)
+ {
+ var r=width/2d; var h=(length-width)/2d; var nx=-dy; var ny=dx;
+ var a=(X:x-dx*h,Y:y-dy*h); var b=(X:x+dx*h,Y:y+dy*h);
+ var p0=(X:a.X+nx*r,Y:a.Y+ny*r); var p1=(X:b.X+nx*r,Y:b.Y+ny*r); var p2=(X:b.X-nx*r,Y:b.Y-ny*r); var p3=(X:a.X-nx*r,Y:a.Y-ny*r);
+ var start=Math.Atan2(ny,nx); var end=Math.Atan2(-ny,-nx);
+ ResolvedProfileSegment2D S(string role, LineArcProfileCurve2D curve) => new(role,curve,new($"profile:{profileName}.Outer.{role}",$"{slotId}.{role}",sourceSpan,$"Slot<Capsule>({slotId})","XY"));
+ return new(profileName,"XY",[new ResolvedProfileLoop2D("Outer",true,[S("NegativeSide",new LineArcLineSegment2D(p3,p2)),S("EndCap",new LineArcCircularArc2D(b,r,end,Math.PI)),S("PositiveSide",new LineArcLineSegment2D(p1,p0)),S("StartCap",new LineArcCircularArc2D(a,r,start,Math.PI))])]);
+ }
+ private static ResolvedProfile2D RoundedRectangleProfile(string profileName, double x, double y, double dx, double dy, double length, double width, double r, string slotId, string sourceSpan)
+ {
+ var nx=-dy; var ny=dx; (double X,double Y) P(double u,double v)=>(x+dx*u+nx*v,y+dy*u+ny*v); var hx=length/2d; var hy=width/2d;
+ ResolvedProfileSegment2D S(string role,LineArcProfileCurve2D curve)=>new(role,curve,new($"profile:{profileName}.Outer.{role}",$"{slotId}.{role}",sourceSpan,$"Slot<RoundedRectangle>({slotId})","XY"));
+ return new(profileName,"XY",[new ResolvedProfileLoop2D("Outer",true,[
+ S("NegativeSide",new LineArcLineSegment2D(P(-hx+r,-hy),P(hx-r,-hy))), S("EndNegativeCorner",new LineArcCircularArc2D(P(hx-r,-hy+r),r,Math.Atan2(-ny, -nx),Math.PI/2d)),
+ S("EndSide",new LineArcLineSegment2D(P(hx,-hy+r),P(hx,hy-r))), S("EndPositiveCorner",new LineArcCircularArc2D(P(hx-r,hy-r),r,Math.Atan2(dy,dx),Math.PI/2d)),
+ S("PositiveSide",new LineArcLineSegment2D(P(hx-r,hy),P(-hx+r,hy))), S("StartPositiveCorner",new LineArcCircularArc2D(P(-hx+r,hy-r),r,Math.Atan2(ny,nx),Math.PI/2d)),
+ S("StartSide",new LineArcLineSegment2D(P(-hx,hy-r),P(-hx,-hy+r))), S("StartNegativeCorner",new LineArcCircularArc2D(P(-hx+r,-hy+r),r,Math.Atan2(-dy,-dx),Math.PI/2d))
+ ])]);
+ }
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.cs
index 3b4a0a54..fba33306 100644
--- a/Aetheris.Kernel.Firmament/Materializer/PrismaticSectionStackCompiler.cs
+++ b/Aetheris.Kernel.Firmament/Materializer/PrismaticSectionStackCompiler.cs
@@ -193,8 +193,35 @@ public static class PrismaticSectionStackEmitter
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}"));
}
+ foreach (var slot in stack.Feature.AllSlotProfiles)
+ {
+ var prefix = $"profile:{slot.ProfileReference}.Outer.";
+ var slotSides = sideFaces.Select((side, index) => (Side: side, Face: faces[capFaces.Count + index]))
+ .Where(x => x.Side.Source.StartsWith(prefix, StringComparison.Ordinal)).ToArray();
+ if (slotSides.Length == 0) { d.Add($"SlotCorrespondenceMissing:{slot.Name}"); continue; }
+ var horizontalEdges = slotSides.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();
+ foreach(var edge in entryEdges) descendants.Add(new($"material:{slot.StableId}:entry-edge:{edge.Value}","Edge",SemanticTopologyRole.TopBoundary,slot.StableId,Edge:edge,ParentStableId:slot.StableId,GeometryPreview:"capsule-entry"));
+ foreach(var edge in exitEdges) descendants.Add(new($"material:{slot.StableId}:exit-edge:{edge.Value}","Edge",SemanticTopologyRole.BottomBoundary,slot.StableId,Edge:edge,ParentStableId:slot.StableId,GeometryPreview:"capsule-exit"));
+ foreach(var side in slotSides)
+ {
+ var role = side.Side.Source.EndsWith(".PositiveSide",StringComparison.Ordinal) || side.Side.Source.EndsWith(".NegativeSide",StringComparison.Ordinal) || side.Side.Source.EndsWith(".StartSide",StringComparison.Ordinal) || side.Side.Source.EndsWith(".EndSide",StringComparison.Ordinal) ? SemanticTopologyRole.SlotStraightWallFace : SemanticTopologyRole.SlotEndWallFace;
+ descendants.Add(new($"material:{slot.StableId}:wall:{side.Face.Value}","Face",SemanticTopologyRole.SlotWallFace,slot.StableId,Face:side.Face,ParentStableId:slot.StableId));
+ descendants.Add(new($"material:{slot.StableId}:{role}:{side.Face.Value}","Face",role,slot.StableId,Face:side.Face,ParentStableId:slot.StableId));
+ }
+ LoopId? LoopFor(IReadOnlyList<EdgeId> boundary) => 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(boundary.ToHashSet())).Select(x => (LoopId?)x.Id).SingleOrDefault();
+ if (entryEdges.Length > 0 && LoopFor(entryEdges) is { } entryLoop) descendants.Add(new($"material:{slot.StableId}:entry-loop","Loop",SemanticTopologyRole.SlotEntryLoop,slot.StableId,Loop:entryLoop,ParentStableId:slot.StableId));
+ if (exitEdges.Length > 0 && LoopFor(exitEdges) is { } exitLoop) descendants.Add(new($"material:{slot.StableId}:exit-loop","Loop",SemanticTopologyRole.SlotExitLoop,slot.StableId,Loop:exitLoop,ParentStableId:slot.StableId));
+ }
var provenance = new List<string> { "ProfileArrangement2D", "PrismaticSectionStackConstruction", "PrismaticSectionStackBrepPlan", "AuthoritativeBRepPlan" };
if ((stack.Feature.ShaftHoles?.Count ?? 0) > 0) provenance.Insert(0, "SemanticHoleComposeLowering");
+ if (stack.Feature.AllSlotProfiles.Any()) provenance.Insert(0, "SemanticSlotComposeLowering");
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");
diff --git a/Aetheris.Kernel.Firmament/Materializer/SemanticTopologySelections.cs b/Aetheris.Kernel.Firmament/Materializer/SemanticTopologySelections.cs
index 75e5eae1..4fc5fb76 100644
--- a/Aetheris.Kernel.Firmament/Materializer/SemanticTopologySelections.cs
+++ b/Aetheris.Kernel.Firmament/Materializer/SemanticTopologySelections.cs
@@ -5,7 +5,7 @@ using System.Text.RegularExpressions;
namespace Aetheris.Kernel.Firmament.Materializer;
/// <summary>Stable roles assigned while an authoritative plan is materialized. These are not geometric queries.</summary>
-public enum SemanticTopologyRole { Unknown, ProfileVertex, VerticalExtrusionEdge, TopBoundary, BottomBoundary, ExtrusionSideFace, TopFaceBoundaryLoop, BottomFaceBoundaryLoop, HoleEntryLoop, HoleExitLoop, HoleWallFace, ComposeTransition }
+public enum SemanticTopologyRole { Unknown, ProfileVertex, VerticalExtrusionEdge, TopBoundary, BottomBoundary, ExtrusionSideFace, TopFaceBoundaryLoop, BottomFaceBoundaryLoop, HoleEntryLoop, HoleExitLoop, HoleWallFace, SlotEntryLoop, SlotExitLoop, SlotWallFace, SlotStraightWallFace, SlotEndWallFace, ComposeTransition }
public enum SemanticSelectionRequirement { ExactlyOne, OneOrMore, ConnectedChain, ClosedLoop, NonEmptyFaceSet }
public enum SemanticSelectionFailure { None, SemanticSourceNotFound, NoMaterializedDescendants, AmbiguousBodyContext, SelectionCardinalityMismatch, DescendantsNotConnected, DescendantsBranch, DescendantsDoNotClose, MixedBoundaryRoles, UnsupportedTopologyChange, SelectionConsumerMismatch }
@@ -126,7 +126,8 @@ public static class SemanticSelectionSourceParser
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 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 SlotSource = new(@"\bSource\s*:\s*Slot\s*\(\s*(?<slot>\w+)\s*\)", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
+ private static readonly Regex Target = new(@"\bTarget\s*:\s*(?<role>TopBoundary|BottomBoundary|SideBoundary|HoleEntry|HoleExit|HoleWall|SlotEntry|SlotExit|SlotWall|SlotStraightWall|SlotEndWall)", 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)
@@ -136,22 +137,26 @@ 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 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 sourceMatches = Source.Matches(body); var loopMatch = LoopSource.Match(body); var holeMatch = HoleSource.Match(body); var slotMatch = SlotSource.Match(body); var target = Target.Match(body); var require = Require.Match(body);
+ if (!target.Success || !require.Success || (sourceMatches.Count == 0 && !loopMatch.Success && !holeMatch.Success && !slotMatch.Success)) { errors.Add($"selection-invalid:{header.Groups["name"].Value}"); continue; }
var boundary = target.Groups["role"].Value;
- var role = holeMatch.Success
+ var role = slotMatch.Success
+ ? boundary switch { "SlotEntry" => SemanticTopologyRole.SlotEntryLoop, "SlotExit" => SemanticTopologyRole.SlotExitLoop, "SlotWall" => SemanticTopologyRole.SlotWallFace, "SlotStraightWall" => SemanticTopologyRole.SlotStraightWallFace, "SlotEndWall" => SemanticTopologyRole.SlotEndWallFace, _ => SemanticTopologyRole.Unknown }
+ : 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 = holeMatch.Success
+ var sources = slotMatch.Success
+ ? new[] { $"slot:{bodyStableId}.{slotMatch.Groups["slot"].Value}" }
+ : 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}", holeMatch.Success ? "Hole" : "EdgeFinish"));
+ Enum.Parse<SemanticSelectionRequirement>(require.Groups["shape"].Value), $"offset:{header.Index}", slotMatch.Success ? "Slot" : holeMatch.Success ? "Hole" : "EdgeFinish"));
}
diagnostics = errors; return output;
}
diff --git a/Aetheris.Server/Api/CadmataFixtureService.cs b/Aetheris.Server/Api/CadmataFixtureService.cs
index 5580ade4..979a254d 100644
--- a/Aetheris.Server/Api/CadmataFixtureService.cs
+++ b/Aetheris.Server/Api/CadmataFixtureService.cs
@@ -16,6 +16,7 @@ internal static class CadmataFixtureService
["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",
+ ["semantic-capsule-slot"] = "fixtures/FirmamentV2/ProfileComposition/valid/semantic-capsule-slot-through.firmament",
};
public static bool TryLoad(string fixtureId, DocumentSession document, out CadmataFixtureLoadResponseDto? response, out string error)
@@ -25,7 +26,7 @@ internal static class CadmataFixtureService
var 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 = []; IReadOnlyList<PrismaticShaftHoleFeature> shaftHoles = [];
+ BrepBody? body = null; SemanticTopologyCorrespondence? correspondence = null; IReadOnlyList<ResolvedProfile2D> profiles = []; IReadOnlyList<PrismaticShaftHoleFeature> shaftHoles = []; IReadOnlyList<PrismaticCapsuleSlotFeature> capsuleSlots = []; IReadOnlyList<PrismaticRoundedRectangleSlotFeature> roundedRectangleSlots = [];
var diagnostics = new List<string>();
if (fixtureId == "semantic-shaft-hole")
{
@@ -41,9 +42,11 @@ internal static class CadmataFixtureService
if (stack is null) { error = string.Join("; ", normalizationDiagnostics); return false; }
var emitted = PrismaticSectionStackEmitter.Emit(stack);
shaftHoles = stack.Feature.ShaftHoles ?? [];
+ capsuleSlots = stack.Feature.CapsuleSlots ?? [];
+ roundedRectangleSlots = stack.Feature.RoundedRectangleSlots ?? [];
// 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();
+ profiles = parsed.Profiles.Values.Where(profile => !shaftHoles.Any(hole => hole.ProfileReference == profile.Name) && !capsuleSlots.Any(slot => slot.ProfileReference == profile.Name) && !roundedRectangleSlots.Any(slot => slot.ProfileReference == profile.Name)).ToArray();
body = emitted.Body; correspondence = emitted.Correspondence; diagnostics.AddRange(emitted.Diagnostics);
}
else
@@ -55,12 +58,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, shaftHoles, correspondence, diagnostics, body);
+ var artifact = BuildArtifact(fixtureId, relative, profiles, shaftHoles, capsuleSlots, roundedRectangleSlots, 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, IReadOnlyList<PrismaticShaftHoleFeature> shaftHoles, SemanticTopologyCorrespondence? correspondence, IReadOnlyList<string> diagnostics, BrepBody body)
+ private static CadmataVisualizationArtifactDto BuildArtifact(string fixtureId, string sourcePath, IReadOnlyList<ResolvedProfile2D> profiles, IReadOnlyList<PrismaticShaftHoleFeature> shaftHoles, IReadOnlyList<PrismaticCapsuleSlotFeature> capsuleSlots, IReadOnlyList<PrismaticRoundedRectangleSlotFeature> roundedRectangleSlots, SemanticTopologyCorrespondence? correspondence, IReadOnlyList<string> diagnostics, BrepBody body)
{
var entities = new List<CadmataVisualizationEntityDto>();
foreach (var profile in profiles)
@@ -94,13 +97,25 @@ internal static class CadmataFixtureService
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 slot in capsuleSlots)
+ {
+ var z = slot.To; var descendants = correspondence?.Descendants.Where(d => d.SourceStableId == slot.StableId).Select(d => d.StableId).ToArray() ?? [];
+ var h=slot.StraightSpan/2d; var a=new CadmataPointDto(slot.CenterX-slot.DirectionX*h,slot.CenterY-slot.DirectionY*h,z); var b=new CadmataPointDto(slot.CenterX+slot.DirectionX*h,slot.CenterY+slot.DirectionY*h,z);
+ entities.Add(new(slot.StableId,"SlotFeature",slot.Name,"conceptAxes","SemanticSlotCapsule",new("polyline",[a,b]),slot.SourceSpan,null,null,null,descendants,null,null,"SemanticSlotCapsuleComposeLowering",null,new Dictionary<string,string> { ["length"]=$"{slot.Length:R} mm", ["width"]=$"{slot.Width:R} mm", ["radius"]=$"{slot.Radius:R} mm", ["extent"]=slot.Extent }));
+ entities.Add(new($"{slot.StableId}.axis","ConceptAxis",$"{slot.Name} major axis","conceptAxes","SlotMajorAxis",new("polyline",[a,b]),slot.SourceSpan,[slot.StableId],null,null,null,null,null,null,null,null));
+ }
+ foreach (var slot in roundedRectangleSlots)
+ {
+ var h=slot.Length/2d; var z=slot.To; var a=new CadmataPointDto(slot.CenterX-slot.DirectionX*h,slot.CenterY-slot.DirectionY*h,z); var b=new CadmataPointDto(slot.CenterX+slot.DirectionX*h,slot.CenterY+slot.DirectionY*h,z); var descendants=correspondence?.Descendants.Where(d=>d.SourceStableId==slot.StableId).Select(d=>d.StableId).ToArray() ?? [];
+ entities.Add(new(slot.StableId,"SlotFeature",slot.Name,"conceptAxes","SemanticSlotRoundedRectangle",new("polyline",[a,b]),slot.SourceSpan,null,null,null,descendants,null,null,"SemanticSlotComposeLowering",null,new Dictionary<string,string> { ["length"]=$"{slot.Length:R} mm",["width"]=$"{slot.Width:R} mm",["cornerRadius"]=$"{slot.CornerRadius:R} mm",["extent"]=slot.Extent }));
+ }
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 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, []);
+ var hasSemanticFeatures = fixtureId == "semantic-shaft-hole" || shaftHoles.Count > 0 || capsuleSlots.Count > 0 || roundedRectangleSlots.Count > 0;
+ var selectionSourceIds = fixtureId == "semantic-shaft-hole" ? new[] { "hole:base.mount" } : capsuleSlots.Count > 0 ? capsuleSlots.Select(slot => slot.StableId).ToArray() : roundedRectangleSlots.Count > 0 ? roundedRectangleSlots.Select(slot => slot.StableId).ToArray() : 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}", hasSemanticFeatures ? "semantic feature descendants" : "compiler-published profile boundary", hasSemanticFeatures ? "FaceSet" : "LoopSet", selectionSourceIds, selectionSourceIds, !hasSemanticFeatures, []);
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 switch
diff --git a/docs/firmament/concept-plane-drilled-holes-x1.md b/docs/firmament/concept-plane-drilled-holes-x1.md
new file mode 100644
index 00000000..0cab9fda
--- /dev/null
+++ b/docs/firmament/concept-plane-drilled-holes-x1.md
@@ -0,0 +1,99 @@
+# CONCEPT-PLANE-DRILLED-HOLES-X1 — implementation boundary audit
+
+## Status
+
+This milestone is **not implemented** in the current production compiler. This
+document records the verified boundary so that a future implementation can extend
+the existing compiler-owned `AirHoleFeature` family instead of creating a parallel
+feature system or accidentally treating a mutable BRep face as an authoring
+reference.
+
+Concept frames contain pre-solved spatial intent. Features consume those frames;
+they do not solve for placement.
+
+A drilled hole is a semantic construction composed of a cylindrical shaft and a
+conical drill-point termination, not merely a subtracted cylinder.
+
+## Existing architecture (verified 2026-08-05)
+
+* Firmament V2 parses `hole<shaft>` into `FirmamentV2SemanticHoleDecl`, then
+ lowers it in `FirmamentV2SemanticHoleLowering` to `AirHoleFeature`.
+* `AirHoleFeature` owns a shaft, a `ThroughAll` or fixed `Depth` end condition,
+ and stack components for simple shaft, counterbore, and countersink. It has
+ no drill-point component, shaft-vs-total depth convention, or frame placement.
+* Its placement is `AirFaceLocalHolePlacement`: an entry-face name plus `U/V`
+ coordinates. This is precisely the mutable-face-shaped abstraction this
+ milestone must replace for new Concept-frame placement.
+* The executable lane is `AirHoleSimpleShaftMaterializer`, then
+ `ProfileStackExtrudeExecutor`. It accepts only rectangular hosts and only
+ `top/+Z` or `bottom/-Z` placement. `AirHoleCompositeMaterializer` retains the
+ same Z-axis restriction.
+* The authoritative through-hole correspondence presently publishes only
+ `HoleEntryLoop`, `HoleExitLoop`, and one `HoleWallFace`. Selection parsing
+ exposes only those roles.
+* `ConceptIrPlaneValue` currently holds only origin and normal. The Concept
+ hole resolver accepts only a `+Z` plane, requires `Point3` input, and rejects
+ every other plane with `firmament-concept-point-projection-unsupported`.
+* The existing `FirmamentV2SideHoleRoutePolicy` belongs to the separate
+ `region ... cut Cylinder ... through` route. Its own documentation explicitly
+ states that it is controlled, face-selector based, and not general side-hole
+ support. It is not a valid implementation substrate for immutable Concept
+ frames.
+
+## Required native extension (not a parallel model)
+
+The next implementation must evolve these existing types together:
+
+1. Extend `ConceptIrPlaneValue`, or introduce a sibling *Concept IR* frame value,
+ to own normalized `Origin`, `Normal`, `AxisU`, `AxisV`, handedness, and source
+ provenance. Validate nonzero vectors and mutual orthogonality at Concept
+ resolution time.
+2. Extend the existing semantic-hole declaration and `AirHoleFeature` placement
+ with an immutable frame identity, local `Point2`, resolved world mouth point,
+ and explicit construction direction. Do not overload
+ `AirFaceLocalHolePlacement` for this: its `EntryFaceName` contract encodes
+ exactly the forbidden attachment model.
+3. Extend `AirHoleEndCondition` with unambiguous `ShaftDepth` and `TotalDepth`,
+ and add a compiler-owned drill-point stack component. Its included point angle
+ must be visible and validated; a candidate default is 118 degrees only after
+ it is declared as a documented manufacturing default. For radius `r` and
+ included angle `theta`, use `r / tan(theta / 2)` as the exact axial tip length.
+4. Add an authoritative local-frame analytic materializer. It must construct
+ exact cylinder and cone surfaces and publish mouth, transition, cone, and tip
+ descendants while intersecting bounded host-material intervals. The existing
+ profile-stack and box-cylinder builders are Z-axis-only and cannot establish
+ this contract by a coordinate relabeling patch.
+
+Only after that materializer exists should Cadmata consume its compiler-published
+frame and analytic envelopes, and `inspect-selections` gain the new roles.
+
+## Why no partial parser/AIR patch was made
+
+Adding syntax or a frame record without an admitted materializer would create a
+second, non-executable Hole model and make false claims about exact BRepPlan,
+STEP, M8, correspondence, and Cadmata evidence. Conversely, modifying the
+existing entry-face model would preserve face attachment under a new spelling.
+Both violate the milestone contract.
+
+The required work spans Concept parsing/resolution, Hole AIR, exact arbitrary-axis
+BRep planning, host material interval evaluation, correspondence, selection
+grammar, inspection, and Cadmata. It should be scheduled as a single coherent
+compiler increment after the current Z-only profile-stack lane is generalized or
+a bounded local-frame analytic feature lane is introduced.
+
+## CTC side-hole evidence
+
+No source-side CTC dimensions or analytic STEP evidence sufficient to declare
+mouth centers, diameters, depths, or point angles was found in the inspected
+repository materials. Existing CTC reconstruction documents should therefore not
+be updated with a candidate declaration. The next CTC increment is blocked on
+the reusable local-frame drill-point capability plus measured source evidence;
+it must not infer values from screenshots.
+
+## Validation performed
+
+`dotnet restore Aetheris.slnx` and
+`dotnet build Aetheris.slnx -f net10.0 --no-restore /m:1` both succeeded on the
+current worktree. The build reports pre-existing JavaScript dependency
+vulnerability warnings from the JavaScript SDK audit; it has no .NET errors.
+
diff --git a/docs/firmament/semantic-slots-x1.md b/docs/firmament/semantic-slots-x1.md
new file mode 100644
index 00000000..13b4c0a4
--- /dev/null
+++ b/docs/firmament/semantic-slots-x1.md
@@ -0,0 +1,21 @@
+# SEMANTIC-SLOTS-X1
+
+`Slot<Capsule>` is a compiler-owned construction contract, not an anonymous user Profile. Templates describe how users generate geometry. Generics describe what standardized mechanical feature the compiler owns.
+
+```firmament
+Slot<Capsule> Relief {
+ Center: Point2(0mm, 0mm)
+ Direction: Vector2(1, 0)
+ Length: 80mm // overall end-to-end length
+ Width: 40mm
+ Extent: ThroughAll // or Between(-5mm, 5mm)
+}
+```
+
+The compiler normalizes Direction and derives `Radius = Width / 2`, `StraightSpan = Length - Width`, and two end centers. It rejects non-positive dimensions, a negative straight span, zero direction, invalid/empty `Between`, and `Length == Width`; use `Hole<Shaft>` for that circular case.
+
+`Slot<RoundedRectangle>` uses the same center, direction, length, width, and extent contract, plus an explicit `CornerRadius`. It lowers to four straight segments and four exact quarter-circle arcs. Its corner radius must be positive and no greater than half of either overall dimension.
+
+The lowering is one exact closed XY Profile: `PositiveSide`, `EndCap`, `NegativeSide`, `StartCap` (two lines and two semicircular arcs), then the existing arrangement and section-stack subtraction route. It is not a box-plus-cylinder Boolean construction. `ThroughAll` resolves over the composed host material interval; `Between` is clipped to its declared material overlap.
+
+The authoritative plan publishes `SlotEntryLoop`, `SlotExitLoop`, `SlotWallFace`, `SlotStraightWallFace`, and `SlotEndWallFace`, allowing `Selection` through `Slot(Name)` without coordinate/radius rediscovery. A custom shape remains a Template, for example `Template TeardropOpening(...) -> custom Profile -> Compose Remove`; it should not become a compiler generic merely because it is recurrent.
diff --git a/docs/reconstruction/ctc01-llm-pressure-x5.md b/docs/reconstruction/ctc01-llm-pressure-x5.md
new file mode 100644
index 00000000..994b30bb
--- /dev/null
+++ b/docs/reconstruction/ctc01-llm-pressure-x5.md
@@ -0,0 +1,7 @@
+# CTC-01 LLM pressure X5 — evidence gate
+
+The new compiler-owned `Slot<Capsule>` route is exercised by the semantic capsule fixture. It replaces four authored boundary segments, four tangent/closure obligations, and hand-maintained derived end points with `Center`, `Direction`, `Length`, `Width`, and `Extent`.
+
+CTC X5 is deliberately not authored yet. Existing repository evidence is internally inconsistent with the requested target: `ctc01-reconstruction-a1.md` identifies the **left** R20 capsule using end centers `(-325, 0)` and `(-245, 0)` (width 40 mm, overall length 120 mm), but calls the **right** opening an R10 rounded-rectangle candidate. No reference STEP/section artifact in this checkout resolves the right opening as an R20 capsule or establishes its Z extent. Writing `ctc01_prismatic_blockout_x5.firmament` as a right-hand capsule would therefore be manual drafting under a semantic name, not a reconstruction.
+
+The proven simple-fixture removal is `2856.6370614359173 mm² × 20 mm = 57132.74122871835 mm³`; exact line/arc lowering, selection correspondence, and inspect output are covered. The next convergent CTC action is to extract the right-opening section loop and its host Z span; if it resolves as capsule, author X5 with the generic. If it resolves as rounded rectangle, implement that separate family rather than misclassifying it.
diff --git a/docs/reconstruction/ctc01-reconstruction-a1.md b/docs/reconstruction/ctc01-reconstruction-a1.md
index 2df38851..ec558da7 100644
--- a/docs/reconstruction/ctc01-reconstruction-a1.md
+++ b/docs/reconstruction/ctc01-reconstruction-a1.md
@@ -47,8 +47,8 @@ The current analyzer labels imported length units as assumed rather than preserv
- The dominant construction family is a multi-level prismatic plate/web in XY. The absence of freeform surfaces and the repeated Z planes are strong evidence.
- The four Ø35 and four Ø25 split-cylinder groups are through-hole families. The current Concept matcher finds zero center/diameter deviation but returns `Candidate`, not `Matched`, because each physical hole contributes two split analytic candidates.
-- R20 supports 80 mm apart at Y=0 define a natural 40 mm-wide left capsule slot.
-- Four R10 centers at X `245..325`, Y `-15..15`, together with adjacent planes, define a right rounded-rectangular opening candidate.
+- R20 supports 80 mm apart at Y=0 define a natural 40 mm-wide `−X` capsule slot.
+- Four R10 centers at X `245..325`, Y `-15..15`, together with adjacent planes, define a `+X` rounded-rectangular opening candidate.
- The central feature is a raised hexagonal region reaching Z=50, with six planar sides and R5 edge supports at three in-plane orientations.
- The shape has strong paired structure about X=0 and partial paired structure about Y=0. It should use patterns/mirroring where semantics are identical, but exact global mirror symmetry is not asserted.
@@ -65,7 +65,7 @@ The current analyzer labels imported length units as assumed rather than preserv
| Raised/recessed regions | Strong inference: broad Z=0/-50/-60 plateaus plus central Z=50 raised region |
| Through holes | Strong: four Ø35 and four Ø25 Z-axis groups; likely additional smaller Z groups |
| Blind holes | Uncertain; analyzer lacks cylinder-span/face-group reporting needed to distinguish every R10/R25 family |
-| Slots | Strong: left R20 capsule; right R10 rounded rectangle/opening candidate |
+| Slots | Strong: `−X` R20 capsule; `+X` R10 rounded rectangle/opening candidate |
| Pockets | Strong but not fully grouped: lowered planar regions and right opening/relief |
| Boss | Strong: central hexagonal raised region |
| Ears/lobes | Strong: paired end regions using R50 outer supports and Ø35 holes |
diff --git a/fixtures/FirmamentV2/ProfileComposition/valid/semantic-capsule-slot-through.firmament b/fixtures/FirmamentV2/ProfileComposition/valid/semantic-capsule-slot-through.firmament
new file mode 100644
index 00000000..f5477cb8
--- /dev/null
+++ b/fixtures/FirmamentV2/ProfileComposition/valid/semantic-capsule-slot-through.firmament
@@ -0,0 +1,16 @@
+Concept Struct SlotLayout On XY {
+ Rect2 Stock { Center: [0mm,0mm]; Size: [200mm,100mm] }
+}
+Profile Plate Using SlotLayout { Loop Outer {
+ Segment South { Trace: Stock.Bottom; From: Stock.BottomLeft; To: Stock.BottomRight }
+ Segment East { Trace: Stock.Right; From: Stock.BottomRight; To: Stock.TopRight }
+ Segment North { Trace: Stock.Top; From: Stock.TopRight; To: Stock.TopLeft }
+ Segment West { Trace: Stock.Left; From: Stock.TopLeft; To: Stock.BottomLeft }
+} }
+Struct SlotFixture { Compose SlotBody {
+ Base Stock { Profile: Plate; From: -10mm; To: 10mm; Role: Stock }
+ Slot<Capsule> Relief { Center: Point2(0mm,0mm); Direction: Vector2(1,0); Length: 80mm; Width: 40mm; Extent: ThroughAll; Role: ThroughSlot }
+} }
+Selection ReliefEntry { Target: SlotEntry Source: Slot(Relief) Require: ClosedLoop }
+Selection ReliefStraightWalls { Target: SlotStraightWall Source: Slot(Relief) Require: NonEmptyFaceSet }
+Selection ReliefEndWalls { Target: SlotEndWall Source: Slot(Relief) Require: NonEmptyFaceSet }
diff --git a/fixtures/FirmamentV2/ProfileComposition/valid/semantic-rounded-rectangle-slot-through.firmament b/fixtures/FirmamentV2/ProfileComposition/valid/semantic-rounded-rectangle-slot-through.firmament
new file mode 100644
index 00000000..6128459d
--- /dev/null
+++ b/fixtures/FirmamentV2/ProfileComposition/valid/semantic-rounded-rectangle-slot-through.firmament
@@ -0,0 +1,14 @@
+Concept Struct SlotLayout On XY { Rect2 Stock { Center: [0mm,0mm]; Size: [200mm,100mm] } }
+Profile Plate Using SlotLayout { Loop Outer {
+ Segment South { Trace: Stock.Bottom; From: Stock.BottomLeft; To: Stock.BottomRight }
+ Segment East { Trace: Stock.Right; From: Stock.BottomRight; To: Stock.TopRight }
+ Segment North { Trace: Stock.Top; From: Stock.TopRight; To: Stock.TopLeft }
+ Segment West { Trace: Stock.Left; From: Stock.TopLeft; To: Stock.BottomLeft }
+} }
+Struct RoundedSlotFixture { Compose RoundedSlotBody {
+ Base Stock { Profile: Plate; From: -10mm; To: 10mm; Role: Stock }
+ Slot<RoundedRectangle> PlusXOpening { Center: Point2(40mm,0mm); Direction: Vector2(1,0); Length: 80mm; Width: 40mm; CornerRadius: 10mm; Extent: ThroughAll; Role: PlusXOpening }
+} }
+Selection PlusXEntry { Target: SlotEntry Source: Slot(PlusXOpening) Require: ClosedLoop }
+Selection PlusXStraightWalls { Target: SlotStraightWall Source: Slot(PlusXOpening) Require: NonEmptyFaceSet }
+Selection PlusXEndWalls { Target: SlotEndWall Source: Slot(PlusXOpening) Require: NonEmptyFaceSet }
diff --git a/fixtures/FirmamentV2/ProfileComposition/valid/semantic-two-slot-plate.firmament b/fixtures/FirmamentV2/ProfileComposition/valid/semantic-two-slot-plate.firmament
new file mode 100644
index 00000000..c63e8e87
--- /dev/null
+++ b/fixtures/FirmamentV2/ProfileComposition/valid/semantic-two-slot-plate.firmament
@@ -0,0 +1,19 @@
+// Frame-stable naming: the capsule occupies the −X side; the rounded rectangle occupies +X.
+Concept Struct TwoSlotPlateLayout On XY {
+ Rect2 Stock { Center: [0mm,0mm]; Size: [240mm,120mm] }
+}
+Profile Plate Using TwoSlotPlateLayout { Loop Outer {
+ Segment South { Trace: Stock.Bottom; From: Stock.BottomLeft; To: Stock.BottomRight }
+ Segment East { Trace: Stock.Right; From: Stock.BottomRight; To: Stock.TopRight }
+ Segment North { Trace: Stock.Top; From: Stock.TopRight; To: Stock.TopLeft }
+ Segment West { Trace: Stock.Left; From: Stock.TopLeft; To: Stock.BottomLeft }
+} }
+Struct TwoSlotPlate { Compose TwoSlotPlateBody {
+ Base Stock { Profile: Plate; From: -10mm; To: 10mm; Role: Plate }
+ Slot<Capsule> MinusXCapsule { Center: Point2(-60mm,0mm); Direction: Vector2(1,0); Length: 80mm; Width: 40mm; Extent: ThroughAll; Role: MinusXCapsule }
+ Slot<RoundedRectangle> PlusXRoundedRectangle { Center: Point2(60mm,0mm); Direction: Vector2(1,0); Length: 80mm; Width: 40mm; CornerRadius: 10mm; Extent: ThroughAll; Role: PlusXRoundedRectangle }
+} }
+Selection MinusXCapsuleEntry { Target: SlotEntry Source: Slot(MinusXCapsule) Require: ClosedLoop }
+Selection MinusXCapsuleWalls { Target: SlotWall Source: Slot(MinusXCapsule) Require: NonEmptyFaceSet }
+Selection PlusXRoundedRectangleEntry { Target: SlotEntry Source: Slot(PlusXRoundedRectangle) Require: ClosedLoop }
+Selection PlusXRoundedRectangleWalls { Target: SlotWall Source: Slot(PlusXRoundedRectangle) Require: NonEmptyFaceSet }