Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Add blind drill-point hole support and inspection contracts

Yuechen Liba4d71cec8ba
diff --git a/Aetheris.CLI/CliRunner.cs b/Aetheris.CLI/CliRunner.cs
index 0e78b300..3862f439 100644
--- a/Aetheris.CLI/CliRunner.cs
+++ b/Aetheris.CLI/CliRunner.cs
@@ -529,12 +529,19 @@ public static class CliRunner
var hole = SemanticHoleInspection.Inspect(v2.Document);
inspectClock.Stop();
if (!hole.Succeeded || hole.Correspondence is null) { stderr.WriteLine(string.Join(Environment.NewLine, hole.Diagnostics)); return 1; }
- var selectionResults = new[]
+ var selectionRequests = new List<SemanticSelectionRequest>
{
- new SemanticSelectionRequest("inspect:mouth-loop", "MouthLoop", hole.Correspondence.BodyStableId, [hole.HoleId!], SemanticTopologyRole.HoleEntryLoop, SemanticSelectionRequirement.ClosedLoop, "inspect-selections"),
- new SemanticSelectionRequest("inspect:exit-loop", "ExitLoop", hole.Correspondence.BodyStableId, [hole.HoleId!], SemanticTopologyRole.HoleExitLoop, SemanticSelectionRequirement.ClosedLoop, "inspect-selections"),
- new SemanticSelectionRequest("inspect:shaft-wall-faces", "ShaftWallFaces", hole.Correspondence.BodyStableId, [hole.HoleId!], SemanticTopologyRole.HoleWallFace, SemanticSelectionRequirement.NonEmptyFaceSet, "inspect-selections")
- }.Select(request => SemanticTopologySelectionResolver.Resolve(hole.Body!, hole.Correspondence, request)).ToArray();
+ new("inspect:mouth-loop", "MouthLoop", hole.Correspondence.BodyStableId, [hole.HoleId!], SemanticTopologyRole.HoleEntryLoop, SemanticSelectionRequirement.ClosedLoop, "inspect-selections"),
+ new("inspect:shaft-wall-faces", "ShaftWallFaces", hole.Correspondence.BodyStableId, [hole.HoleId!], SemanticTopologyRole.HoleWallFace, SemanticSelectionRequirement.NonEmptyFaceSet, "inspect-selections")
+ };
+ if (hole.Evidence?.PointAngle is { })
+ {
+ selectionRequests.Add(new("inspect:shaft-to-drill-point-loop", "ShaftToDrillPointLoop", hole.Correspondence.BodyStableId, [hole.HoleId!], SemanticTopologyRole.HoleShaftToDrillPointLoop, SemanticSelectionRequirement.ClosedLoop, "inspect-selections"));
+ selectionRequests.Add(new("inspect:drill-point-faces", "DrillPointFaces", hole.Correspondence.BodyStableId, [hole.HoleId!], SemanticTopologyRole.HoleDrillPointFace, SemanticSelectionRequirement.NonEmptyFaceSet, "inspect-selections"));
+ selectionRequests.Add(new("inspect:tip-vertex", "TipVertex", hole.Correspondence.BodyStableId, [hole.HoleId!], SemanticTopologyRole.HoleTipVertex, SemanticSelectionRequirement.ExactlyOne, "inspect-selections"));
+ }
+ else selectionRequests.Add(new("inspect:exit-loop", "ExitLoop", hole.Correspondence.BodyStableId, [hole.HoleId!], SemanticTopologyRole.HoleExitLoop, SemanticSelectionRequirement.ClosedLoop, "inspect-selections"));
+ var selectionResults = selectionRequests.Select(request => SemanticTopologySelectionResolver.Resolve(hole.Body!, hole.Correspondence, request)).ToArray();
totalClock.Stop();
stdout.WriteLine(JsonSerializer.Serialize(new
{
@@ -544,12 +551,41 @@ public static class CliRunner
boundPlacement = hole.Evidence is null ? null : new { kind = hole.Evidence.PlacementKind, hole.Evidence.ConstructionPlaneId, hole.Evidence.SourceConceptPlaneId, hole.Evidence.LocalCenter },
airPlacement = hole.Evidence is null ? null : new { kind = hole.Evidence.PlacementKind == "ConstructionPlane" ? "AirConstructionPlaneHolePlacement" : "AirFaceLocalHolePlacement", featureId = hole.Evidence.FeatureId, hole.Evidence.ConstructionPlaneId, hole.Evidence.LocalCenter },
plan = hole.Evidence?.PlanId is null ? null : new { kind = "LocalFrameHoleBRepPlan", stableId = hole.Evidence.PlanId, hostInterval = hole.Evidence.HostInterval },
+ holeContract = hole.Evidence?.Contract is null ? null : new
+ {
+ FeatureId = hole.Evidence.FeatureId,
+ DeclaredEndCondition = hole.Evidence.Contract.DeclaredEndCondition,
+ DeclaredTermination = hole.Evidence.Contract.DeclaredTermination,
+ hole.Evidence.ConstructionPlaneId,
+ LocalCenter = hole.Evidence.LocalCenter,
+ WorldMouthCenter = hole.Evidence.WorldMouthCenter,
+ Axis = hole.Evidence.HostTraversal?.Axis,
+ hole.Evidence.Diameter,
+ hole.Evidence.Radius,
+ hole.Evidence.Contract.ShaftDepth,
+ hole.Evidence.Contract.TipLength,
+ hole.Evidence.Contract.TotalDepth,
+ PointAngle = hole.Evidence.PointAngle,
+ HostTraversalClassification = hole.Evidence.HostTraversal?.Classification.ToString(),
+ HostIntervals = hole.Evidence.HostTraversal?.OrderedIntervals,
+ PhysicalMaterialSpan = hole.Evidence.HostTraversal?.PhysicalMaterialSpan,
+ hole.Evidence.Contract.RemainingWall,
+ hole.Evidence.Contract.IsThroughAll,
+ hole.Evidence.Contract.IsBlind,
+ HasExit = hole.Evidence.Contract.HasExit,
+ hole.Evidence.Contract.HasDrillPoint,
+ hole.Evidence.Contract.MouthInsideMaterial,
+ hole.Evidence.Contract.TipInsideMaterial,
+ hole.Evidence.Contract.ContractSatisfied,
+ diagnostics = hole.Evidence.Contract.Diagnostics
+ },
summary = hole.Evidence is null ? null : new
{
hole.Evidence.FeatureId, hole.Evidence.PlacementKind, hole.Evidence.ConstructionPlaneId, hole.Evidence.SourceConceptPlaneId,
frameOrigin = hole.Evidence.FrameOrigin, axisX = hole.Evidence.AxisX, axisY = hole.Evidence.AxisY, axisZ = hole.Evidence.AxisZ,
localCenter = hole.Evidence.LocalCenter, worldMouthCenter = hole.Evidence.WorldMouthCenter,
- hole.Evidence.Diameter, hole.Evidence.Radius, extent = hole.Evidence.Extent, hostInterval = hole.Evidence.HostInterval,
+ hole.Evidence.Diameter, hole.Evidence.Radius, extent = hole.Evidence.Extent, endKind = hole.Evidence.Extent, hole.Evidence.DeclaredDepth, hole.Evidence.ShaftDepth, hole.Evidence.TipLength, hole.Evidence.TotalDepth, pointAngle = hole.Evidence.PointAngle,
+ hostInterval = hole.Evidence.HostInterval,
hole.Evidence.PlanId, hole.Evidence.SourceSpan
},
descendants = hole.Correspondence.Descendants.Select(x => new { x.StableId, x.Kind, role = x.Role.ToString(), x.SourceStableId, x.ParentStableId, edge = x.Edge?.Value, face = x.Face?.Value, loop = x.Loop?.Value }),
@@ -2677,6 +2713,9 @@ public static class CliRunner
stdout.WriteLine("aetheris - firmament build and STEP analysis CLI");
stdout.WriteLine();
stdout.WriteLine(TopLevelUsage);
+ // Keep this stable discovery string while the longer usage line above
+ // advertises the newer inspection commands.
+ stdout.WriteLine("Usage: aetheris <build|analyze|trace|canon|asm|experimental> <path> [options]");
stdout.WriteLine();
stdout.WriteLine("Commands:");
stdout.WriteLine(" build Build a .firmament source file into STEP.");
diff --git a/Aetheris.Kernel.Core/Air/AirHoleFeature.cs b/Aetheris.Kernel.Core/Air/AirHoleFeature.cs
index 0bc54aa5..b3ee8e35 100644
--- a/Aetheris.Kernel.Core/Air/AirHoleFeature.cs
+++ b/Aetheris.Kernel.Core/Air/AirHoleFeature.cs
@@ -2,7 +2,8 @@ using Aetheris.Kernel.Core.Math;
namespace Aetheris.Kernel.Core.Air;
-internal enum AirHoleEndConditionKind { ThroughAll, Depth }
+internal enum AirHoleEndConditionKind { ThroughAll, Depth, ShaftDepth, TotalDepth }
+internal enum AirHoleTerminationKind { FlatBottom, DrillPoint }
internal enum AirHoleLoweringRouteKind { NotLowered, SimpleShaftProfileStackCandidate, StackedProfileStackCandidate }
internal enum AirHoleStackKind { SimpleShaft, Counterbore, Countersink }
internal enum AirHoleStackComponentKind { Shaft, Counterbore, Countersink }
@@ -15,6 +16,7 @@ internal sealed record AirHoleFeature(
AirHoleAxis Axis,
AirHoleShaft Shaft,
AirHoleEndCondition EndCondition,
+ AirHoleTermination Termination,
AirHoleStack Stack,
AirProvenance Provenance,
IReadOnlyList<AirDiagnostic> Diagnostics)
@@ -46,6 +48,7 @@ internal sealed record AirHoleFeature(
axis,
shaft,
endCondition,
+ new AirHoleTermination.FlatBottom(),
AirHoleStack.SimpleShaft(shaft, endCondition),
provenance ?? DefaultProvenance(name, featureId),
diagnostics);
@@ -58,11 +61,13 @@ internal sealed record AirHoleFeature(
AirConstructionPlaneHolePlacement placement,
AirHoleShaft shaft,
AirHoleEndCondition endCondition,
- AirProvenance? provenance = null)
+ AirProvenance? provenance = null,
+ AirHoleTermination? termination = null)
{
- var diagnostics = ValidateConstructionPlane(name, featureId, placement, shaft, endCondition).ToArray();
+ var resolvedTermination = termination ?? new AirHoleTermination.FlatBottom();
+ var diagnostics = ValidateConstructionPlane(name, featureId, placement, shaft, endCondition, resolvedTermination).ToArray();
return new AirHoleFeature(name, featureId, targetBodyId, placement,
- new AirHoleAxis(placement.AxisZ, false), shaft, endCondition, AirHoleStack.SimpleShaft(shaft, endCondition),
+ new AirHoleAxis(placement.AxisZ, false), shaft, endCondition, resolvedTermination, AirHoleStack.SimpleShaft(shaft, endCondition),
provenance ?? DefaultProvenance(name, featureId), diagnostics);
}
@@ -80,7 +85,7 @@ internal sealed record AirHoleFeature(
{
var stack = AirHoleStack.Counterbore(counterbore, new AirHoleShaftComponent(shaft.Diameter, endCondition));
var diagnostics = Validate(name, featureId, placement, axis, shaft, endCondition).Concat(ValidateStack(stack, shaft, endCondition)).ToArray();
- return new AirHoleFeature(name, featureId, targetBodyId, placement, axis, shaft, endCondition, stack, provenance ?? DefaultProvenance(name, featureId), diagnostics);
+ return new AirHoleFeature(name, featureId, targetBodyId, placement, axis, shaft, endCondition, new AirHoleTermination.FlatBottom(), stack, provenance ?? DefaultProvenance(name, featureId), diagnostics);
}
public static AirHoleFeature CreateCountersink(
@@ -96,7 +101,7 @@ internal sealed record AirHoleFeature(
{
var stack = AirHoleStack.Countersink(countersink, new AirHoleShaftComponent(shaft.Diameter, endCondition));
var diagnostics = Validate(name, featureId, placement, axis, shaft, endCondition).Concat(ValidateStack(stack, shaft, endCondition)).ToArray();
- return new AirHoleFeature(name, featureId, targetBodyId, placement, axis, shaft, endCondition, stack, provenance ?? DefaultProvenance(name, featureId), diagnostics);
+ return new AirHoleFeature(name, featureId, targetBodyId, placement, axis, shaft, endCondition, new AirHoleTermination.FlatBottom(), stack, provenance ?? DefaultProvenance(name, featureId), diagnostics);
}
public AirHoleLoweringPlan CreateSimpleShaftLoweringPlan()
@@ -158,7 +163,7 @@ internal sealed record AirHoleFeature(
}
}
- private static IEnumerable<AirDiagnostic> ValidateConstructionPlane(string name, string featureId, AirConstructionPlaneHolePlacement placement, AirHoleShaft shaft, AirHoleEndCondition endCondition)
+ private static IEnumerable<AirDiagnostic> ValidateConstructionPlane(string name, string featureId, AirConstructionPlaneHolePlacement placement, AirHoleShaft shaft, AirHoleEndCondition endCondition, AirHoleTermination termination)
{
if (string.IsNullOrWhiteSpace(name)) yield return Error("hole-x2-name-required", "Hole feature name is required.");
if (string.IsNullOrWhiteSpace(featureId)) yield return Error("hole-x2-feature-id-required", "Hole feature id is required.");
@@ -166,6 +171,12 @@ internal sealed record AirHoleFeature(
if (!IsFinite(placement.LocalCenterX) || !IsFinite(placement.LocalCenterY)) yield return Error("HoleLocalCenterInvalid", "Construction Plane local center coordinates must be finite.");
if (!IsFinite(shaft.Diameter) || shaft.Diameter <= 0d) yield return Error("hole-x2-diameter-invalid", "Hole diameter must be greater than zero.");
if (endCondition is AirHoleEndCondition.Depth depth && (!IsFinite(depth.Value) || depth.Value <= 0d)) yield return Error("HoleExtentInvalid", "Bounded shaft depth must be greater than zero.");
+ if (termination is AirHoleTermination.DrillPoint point)
+ {
+ if (endCondition is AirHoleEndCondition.ThroughAll) yield return Error("HoleTerminationConflictsWithExtent", "DrillPoint requires ShaftDepth or TotalDepth, never ThroughAll.");
+ if (!IsFinite(point.PointAngleDegrees) || point.PointAngleDegrees <= 0d || point.PointAngleDegrees >= 180d) yield return Error("HoleDrillPointAngleInvalid", "DrillPoint PointAngle must be finite and between 0deg and 180deg.");
+ if (endCondition is not (AirHoleEndCondition.ShaftDepth or AirHoleEndCondition.TotalDepth)) yield return Error("HoleBlindDepthMissing", "DrillPoint requires an explicit ShaftDepth or TotalDepth.");
+ }
}
private static bool IsFinite(double value) => !double.IsNaN(value) && !double.IsInfinity(value);
@@ -251,6 +262,18 @@ internal abstract record AirHoleEndCondition(AirHoleEndConditionKind Kind)
{
public sealed record ThroughAll() : AirHoleEndCondition(AirHoleEndConditionKind.ThroughAll);
public sealed record Depth(double Value) : AirHoleEndCondition(AirHoleEndConditionKind.Depth);
+ public sealed record ShaftDepth(double Value) : AirHoleEndCondition(AirHoleEndConditionKind.ShaftDepth);
+ public sealed record TotalDepth(double Value) : AirHoleEndCondition(AirHoleEndConditionKind.TotalDepth);
+}
+
+/// <summary>Mechanical termination owned by Hole AIR. 118deg is the compiler default included drill angle.</summary>
+internal abstract record AirHoleTermination(AirHoleTerminationKind Kind)
+{
+ public sealed record FlatBottom() : AirHoleTermination(AirHoleTerminationKind.FlatBottom);
+ public sealed record DrillPoint(double PointAngleDegrees = AirHoleTermination.DrillPoint.DefaultPointAngleDegrees) : AirHoleTermination(AirHoleTerminationKind.DrillPoint)
+ {
+ public const double DefaultPointAngleDegrees = 118d;
+ }
}
internal sealed record AirHoleLoweringPlan(
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentV2ConstructionPlaneHoleSourceTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentV2ConstructionPlaneHoleSourceTests.cs
index e96f6b18..e869815d 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentV2ConstructionPlaneHoleSourceTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentV2ConstructionPlaneHoleSourceTests.cs
@@ -6,6 +6,25 @@ namespace Aetheris.Kernel.Firmament.Tests;
public sealed class FirmamentV2ConstructionPlaneHoleSourceTests
{
+ [Fact]
+ public void Source_ConstructionPlaneBlindDrillPoint_LowersWithUnambiguousDepth()
+ {
+ var source = File.ReadAllText(Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "../../../../fixtures/FirmamentV2/Hole/valid/construction-plane-blind-drillpoint-shaft-depth.firmament")));
+ var parsed = FirmamentV2Parser.Parse(source);
+ Assert.True(parsed.IsSuccess, string.Join(Environment.NewLine, parsed.Diagnostics));
+ var hole = Assert.Single(Assert.Single(parsed.Document!.ModifyBlocks!).SemanticHoles);
+ Assert.Equal(FirmamentV2SemanticHoleEndKind.ShaftDepth, hole.EndCondition.Kind);
+ Assert.Equal(30d, hole.EndCondition.Depth);
+ Assert.Equal(FirmamentV2SemanticHoleTerminationKind.DrillPoint, hole.Termination!.Kind);
+ Assert.Equal(118d, hole.Termination.PointAngleDegrees);
+ var air = Assert.Single(FirmamentV2SemanticHoleLowering.LowerSemanticHoles(parsed.Document));
+ Assert.IsType<AirHoleEndCondition.ShaftDepth>(air.EndCondition);
+ Assert.IsType<AirHoleTermination.DrillPoint>(air.Termination);
+ var materialized = AirHoleSimpleShaftMaterializer.Execute(air, new AirHoleSimpleShaftHost(100, 60, -20, 20));
+ Assert.True(materialized.Succeeded, string.Join(" | ", materialized.Diagnostics));
+ Assert.Contains(materialized.Correspondence!.Descendants, d => d.Role == SemanticTopologyRole.HoleTipVertex);
+ }
+
[Fact]
public void Source_ConstructionPlaneHole_LowersDirectlyAndPublishesSelectableDescendants()
{
diff --git a/Aetheris.Kernel.Firmament.Tests/HoleEndConditionContractTests.cs b/Aetheris.Kernel.Firmament.Tests/HoleEndConditionContractTests.cs
new file mode 100644
index 00000000..d470c862
--- /dev/null
+++ b/Aetheris.Kernel.Firmament.Tests/HoleEndConditionContractTests.cs
@@ -0,0 +1,46 @@
+using Aetheris.Kernel.Core.Air;
+using Aetheris.Kernel.Core.Math;
+using Aetheris.Kernel.Firmament.Materializer;
+
+namespace Aetheris.Kernel.Firmament.Tests;
+
+public sealed class HoleEndConditionContractTests
+{
+ [Fact]
+ public void ThroughAll_DisconnectedTraversal_IsRejectedRatherThanSelectingAnInterval()
+ {
+ var feature = ThroughAllFeature();
+ var traversal = Evidence(feature, HoleHostTraversalClassification.DisconnectedMaterialIntervals,
+ new(0, 20, "compose:slab-a", "Base", true, "Mouth", "AirGap"),
+ new(30, 50, "compose:slab-b", "Add", true, "ReEntry", "FarBoundary"));
+
+ var contract = HoleEndConditionContract.Evaluate(feature, traversal);
+
+ Assert.False(contract.ContractSatisfied);
+ Assert.Contains(contract.Diagnostics, d => d.StartsWith("HoleHostTraversalDisconnected:", StringComparison.Ordinal));
+ Assert.True(contract.IsThroughAll);
+ }
+
+ [Fact]
+ public void BlindDrillPoint_ReportsRemainingWallFromObservedMaterialSpan()
+ {
+ var feature = AirHoleFeature.CreateConstructionPlaneSimpleShaft("Blind", "Base.Blind", "Base", Placement(),
+ new AirHoleShaft(8), new AirHoleEndCondition.ShaftDepth(30), termination: new AirHoleTermination.DrillPoint());
+ var traversal = Evidence(feature, HoleHostTraversalClassification.MultipleContiguousPartitionsOfOneMaterialSpan,
+ new(0, 50, "compose:base", "Base", true, "Mouth", "Transition"),
+ new(50, 100, "compose:add", "Add", true, "Transition", "FarBoundary"));
+
+ var contract = HoleEndConditionContract.Evaluate(feature, traversal);
+
+ Assert.True(contract.ContractSatisfied);
+ Assert.InRange(contract.RemainingWall!.Value, 67.59, 67.60);
+ Assert.True(contract.TipInsideMaterial);
+ Assert.False(contract.HasExit);
+ }
+
+ private static AirHoleFeature ThroughAllFeature() => AirHoleFeature.CreateConstructionPlaneSimpleShaft("Through", "Base.Through", "Base", Placement(), new AirHoleShaft(8), new AirHoleEndCondition.ThroughAll());
+ private static AirConstructionPlaneHolePlacement Placement() => new("construction:PositiveX", "concept:Plane", new Point3D(-50, 0, 0),
+ Direction3D.Create(new Vector3D(0, 1, 0)), Direction3D.Create(new Vector3D(0, 0, 1)), Direction3D.Create(new Vector3D(1, 0, 0)), 0, 0, "fixture", "test");
+ private static HoleHostTraversalEvidence Evidence(AirHoleFeature feature, HoleHostTraversalClassification classification, params HoleHostMaterialIntervalEvidence[] intervals) =>
+ new(feature.FeatureId, "Base", "construction:PositiveX", [-50, 0, 0], [1, 0, 0], feature.Shaft.Radius, classification, intervals, []);
+}
diff --git a/Aetheris.Kernel.Firmament.Tests/LocalFrameHoleBRepPlanTests.cs b/Aetheris.Kernel.Firmament.Tests/LocalFrameHoleBRepPlanTests.cs
index 97cc2e32..3031c8e0 100644
--- a/Aetheris.Kernel.Firmament.Tests/LocalFrameHoleBRepPlanTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/LocalFrameHoleBRepPlanTests.cs
@@ -8,6 +8,44 @@ namespace Aetheris.Kernel.Firmament.Tests;
public sealed class LocalFrameHoleBRepPlanTests
{
+ [Fact]
+ public void PositiveXConstructionPlane_BlindDrillPoint_IsExactPlanOwnedAndSelectable()
+ {
+ var placement = new AirConstructionPlaneHolePlacement(
+ "construction:PositiveXWorkplane", "concept:SideLayout.PositiveXDatum",
+ new Point3D(-50, 0, 0), Direction3D.Create(new Vector3D(0, 1, 0)), Direction3D.Create(new Vector3D(0, 0, 1)), Direction3D.Create(new Vector3D(1, 0, 0)),
+ 10, 6, "fixture", "test");
+ var feature = AirHoleFeature.CreateConstructionPlaneSimpleShaft("PositiveXBlind", "base.PositiveXBlind", "base", placement,
+ new AirHoleShaft(8), new AirHoleEndCondition.ShaftDepth(30), termination: new AirHoleTermination.DrillPoint());
+
+ var result = AirHoleSimpleShaftMaterializer.Execute(feature, new AirHoleSimpleShaftHost(100, 60, -20, 20));
+
+ Assert.True(result.Succeeded, string.Join(" | ", result.Diagnostics));
+ var plan = Assert.IsType<LocalFrameHoleBRepPlan>(result.Plan!.HoleBRepPlan);
+ Assert.Equal(HoleHostTraversalClassification.OneContiguousInterval, plan.TraversalEvidence!.Classification);
+ Assert.True(plan.ContractEvidence!.ContractSatisfied);
+ Assert.True(plan.ContractEvidence.IsBlind);
+ Assert.False(plan.ContractEvidence.HasExit);
+ Assert.True(plan.ContractEvidence.RemainingWall > 0d);
+ Assert.DoesNotContain(plan.Correspondence.Descendants, d => d.Role == SemanticTopologyRole.HoleExitLoop);
+ Assert.Contains(plan.Correspondence.Descendants, d => d.Role == SemanticTopologyRole.HoleShaftToDrillPointLoop);
+ Assert.Contains(plan.Correspondence.Descendants, d => d.Role == SemanticTopologyRole.HoleDrillPointFace);
+ Assert.Contains(plan.Correspondence.Descendants, d => d.Role == SemanticTopologyRole.HoleTipVertex);
+ Assert.Contains(plan.Topology.Surfaces, s => s.Geometry.Cylinder is { } c && Math.Abs(c.Axis.ToVector().X - 1d) < 1e-12 && Math.Abs(c.Radius - 4d) < 1e-12);
+ Assert.Contains(plan.Topology.Surfaces, s => s.Geometry.Cone is { } c && Math.Abs(c.Axis.ToVector().X + 1d) < 1e-12 && Math.Abs(c.SemiAngleRadians - 59d * Math.PI / 180d) < 1e-12);
+
+ var transition = new SemanticSelectionRequest("selection:transition", "transition", "base", ["base.PositiveXBlind"], SemanticTopologyRole.HoleShaftToDrillPointLoop, SemanticSelectionRequirement.ClosedLoop, "fixture");
+ Assert.True(SemanticTopologySelectionResolver.Resolve(result.Body!, plan.Correspondence, transition).Succeeded);
+ var mass = BrepMassProperties.Evaluate(result.Body!);
+ Assert.True(mass.IsEnclosed);
+ Assert.True(mass.IsOrientationConsistent);
+ var step = Step242Exporter.ExportBody(result.Body!);
+ Assert.True(step.IsSuccess);
+ var reimport = Step242Importer.ImportBody(step.Value!);
+ Assert.True(reimport.IsSuccess);
+ Assert.Contains(reimport.Value!.Geometry.Surfaces, s => s.Value.Cone is not null);
+ }
+
[Fact]
public void PositiveXConstructionPlane_ThroughAll_IsExactAndPlanOwned()
{
@@ -43,6 +81,24 @@ public sealed class LocalFrameHoleBRepPlanTests
Assert.Contains(reimport.Value!.Geometry.Surfaces, s => s.Value.Cylinder is { } c && Math.Abs(c.Axis.ToVector().X - 1d) < 1e-12);
}
+ [Fact]
+ public void PositiveXConstructionPlane_BlindDrillPoint_BreakthroughIsRejectedWithoutReinterpretation()
+ {
+ var placement = new AirConstructionPlaneHolePlacement(
+ "construction:PositiveXWorkplane", "concept:SideLayout.PositiveXDatum",
+ new Point3D(-50, 0, 0), Direction3D.Create(new Vector3D(0, 1, 0)), Direction3D.Create(new Vector3D(0, 0, 1)), Direction3D.Create(new Vector3D(1, 0, 0)),
+ 0, 0, "fixture", "test");
+ var feature = AirHoleFeature.CreateConstructionPlaneSimpleShaft("Breakthrough", "base.Breakthrough", "base", placement,
+ new AirHoleShaft(8), new AirHoleEndCondition.TotalDepth(100), termination: new AirHoleTermination.DrillPoint());
+
+ var result = AirHoleSimpleShaftMaterializer.Execute(feature, new AirHoleSimpleShaftHost(100, 60, -6, 6));
+
+ Assert.False(result.Succeeded);
+ Assert.Contains(result.Diagnostics, d => d.StartsWith("BlindHoleBreakthrough:", StringComparison.Ordinal));
+ Assert.Null(result.Body);
+ Assert.Null(result.Correspondence);
+ }
+
[Fact]
public void ConstructionPlane_MouthAwayFromBoxBoundary_IsRejectedExplicitly()
{
diff --git a/Aetheris.Kernel.Firmament.Tests/PrismaticSectionStackHoleTraversalTests.cs b/Aetheris.Kernel.Firmament.Tests/PrismaticSectionStackHoleTraversalTests.cs
new file mode 100644
index 00000000..916a01eb
--- /dev/null
+++ b/Aetheris.Kernel.Firmament.Tests/PrismaticSectionStackHoleTraversalTests.cs
@@ -0,0 +1,83 @@
+using Aetheris.Kernel.Core.Air;
+using Aetheris.Kernel.Core.Math;
+using Aetheris.Kernel.Firmament.Materializer;
+
+namespace Aetheris.Kernel.Firmament.Tests;
+
+public sealed class PrismaticSectionStackHoleTraversalTests
+{
+ [Fact]
+ public void AxialConstructionPlaneHole_OnePhysicalSpanMayCrossTwoPlannerSlabs()
+ {
+ var stack = Stack(); var placement = Placement(new Point3D(0, 0, 0), new Vector3D(0, 0, 1)); var feature = Feature(4d, placement);
+
+ var evidence = PrismaticSectionStackHoleTraversal.Traverse(feature, stack, placement);
+ var contract = HoleEndConditionContract.Evaluate(feature, evidence.HostTraversal);
+
+ Assert.Equal(HoleHostTraversalClassification.MultipleContiguousPartitionsOfOneMaterialSpan, evidence.HostTraversal.Classification);
+ Assert.Equal(2, evidence.OrderedPartitions.Count);
+ Assert.Single(evidence.PhysicalSpans);
+ Assert.Equal((0d, 20d), (evidence.PhysicalSpans[0].Start, evidence.PhysicalSpans[0].End));
+ Assert.All(evidence.OrderedPartitions, partition => Assert.True(partition.CompleteCircularFootprintInMaterial));
+ Assert.Contains(evidence.TransitionEvents, x => x.Contains("InternalPlannerPartition", StringComparison.Ordinal));
+ Assert.True(contract.ContractSatisfied, string.Join(" | ", contract.Diagnostics));
+ }
+
+ [Fact]
+ public void ExactDiskContainment_RejectsCenterlineThatLeavesOuterBoundary()
+ {
+ var stack = Stack(); var placement = Placement(new Point3D(0, 0, 0), new Vector3D(0, 0, 1)); var feature = Feature(42d, placement);
+
+ var evidence = PrismaticSectionStackHoleTraversal.Traverse(feature, stack, placement);
+ var contract = HoleEndConditionContract.Evaluate(feature, evidence.HostTraversal);
+
+ Assert.All(evidence.FootprintChecks, check => Assert.Equal(SectionStackFootprintClassification.CrossesOuterBoundary, check.Classification));
+ Assert.False(contract.ContractSatisfied);
+ Assert.Contains(contract.Diagnostics, x => x.StartsWith("HoleFootprintLeavesHost", StringComparison.Ordinal));
+ }
+
+ [Fact]
+ public void TransverseConstructionPlane_RejectsInsteadOfReusingBoxInterval()
+ {
+ var stack = Stack(); var placement = Placement(new Point3D(-20, 0, 5), new Vector3D(1, 0, 0)); var feature = Feature(4d, placement);
+
+ var evidence = PrismaticSectionStackHoleTraversal.Traverse(feature, stack, placement);
+
+ Assert.Empty(evidence.OrderedPartitions);
+ Assert.Contains(evidence.Diagnostics, x => x.StartsWith("SectionStackHoleTransverseTraversalNotYetAdmitted", StringComparison.Ordinal));
+ Assert.Contains(evidence.Provenance, x => x == "NoBoxIntervalFallback");
+ }
+
+ private static PrismaticSectionStackConstruction Stack()
+ {
+ const string source = """
+ Concept Struct Layout On XY {
+ Rect2 Guide { Center: [0mm, 0mm]; Size: [40mm, 40mm] }
+ }
+ Profile StockProfile Using Layout { Loop Outer {
+ Segment South { Trace: Guide.Bottom; From: Guide.BottomLeft; To: Guide.BottomRight }
+ Segment East { Trace: Guide.Right; From: Guide.BottomRight; To: Guide.TopRight }
+ Segment North { Trace: Guide.Top; From: Guide.TopRight; To: Guide.TopLeft }
+ Segment West { Trace: Guide.Left; From: Guide.TopLeft; To: Guide.BottomLeft }
+ } }
+ Struct Composition { Compose Stack {
+ Base Lower { Profile: StockProfile; From: 0mm; To: 10mm }
+ Add Upper { Profile: StockProfile; From: 10mm; To: 20mm }
+ } }
+ """;
+ var parsed = PrismaticProfileCompositionParser.Parse(source);
+ Assert.Empty(parsed.Diagnostics);
+ return Assert.IsType<PrismaticSectionStackConstruction>(PrismaticSectionStackCompiler.Normalize(parsed, out var diagnostics));
+ }
+
+ private static AirConstructionPlaneHolePlacement Placement(Point3D origin, Vector3D axisZ)
+ {
+ var x = Math.Abs(axisZ.Z) > 0.5 ? new Vector3D(1, 0, 0) : new Vector3D(0, 1, 0);
+ var y = axisZ.Z > 0.5 ? new Vector3D(0, 1, 0) : new Vector3D(0, 0, 1);
+ return new("construction:test", "concept:test", origin, Direction3D.Create(x), Direction3D.Create(y), Direction3D.Create(axisZ), 0d, 0d, "test", "test");
+ }
+
+ private static AirHoleFeature Feature(double diameter, AirConstructionPlaneHolePlacement placement) =>
+ AirHoleFeature.CreateConstructionPlaneSimpleShaft("Hole", "Stack.Hole", "Stack", placement, new AirHoleShaft(diameter),
+ new AirHoleEndCondition.ThroughAll(), new AirProvenance("test", "test", "Hole", "Stack.Hole", "test", AirSelectionClass.None, AirRuleKind.None, "test", true, []));
+}
diff --git a/Aetheris.Kernel.Firmament.Tests/TransverseBlindDrillToolCorridorTests.cs b/Aetheris.Kernel.Firmament.Tests/TransverseBlindDrillToolCorridorTests.cs
new file mode 100644
index 00000000..e3ddbd4e
--- /dev/null
+++ b/Aetheris.Kernel.Firmament.Tests/TransverseBlindDrillToolCorridorTests.cs
@@ -0,0 +1,63 @@
+using Aetheris.Kernel.Core.Air;
+using Aetheris.Kernel.Core.Math;
+using Aetheris.Kernel.Firmament.Materializer;
+
+namespace Aetheris.Kernel.Firmament.Tests;
+
+public sealed class TransverseBlindDrillToolCorridorTests
+{
+ [Fact]
+ public void PlusXBlindDrill_ProvesCompleteShaftAndConeAcrossTwoZSlabs()
+ {
+ var stack = Stack(40, 20); var placement = Placement(); var feature = Feature(4, 10, placement);
+
+ var proof = TransverseBlindDrillToolCorridor.Prove(feature, stack, placement);
+
+ Assert.True(proof.Classification == BlindDrillToolCorridorClassification.CorridorProven, string.Join(" | ", proof.Diagnostics));
+ Assert.Equal(2, proof.ShaftSliceProofs.Count);
+ Assert.Equal(2, proof.ConeSliceProofs.Count);
+ Assert.All(proof.ShaftSliceProofs.Concat(proof.ConeSliceProofs), x => Assert.Equal(SectionRectangleCorridorClassification.FullyContained, x.Classification));
+ Assert.Equal(10d, proof.ShaftDepth);
+ Assert.InRange(proof.TipLength, 1.2d, 1.21d);
+ }
+
+ [Fact]
+ public void PlusXBlindDrill_RejectsShaftChordThatLeavesHost()
+ {
+ var stack = Stack(40, 12); var placement = Placement(); var feature = Feature(14, 10, placement);
+
+ var proof = TransverseBlindDrillToolCorridor.Prove(feature, stack, placement);
+
+ Assert.Equal(BlindDrillToolCorridorClassification.ShaftBoundaryCrossing, proof.Classification);
+ Assert.Contains(proof.Diagnostics, x => x.StartsWith("ToolCorridorFailure: part=Shaft", StringComparison.Ordinal));
+ }
+
+ private static PrismaticSectionStackConstruction Stack(double width, double depth)
+ {
+ var source = $$"""
+ Concept Struct Layout On XY { Rect2 Guide { Center: [0mm, 0mm]; Size: [{{width}}mm, {{depth}}mm] } }
+ Profile Stock Using Layout { Loop Outer {
+ Segment South { Trace: Guide.Bottom; From: Guide.BottomLeft; To: Guide.BottomRight }
+ Segment East { Trace: Guide.Right; From: Guide.BottomRight; To: Guide.TopRight }
+ Segment North { Trace: Guide.Top; From: Guide.TopRight; To: Guide.TopLeft }
+ Segment West { Trace: Guide.Left; From: Guide.TopLeft; To: Guide.BottomLeft }
+ } }
+ Struct Composition { Compose Host {
+ Base Lower { Profile: Stock; From: -10mm; To: 0mm }
+ Add Upper { Profile: Stock; From: 0mm; To: 10mm }
+ } }
+ """;
+ var parsed = PrismaticProfileCompositionParser.Parse(source);
+ Assert.Empty(parsed.Diagnostics);
+ return Assert.IsType<PrismaticSectionStackConstruction>(PrismaticSectionStackCompiler.Normalize(parsed, out var diagnostics));
+ }
+
+ private static AirConstructionPlaneHolePlacement Placement() => new("construction:+X", "concept:+X", new Point3D(-20, 0, 0),
+ Direction3D.Create(new Vector3D(0, 1, 0)), Direction3D.Create(new Vector3D(0, 0, 1)), Direction3D.Create(new Vector3D(1, 0, 0)),
+ 0, 0, "test", "test");
+
+ private static AirHoleFeature Feature(double diameter, double shaftDepth, AirConstructionPlaneHolePlacement placement) =>
+ AirHoleFeature.CreateConstructionPlaneSimpleShaft("SideBlind", "Host.SideBlind", "Host", placement, new AirHoleShaft(diameter),
+ new AirHoleEndCondition.ShaftDepth(shaftDepth), new AirProvenance("test", "test", "SideBlind", "Host.SideBlind", "test", AirSelectionClass.None, AirRuleKind.None, "test", true, []),
+ new AirHoleTermination.DrillPoint());
+}
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/ConceptIr.cs b/Aetheris.Kernel.Firmament/FirmamentV2/ConceptIr.cs
index 3bb1db24..59de04e3 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/ConceptIr.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/ConceptIr.cs
@@ -1,6 +1,7 @@
using System.Globalization;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
+using Aetheris.Kernel.Core.Air;
using Aetheris.Kernel.Firmament.Materializer;
namespace Aetheris.Kernel.Firmament.FirmamentV2;
@@ -377,14 +378,24 @@ internal static class ConceptIrResolver
if (localCenter is null) { diagnostics.Add(FirmamentV2Parser.HoleConstructionPlaneCenterMissing); continue; }
var localDiameter = ParseLengthOrUnitless(FieldValue(holeBody, "diameter"));
if (!double.IsFinite(localDiameter) || localDiameter <= 0) { diagnostics.Add(FirmamentV2Parser.HoleDiameterInvalid); continue; }
- var localEnd = FieldValue(holeBody, "end");
- if (!string.Equals(localEnd, "throughAll", StringComparison.OrdinalIgnoreCase) && !string.Equals(localEnd, "Through", StringComparison.OrdinalIgnoreCase))
- { diagnostics.Add(FirmamentV2Parser.HoleConstructionPlaneExtentUnsupported); continue; }
+ var localEndText = FieldValue(holeBody, "end");
+ var localEnd = ParseConstructionPlaneHoleEnd(localEndText);
+ if (localEnd is null) { diagnostics.Add(string.Equals(localEndText, "Blind", StringComparison.OrdinalIgnoreCase) ? FirmamentV2Parser.HoleConstructionPlaneExtentUnsupported : FirmamentV2Parser.HoleBlindDepthInvalid); continue; }
+ var termination = ParseConstructionPlaneHoleTermination(holeBody, diagnostics);
+ if (localEnd.Kind == FirmamentV2SemanticHoleEndKind.ThroughAll)
+ {
+ if (termination is not null) { diagnostics.Add(FirmamentV2Parser.HoleTerminationConflictsWithExtent); continue; }
+ }
+ else
+ {
+ if (termination is null) { diagnostics.Add(FirmamentV2Parser.HoleBlindDepthMissing); continue; }
+ if (termination.Kind != FirmamentV2SemanticHoleTerminationKind.DrillPoint) { diagnostics.Add(FirmamentV2Parser.HoleConstructionPlaneExtentUnsupported); continue; }
+ }
var constructionSourceSpan = new FirmamentV2SourceSpan(bodyOffset + header.Index, close - header.Index + 1);
var center = new FirmamentV2FaceLocalPoint2D(localCenter.Value.U, localCenter.Value.V, "ConstructionPlaneLocalXY");
result.Add(new(header.Groups["name"].Value, FirmamentV2SemanticHoleVariant.Shaft, FirmamentV2FaceTarget.Direct("+Z"), center,
- localDiameter, new(FirmamentV2SemanticHoleEndKind.ThroughAll), SourceSpan: constructionSourceSpan,
- Placement: new FirmamentV2ConstructionPlaneHolePlacement(constructionPlane!, center, constructionSourceSpan)));
+ localDiameter, localEnd, SourceSpan: constructionSourceSpan,
+ Placement: new FirmamentV2ConstructionPlaneHolePlacement(constructionPlane!, center, constructionSourceSpan), Termination: termination));
bindings.Add(new($"{materializedName}.{header.Groups["name"].Value}.ConstructionPlane", from, constructionPlane!.SourceConceptId, "ConstructionPlane"));
continue;
}
@@ -940,6 +951,29 @@ internal static class ConceptIrResolver
private static string AxisOf(ConceptIrVector3 v) => (v.X, v.Y, v.Z) switch { (1, 0, 0) => "+X", (-1, 0, 0) => "-X", (0, 1, 0) => "+Y", (0, -1, 0) => "-Y", (0, 0, 1) => "+Z", (0, 0, -1) => "-Z", _ => string.Empty };
private static bool IsInsidePattern(string body, int index) => Regex.Matches(body, @"\bPattern\s+[A-Za-z_][A-Za-z0-9_]*\s*\{", RegexOptions.CultureInvariant).Cast<Match>().Any(p => { var close = FindMatchingBrace(body, body.IndexOf('{', p.Index)); return p.Index < index && close > index; });
private static string FieldValue(string body, string name) { var m = Regex.Match(body, $@"\b{Regex.Escape(name)}\s*:\s*(?<value>[^\r\n;}}]+)", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant); return m.Success ? m.Groups["value"].Value.Trim() : string.Empty; }
+ private static FirmamentV2SemanticHoleEnd? ParseConstructionPlaneHoleEnd(string value)
+ {
+ if (string.Equals(value, "ThroughAll", StringComparison.OrdinalIgnoreCase) || string.Equals(value, "Through", StringComparison.OrdinalIgnoreCase)) return new(FirmamentV2SemanticHoleEndKind.ThroughAll);
+ var match = Regex.Match(value, @"^(?<kind>ShaftDepth|TotalDepth)\s*\(\s*(?<value>[^)]+)\s*\)$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
+ if (!match.Success) return null;
+ var depth = ParseLengthOrUnitless(match.Groups["value"].Value);
+ if (!double.IsFinite(depth) || (string.Equals(match.Groups["kind"].Value, "ShaftDepth", StringComparison.OrdinalIgnoreCase) ? depth < 0d : depth <= 0d)) return null;
+ return new(string.Equals(match.Groups["kind"].Value, "ShaftDepth", StringComparison.OrdinalIgnoreCase) ? FirmamentV2SemanticHoleEndKind.ShaftDepth : FirmamentV2SemanticHoleEndKind.TotalDepth, depth);
+ }
+ private static FirmamentV2SemanticHoleTermination? ParseConstructionPlaneHoleTermination(string body, List<string> diagnostics)
+ {
+ var match = Regex.Match(body, @"\btermination\s*:\s*(?<kind>DrillPoint)\b(?:\s*\{\s*PointAngle\s*:\s*(?<angle>[^}\r\n;]+)\s*\})?", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
+ if (!match.Success) return null;
+ var angle = AirHoleTermination.DrillPoint.DefaultPointAngleDegrees;
+ if (match.Groups["angle"].Success)
+ {
+ var raw = match.Groups["angle"].Value.Trim();
+ if (raw.EndsWith("deg", StringComparison.OrdinalIgnoreCase)) raw = raw[..^3];
+ if (!double.TryParse(raw, NumberStyles.Float, CultureInfo.InvariantCulture, out angle) || !double.IsFinite(angle) || angle <= 0d || angle >= 180d)
+ { diagnostics.Add(FirmamentV2Parser.HoleDrillPointAngleInvalid); return null; }
+ }
+ return new(FirmamentV2SemanticHoleTerminationKind.DrillPoint, angle);
+ }
private static int FieldCount(string body, string name) => Regex.Matches(body, $@"\b{Regex.Escape(name)}\s*:", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant).Count;
private static (double U, double V)? ParsePoint2(string source)
{
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs
index 5739decb..3486cd90 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs
@@ -145,8 +145,10 @@ public sealed record FirmamentV2SideHoleIntent(string TargetSolid, string Region
public FirmamentV2SideHoleRoutePolicyEvidence RouteEvidence => PolicyRoute;
}
public enum FirmamentV2SemanticHoleVariant { Shaft, Counterbore, Countersink }
-public enum FirmamentV2SemanticHoleEndKind { ThroughAll, Depth }
+public enum FirmamentV2SemanticHoleEndKind { ThroughAll, Depth, ShaftDepth, TotalDepth }
public sealed record FirmamentV2SemanticHoleEnd(FirmamentV2SemanticHoleEndKind Kind, double? Depth = null);
+public enum FirmamentV2SemanticHoleTerminationKind { FlatBottom, DrillPoint }
+public sealed record FirmamentV2SemanticHoleTermination(FirmamentV2SemanticHoleTerminationKind Kind, double? PointAngleDegrees = null);
public sealed record FirmamentV2ResolvedPoint3(
double X,
double Y,
@@ -174,7 +176,8 @@ public sealed record FirmamentV2SemanticHoleDecl(
double? CountersinkAngleDegrees = null,
FirmamentV2ResolvedPoint3? ResolvedCenter = null,
FirmamentV2SourceSpan? SourceSpan = null,
- FirmamentV2BoundHolePlacement? Placement = null);
+ FirmamentV2BoundHolePlacement? Placement = null,
+ FirmamentV2SemanticHoleTermination? Termination = null);
public enum FirmamentV2PmiKind { HoleDiameter, DatumPlane, Distance, Flatness, Parallel, Perpendicular, Coplanar }
public sealed record FirmamentV2PmiDecl(string Name, FirmamentV2PmiKind Kind, string Target, double? Value = null);
public sealed record FirmamentV2PmiBlock(IReadOnlyList<FirmamentV2PmiRecord> Records, FirmamentV2SourceSpan SourceSpan);
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs
index 85e6a11d..25b5ba59 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs
@@ -140,6 +140,12 @@ public static class FirmamentV2Parser
public const string HoleConstructionPlaneHostUnsupported = "HoleConstructionPlaneHostUnsupported";
public const string HoleConstructionPlaneCenterMissing = "HoleLocalCenterInvalid";
public const string HoleConstructionPlaneExtentUnsupported = "HoleConstructionPlaneExtentUnsupported";
+ public const string HoleBlindDepthMissing = "HoleBlindDepthMissing";
+ public const string HoleBlindDepthInvalid = "HoleBlindDepthInvalid";
+ public const string HoleDrillPointAngleInvalid = "HoleDrillPointAngleInvalid";
+ public const string HoleTotalDepthShorterThanTip = "HoleTotalDepthShorterThanTip";
+ public const string HoleTerminationConflictsWithExtent = "HoleTerminationConflictsWithExtent";
+ public const string HoleDrillPointExitsHost = "HoleDrillPointExitsHost";
public const string PmiKindUnknown = "firmament-v2-pmi-kind-unknown";
public const string PmiTargetMissing = "firmament-v2-pmi-target-missing";
public const string PmiTargetUnresolved = "firmament-v2-pmi-target-unresolved";
@@ -985,7 +991,7 @@ public static class FirmamentV2Parser
}
internal static bool IsConceptFatalDiagnostic(string code) =>
- code is HoleConstructionPlaneNotFound or HolePlacementMixed or HolePlacementDuplicate or HoleConstructionPlaneCenterMissing or HoleConstructionPlaneExtentUnsupported or HoleConstructionPlaneHostUnsupported
+ code is HoleConstructionPlaneNotFound or HolePlacementMixed or HolePlacementDuplicate or HoleConstructionPlaneCenterMissing or HoleConstructionPlaneExtentUnsupported or HoleConstructionPlaneHostUnsupported or HoleBlindDepthMissing or HoleBlindDepthInvalid or HoleDrillPointAngleInvalid or HoleTerminationConflictsWithExtent
||
code.StartsWith(ConceptIrResolver.MissingMember, StringComparison.Ordinal)
|| code.StartsWith(ConceptIrResolver.UnknownMember, StringComparison.Ordinal)
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2SemanticHoleLowering.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2SemanticHoleLowering.cs
index eadc2c09..984f42aa 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2SemanticHoleLowering.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2SemanticHoleLowering.cs
@@ -12,16 +12,26 @@ internal static class FirmamentV2SemanticHoleLowering
var plane = construction.Plane;
var constructionPlacement = new AirConstructionPlaneHolePlacement(plane.StableId, plane.SourceConceptId, plane.Origin, plane.AxisX, plane.AxisY, plane.AxisZ,
construction.Center.U, construction.Center.V, $"{construction.SourceSpan.Start}:{construction.SourceSpan.Length}", plane.Provenance);
- AirHoleEndCondition constructionEnd = hole.EndCondition.Kind == FirmamentV2SemanticHoleEndKind.ThroughAll
- ? new AirHoleEndCondition.ThroughAll()
- : new AirHoleEndCondition.Depth(hole.EndCondition.Depth!.Value);
+ AirHoleEndCondition constructionEnd = hole.EndCondition.Kind switch
+ {
+ FirmamentV2SemanticHoleEndKind.ThroughAll => new AirHoleEndCondition.ThroughAll(),
+ FirmamentV2SemanticHoleEndKind.ShaftDepth => new AirHoleEndCondition.ShaftDepth(hole.EndCondition.Depth!.Value),
+ FirmamentV2SemanticHoleEndKind.TotalDepth => new AirHoleEndCondition.TotalDepth(hole.EndCondition.Depth!.Value),
+ _ => new AirHoleEndCondition.Depth(hole.EndCondition.Depth!.Value)
+ };
+ AirHoleTermination? constructionTermination = hole.Termination?.Kind switch
+ {
+ FirmamentV2SemanticHoleTerminationKind.DrillPoint => new AirHoleTermination.DrillPoint(hole.Termination.PointAngleDegrees ?? AirHoleTermination.DrillPoint.DefaultPointAngleDegrees),
+ _ => null
+ };
var constructionProvenance = new AirProvenance("CONSTRUCTION-PLANE-HOLE-SOURCE-X3", "Construction Plane semantic hole source", hole.Name,
$"{modify.TargetSolid}.{hole.Name}", nameof(AirConstructionPlaneHolePlacement), AirSelectionClass.None, AirRuleKind.None,
"FirmamentV2 Hole<Shaft> From ConstructionPlane", true,
[$"target-solid:{modify.TargetSolid}", $"construction-plane:{plane.StableId}", $"source-concept-plane:{plane.SourceConceptId}",
- $"local-center:[{construction.Center.U:R},{construction.Center.V:R}]", "extent:ThroughAll"]);
+ $"local-center:[{construction.Center.U:R},{construction.Center.V:R}]", "extent:" + constructionEnd.Kind,
+ "termination:" + (constructionTermination?.Kind.ToString() ?? "FlatBottom"), constructionTermination is AirHoleTermination.DrillPoint point ? $"point-angle:{point.PointAngleDegrees:R}deg" : ""]);
return AirHoleFeature.CreateConstructionPlaneSimpleShaft(hole.Name, $"{modify.TargetSolid}.{hole.Name}", modify.TargetSolid, constructionPlacement,
- new AirHoleShaft(hole.ShaftDiameter), constructionEnd, constructionProvenance);
+ new AirHoleShaft(hole.ShaftDiameter), constructionEnd, constructionProvenance, constructionTermination);
}
var pointSource = hole.ResolvedCenter is null ? null : new AirResolvedPoint3PlacementSource(
hole.ResolvedCenter.X, hole.ResolvedCenter.Y, hole.ResolvedCenter.Z, hole.ResolvedCenter.StableId,
diff --git a/Aetheris.Kernel.Firmament/Materializer/AirHoleSimpleShaftMaterializer.cs b/Aetheris.Kernel.Firmament/Materializer/AirHoleSimpleShaftMaterializer.cs
index 9d235d51..c9064a4c 100644
--- a/Aetheris.Kernel.Firmament/Materializer/AirHoleSimpleShaftMaterializer.cs
+++ b/Aetheris.Kernel.Firmament/Materializer/AirHoleSimpleShaftMaterializer.cs
@@ -10,7 +10,9 @@ public sealed record SemanticHoleSourceInspectionEvidence(
string FeatureId, string PlacementKind, string? ConstructionPlaneId, string? SourceConceptPlaneId,
double[]? FrameOrigin, double[]? AxisX, double[]? AxisY, double[]? AxisZ,
double[] LocalCenter, double[]? WorldMouthCenter, double Diameter, double Radius,
- string Extent, double[]? HostInterval, string? PlanId, string? SourceSpan);
+ string Extent, double[]? HostInterval, string? PlanId, string? SourceSpan,
+ double? DeclaredDepth = null, double? ShaftDepth = null, double? TipLength = null, double? TotalDepth = null, double? PointAngle = null,
+ HoleHostTraversalEvidence? HostTraversal = null, HoleEndConditionContractEvidence? Contract = null);
public sealed record SemanticHoleInspectionResult(bool Succeeded, string? HoleId, BrepBody? Body, SemanticTopologyCorrespondence? Correspondence, IReadOnlyList<string> Diagnostics, SemanticHoleSourceInspectionEvidence? Evidence = null);
public static class SemanticHoleInspection
{
@@ -22,6 +24,11 @@ public static class SemanticHoleInspection
var host = document.ConceptIr is null ? new AirHoleSimpleShaftHost(box.Size[0], box.Size[1], -box.Size[2] / 2d, box.Size[2] / 2d) : new AirHoleSimpleShaftHost(box.Size[0], box.Size[1], 0d, box.Size[2]);
var result = AirHoleSimpleShaftMaterializer.Execute(holes[0], host);
var feature = holes[0]; var placement = feature.ConstructionPlanePlacement;
+ var drill = feature.Termination as AirHoleTermination.DrillPoint;
+ var tipLength = drill is null ? (double?)null : feature.Shaft.Radius / Math.Tan(drill.PointAngleDegrees * Math.PI / 360d);
+ double? declaredDepth = feature.EndCondition switch { AirHoleEndCondition.ShaftDepth d => d.Value, AirHoleEndCondition.TotalDepth d => d.Value, _ => null };
+ double? shaftDepth = drill is null ? null : feature.EndCondition switch { AirHoleEndCondition.ShaftDepth d => d.Value, AirHoleEndCondition.TotalDepth d => d.Value - tipLength!.Value, _ => null };
+ double? totalDepth = drill is null ? null : shaftDepth!.Value + tipLength!.Value;
double[] Vector(Aetheris.Kernel.Core.Math.Vector3D v) => [v.X, v.Y, v.Z];
var evidence = placement is null
? new SemanticHoleSourceInspectionEvidence(feature.FeatureId, "FaceLocal", null, null, null, null, null, null,
@@ -29,8 +36,9 @@ public static class SemanticHoleInspection
: new SemanticHoleSourceInspectionEvidence(feature.FeatureId, "ConstructionPlane", placement.ConstructionPlaneId, placement.SourceConceptPlaneId,
[placement.FrameOrigin.X, placement.FrameOrigin.Y, placement.FrameOrigin.Z], Vector(placement.AxisX.ToVector()), Vector(placement.AxisY.ToVector()), Vector(placement.AxisZ.ToVector()),
[placement.LocalCenterX, placement.LocalCenterY], [placement.WorldMouthCenter.X, placement.WorldMouthCenter.Y, placement.WorldMouthCenter.Z],
- feature.Shaft.Diameter, feature.Shaft.Radius, "ThroughAll", result.Plan?.HoleBRepPlan is { } plan ? [plan.HostMaterialInterval.Start, plan.HostMaterialInterval.End] : null,
- result.Plan?.HoleBRepPlan?.StableId, placement.SourceSpan);
+ feature.Shaft.Diameter, feature.Shaft.Radius, feature.EndCondition.Kind.ToString(), result.Plan?.HoleBRepPlan is { } plan ? [plan.HostMaterialInterval.Start, plan.HostMaterialInterval.End] : null,
+ result.Plan?.HoleBRepPlan?.StableId, placement.SourceSpan, declaredDepth, shaftDepth, tipLength, totalDepth, drill?.PointAngleDegrees,
+ result.Plan?.HoleBRepPlan?.TraversalEvidence, result.Plan?.HoleBRepPlan?.ContractEvidence);
return new(result.Succeeded && result.Correspondence is not null, feature.FeatureId, result.Body, result.Correspondence, result.Diagnostics, evidence);
}
}
@@ -245,9 +253,9 @@ internal static class AirHoleSimpleShaftMaterializer
diagnostics.AddRange(feature.Diagnostics.Select(d => $"semantic diagnostic {d.Code}: {d.Message}"));
return new(AirHoleSimpleShaftMaterializationStatus.InvalidSemanticHole, null, null, diagnostics);
}
- if (feature.EndCondition is not AirHoleEndCondition.ThroughAll)
+ if (feature.EndCondition is not AirHoleEndCondition.ThroughAll && feature.Termination is not AirHoleTermination.DrillPoint)
{
- diagnostics.Add("HoleConstructionPlaneExtentUnsupported: construction-plane execution currently admits ThroughAll only; blind termination remains unimplemented.");
+ diagnostics.Add("HoleConstructionPlaneExtentUnsupported: Construction Plane bounded holes require DrillPoint termination and explicit ShaftDepth or TotalDepth.");
return new(AirHoleSimpleShaftMaterializationStatus.UnsupportedPlacement, null, null, diagnostics);
}
if (feature.Stack.Kind != AirHoleStackKind.SimpleShaft)
@@ -284,11 +292,78 @@ internal static class AirHoleSimpleShaftMaterializer
diagnostics.Add($"HoleDirectionDoesNotEnterHost: mouth localZ interval is [{zmin:R},{zmax:R}], expected [0,+). constructionPlane={placement.ConstructionPlaneId}");
return new(AirHoleSimpleShaftMaterializationStatus.UnsupportedPlacement, null, null, diagnostics);
}
- if (placement.LocalCenterX - feature.Shaft.Radius < xmin - Tolerance || placement.LocalCenterX + feature.Shaft.Radius > xmax + Tolerance ||
- placement.LocalCenterY - feature.Shaft.Radius < ymin - Tolerance || placement.LocalCenterY + feature.Shaft.Radius > ymax + Tolerance)
+ var footprintSupported = placement.LocalCenterX - feature.Shaft.Radius >= xmin - Tolerance && placement.LocalCenterX + feature.Shaft.Radius <= xmax + Tolerance &&
+ placement.LocalCenterY - feature.Shaft.Radius >= ymin - Tolerance && placement.LocalCenterY + feature.Shaft.Radius <= ymax + Tolerance;
+ var traversal = new HoleHostTraversalEvidence(
+ feature.FeatureId, feature.TargetBodyId ?? "semantic-hole-host", placement.ConstructionPlaneId,
+ [placement.WorldMouthCenter.X, placement.WorldMouthCenter.Y, placement.WorldMouthCenter.Z],
+ [placement.AxisZ.ToVector().X, placement.AxisZ.ToVector().Y, placement.AxisZ.ToVector().Z], feature.Shaft.Radius,
+ HoleHostTraversalClassification.OneContiguousInterval,
+ [new HoleHostMaterialIntervalEvidence(0d, zmax, "box:single-material-span", "BoxSignedPermutation", footprintSupported, "Mouth", "FarBoundary")],
+ ["HostMaterialIntervalQuery:BoxSignedPermutation", "HostMaterialSpan:[0," + zmax.ToString("R") + "]"]);
+ var contract = HoleEndConditionContract.Evaluate(feature, traversal);
+ diagnostics.AddRange(traversal.Diagnostics);
+ diagnostics.AddRange(contract.Diagnostics);
+ if (!footprintSupported)
{
diagnostics.Add("HoleMouthMissesHost: local circular mouth does not lie fully within the admitted Box cross-section.");
- return new(AirHoleSimpleShaftMaterializationStatus.UnsupportedPlacement, null, null, diagnostics);
+ return new(AirHoleSimpleShaftMaterializationStatus.UnsupportedPlacement, null, null, diagnostics.Distinct().ToArray());
+ }
+ if (!contract.MouthInsideMaterial || !contract.ContractSatisfied)
+ return new(AirHoleSimpleShaftMaterializationStatus.UnsupportedPlacement, null, null, diagnostics.Distinct().ToArray());
+
+ if (feature.Termination is AirHoleTermination.DrillPoint point)
+ {
+ var halfAngleRadians = point.PointAngleDegrees * Math.PI / 360d;
+ var tipLength = feature.Shaft.Radius / Math.Tan(halfAngleRadians);
+ double shaftDepth; double totalDepth;
+ switch (feature.EndCondition)
+ {
+ case AirHoleEndCondition.ShaftDepth declared:
+ shaftDepth = declared.Value; totalDepth = shaftDepth + tipLength; break;
+ case AirHoleEndCondition.TotalDepth declared:
+ totalDepth = declared.Value; shaftDepth = totalDepth - tipLength; break;
+ default:
+ diagnostics.Add("HoleBlindDepthMissing: DrillPoint requires ShaftDepth or TotalDepth.");
+ return new(AirHoleSimpleShaftMaterializationStatus.UnsupportedPlacement, null, null, diagnostics);
+ }
+ if (feature.EndCondition is AirHoleEndCondition.TotalDepth && totalDepth < tipLength - Tolerance)
+ {
+ diagnostics.Add($"HoleTotalDepthShorterThanTip: feature={feature.FeatureId}; totalDepth={totalDepth:R}; tipLength={tipLength:R}; pointAngle={point.PointAngleDegrees:R}deg.");
+ return new(AirHoleSimpleShaftMaterializationStatus.UnsupportedPlacement, null, null, diagnostics);
+ }
+ if (!double.IsFinite(tipLength) || tipLength <= Tolerance || !double.IsFinite(shaftDepth) || shaftDepth < -Tolerance || !double.IsFinite(totalDepth) || totalDepth <= Tolerance)
+ {
+ diagnostics.Add($"HoleBlindDepthInvalid: feature={feature.FeatureId}; shaftDepth={shaftDepth:R}; tipLength={tipLength:R}; totalDepth={totalDepth:R}.");
+ return new(AirHoleSimpleShaftMaterializationStatus.UnsupportedPlacement, null, null, diagnostics);
+ }
+ if (totalDepth >= zmax - Tolerance)
+ {
+ diagnostics.Add($"HoleDrillPointExitsHost: feature={feature.FeatureId}; constructionPlane={placement.ConstructionPlaneId}; localCenter=[{placement.LocalCenterX:R},{placement.LocalCenterY:R}]; diameter={feature.Shaft.Diameter:R}; shaftDepth={shaftDepth:R}; tipLength={tipLength:R}; totalDepth={totalDepth:R}; hostInterval=[0,{zmax:R}].");
+ return new(AirHoleSimpleShaftMaterializationStatus.UnsupportedPlacement, null, null, diagnostics.Distinct().ToArray());
+ }
+ var blind = BlindDrillPointBRepPlanner.TryPlan(feature, placement, (xmin, xmax, ymin, ymax, zmax), Math.Max(0d, shaftDepth), tipLength);
+ if (!blind.Succeeded || blind.Plan is null)
+ {
+ diagnostics.AddRange(blind.Diagnostics); diagnostics.Add("HoleDrillPointPlanInvalid: authoritative blind local-frame plan was not created.");
+ return new(AirHoleSimpleShaftMaterializationStatus.ExecutionFailed, null, null, diagnostics);
+ }
+ var materializedBlind = ProfileExtrusionBRepMaterializer.TryMaterialize(blind.Plan);
+ diagnostics.AddRange(materializedBlind.Diagnostics);
+ if (!materializedBlind.Succeeded || materializedBlind.Body is null)
+ {
+ diagnostics.Add("HoleDrillPointMaterializerDiverged: authoritative blind plan failed materialization.");
+ return new(AirHoleSimpleShaftMaterializationStatus.ExecutionFailed, null, null, diagnostics);
+ }
+ var provenance = blind.Plan.Correspondence.ProvenanceChain.Concat(["HostMaterialIntervalQuery:BoxSignedPermutation", "DrillPointTermination"]).ToArray();
+ var blindHolePlan = new LocalFrameHoleBRepPlan($"brep-plan:hole:{feature.FeatureId}:{placement.ConstructionPlaneId}", feature.FeatureId, placement, (0d, zmax), blind.Plan,
+ blind.Plan.Correspondence with { ProvenanceChain = provenance }, provenance, traversal, contract);
+ var specBlind = new ProfileStackExtrudeSpec(host.Width, host.Depth, host.ZMin, host.ZMax, [], [], placement.LocalCenterX, placement.LocalCenterY);
+ var planBlind = new AirHoleSimpleShaftMaterializationPlan(feature, host, feature.FeatureId, nameof(AirHoleFeature), placement.ConstructionPlaneId,
+ placement.LocalCenterX, placement.LocalCenterY, 1d, feature.Shaft.Radius, 0d, totalDepth, feature.EndCondition.Kind, feature.Stack.Kind,
+ feature.Stack.Components.Select(c => c.Kind).ToArray(), specBlind, diagnostics.ToArray(), blindHolePlan);
+ diagnostics.Add($"BlindDrillPoint: declared={feature.EndCondition.Kind}; shaftDepth={shaftDepth:R}; tipLength={tipLength:R}; totalDepth={totalDepth:R}; pointAngle={point.PointAngleDegrees:R}deg; hostInterval=[0,{zmax:R}].");
+ return new(AirHoleSimpleShaftMaterializationStatus.Succeeded, planBlind, materializedBlind.Body, diagnostics, blindHolePlan.Correspondence);
}
var frame = new ConstructionPlane(placement.ConstructionPlaneId, placement.SourceConceptPlaneId, placement.FrameOrigin,
@@ -308,7 +383,7 @@ internal static class AirHoleSimpleShaftMaterializer
diagnostics.AddRange(planned.Diagnostics); diagnostics.Add("HolePlanInvalid: local-frame circular extrusion plan was not created.");
return new(AirHoleSimpleShaftMaterializationStatus.ExecutionFailed, null, null, diagnostics);
}
- var holePlan = LocalFrameHoleBRepPlan.FromProfilePlan(feature, placement, (0d, zmax), planned.Plan);
+ var holePlan = LocalFrameHoleBRepPlan.FromProfilePlan(feature, placement, (0d, zmax), planned.Plan, traversal, contract);
var materialized = ProfileExtrusionBRepMaterializer.TryMaterialize(planned.Plan);
diagnostics.AddRange(materialized.Diagnostics);
if (!materialized.Succeeded || materialized.Body is null)
diff --git a/Aetheris.Kernel.Firmament/Materializer/BlindDrillPointBRepPlan.cs b/Aetheris.Kernel.Firmament/Materializer/BlindDrillPointBRepPlan.cs
new file mode 100644
index 00000000..793ab783
--- /dev/null
+++ b/Aetheris.Kernel.Firmament/Materializer/BlindDrillPointBRepPlan.cs
@@ -0,0 +1,131 @@
+using Aetheris.Kernel.Core.Air;
+using Aetheris.Kernel.Core.Geometry;
+using Aetheris.Kernel.Core.Geometry.Curves;
+using Aetheris.Kernel.Core.Geometry.Surfaces;
+using Aetheris.Kernel.Core.Math;
+using Aetheris.Kernel.Core.Topology;
+
+namespace Aetheris.Kernel.Firmament.Materializer;
+
+/// <summary>
+/// Exact local-frame authority for one Box-hosted blind drilled hole. It uses the
+/// shared ProfileExtrusion plan entities and materializer; only the mechanical
+/// shaft/cone topology is new. No Boolean, clipping, or post-materialization
+/// topology discovery participates in this route.
+/// </summary>
+internal static class BlindDrillPointBRepPlanner
+{
+ public static ProfileExtrusionPlanResult TryPlan(AirHoleFeature feature, AirConstructionPlaneHolePlacement placement,
+ (double XMin, double XMax, double YMin, double YMax, double ZMax) bounds, double shaftDepth, double tipLength)
+ {
+ const double tol = 1e-9;
+ var totalDepth = shaftDepth + tipLength;
+ if (feature.Termination is not AirHoleTermination.DrillPoint point || shaftDepth < -tol || tipLength <= tol || totalDepth >= bounds.ZMax - tol)
+ return new(false, null, ["HoleDrillPointPlanInvalid: blind shaft/cone interval is invalid."]);
+
+ var frame = new ConstructionPlane(placement.ConstructionPlaneId, placement.SourceConceptPlaneId, placement.FrameOrigin,
+ placement.AxisX, placement.AxisY, placement.AxisZ, placement.SourceSpan, placement.Provenance);
+ var source = feature.FeatureId;
+ var vertices = new List<ProfileExtrusionPlanVertex>();
+ var curves = new List<ProfileExtrusionPlanCurve>();
+ var edges = new List<ProfileExtrusionPlanEdge>();
+ var loops = new List<ProfileExtrusionPlanLoop>();
+ var surfaces = new List<ProfileExtrusionPlanSurface>();
+ var faces = new List<ProfileExtrusionPlanFace>();
+ var nextVertex = 1; var nextCurve = 1; var nextEdge = 1; var nextLoop = 1; var nextCoedge = 1; var nextSurface = 1; var nextFace = 1;
+
+ Point3D World(double x, double y, double z) => frame.ToWorld((x, y), z);
+ ProfileExtrusionPlanVertex Vertex(string id, double x, double y, double z, ProfileExtrusionPlanRole role)
+ {
+ var v = new ProfileExtrusionPlanVertex(id, new VertexId(nextVertex++), World(x, y, z), role, source); vertices.Add(v); return v;
+ }
+ ProfileExtrusionPlanCurve Curve(string id, CurveGeometry geometry, ParameterInterval trim) { var c = new ProfileExtrusionPlanCurve(id, new CurveGeometryId(nextCurve++), geometry, trim, true, source); curves.Add(c); return c; }
+ ProfileExtrusionPlanEdge Edge(string id, ProfileExtrusionPlanVertex a, ProfileExtrusionPlanVertex b, ProfileExtrusionPlanCurve curve, ProfileExtrusionPlanRole role)
+ { var e = new ProfileExtrusionPlanEdge(id, new EdgeId(nextEdge++), a.Id, b.Id, curve.Id, source, role); edges.Add(e); return e; }
+ ProfileExtrusionPlanEdge Line(string id, ProfileExtrusionPlanVertex a, ProfileExtrusionPlanVertex b, ProfileExtrusionPlanRole role) =>
+ Edge(id, a, b, Curve(id + ":curve", CurveGeometry.FromLine(new Line3Curve(a.WorldPoint, Direction3D.Create(b.WorldPoint - a.WorldPoint))), new(0d, (b.WorldPoint - a.WorldPoint).Length)), role);
+ ProfileExtrusionPlanEdge Arc(string id, ProfileExtrusionPlanVertex a, ProfileExtrusionPlanVertex b, double z, double start, ProfileExtrusionPlanRole role) =>
+ Edge(id, a, b, Curve(id + ":curve", CurveGeometry.FromCircle(new Circle3Curve(World(placement.LocalCenterX, placement.LocalCenterY, z), frame.AxisZ, feature.Shaft.Radius, frame.AxisX)), new(start, start + Math.PI)), role);
+ ProfileExtrusionPlanLoop Loop(string id, ProfileExtrusionPlanRole role, params (ProfileExtrusionPlanEdge Edge, bool Reverse)[] uses)
+ {
+ var material = uses.Select((u, i) => new ProfileExtrusionPlanDirectedEdgeUse(id + $":use:{i}", new CoedgeId(nextCoedge++), u.Edge.Id, u.Reverse,
+ DirectedEdgeUse.Resolve(new Edge(u.Edge.Id, u.Edge.StartVertexId, u.Edge.EndVertexId), u.Reverse))).ToArray();
+ var loop = new ProfileExtrusionPlanLoop(id, new LoopId(nextLoop++), material, source, role); loops.Add(loop); return loop;
+ }
+ ProfileExtrusionPlanSurface Surface(string id, SurfaceGeometry geometry, bool sameSense, ProfileExtrusionPlanRole role)
+ { var surface = new ProfileExtrusionPlanSurface(id, new SurfaceGeometryId(nextSurface++), geometry, sameSense, source, role); surfaces.Add(surface); return surface; }
+ ProfileExtrusionPlanFace Face(string id, ProfileExtrusionPlanSurface surface, bool sameSense, ProfileExtrusionPlanRole role, params ProfileExtrusionPlanLoop[] faceLoops)
+ { var face = new ProfileExtrusionPlanFace(id, new FaceId(nextFace++), faceLoops.Select(x => x.Id).ToArray(), surface.Id, sameSense, source, role); faces.Add(face); return face; }
+
+ var b0 = Vertex("plan:box:mouth:0", bounds.XMin, bounds.YMin, 0d, ProfileExtrusionPlanRole.LocalStartVertex);
+ var b1 = Vertex("plan:box:mouth:1", bounds.XMax, bounds.YMin, 0d, ProfileExtrusionPlanRole.LocalStartVertex);
+ var b2 = Vertex("plan:box:mouth:2", bounds.XMax, bounds.YMax, 0d, ProfileExtrusionPlanRole.LocalStartVertex);
+ var b3 = Vertex("plan:box:mouth:3", bounds.XMin, bounds.YMax, 0d, ProfileExtrusionPlanRole.LocalStartVertex);
+ var t0 = Vertex("plan:box:far:0", bounds.XMin, bounds.YMin, bounds.ZMax, ProfileExtrusionPlanRole.LocalEndVertex);
+ var t1 = Vertex("plan:box:far:1", bounds.XMax, bounds.YMin, bounds.ZMax, ProfileExtrusionPlanRole.LocalEndVertex);
+ var t2 = Vertex("plan:box:far:2", bounds.XMax, bounds.YMax, bounds.ZMax, ProfileExtrusionPlanRole.LocalEndVertex);
+ var t3 = Vertex("plan:box:far:3", bounds.XMin, bounds.YMax, bounds.ZMax, ProfileExtrusionPlanRole.LocalEndVertex);
+ var mouthA = Vertex("plan:drill:mouth:a", placement.LocalCenterX + feature.Shaft.Radius, placement.LocalCenterY, 0d, ProfileExtrusionPlanRole.LocalStartVertex);
+ var mouthB = Vertex("plan:drill:mouth:b", placement.LocalCenterX - feature.Shaft.Radius, placement.LocalCenterY, 0d, ProfileExtrusionPlanRole.LocalStartVertex);
+ var transitionA = Vertex("plan:drill:shaft-to-point:a", placement.LocalCenterX + feature.Shaft.Radius, placement.LocalCenterY, shaftDepth, ProfileExtrusionPlanRole.LocalEndVertex);
+ var transitionB = Vertex("plan:drill:shaft-to-point:b", placement.LocalCenterX - feature.Shaft.Radius, placement.LocalCenterY, shaftDepth, ProfileExtrusionPlanRole.LocalEndVertex);
+ var tip = Vertex("plan:drill:tip", placement.LocalCenterX, placement.LocalCenterY, totalDepth, ProfileExtrusionPlanRole.LocalEndVertex);
+
+ var lower = new[] { Line("plan:box:mouth:e0", b0, b1, ProfileExtrusionPlanRole.LocalStartBoundary), Line("plan:box:mouth:e1", b1, b2, ProfileExtrusionPlanRole.LocalStartBoundary), Line("plan:box:mouth:e2", b2, b3, ProfileExtrusionPlanRole.LocalStartBoundary), Line("plan:box:mouth:e3", b3, b0, ProfileExtrusionPlanRole.LocalStartBoundary) };
+ var upper = new[] { Line("plan:box:far:e0", t0, t1, ProfileExtrusionPlanRole.LocalEndBoundary), Line("plan:box:far:e1", t1, t2, ProfileExtrusionPlanRole.LocalEndBoundary), Line("plan:box:far:e2", t2, t3, ProfileExtrusionPlanRole.LocalEndBoundary), Line("plan:box:far:e3", t3, t0, ProfileExtrusionPlanRole.LocalEndBoundary) };
+ var vertical = new[] { Line("plan:box:vertical:e0", b0, t0, ProfileExtrusionPlanRole.LongitudinalBoundary), Line("plan:box:vertical:e1", b1, t1, ProfileExtrusionPlanRole.LongitudinalBoundary), Line("plan:box:vertical:e2", b2, t2, ProfileExtrusionPlanRole.LongitudinalBoundary), Line("plan:box:vertical:e3", b3, t3, ProfileExtrusionPlanRole.LongitudinalBoundary) };
+ var mouthCircleA = Arc("plan:drill:mouth-circle:a", mouthA, mouthB, 0d, 0d, ProfileExtrusionPlanRole.LocalStartBoundary);
+ var mouthCircleB = Arc("plan:drill:mouth-circle:b", mouthB, mouthA, 0d, Math.PI, ProfileExtrusionPlanRole.LocalStartBoundary);
+ var transitionCircleA = Arc("plan:drill:transition-circle:a", transitionA, transitionB, shaftDepth, 0d, ProfileExtrusionPlanRole.LocalEndBoundary);
+ var transitionCircleB = Arc("plan:drill:transition-circle:b", transitionB, transitionA, shaftDepth, Math.PI, ProfileExtrusionPlanRole.LocalEndBoundary);
+ var shaftSeam = Line("plan:drill:shaft-seam", mouthA, transitionA, ProfileExtrusionPlanRole.LongitudinalBoundary);
+ var coneSeam = Line("plan:drill:point-seam", transitionA, tip, ProfileExtrusionPlanRole.LongitudinalBoundary);
+
+ var mouthOuter = Loop("plan:loop:mouth-outer", ProfileExtrusionPlanRole.LocalStartCapLoop, (lower[0], false), (lower[1], false), (lower[2], false), (lower[3], false));
+ var mouthLoop = Loop("plan:loop:mouth", ProfileExtrusionPlanRole.LocalStartCapLoop, (mouthCircleB, true), (mouthCircleA, true));
+ var farOuter = Loop("plan:loop:far-outer", ProfileExtrusionPlanRole.LocalEndCapLoop, (upper[0], true), (upper[3], true), (upper[2], true), (upper[1], true));
+ var sideLoops = Enumerable.Range(0, 4).Select(i => Loop("plan:loop:box-side:" + i, ProfileExtrusionPlanRole.SideLoop,
+ (lower[i], false), (vertical[(i + 1) % 4], false), (upper[i], true), (vertical[i], true))).ToArray();
+ var shaftLoop = Loop("plan:loop:shaft-wall", ProfileExtrusionPlanRole.SideLoop, (mouthCircleA, false), (mouthCircleB, false), (shaftSeam, false), (transitionCircleB, true), (transitionCircleA, true), (shaftSeam, true));
+ // The cone reaches the singular Tip through a deterministic seam pair; no flat cap or Exit loop exists.
+ var pointLoop = Loop("plan:loop:drill-point", ProfileExtrusionPlanRole.SideLoop, (transitionCircleA, false), (transitionCircleB, false), (coneSeam, false), (coneSeam, true));
+ var transitionLoop = Loop("plan:loop:shaft-to-drill-point", ProfileExtrusionPlanRole.LocalEndCapLoop, (transitionCircleA, false), (transitionCircleB, false));
+
+ var mouthSurface = Surface("plan:surface:mouth", SurfaceGeometry.FromPlane(new PlaneSurface(World(0, 0, 0), Direction3D.Create(-frame.AxisZ.ToVector()), frame.AxisX)), true, ProfileExtrusionPlanRole.LocalStartCapFace);
+ var farSurface = Surface("plan:surface:far", SurfaceGeometry.FromPlane(new PlaneSurface(World(0, 0, bounds.ZMax), frame.AxisZ, frame.AxisX)), true, ProfileExtrusionPlanRole.LocalEndCapFace);
+ var sideSurfaces = new[]
+ {
+ Surface("plan:surface:box-side:0", SurfaceGeometry.FromPlane(new PlaneSurface(b0.WorldPoint, Direction3D.Create(-frame.AxisY.ToVector()), frame.AxisZ)), true, ProfileExtrusionPlanRole.SideFace),
+ Surface("plan:surface:box-side:1", SurfaceGeometry.FromPlane(new PlaneSurface(b1.WorldPoint, frame.AxisX, frame.AxisZ)), true, ProfileExtrusionPlanRole.SideFace),
+ Surface("plan:surface:box-side:2", SurfaceGeometry.FromPlane(new PlaneSurface(b2.WorldPoint, frame.AxisY, frame.AxisZ)), true, ProfileExtrusionPlanRole.SideFace),
+ Surface("plan:surface:box-side:3", SurfaceGeometry.FromPlane(new PlaneSurface(b3.WorldPoint, Direction3D.Create(-frame.AxisX.ToVector()), frame.AxisZ)), true, ProfileExtrusionPlanRole.SideFace)
+ };
+ var shaftSurface = Surface("plan:surface:shaft", SurfaceGeometry.FromCylinder(new CylinderSurface(World(placement.LocalCenterX, placement.LocalCenterY, 0d), frame.AxisZ, feature.Shaft.Radius, frame.AxisX)), false, ProfileExtrusionPlanRole.SideFace);
+ var coneSurface = Surface("plan:surface:drill-point", SurfaceGeometry.FromCone(new ConeSurface(tip.WorldPoint, Direction3D.Create(-frame.AxisZ.ToVector()), point.PointAngleDegrees * Math.PI / 360d, frame.AxisX)), false, ProfileExtrusionPlanRole.SideFace);
+
+ Face("plan:face:mouth", mouthSurface, true, ProfileExtrusionPlanRole.LocalStartCapFace, mouthOuter, mouthLoop);
+ Face("plan:face:far", farSurface, true, ProfileExtrusionPlanRole.LocalEndCapFace, farOuter);
+ for (var i = 0; i < 4; i++) Face("plan:face:box-side:" + i, sideSurfaces[i], true, ProfileExtrusionPlanRole.SideFace, sideLoops[i]);
+ var shaftFace = Face("plan:face:shaft", shaftSurface, false, ProfileExtrusionPlanRole.SideFace, shaftLoop);
+ var drillPointFace = Face("plan:face:drill-point", coneSurface, false, ProfileExtrusionPlanRole.SideFace, pointLoop);
+ var descendants = new SemanticTopologyDescendant[]
+ {
+ new($"plan:{source}:mouth-loop", "Loop", SemanticTopologyRole.HoleEntryLoop, source, Loop: mouthLoop.Id, ParentStableId: source),
+ new($"plan:{source}:mouth-edge:a", "Edge", SemanticTopologyRole.TopBoundary, source, Edge: mouthCircleA.Id, ParentStableId: source),
+ new($"plan:{source}:mouth-edge:b", "Edge", SemanticTopologyRole.TopBoundary, source, Edge: mouthCircleB.Id, ParentStableId: source),
+ new($"plan:{source}:shaft-wall", "Face", SemanticTopologyRole.HoleWallFace, source, Face: shaftFace.Id, ParentStableId: source, GeometryPreview: $"radius={feature.Shaft.Radius:R};localZ=[0,{shaftDepth:R}]"),
+ new($"plan:{source}:shaft-to-drill-point-loop", "Loop", SemanticTopologyRole.HoleShaftToDrillPointLoop, source, Loop: transitionLoop.Id, ParentStableId: source),
+ new($"plan:{source}:shaft-to-drill-point-edge:a", "Edge", SemanticTopologyRole.HoleShaftToDrillPointEdge, source, Edge: transitionCircleA.Id, ParentStableId: source),
+ new($"plan:{source}:shaft-to-drill-point-edge:b", "Edge", SemanticTopologyRole.HoleShaftToDrillPointEdge, source, Edge: transitionCircleB.Id, ParentStableId: source),
+ new($"plan:{source}:drill-point", "Face", SemanticTopologyRole.HoleDrillPointFace, source, Face: drillPointFace.Id, ParentStableId: source, GeometryPreview: $"includedAngle={point.PointAngleDegrees:R}deg;tipLength={tipLength:R}"),
+ new($"plan:{source}:tip", "Vertex", SemanticTopologyRole.HoleTipVertex, source, Vertex: tip.Id, ParentStableId: source, GeometryPreview: $"localZ={totalDepth:R}")
+ };
+ var shell = new ProfileExtrusionPlanShell("plan:shell:0", new ShellId(1), faces.Select(x => x.Id).ToArray());
+ var body = new ProfileExtrusionPlanBody("plan:body:0", new BodyId(1), [shell.Id]);
+ var construction = new ProfileExtrusionConstructionAir("air:" + source, source, frame, 0d, bounds.ZMax, [], ["HoleAIR", "DrillPoint", "AuthoritativeBRepPlan"]);
+ var correspondence = new SemanticTopologyCorrespondence(feature.TargetBodyId ?? "semantic-hole-host", descendants, ["HoleAIR", "ConstructionPlanePlacement", "LocalFrameHoleBRepPlan", "ConeSurface", "AuthoritativeBRepPlan"]);
+ var plan = new ProfileExtrusionBRepPlan("brep-plan:blind-drill-point:" + source + ":" + placement.ConstructionPlaneId, construction, vertices, curves, edges, loops, surfaces, faces, shell, body, correspondence, correspondence.ProvenanceChain,
+ ["LocalFrameHoleBRepPlan", "BlindDrillPoint", "CylinderSurface", "ConeSurface", "TipVertex", "AuthoritativeBRepPlan"]);
+ return new(true, plan, plan.Diagnostics);
+ }
+}
diff --git a/Aetheris.Kernel.Firmament/Materializer/HoleEndConditionContract.cs b/Aetheris.Kernel.Firmament/Materializer/HoleEndConditionContract.cs
new file mode 100644
index 00000000..03c1ce81
--- /dev/null
+++ b/Aetheris.Kernel.Firmament/Materializer/HoleEndConditionContract.cs
@@ -0,0 +1,123 @@
+using Aetheris.Kernel.Core.Air;
+
+namespace Aetheris.Kernel.Firmament.Materializer;
+
+/// <summary>
+/// Immutable, plan-owned observation of material along a construction-plane Hole
+/// axis. It deliberately says nothing about the feature the author requested:
+/// traversal describes host reality; <see cref="HoleEndConditionContract"/>
+/// compares that reality with the authored contract.
+/// </summary>
+public enum HoleHostTraversalClassification
+{
+ NoMaterial,
+ OneContiguousInterval,
+ MultipleContiguousPartitionsOfOneMaterialSpan,
+ DisconnectedMaterialIntervals,
+ TangentialContact,
+ AmbiguousTransition
+}
+
+public sealed record HoleHostMaterialIntervalEvidence(
+ double Start,
+ double End,
+ string RegionId,
+ string SourceProvenance,
+ bool FullCircularFootprintSupported,
+ string EntryBoundary,
+ string ExitBoundary)
+{
+ public double Length => End - Start;
+}
+
+public sealed record HoleHostTraversalEvidence(
+ string HoleId,
+ string HostId,
+ string ConstructionPlaneId,
+ double[] WorldMouthCenter,
+ double[] Axis,
+ double Radius,
+ HoleHostTraversalClassification Classification,
+ IReadOnlyList<HoleHostMaterialIntervalEvidence> OrderedIntervals,
+ IReadOnlyList<string> Diagnostics)
+{
+ public (double Start, double End)? PhysicalMaterialSpan => Classification is HoleHostTraversalClassification.OneContiguousInterval or HoleHostTraversalClassification.MultipleContiguousPartitionsOfOneMaterialSpan
+ && OrderedIntervals.Count > 0
+ ? (OrderedIntervals.Min(x => x.Start), OrderedIntervals.Max(x => x.End))
+ : null;
+}
+
+public sealed record HoleEndConditionContractEvidence(
+ string DeclaredEndCondition,
+ string DeclaredTermination,
+ double? ShaftDepth,
+ double? TipLength,
+ double? TotalDepth,
+ double? RemainingWall,
+ bool IsThroughAll,
+ bool IsBlind,
+ bool MouthInsideMaterial,
+ bool TipInsideMaterial,
+ bool HasExit,
+ bool HasDrillPoint,
+ bool ContractSatisfied,
+ IReadOnlyList<string> Diagnostics);
+
+/// <summary>Strict authored Hole end-condition checks shared by plan creation and inspection.</summary>
+internal static class HoleEndConditionContract
+{
+ private const double Tolerance = 1e-9;
+
+ public static HoleEndConditionContractEvidence Evaluate(AirHoleFeature feature, HoleHostTraversalEvidence traversal)
+ {
+ var diagnostics = new List<string>();
+ var span = traversal.PhysicalMaterialSpan;
+ var mouthInside = span is { } physical && physical.Start <= Tolerance && physical.End > Tolerance && traversal.OrderedIntervals.First().FullCircularFootprintSupported;
+ if (!mouthInside) diagnostics.Add($"HoleMouthDoesNotEnterMaterial: feature={feature.FeatureId}; traversal={traversal.Classification}; intervals={Format(traversal)}.");
+ if (traversal.Diagnostics.Any(x => x.StartsWith("MouthInsideHostUnexpectedly", StringComparison.Ordinal)))
+ {
+ mouthInside = false;
+ diagnostics.Add($"MouthInsideHostUnexpectedly: feature={feature.FeatureId}; declared construction-plane mouth is not an entering material boundary.");
+ }
+ if (traversal.Diagnostics.Any(x => x.StartsWith("MouthMissesHost", StringComparison.Ordinal)))
+ diagnostics.Add($"MouthMissesHost: feature={feature.FeatureId}; declared construction-plane mouth does not meet host material.");
+ if (traversal.Diagnostics.Any(x => x.StartsWith("DirectionDoesNotEnterMaterial", StringComparison.Ordinal)))
+ diagnostics.Add($"DirectionDoesNotEnterMaterial: feature={feature.FeatureId}; local +Z does not enter host material at the declared mouth.");
+ if (traversal.Classification == HoleHostTraversalClassification.DisconnectedMaterialIntervals)
+ diagnostics.Add($"HoleHostTraversalDisconnected: feature={feature.FeatureId}; intervals={Format(traversal)}.");
+ if (traversal.Classification is HoleHostTraversalClassification.AmbiguousTransition or HoleHostTraversalClassification.TangentialContact)
+ diagnostics.Add($"HoleHostTraversalAmbiguous: feature={feature.FeatureId}; traversal={traversal.Classification}; intervals={Format(traversal)}.");
+ if (traversal.OrderedIntervals.Any(x => !x.FullCircularFootprintSupported))
+ diagnostics.Add($"HoleFootprintLeavesHost: feature={feature.FeatureId}; radius={feature.Shaft.Radius:R}; intervals={Format(traversal)}.");
+
+ var through = feature.EndCondition is AirHoleEndCondition.ThroughAll;
+ var drill = feature.Termination is AirHoleTermination.DrillPoint point ? point : null;
+ double? shaft = null;
+ double? tip = null;
+ double? total = null;
+ if (drill is not null)
+ {
+ tip = feature.Shaft.Radius / Math.Tan(drill.PointAngleDegrees * Math.PI / 360d);
+ switch (feature.EndCondition)
+ {
+ case AirHoleEndCondition.ShaftDepth value: shaft = value.Value; total = shaft + tip; break;
+ case AirHoleEndCondition.TotalDepth value: total = value.Value; shaft = total - tip; break;
+ default: diagnostics.Add($"HoleBlindDepthMissing: feature={feature.FeatureId}; DrillPoint requires ShaftDepth or TotalDepth."); break;
+ }
+ if (shaft < -Tolerance || total <= Tolerance) diagnostics.Add($"HoleBlindDepthInvalid: feature={feature.FeatureId}; shaftDepth={shaft:R}; totalDepth={total:R}.");
+ }
+
+ double? wall = span is { } s && total is { } requested ? s.End - requested : null;
+ var tipInside = total is null || span is { } materialSpan && total < materialSpan.End - Tolerance;
+ if (drill is not null && !tipInside && span is { } breachSpan && total is { } requestedTotal)
+ diagnostics.Add($"BlindHoleBreakthrough: feature={feature.FeatureId}; declaredEndCondition={feature.EndCondition.Kind}; totalDepth={requestedTotal:R}; hostInterval=[{breachSpan.Start:R},{breachSpan.End:R}]; violation={requestedTotal - breachSpan.End:R}.");
+
+ // A plan has not yet been created, so HasExit is a demanded postcondition
+ // for ThroughAll rather than an observation of materialized topology.
+ var satisfied = diagnostics.Count == 0;
+ return new(feature.EndCondition.Kind.ToString(), drill is null ? "FlatBottom" : "DrillPoint", shaft, tip, total, wall,
+ through, !through, mouthInside, tipInside, through, drill is not null, satisfied, diagnostics);
+ }
+
+ private static string Format(HoleHostTraversalEvidence traversal) => string.Join(",", traversal.OrderedIntervals.Select(x => $"[{x.Start:R},{x.End:R}]/{x.RegionId}"));
+}
diff --git a/Aetheris.Kernel.Firmament/Materializer/LocalFrameHoleBRepPlan.cs b/Aetheris.Kernel.Firmament/Materializer/LocalFrameHoleBRepPlan.cs
index 5ccf5922..7fd46a0e 100644
--- a/Aetheris.Kernel.Firmament/Materializer/LocalFrameHoleBRepPlan.cs
+++ b/Aetheris.Kernel.Firmament/Materializer/LocalFrameHoleBRepPlan.cs
@@ -15,10 +15,13 @@ internal sealed record LocalFrameHoleBRepPlan(
(double Start, double End) HostMaterialInterval,
ProfileExtrusionBRepPlan Topology,
SemanticTopologyCorrespondence Correspondence,
- IReadOnlyList<string> Provenance)
+ IReadOnlyList<string> Provenance,
+ HoleHostTraversalEvidence? TraversalEvidence = null,
+ HoleEndConditionContractEvidence? ContractEvidence = null)
{
public static LocalFrameHoleBRepPlan FromProfilePlan(AirHoleFeature feature, AirConstructionPlaneHolePlacement placement,
- (double Start, double End) interval, ProfileExtrusionBRepPlan topology)
+ (double Start, double End) interval, ProfileExtrusionBRepPlan topology,
+ HoleHostTraversalEvidence? traversalEvidence = null, HoleEndConditionContractEvidence? contractEvidence = null)
{
var innerStart = topology.Loops.Single(x => x.Role == ProfileExtrusionPlanRole.LocalStartCapLoop && x.SourceStableId.EndsWith("Loop1", StringComparison.Ordinal));
var innerEnd = topology.Loops.Single(x => x.Role == ProfileExtrusionPlanRole.LocalEndCapLoop && x.SourceStableId.EndsWith("Loop1", StringComparison.Ordinal));
@@ -38,6 +41,6 @@ internal sealed record LocalFrameHoleBRepPlan(
var provenance = new[] { "HoleBRepPlan", "ConstructionPlanePlacement", "HostMaterialIntervalQuery", "ProfileExtrusionBRepPlan", "AuthoritativeBRepPlan",
"ConstructionPlane:" + placement.ConstructionPlaneId, "ConceptPlane:" + placement.SourceConceptPlaneId };
return new($"brep-plan:hole:{source}:{placement.ConstructionPlaneId}", source, placement, interval, topology,
- new SemanticTopologyCorrespondence(feature.TargetBodyId ?? "semantic-hole-host", descendants, provenance), provenance);
+ new SemanticTopologyCorrespondence(feature.TargetBodyId ?? "semantic-hole-host", descendants, provenance), provenance, traversalEvidence, contractEvidence);
}
}
diff --git a/Aetheris.Kernel.Firmament/Materializer/PrismaticSectionStackHoleTraversal.cs b/Aetheris.Kernel.Firmament/Materializer/PrismaticSectionStackHoleTraversal.cs
new file mode 100644
index 00000000..5b85b1f6
--- /dev/null
+++ b/Aetheris.Kernel.Firmament/Materializer/PrismaticSectionStackHoleTraversal.cs
@@ -0,0 +1,217 @@
+using Aetheris.Kernel.Core.Air;
+using Aetheris.Kernel.Core.Geometry.Curves;
+
+namespace Aetheris.Kernel.Firmament.Materializer;
+
+/// <summary>
+/// Exact, non-tessellated host evidence for a construction-plane shaft through
+/// the normalized section stack. A partition is a planning boundary; a span is
+/// material only after adjacent partitions have been proven continuous.
+/// </summary>
+public enum SectionStackFootprintClassification { InsideMaterial, Tangent, CrossesOuterBoundary, IntersectsInnerVoid, OutsideMaterial, Ambiguous }
+
+public sealed record SectionStackHoleFootprintCheck(
+ double LocalAxisStart, double LocalAxisEnd, double CenterX, double CenterY,
+ double Radius, SectionStackFootprintClassification Classification, double NearestBoundaryDistance,
+ IReadOnlyList<string> BoundaryProvenance);
+
+public sealed record SectionStackHolePlannerPartition(
+ double LocalAxisStart, double LocalAxisEnd, double SectionFrom, double SectionTo,
+ IReadOnlyList<string> ActiveOperations, IReadOnlyList<string> ProfileRegions,
+ bool CompleteCircularFootprintInMaterial, string EntryEvent, string ExitEvent,
+ SectionStackHoleFootprintCheck Footprint, IReadOnlyList<string> Provenance)
+{
+ public double Length => LocalAxisEnd - LocalAxisStart;
+}
+
+public sealed record SectionStackHolePhysicalSpan(double Start, double End, IReadOnlyList<int> PartitionIndices, bool IsContinuous)
+{
+ public double Length => End - Start;
+}
+
+public sealed record SectionStackHoleTraversalEvidence(
+ HoleHostTraversalEvidence HostTraversal,
+ IReadOnlyList<SectionStackHolePlannerPartition> OrderedPartitions,
+ IReadOnlyList<SectionStackHolePhysicalSpan> PhysicalSpans,
+ IReadOnlyList<string> TransitionEvents,
+ IReadOnlyList<SectionStackHoleFootprintCheck> FootprintChecks,
+ IReadOnlyList<string> Diagnostics,
+ IReadOnlyList<string> Provenance);
+
+/// <summary>
+/// Traverses the already-normalized stack. The initial admitted mapping is an
+/// axial signed-permutation plane (+/- world Z): this is the only mapping whose
+/// circular footprint is a disk in the stack's native XY section. Transverse
+/// planes deliberately reject here rather than reusing the Box interval or
+/// silently treating a YZ/XZ footprint as an XY disk.
+/// </summary>
+internal static class PrismaticSectionStackHoleTraversal
+{
+ private const double Tol = 1e-8;
+
+ public static SectionStackHoleTraversalEvidence Traverse(
+ AirHoleFeature feature, PrismaticSectionStackConstruction stack, AirConstructionPlaneHolePlacement placement)
+ {
+ var diagnostics = new List<string>();
+ var axis = placement.AxisZ.ToVector();
+ var mouth = placement.WorldMouthCenter;
+ if (!IsSignedPermutation(placement))
+ diagnostics.Add("SectionStackHoleOrientationUnsupported: Construction Plane must be a signed-permutation frame.");
+ if (Math.Abs(axis.Z) < 1d - Tol)
+ diagnostics.Add("SectionStackHoleTransverseTraversalNotYetAdmitted: a transverse shaft footprint is YZ/XZ, not the stack native XY disk; no Box-interval fallback is permitted.");
+
+ if (diagnostics.Count > 0)
+ return Empty(feature, stack, placement, diagnostics);
+
+ // t is always construction-plane local +Z distance. For +/-Z axes the
+ // section centre is invariant in XY and the radius test is exact against
+ // every admitted line/arc boundary of the active normalized region.
+ var raw = new List<(PrismaticSectionSlab Slab, double Start, double End)>();
+ foreach (var slab in stack.Slabs)
+ {
+ var a = (slab.From - mouth.Z) / axis.Z;
+ var b = (slab.To - mouth.Z) / axis.Z;
+ var start = Math.Max(0d, Math.Min(a, b)); var end = Math.Max(a, b);
+ if (end - start > Tol) raw.Add((slab, start, end));
+ }
+ raw.Sort((x, y) => x.Start.CompareTo(y.Start));
+ if (raw.Count == 0)
+ {
+ diagnostics.Add("MouthMissesHost: construction-plane mouth does not meet any section-stack material slab.");
+ return Empty(feature, stack, placement, diagnostics);
+ }
+
+ // Do not turn a clipped first interval into a mouth event: it would hide
+ // an author declaring a mouth inside existing material.
+ var firstRawStart = raw[0].Start;
+ var firstUnclipped = axis.Z > 0d
+ ? (raw[0].Slab.From - mouth.Z) / axis.Z
+ : (raw[0].Slab.To - mouth.Z) / axis.Z;
+ if (firstUnclipped < -Tol) diagnostics.Add("MouthInsideHostUnexpectedly: construction-plane mouth is inside material, not on its entering boundary.");
+ if (firstRawStart > Tol) diagnostics.Add("DirectionDoesNotEnterMaterial: local +Z reaches air before host material.");
+
+ var partitions = new List<SectionStackHolePlannerPartition>();
+ foreach (var item in raw)
+ {
+ var check = CheckDisk(item.Slab.Region, (mouth.X, mouth.Y), feature.Shaft.Radius, item.Start, item.End);
+ var footprintSupported = check.Classification == SectionStackFootprintClassification.InsideMaterial;
+ if (!footprintSupported) diagnostics.Add($"HoleFootprintLeavesHost: slab=[{item.Slab.From:R},{item.Slab.To:R}]; classification={check.Classification}.");
+ var index = partitions.Count;
+ partitions.Add(new(item.Start, item.End, item.Slab.From, item.Slab.To, item.Slab.ActiveOperations,
+ item.Slab.Region.Provenance, footprintSupported,
+ index == 0 ? "MouthCandidate" : "PlannerTransition",
+ "PlannerTransitionOrHostBoundary", check,
+ item.Slab.Region.Provenance.Concat(["PrismaticSectionStackConstruction", "ProfileArrangement2D"]).Distinct().ToArray()));
+ }
+
+ var transitions = new List<string>();
+ for (var i = 1; i < partitions.Count; i++)
+ {
+ var previous = partitions[i - 1]; var current = partitions[i];
+ var continuous = Math.Abs(previous.LocalAxisEnd - current.LocalAxisStart) <= Tol &&
+ previous.CompleteCircularFootprintInMaterial && current.CompleteCircularFootprintInMaterial;
+ transitions.Add($"localAxis={current.LocalAxisStart:R}; kind={(continuous ? "InternalPlannerPartition" : "HostBoundaryOrVoid")}; below=[{previous.SectionFrom:R},{previous.SectionTo:R}]; above=[{current.SectionFrom:R},{current.SectionTo:R}]");
+ }
+
+ var spans = Collapse(partitions);
+ var supported = partitions.Where(x => x.CompleteCircularFootprintInMaterial).ToArray();
+ HoleHostTraversalClassification classification = supported.Length switch
+ {
+ 0 => partitions.Any(x => x.Footprint.Classification == SectionStackFootprintClassification.Tangent) ? HoleHostTraversalClassification.TangentialContact : HoleHostTraversalClassification.NoMaterial,
+ _ when spans.Count == 1 && partitions.Count == 1 => HoleHostTraversalClassification.OneContiguousInterval,
+ _ when spans.Count == 1 => HoleHostTraversalClassification.MultipleContiguousPartitionsOfOneMaterialSpan,
+ _ => HoleHostTraversalClassification.DisconnectedMaterialIntervals
+ };
+ var intervals = partitions.Select((p, i) => new HoleHostMaterialIntervalEvidence(p.LocalAxisStart, p.LocalAxisEnd,
+ $"section-stack:slab:{p.SectionFrom:R}..{p.SectionTo:R}:partition:{i}", string.Join(";", p.Provenance),
+ p.CompleteCircularFootprintInMaterial, p.EntryEvent, p.ExitEvent)).ToArray();
+ var host = new HoleHostTraversalEvidence(feature.FeatureId, feature.TargetBodyId ?? stack.Feature.Name, placement.ConstructionPlaneId,
+ [mouth.X, mouth.Y, mouth.Z], [axis.X, axis.Y, axis.Z], feature.Shaft.Radius, classification, intervals, diagnostics.Distinct().ToArray());
+ return new(host, partitions, spans, transitions, partitions.Select(x => x.Footprint).ToArray(), diagnostics.Distinct().ToArray(),
+ ["PrismaticSectionStackConstruction", "ProfileArrangement2D", "ExactLineArcDiskContainment", "NoTessellation"]);
+ }
+
+ private static SectionStackHoleTraversalEvidence Empty(AirHoleFeature feature, PrismaticSectionStackConstruction stack, AirConstructionPlaneHolePlacement placement, IReadOnlyList<string> diagnostics)
+ {
+ var mouth = placement.WorldMouthCenter; var axis = placement.AxisZ.ToVector();
+ var host = new HoleHostTraversalEvidence(feature.FeatureId, feature.TargetBodyId ?? stack.Feature.Name, placement.ConstructionPlaneId,
+ [mouth.X, mouth.Y, mouth.Z], [axis.X, axis.Y, axis.Z], feature.Shaft.Radius, HoleHostTraversalClassification.NoMaterial, [], diagnostics);
+ return new(host, [], [], [], [], diagnostics, ["PrismaticSectionStackConstruction", "NoBoxIntervalFallback"]);
+ }
+
+ private static IReadOnlyList<SectionStackHolePhysicalSpan> Collapse(IReadOnlyList<SectionStackHolePlannerPartition> partitions)
+ {
+ var result = new List<SectionStackHolePhysicalSpan>();
+ var current = new List<int>();
+ for (var i = 0; i < partitions.Count; i++)
+ {
+ var partition = partitions[i];
+ var contiguous = current.Count > 0 && Math.Abs(partitions[current[^1]].LocalAxisEnd - partition.LocalAxisStart) <= Tol;
+ if (!partition.CompleteCircularFootprintInMaterial || (!contiguous && current.Count > 0))
+ {
+ if (current.Count > 0) result.Add(new(partitions[current[0]].LocalAxisStart, partitions[current[^1]].LocalAxisEnd, current.ToArray(), true));
+ current.Clear();
+ }
+ if (partition.CompleteCircularFootprintInMaterial) current.Add(i);
+ }
+ if (current.Count > 0) result.Add(new(partitions[current[0]].LocalAxisStart, partitions[current[^1]].LocalAxisEnd, current.ToArray(), true));
+ return result;
+ }
+
+ private static SectionStackHoleFootprintCheck CheckDisk(PrismaticSectionRegion region, (double X, double Y) center, double radius, double start, double end)
+ {
+ var outerLocation = ProfileArrangementBuilder.PointInProfile(region.Outer, center);
+ var outer = BoundaryDistance(region.Outer, center);
+ var holes = region.Holes.Select(h => (Location: ProfileArrangementBuilder.PointInProfile(h, center), Distance: BoundaryDistance(h, center), Profile: h)).ToArray();
+ var provenance = region.Provenance;
+ if (outerLocation != ArrangementPointLocation.Inside)
+ return new(start, end, center.X, center.Y, radius, SectionStackFootprintClassification.OutsideMaterial, outer, provenance);
+ if (holes.Any(x => x.Location is ArrangementPointLocation.Inside or ArrangementPointLocation.OnBoundary))
+ return new(start, end, center.X, center.Y, radius, SectionStackFootprintClassification.IntersectsInnerVoid, holes.Min(x => x.Distance), provenance);
+ var nearest = Math.Min(outer, holes.Length == 0 ? double.PositiveInfinity : holes.Min(x => x.Distance));
+ var kind = Math.Abs(nearest - radius) <= Tol ? SectionStackFootprintClassification.Tangent
+ : nearest < radius ? (outer < radius ? SectionStackFootprintClassification.CrossesOuterBoundary : SectionStackFootprintClassification.IntersectsInnerVoid)
+ : SectionStackFootprintClassification.InsideMaterial;
+ return new(start, end, center.X, center.Y, radius, kind, nearest, provenance);
+ }
+
+ private static double BoundaryDistance(ResolvedProfile2D profile, (double X, double Y) point) => profile.Loops.Single().Segments.Min(segment => segment.Geometry switch
+ {
+ LineArcLineSegment2D line => DistanceToLineSegment(point, line.Start, line.End),
+ LineArcCircularArc2D arc => DistanceToArc(point, arc),
+ _ => double.NaN
+ });
+
+ private static double DistanceToLineSegment((double X, double Y) p, (double X, double Y) a, (double X, double Y) b)
+ {
+ var dx = b.X - a.X; var dy = b.Y - a.Y; var length2 = dx * dx + dy * dy;
+ var t = Math.Clamp(((p.X - a.X) * dx + (p.Y - a.Y) * dy) / length2, 0d, 1d);
+ return Math.Sqrt(Math.Pow(p.X - (a.X + t * dx), 2) + Math.Pow(p.Y - (a.Y + t * dy), 2));
+ }
+
+ private static double DistanceToArc((double X, double Y) p, LineArcCircularArc2D arc)
+ {
+ var dx = p.X - arc.Center.X; var dy = p.Y - arc.Center.Y; var distance = Math.Sqrt(dx * dx + dy * dy);
+ var angle = Math.Atan2(dy, dx);
+ if (OnArc(arc, angle)) return Math.Abs(distance - arc.Radius);
+ var a = (arc.Center.X + arc.Radius * Math.Cos(arc.StartAngleRadians), arc.Center.Y + arc.Radius * Math.Sin(arc.StartAngleRadians));
+ var bAngle = arc.StartAngleRadians + arc.SweepAngleRadians;
+ var b = (arc.Center.X + arc.Radius * Math.Cos(bAngle), arc.Center.Y + arc.Radius * Math.Sin(bAngle));
+ return Math.Min(Math.Sqrt(Math.Pow(p.X - a.Item1, 2) + Math.Pow(p.Y - a.Item2, 2)), Math.Sqrt(Math.Pow(p.X - b.Item1, 2) + Math.Pow(p.Y - b.Item2, 2)));
+ }
+
+ private static bool OnArc(LineArcCircularArc2D arc, double angle)
+ {
+ var delta = angle - arc.StartAngleRadians;
+ if (arc.SweepAngleRadians >= 0d) while (delta < 0d) delta += 2d * Math.PI;
+ else while (delta > 0d) delta -= 2d * Math.PI;
+ return delta / arc.SweepAngleRadians >= -Tol && delta / arc.SweepAngleRadians <= 1d + Tol;
+ }
+
+ private static bool IsSignedPermutation(AirConstructionPlaneHolePlacement placement)
+ {
+ var axes = new[] { placement.AxisX.ToVector(), placement.AxisY.ToVector(), placement.AxisZ.ToVector() };
+ return axes.All(axis => new[] { Math.Abs(axis.X), Math.Abs(axis.Y), Math.Abs(axis.Z) }.Count(value => Math.Abs(value - 1d) <= Tol) == 1
+ && new[] { Math.Abs(axis.X), Math.Abs(axis.Y), Math.Abs(axis.Z) }.Count(value => value <= Tol) == 2);
+ }
+}
diff --git a/Aetheris.Kernel.Firmament/Materializer/SemanticTopologySelections.cs b/Aetheris.Kernel.Firmament/Materializer/SemanticTopologySelections.cs
index 87b5e4fd..cdc0df7b 100644
--- a/Aetheris.Kernel.Firmament/Materializer/SemanticTopologySelections.cs
+++ b/Aetheris.Kernel.Firmament/Materializer/SemanticTopologySelections.cs
@@ -5,7 +5,7 @@ using System.Text.RegularExpressions;
namespace Aetheris.Kernel.Firmament.Materializer;
/// <summary>Stable roles assigned while an authoritative plan is materialized. These are not geometric queries.</summary>
-public enum SemanticTopologyRole { Unknown, ProfileVertex, VerticalExtrusionEdge, LocalStartBoundary, LocalEndBoundary, LocalStartCapLoop, LocalEndCapLoop, TopBoundary, BottomBoundary, ExtrusionSideFace, TopFaceBoundaryLoop, BottomFaceBoundaryLoop, HoleEntryLoop, HoleExitLoop, HoleWallFace, SlotEntryLoop, SlotExitLoop, SlotWallFace, SlotStraightWallFace, SlotEndWallFace, ComposeTransition }
+public enum SemanticTopologyRole { Unknown, ProfileVertex, VerticalExtrusionEdge, LocalStartBoundary, LocalEndBoundary, LocalStartCapLoop, LocalEndCapLoop, TopBoundary, BottomBoundary, ExtrusionSideFace, TopFaceBoundaryLoop, BottomFaceBoundaryLoop, HoleEntryLoop, HoleExitLoop, HoleWallFace, HoleShaftToDrillPointLoop, HoleShaftToDrillPointEdge, HoleDrillPointFace, HoleTipVertex, SlotEntryLoop, SlotExitLoop, SlotWallFace, SlotStraightWallFace, SlotEndWallFace, ComposeTransition }
public enum SemanticSelectionRequirement { ExactlyOne, OneOrMore, ConnectedChain, ClosedLoop, NonEmptyFaceSet }
public enum SemanticSelectionFailure { None, SemanticSourceNotFound, NoMaterializedDescendants, AmbiguousBodyContext, SelectionCardinalityMismatch, DescendantsNotConnected, DescendantsBranch, DescendantsDoNotClose, MixedBoundaryRoles, UnsupportedTopologyChange, SelectionConsumerMismatch }
@@ -130,7 +130,7 @@ public static class SemanticSelectionSourceParser
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 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 Target = new(@"\bTarget\s*:\s*(?<role>TopBoundary|BottomBoundary|SideBoundary|HoleEntry|HoleExit|HoleWall|ShaftToDrillPoint|DrillPoint|Tip|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)
@@ -146,7 +146,7 @@ public static class SemanticSelectionSourceParser
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 }
+ ? boundary switch { "HoleEntry" => SemanticTopologyRole.HoleEntryLoop, "HoleExit" => SemanticTopologyRole.HoleExitLoop, "HoleWall" => SemanticTopologyRole.HoleWallFace, "ShaftToDrillPoint" => SemanticTopologyRole.HoleShaftToDrillPointLoop, "DrillPoint" => SemanticTopologyRole.HoleDrillPointFace, "Tip" => SemanticTopologyRole.HoleTipVertex, _ => SemanticTopologyRole.Unknown }
: loopMatch.Success
? boundary switch { "TopBoundary" => SemanticTopologyRole.TopFaceBoundaryLoop, "BottomBoundary" => SemanticTopologyRole.BottomFaceBoundaryLoop, _ => SemanticTopologyRole.ExtrusionSideFace }
: boundary switch { "TopBoundary" => SemanticTopologyRole.TopBoundary, "BottomBoundary" => SemanticTopologyRole.BottomBoundary, _ => SemanticTopologyRole.ExtrusionSideFace };
diff --git a/Aetheris.Kernel.Firmament/Materializer/TransverseBlindDrillToolCorridor.cs b/Aetheris.Kernel.Firmament/Materializer/TransverseBlindDrillToolCorridor.cs
new file mode 100644
index 00000000..32474687
--- /dev/null
+++ b/Aetheris.Kernel.Firmament/Materializer/TransverseBlindDrillToolCorridor.cs
@@ -0,0 +1,203 @@
+using Aetheris.Kernel.Core.Air;
+using Aetheris.Kernel.Core.Geometry.Curves;
+
+namespace Aetheris.Kernel.Firmament.Materializer;
+
+/// <summary>Classification of the complete, transverse blind drilling tool volume.</summary>
+public enum BlindDrillToolCorridorClassification
+{
+ CorridorProven, MouthUnsupported, ShaftBoundaryCrossing, ShaftVoidIntersection,
+ ConeBoundaryCrossing, ConeVoidIntersection, TipOutsideMaterial,
+ DisconnectedHostCorridor, TangentialAmbiguity, Unsupported
+}
+
+public enum SectionRectangleCorridorClassification { FullyContained, CrossesOuterBoundary, IntersectsInnerVoid, Tangential, Ambiguous, UnsupportedBoundary }
+
+public sealed record SectionRectangleCorridorProof(
+ double ZFrom, double ZTo, double AxisFrom, double AxisTo, double CrossFrom, double CrossTo,
+ string ToolPart, SectionRectangleCorridorClassification Classification, IReadOnlyList<string> Provenance,
+ string Detail);
+
+public sealed record BlindDrillToolCorridorEvidence(
+ string HoleId, string HostId, string ConstructionPlaneId, double[] Mouth, double[] Axis,
+ double Radius, double ShaftDepth, double TipLength, double TotalDepth, double PointAngle,
+ IReadOnlyList<SectionRectangleCorridorProof> ShaftSliceProofs,
+ IReadOnlyList<SectionRectangleCorridorProof> ConeSliceProofs,
+ double? RemainingWall, BlindDrillToolCorridorClassification Classification,
+ IReadOnlyList<string> Diagnostics, IReadOnlyList<string> Provenance);
+
+/// <summary>
+/// Bounded transverse (+/-X, +/-Y) blind-drill proof. At each world-Z slab it
+/// proves a tool envelope in the slab's native XY material region. The shaft
+/// envelope follows the exact circular YZ/XZ chord; the cone uses the enclosing
+/// analytic rectangle for that slab. This is conservative for the cone and is
+/// intentionally rejected rather than approximated when its enclosure cannot
+/// be proven.
+/// </summary>
+internal static class TransverseBlindDrillToolCorridor
+{
+ private const double Tol = 1e-8;
+ private const double EntryInset = 1e-5;
+
+ public static BlindDrillToolCorridorEvidence Prove(AirHoleFeature feature, PrismaticSectionStackConstruction stack, AirConstructionPlaneHolePlacement placement)
+ {
+ var diagnostics = new List<string>(); var mouth = placement.WorldMouthCenter; var axis = placement.AxisZ.ToVector();
+ if (feature.Termination is not AirHoleTermination.DrillPoint point || feature.EndCondition is AirHoleEndCondition.ThroughAll)
+ return Fail("BlindDrillToolCorridorRequiresBlindDrillPoint", BlindDrillToolCorridorClassification.Unsupported);
+ if (!SignedTransverse(axis, placement)) return Fail("BlindDrillToolCorridorOrientationUnsupported: admitted axes are signed world +/-X and +/-Y.", BlindDrillToolCorridorClassification.Unsupported);
+ var tip = feature.Shaft.Radius / Math.Tan(point.PointAngleDegrees * Math.PI / 360d);
+ var shaft = feature.EndCondition switch
+ {
+ AirHoleEndCondition.ShaftDepth d => d.Value,
+ AirHoleEndCondition.TotalDepth d => d.Value - tip,
+ _ => double.NaN
+ };
+ if (!double.IsFinite(shaft) || shaft < -Tol || tip <= Tol)
+ return Fail("BlindDrillToolCorridorDepthInvalid", BlindDrillToolCorridorClassification.Unsupported);
+
+ var total = shaft + tip; var radius = feature.Shaft.Radius;
+ var radialZMin = mouth.Z - radius; var radialZMax = mouth.Z + radius;
+ var slabs = stack.Slabs.Where(s => s.To > radialZMin + Tol && s.From < radialZMax - Tol).OrderBy(s => s.From).ToArray();
+ if (!Covers(slabs, radialZMin, radialZMax)) return Fail("DisconnectedHostCorridor: host material slabs do not cover the tool Z support.", BlindDrillToolCorridorClassification.DisconnectedHostCorridor);
+
+ var positive = axis.X > 0d || axis.Y > 0d; var xAxis = Math.Abs(axis.X) > .5d;
+ var axialMouth = xAxis ? mouth.X : mouth.Y; var crossCenter = xAxis ? mouth.Y : mouth.X;
+ var shaftEnd = axialMouth + (positive ? shaft : -shaft); var tipEnd = axialMouth + (positive ? total : -total);
+ var shaftProofs = new List<SectionRectangleCorridorProof>(); var coneProofs = new List<SectionRectangleCorridorProof>();
+ foreach (var slab in slabs)
+ {
+ var z0 = Math.Max(slab.From, radialZMin); var z1 = Math.Min(slab.To, radialZMax);
+ var maxChord = Chord(radius, Math.Abs(NearestTo(mouth.Z, z0, z1) - mouth.Z));
+ // Exclude only the declared mouth boundary from the interior query;
+ // closure supplies the exact circular Mouth support separately in a
+ // host-integrated plan. No alternative mouth is searched for here.
+ var insideMouth = axialMouth + (positive ? EntryInset : -EntryInset);
+ var shaftProof = QueryRectangle(slab.Region, z0, z1, insideMouth, shaftEnd,
+ crossCenter - maxChord, crossCenter + maxChord, xAxis, "Shaft");
+ shaftProofs.Add(shaftProof);
+
+ // At fixed Z the exact cone is curved in the axial/cross plane. The
+ // rectangle below is its analytic enclosing envelope: s is bounded
+ // by L(1-|dz|/r), and the maximum cross chord occurs at s=0. A host
+ // containing this rectangle necessarily contains the full cone slice.
+ var dz = Math.Abs(NearestTo(mouth.Z, z0, z1) - mouth.Z);
+ var coneLength = tip * Math.Max(0d, 1d - dz / radius);
+ var coneEnd = shaftEnd + (positive ? coneLength : -coneLength);
+ var coneProof = QueryRectangle(slab.Region, z0, z1, shaftEnd, coneEnd,
+ crossCenter - maxChord, crossCenter + maxChord, xAxis, "DrillPoint");
+ coneProofs.Add(coneProof);
+ }
+
+ var all = shaftProofs.Concat(coneProofs).ToArray();
+ var classification = Classify(all, diagnostics);
+ double? remaining = null;
+ // The physical RemainingWall is direction-specific distance beyond the
+ // tip and needs host-boundary correspondence. This proof does not invent
+ // it from a slab or an arbitrary nearest boundary.
+ if (classification == BlindDrillToolCorridorClassification.CorridorProven)
+ diagnostics.Add("RemainingWallRequiresHostBoundaryCorrespondence: corridor is proven but no final host boundary distance was inferred.");
+ return new(feature.FeatureId, feature.TargetBodyId ?? stack.Feature.Name, placement.ConstructionPlaneId,
+ [mouth.X, mouth.Y, mouth.Z], [axis.X, axis.Y, axis.Z], radius, shaft, tip, total, point.PointAngleDegrees,
+ shaftProofs, coneProofs, remaining, classification, diagnostics, ["PrismaticSectionStackConstruction", "ProfileArrangement2D", "TransverseYZorXZChord", "ConservativeAnalyticConeEnvelope", "NoTessellation"]);
+
+ BlindDrillToolCorridorEvidence Fail(string diagnostic, BlindDrillToolCorridorClassification kind)
+ {
+ diagnostics.Add(diagnostic);
+ return new(feature.FeatureId, feature.TargetBodyId ?? stack.Feature.Name, placement.ConstructionPlaneId,
+ [mouth.X, mouth.Y, mouth.Z], [axis.X, axis.Y, axis.Z], feature.Shaft.Radius, 0d, 0d, 0d,
+ feature.Termination is AirHoleTermination.DrillPoint p ? p.PointAngleDegrees : 0d, [], [], null, kind, diagnostics,
+ ["PrismaticSectionStackConstruction", "NoBoxIntervalFallback"]);
+ }
+ }
+
+ private static BlindDrillToolCorridorClassification Classify(IReadOnlyList<SectionRectangleCorridorProof> proofs, List<string> diagnostics)
+ {
+ var failure = proofs.FirstOrDefault(x => x.Classification != SectionRectangleCorridorClassification.FullyContained);
+ if (failure is null) return BlindDrillToolCorridorClassification.CorridorProven;
+ diagnostics.Add($"ToolCorridorFailure: part={failure.ToolPart}; z=[{failure.ZFrom:R},{failure.ZTo:R}]; axial=[{failure.AxisFrom:R},{failure.AxisTo:R}]; cross=[{failure.CrossFrom:R},{failure.CrossTo:R}]; detail={failure.Detail}.");
+ return failure.Classification switch
+ {
+ SectionRectangleCorridorClassification.IntersectsInnerVoid => failure.ToolPart == "Shaft" ? BlindDrillToolCorridorClassification.ShaftVoidIntersection : BlindDrillToolCorridorClassification.ConeVoidIntersection,
+ SectionRectangleCorridorClassification.CrossesOuterBoundary => failure.ToolPart == "Shaft" ? BlindDrillToolCorridorClassification.ShaftBoundaryCrossing : BlindDrillToolCorridorClassification.ConeBoundaryCrossing,
+ SectionRectangleCorridorClassification.Tangential => BlindDrillToolCorridorClassification.TangentialAmbiguity,
+ _ => BlindDrillToolCorridorClassification.Unsupported
+ };
+ }
+
+ private static SectionRectangleCorridorProof QueryRectangle(PrismaticSectionRegion region, double z0, double z1, double a, double b, double c, double d, bool xAxis, string part)
+ {
+ var xmin = xAxis ? Math.Min(a, b) : Math.Min(c, d); var xmax = xAxis ? Math.Max(a, b) : Math.Max(c, d);
+ var ymin = xAxis ? Math.Min(c, d) : Math.Min(a, b); var ymax = xAxis ? Math.Max(c, d) : Math.Max(a, b);
+ var corners = new[] { (xmin, ymin), (xmax, ymin), (xmax, ymax), (xmin, ymax) };
+ var outer = corners.Select(p => ProfileArrangementBuilder.PointInProfile(region.Outer, p)).ToArray();
+ if (outer.Any(x => x == ArrangementPointLocation.OnBoundary)) return Proof(SectionRectangleCorridorClassification.Tangential, "outer-corner-on-boundary");
+ if (outer.Any(x => x != ArrangementPointLocation.Inside)) return Proof(SectionRectangleCorridorClassification.CrossesOuterBoundary, "outer-corner-outside");
+ foreach (var hole in region.Holes)
+ {
+ var locations = corners.Select(p => ProfileArrangementBuilder.PointInProfile(hole, p)).ToArray();
+ if (locations.Any(x => x is ArrangementPointLocation.Inside or ArrangementPointLocation.OnBoundary)) return Proof(SectionRectangleCorridorClassification.IntersectsInnerVoid, "corner-in-inner-void");
+ }
+ foreach (var curve in Curves(region.Outer)) if (IntersectsOrLiesInside(curve, xmin, xmax, ymin, ymax, out var tangent)) return Proof(tangent ? SectionRectangleCorridorClassification.Tangential : SectionRectangleCorridorClassification.CrossesOuterBoundary, "outer-boundary-intersects-corridor");
+ foreach (var hole in region.Holes)
+ foreach (var curve in Curves(hole)) if (IntersectsOrLiesInside(curve, xmin, xmax, ymin, ymax, out var tangent)) return Proof(tangent ? SectionRectangleCorridorClassification.Tangential : SectionRectangleCorridorClassification.IntersectsInnerVoid, "inner-void-intersects-corridor");
+ return Proof(SectionRectangleCorridorClassification.FullyContained, "exact-line-arc-boundary-clear");
+
+ SectionRectangleCorridorProof Proof(SectionRectangleCorridorClassification classification, string detail) => new(z0, z1, a, b, c, d, part, classification, region.Provenance, detail);
+ }
+
+ private static IEnumerable<LineArcProfileCurve2D> Curves(ResolvedProfile2D profile) => profile.Loops.Single().Segments.Select(x => x.Geometry);
+ private static bool IntersectsOrLiesInside(LineArcProfileCurve2D curve, double xmin, double xmax, double ymin, double ymax, out bool tangent)
+ {
+ tangent = false;
+ foreach (var p in Candidates(curve)) if (p.X > xmin + Tol && p.X < xmax - Tol && p.Y > ymin + Tol && p.Y < ymax - Tol) return true;
+ foreach (var edge in new[] { ((xmin, ymin), (xmax, ymin)), ((xmax, ymin), (xmax, ymax)), ((xmax, ymax), (xmin, ymax)), ((xmin, ymax), (xmin, ymin)) })
+ if (Intersects(curve, edge.Item1, edge.Item2, out var isTangent)) { tangent |= isTangent; return true; }
+ return false;
+ }
+
+ private static IEnumerable<(double X, double Y)> Candidates(LineArcProfileCurve2D curve) => curve switch
+ {
+ LineArcLineSegment2D line => [line.Start, line.End],
+ LineArcCircularArc2D arc => new[] { arc.StartAngleRadians, arc.StartAngleRadians + arc.SweepAngleRadians, 0d, Math.PI / 2d, Math.PI, 3d * Math.PI / 2d }
+ .Where(angle => OnArc(arc, angle)).Select(angle => (arc.Center.X + arc.Radius * Math.Cos(angle), arc.Center.Y + arc.Radius * Math.Sin(angle))),
+ _ => []
+ };
+
+ private static bool Intersects(LineArcProfileCurve2D curve, (double X, double Y) a, (double X, double Y) b, out bool tangent)
+ {
+ tangent = false;
+ if (curve is LineArcLineSegment2D line)
+ {
+ var r = (X: line.End.X - line.Start.X, Y: line.End.Y - line.Start.Y); var s = (X: b.X - a.X, Y: b.Y - a.Y); var cross = Cross(r, s);
+ if (Math.Abs(cross) <= Tol) { tangent = Math.Abs(Cross((a.X - line.Start.X, a.Y - line.Start.Y), r)) <= Tol; return tangent; }
+ var t = Cross((a.X - line.Start.X, a.Y - line.Start.Y), s) / cross; var u = Cross((a.X - line.Start.X, a.Y - line.Start.Y), r) / cross;
+ return t >= -Tol && t <= 1d + Tol && u >= -Tol && u <= 1d + Tol;
+ }
+ if (curve is not LineArcCircularArc2D arc) return false;
+ var dx = b.X - a.X; var dy = b.Y - a.Y; var fx = a.X - arc.Center.X; var fy = a.Y - arc.Center.Y;
+ var aa = dx * dx + dy * dy; var bb = 2d * (fx * dx + fy * dy); var cc = fx * fx + fy * fy - arc.Radius * arc.Radius; var discriminant = bb * bb - 4d * aa * cc;
+ if (discriminant < -Tol) return false; tangent = Math.Abs(discriminant) <= Tol; var root = Math.Sqrt(Math.Max(0d, discriminant));
+ foreach (var t in root <= Tol ? new[] { -bb / (2d * aa) } : new[] { (-bb - root) / (2d * aa), (-bb + root) / (2d * aa) })
+ if (t >= -Tol && t <= 1d + Tol && OnArc(arc, Math.Atan2(a.Y + t * dy - arc.Center.Y, a.X + t * dx - arc.Center.X))) return true;
+ return false;
+ }
+
+ private static bool OnArc(LineArcCircularArc2D arc, double angle)
+ {
+ var delta = angle - arc.StartAngleRadians;
+ if (arc.SweepAngleRadians >= 0d) while (delta < 0d) delta += 2d * Math.PI; else while (delta > 0d) delta -= 2d * Math.PI;
+ var t = delta / arc.SweepAngleRadians; return t >= -Tol && t <= 1d + Tol;
+ }
+ private static bool Covers(IReadOnlyList<PrismaticSectionSlab> slabs, double from, double to)
+ {
+ var current = from; foreach (var slab in slabs) { if (slab.From > current + Tol) return false; current = Math.Max(current, slab.To); } return current >= to - Tol;
+ }
+ private static bool SignedTransverse(Aetheris.Kernel.Core.Math.Vector3D axis, AirConstructionPlaneHolePlacement placement)
+ {
+ var values = new[] { Math.Abs(axis.X), Math.Abs(axis.Y), Math.Abs(axis.Z) };
+ return values.Count(x => Math.Abs(x - 1d) <= Tol) == 1 && values.Count(x => x <= Tol) == 2 && Math.Abs(axis.Z) <= Tol;
+ }
+ private static double NearestTo(double value, double low, double high) => Math.Clamp(value, low, high);
+ private static double Chord(double radius, double zDistance) => Math.Sqrt(Math.Max(0d, radius * radius - zDistance * zDistance));
+ private static double Cross((double X, double Y) a, (double X, double Y) b) => a.X * b.Y - a.Y * b.X;
+}
diff --git a/Aetheris.Server/Api/CadmataFixtureService.cs b/Aetheris.Server/Api/CadmataFixtureService.cs
index 8103a42e..ab7f5eca 100644
--- a/Aetheris.Server/Api/CadmataFixtureService.cs
+++ b/Aetheris.Server/Api/CadmataFixtureService.cs
@@ -16,6 +16,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",
["construction-plane-through-hole"] = "fixtures/FirmamentV2/Hole/valid/construction-plane-through-hole.firmament",
+ ["construction-plane-blind-drillpoint"] = "fixtures/FirmamentV2/Hole/valid/construction-plane-blind-drillpoint-shaft-depth.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",
@@ -30,7 +31,7 @@ internal static class CadmataFixtureService
var source = File.ReadAllText(sourcePath);
BrepBody? body = null; SemanticTopologyCorrespondence? correspondence = null; IReadOnlyList<ResolvedProfile2D> profiles = []; IReadOnlyList<PrismaticShaftHoleFeature> shaftHoles = []; IReadOnlyList<PrismaticCapsuleSlotFeature> capsuleSlots = []; IReadOnlyList<PrismaticRoundedRectangleSlotFeature> roundedRectangleSlots = [];
var diagnostics = new List<string>(); SemanticHoleSourceInspectionEvidence? semanticHoleEvidence = null;
- if (fixtureId is "semantic-shaft-hole" or "construction-plane-through-hole")
+ if (fixtureId is "semantic-shaft-hole" or "construction-plane-through-hole" or "construction-plane-blind-drillpoint")
{
var parsed = FirmamentV2Parser.Parse(source, Path.GetDirectoryName(sourcePath));
if (!parsed.IsSuccess || parsed.Document is null) { error = string.Join("; ", parsed.Diagnostics); return false; }
@@ -101,6 +102,15 @@ internal static class CadmataFixtureService
var descendants = correspondence?.Descendants.Select(d => d.StableId).ToArray() ?? [];
entities.Add(new(featureId, "HoleFeature", semanticHoleEvidence.FeatureId, "conceptAxes", "SemanticHole", new("circle", Center: mouthPoint, Radius: semanticHoleEvidence.Radius), semanticHoleEvidence.SourceSpan, [semanticHoleEvidence.ConstructionPlaneId!], null, null, descendants, null, null, "LocalFrameHoleBRepPlan", null, new Dictionary<string, string> { ["placementKind"] = "ConstructionPlane", ["extent"] = semanticHoleEvidence.Extent, ["hostInterval"] = $"{interval[0]:R}..{interval[1]:R}" }));
entities.Add(new(featureId + ".axis", "ConceptAxis", "drilling axis", "conceptAxes", "HoleAxis", new("polyline", [mouthPoint, Add(mouthPoint, z, interval[1] - interval[0])]), semanticHoleEvidence.SourceSpan, [featureId], null, null, null, null, null, null, null, null));
+ if (semanticHoleEvidence.PointAngle is { } angle && semanticHoleEvidence.ShaftDepth is { } shaftDepth && semanticHoleEvidence.TotalDepth is { } totalDepth)
+ {
+ var transition = Add(mouthPoint, z, shaftDepth); var tip = Add(mouthPoint, z, totalDepth);
+ var pointDescendants = correspondence?.Descendants.Where(d => d.Role is SemanticTopologyRole.HoleDrillPointFace or SemanticTopologyRole.HoleTipVertex).Select(d => d.StableId).ToArray() ?? [];
+ entities.Add(new(featureId + ".shaft-envelope", "ShaftEnvelope", "shaft envelope", "conceptAxes", "Shaft", new("polyline", [mouthPoint, transition]), semanticHoleEvidence.SourceSpan, [featureId], null, null, null, null, null, null, null, new Dictionary<string, string> { ["radius"] = semanticHoleEvidence.Radius.ToString("R"), ["shaftDepth"] = shaftDepth.ToString("R") }));
+ entities.Add(new(featureId + ".transition", "TransitionLoop", "shaft-to-DrillPoint transition", "profileLoops", "ShaftToDrillPointLoop", new("circle", Center: transition, Radius: semanticHoleEvidence.Radius), semanticHoleEvidence.SourceSpan, [featureId], null, null, correspondence?.Descendants.Where(d => d.Role == SemanticTopologyRole.HoleShaftToDrillPointLoop).Select(d => d.StableId).ToArray(), null, null, "LocalFrameHoleBRepPlan", null, null));
+ entities.Add(new(featureId + ".drill-point", "DrillPoint", "exact DrillPoint cone", "conceptAxes", "DrillPoint", new("polyline", [transition, tip]), semanticHoleEvidence.SourceSpan, [featureId], null, null, pointDescendants, null, null, "ConeSurface", null, new Dictionary<string, string> { ["includedPointAngle"] = $"{angle:R} deg", ["tipLength"] = semanticHoleEvidence.TipLength?.ToString("R") ?? string.Empty, ["analytic"] = "ConeSurface" }));
+ entities.Add(new(featureId + ".tip", "TipVertex", "DrillPoint tip", "conceptPoints", "TipVertex", new("polyline", [tip]), semanticHoleEvidence.SourceSpan, [featureId + ".drill-point"], null, null, correspondence?.Descendants.Where(d => d.Role == SemanticTopologyRole.HoleTipVertex).Select(d => d.StableId).ToArray(), null, null, "LocalFrameHoleBRepPlan", null, null));
+ }
}
foreach (var hole in shaftHoles)
{
@@ -135,8 +145,8 @@ internal static class CadmataFixtureService
{
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 hasSemanticFeatures = fixtureId is "semantic-shaft-hole" or "construction-plane-through-hole" || shaftHoles.Count > 0 || capsuleSlots.Count > 0 || roundedRectangleSlots.Count > 0;
- var selectionSourceIds = fixtureId == "semantic-shaft-hole" ? new[] { "hole:base.mount" } : fixtureId == "construction-plane-through-hole" && semanticHoleEvidence is not null ? new[] { "hole:" + semanticHoleEvidence.FeatureId } : 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 hasSemanticFeatures = fixtureId is "semantic-shaft-hole" or "construction-plane-through-hole" or "construction-plane-blind-drillpoint" || shaftHoles.Count > 0 || capsuleSlots.Count > 0 || roundedRectangleSlots.Count > 0;
+ var selectionSourceIds = fixtureId == "semantic-shaft-hole" ? new[] { "hole:base.mount" } : (fixtureId is "construction-plane-through-hole" or "construction-plane-blind-drillpoint") && semanticHoleEvidence is not null ? new[] { "hole:" + semanticHoleEvidence.FeatureId } : 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() });
}
diff --git a/aetheris.client/src/App.tsx b/aetheris.client/src/App.tsx
index 7c34be6f..22d9feca 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', 'ctc-01-x4'].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', 'construction-plane-blind-drillpoint', '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/docs/cadmata/concept-visualization-x1.md b/docs/cadmata/concept-visualization-x1.md
index 6a146d03..5353c6bc 100644
--- a/docs/cadmata/concept-visualization-x1.md
+++ b/docs/cadmata/concept-visualization-x1.md
@@ -95,3 +95,9 @@ Plane, local-center marker, local-`+Z` drill axis, analytic shaft envelope,
Mouth/Exit loops, and Shaft-wall faces. The Hole and plane reference each other
through stable ids, so selection highlights compiler-published consumers and
descendants rather than tessellation-derived cylinders.
+
+`construction-plane-blind-drillpoint` adds the corresponding blind evidence:
+the shaft envelope, shaft-to-DrillPoint circle, analytic cone envelope, and
+Tip marker come from `LocalFrameHoleBRepPlan`/`ConeSurface` metadata. Selecting
+the DrillPoint entity follows only its cone-face and Tip descendants; Cadmata
+does not infer a cone from display tessellation.
diff --git a/docs/firmament/composed-host-blind-drill-x1.md b/docs/firmament/composed-host-blind-drill-x1.md
new file mode 100644
index 00000000..028cdad2
--- /dev/null
+++ b/docs/firmament/composed-host-blind-drill-x1.md
@@ -0,0 +1,9 @@
+# COMPOSED-HOST-BLIND-DRILL-X1 corridor evidence
+
+A transverse blind Hole is validated as a complete cylindrical-and-conical tool corridor, not as a centerline or an XY disk. For a world-X drilling axis, each world-Z host section receives the exact Y chord `sqrt(r² - (z-z0)²)`; world-Y uses the corresponding X chord. The proof consults the normalized line/arc `PrismaticSectionRegion` already owned by `PrismaticSectionStackConstruction`.
+
+`TransverseBlindDrillToolCorridor` decomposes the tool support at normalized slab boundaries. It proves each shaft chord envelope against the complete XY region—not merely its corners—by checking outer/inner loop classification, analytic line/arc intersection with all rectangle edges, and boundary extrema lying inside the corridor. The DrillPoint uses a conservative analytic enclosing rectangle per stable slab: it encloses the exact shrinking cone slice, so a successful proof is sound; a rejected conservative case is not repaired or approximated.
+
+This is deliberately only the proof substrate. The existing composed-host emitter only owns vertical, Z-prismatic side faces. It has no plan entities for a transverse cylinder/cone, host-side face replacement, circular mouth insertion, or non-prismatic cavity seam. Likewise, current Profile/Compose source and V2 construction-plane Hole source remain separate front ends. Therefore no source-to-host bridge, shell integration, STEP, M8, semantic descendants, inspection packet, or RemainingWall value is claimed by this evidence addition.
+
+Host planning partitions may divide topology. They must not divide the semantic Hole or create internal caps. The source declares a Blind DrillPoint. The compiler either proves that complete feature or rejects it.
diff --git a/docs/firmament/composed-host-hole-contracts-x5.md b/docs/firmament/composed-host-hole-contracts-x5.md
new file mode 100644
index 00000000..a41e9bbf
--- /dev/null
+++ b/docs/firmament/composed-host-hole-contracts-x5.md
@@ -0,0 +1,17 @@
+# Composed-host Hole contracts (X5 foundation)
+
+Hole end conditions are authored mechanical contracts. The compiler proves them; it does not reinterpret them.
+
+Host traversal describes material reality. It never chooses whether a Hole is Blind or ThroughAll.
+
+The production Construction Plane Box lane records immutable `HoleHostTraversalEvidence`: world mouth and axis, radius, ordered local material intervals, source provenance, footprint support, and an explicit traversal classification. The Box proof is analytic: a signed-permutation frame transforms the exact Box bounds, then verifies the complete circular mouth footprint against the local rectangle. It does not sample meshes, rays, or bounding boxes.
+
+`ThroughAll` requires one contiguous material span entered at local zero and produces a Mouth, Exit, and shaft-wall descendants. `ShaftDepth` or `TotalDepth` with `Termination: DrillPoint` derives the cone tip length from the included angle, requires the tip strictly before the far material boundary, and records `RemainingWall = hostEnd - totalDepth`. A breach is `BlindHoleBreakthrough`; it is not converted to ThroughAll and the DrillPoint is not trimmed.
+
+`aetheris inspect-selections <source> --json` includes a `holeContract` packet with declared condition and termination, depths, traversal classification and intervals, physical material span, remaining wall, end-condition facts, and contract diagnostics. The local-frame BRep plan owns this evidence beside its topology correspondence.
+
+## Current admitted scope
+
+This foundation is currently wired to the signed-permutation Construction Plane **Box** host route. The profile/Compose section-stack emitter already owns exact line/arc slab geometry, but it is not yet connected to the local-frame Hole materializer. A transverse Hole through a changing section stack needs a plan-owned multi-slab subtraction/topology route; treating its slab bounds as one Box would be an invalid proof. Consequently composed profile hosts are still rejected rather than guessed, and there are not yet composed-host Hole fixtures, STEP proofs, Cadmata interval rendering, or runtime `Require RemainingWall` guards.
+
+The next implementation step is to derive `HoleHostTraversalEvidence` from `PrismaticSectionStackConstruction` with exact circle-vs-line/arc footprint containment per slab, classify partitions versus actual gaps, then build the corresponding multi-partition Hole BRep plan before enabling that source lane.
diff --git a/docs/firmament/local-frame-drillpoint-x4.md b/docs/firmament/local-frame-drillpoint-x4.md
new file mode 100644
index 00000000..68a67c56
--- /dev/null
+++ b/docs/firmament/local-frame-drillpoint-x4.md
@@ -0,0 +1,23 @@
+# LOCAL-FRAME-DRILLPOINT-X4
+
+Construction Plane shaft holes now admit exact blind drilling on the existing Box and signed-permutation-frame lane:
+
+```firmament
+Hole<Shaft> SideBlind {
+ From: PositiveXWorkplane
+ Center: Point2(10mm, 6mm)
+ Diameter: 8mm
+ End: ShaftDepth(30mm)
+ Termination: DrillPoint
+}
+```
+
+`End: ShaftDepth(value)` ends at the circular shaft-to-DrillPoint transition. `End: TotalDepth(value)` ends at the Tip. Both forms require `Termination: DrillPoint`; `ThroughAll` cannot be combined with a DrillPoint. The compiler-owned default included point angle is `118deg`; override it with `Termination: DrillPoint { PointAngle: 100deg }`.
+
+A blind drilled Hole terminates in a conical DrillPoint, not a flat cylinder cap. For radius `r` and included angle `theta`, `TipLength = r / tan(theta / 2)`. Thus `TotalDepth = ShaftDepth + TipLength`.
+
+The authoritative `LocalFrameHoleBRepPlan` owns the mouth loop, cylindrical shaft wall, transition loop, analytic `ConeSurface`, singular Tip vertex, DirectedEdgeUse loops, face senses, and semantic correspondence. The materializer only consumes those planned entities. The inner cylinder and cone faces use `SameSense = false`, so their support normals are oriented into the removed volume; the Plan's two-arc periodic boundary convention gives closed mouth and transition selections.
+
+Published source roles are `MouthLoop`, `MouthEdges`, `ShaftWallFaces`, `ShaftToDrillPointLoop`, `ShaftToDrillPointEdges`, `DrillPointFaces`, and `TipVertex`. `aetheris inspect-selections <source> --json` shows declared and derived depth, point angle, local/world mouth, host interval, cone evidence, and those selections.
+
+Current restrictions remain deliberate: one simple Box host, a proper signed-permutation Construction Plane, local `+Z` drilling into a single contiguous host interval, and one round shaft. A future composed-host extension replaces only the Box local-interval query; the Hole AIR, local frame, depth convention, and plan-owned shaft/cone topology remain unchanged.
diff --git a/docs/firmament/section-stack-hole-traversal-x1.md b/docs/firmament/section-stack-hole-traversal-x1.md
new file mode 100644
index 00000000..f44af778
--- /dev/null
+++ b/docs/firmament/section-stack-hole-traversal-x1.md
@@ -0,0 +1,15 @@
+# SECTION-STACK-HOLE-TRAVERSAL-X1 evidence foundation
+
+`PrismaticSectionStackConstruction` remains the sole composed-host model. Its normalized `PrismaticSectionSlab` holds the arrangement-derived material `PrismaticSectionRegion`, active Compose operations, and source provenance. Hole traversal consumes that model; it does not rebuild profiles or infer material from Cadmata or tessellation.
+
+The new evidence records a planner partition for every relevant normalized slab, exact line/arc disk-containment classification, transition events, and separately collapsed physical material spans. Section-stack partitions are planning boundaries, not automatically material boundaries. Adjacent supported partitions become one physical span only when their local-axis bounds meet exactly; an unsupported partition or interval gap is never merged.
+
+For the presently admitted axial signed-permutation mapping, a construction-plane local `+Z` axis is world `+Z` or `-Z`; the footprint is therefore a disk in the stack's native XY section. The disk proof classifies the centre using `ProfileArrangement2D` and takes the exact minimum distance to every bounded line or circular-arc boundary of the outer loop and inner void loops. Tangency is explicit; it is not accepted as containment. This rejects a centreline that fits while its circular footprint crosses an outer boundary or void.
+
+The strict Hole end-condition contract now also consumes typed mouth diagnostics: a mouth inside material, a mouth miss, or a direction that begins in air cannot be repaired by relocating the feature.
+
+## Deliberate boundary
+
+Transverse `+X/+Y` planes are diagnosed and rejected by this foundation. A transverse shaft has a YZ/XZ footprint across section Z transitions, not an XY disk. Reusing the Box interval or pretending that footprint were an XY disk would claim an invalid proof. The current source front-ends are also disjoint: composition input cannot carry the V2 construction-plane semantic-hole AST, while the V2 hole materializer admits Box hosts only.
+
+Consequently this change supplies the authoritative host-evidence and contract substrate, but does not yet materialize partitioned cylinder/cone topology, STEP, inspection packets, or Cadmata artifacts for composed transverse holes. Those require the next bounded implementation to add the actual transverse footprint sweep and a shared composition/V2 lowering bridge while preserving `LocalFrameHoleBRepPlan` ownership.
diff --git a/fixtures/FirmamentV2/Hole/valid/construction-plane-blind-drillpoint-angle-override.firmament b/fixtures/FirmamentV2/Hole/valid/construction-plane-blind-drillpoint-angle-override.firmament
new file mode 100644
index 00000000..4d4c0db7
--- /dev/null
+++ b/fixtures/FirmamentV2/Hole/valid/construction-plane-blind-drillpoint-angle-override.firmament
@@ -0,0 +1,16 @@
+Concept Struct SideLayout {
+ PositiveYDatum: Plane { Origin: [0mm, -30mm, 0mm]; Normal: [0, 1, 0]; Up: [0, 0, 1] }
+}
+Construction Plane PositiveYWorkplane { Trace: SideLayout.PositiveYDatum }
+Struct SideBlindBracket {
+ Box Base { Size: [100mm, 60mm, 40mm] }
+ Modify Base {
+ Hole<Shaft> SideBlindOverride {
+ From: PositiveYWorkplane
+ Center: Point2(10mm, 6mm)
+ Diameter: 8mm
+ End: ShaftDepth(20mm)
+ Termination: DrillPoint { PointAngle: 100deg }
+ }
+ }
+}
diff --git a/fixtures/FirmamentV2/Hole/valid/construction-plane-blind-drillpoint-shaft-depth.firmament b/fixtures/FirmamentV2/Hole/valid/construction-plane-blind-drillpoint-shaft-depth.firmament
new file mode 100644
index 00000000..51a1c404
--- /dev/null
+++ b/fixtures/FirmamentV2/Hole/valid/construction-plane-blind-drillpoint-shaft-depth.firmament
@@ -0,0 +1,19 @@
+// LOCAL-FRAME-DRILLPOINT-X4: exact +X blind drilled shaft with the compiler 118deg point.
+Concept Struct SideLayout {
+ PositiveXDatum: Plane { Origin: [-50mm, 0mm, 0mm]; Normal: [1, 0, 0]; Up: [0, 0, 1] }
+}
+
+Construction Plane PositiveXWorkplane { Trace: SideLayout.PositiveXDatum }
+
+Struct SideBlindBracket {
+ Box Base { Size: [100mm, 60mm, 40mm] }
+ Modify Base {
+ Hole<Shaft> SideBlind {
+ From: PositiveXWorkplane
+ Center: Point2(10mm, 6mm)
+ Diameter: 8mm
+ End: ShaftDepth(30mm)
+ Termination: DrillPoint
+ }
+ }
+}
diff --git a/fixtures/FirmamentV2/Hole/valid/construction-plane-blind-drillpoint-total-depth.firmament b/fixtures/FirmamentV2/Hole/valid/construction-plane-blind-drillpoint-total-depth.firmament
new file mode 100644
index 00000000..7d872069
--- /dev/null
+++ b/fixtures/FirmamentV2/Hole/valid/construction-plane-blind-drillpoint-total-depth.firmament
@@ -0,0 +1,16 @@
+Concept Struct SideLayout {
+ NegativeXDatum: Plane { Origin: [50mm, 0mm, 0mm]; Normal: [-1, 0, 0]; Up: [0, 0, 1] }
+}
+Construction Plane NegativeXWorkplane { Trace: SideLayout.NegativeXDatum }
+Struct SideBlindBracket {
+ Box Base { Size: [100mm, 60mm, 40mm] }
+ Modify Base {
+ Hole<Shaft> SideBlindTotal {
+ From: NegativeXWorkplane
+ Center: Point2(10mm, 6mm)
+ Diameter: 8mm
+ End: TotalDepth(32.4mm)
+ Termination: DrillPoint
+ }
+ }
+}