Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Add Firmament V2 reverse-X side-hole route

Yuechen Li443d6b637462
diff --git a/Aetheris.CLI.Tests/AirTraceCommandTests.cs b/Aetheris.CLI.Tests/AirTraceCommandTests.cs
index 4500e616..7afe16dd 100644
--- a/Aetheris.CLI.Tests/AirTraceCommandTests.cs
+++ b/Aetheris.CLI.Tests/AirTraceCommandTests.cs
@@ -1252,6 +1252,49 @@ public sealed class AirTraceCommandTests
Assert.Contains("STEP smoke: Succeeded", output);
}
+
+ [Fact]
+ public void FirmamentV2SideHoleReverseX_TraceJsonContainsRouteEvidence()
+ {
+ var (exitCode, output, _) = Run("trace", "--fixture", FirmamentV2Fixture("Region/valid/side-hole-reverse-x-v2.valid.firmfixture"), "--json");
+ Assert.Equal(0, exitCode);
+ using var doc = JsonDocument.Parse(output);
+ var intent = doc.RootElement.GetProperty("firmamentV2").GetProperty("semanticIntent");
+ Assert.Equal("-X->+X", intent.GetProperty("route").GetString());
+ Assert.Equal("-X", intent.GetProperty("attachFace").GetString());
+ Assert.Equal("+X", intent.GetProperty("throughFace").GetString());
+ Assert.Equal("face(-X):u=+Y,v=+Z", intent.GetProperty("centerSelectorFrame").GetString());
+ }
+
+ [Fact]
+ public void FirmamentV2SideHoleReverseX_TraceTextContainsRouteEvidence()
+ {
+ var (exitCode, output, _) = Run("trace", "--fixture", FirmamentV2Fixture("Region/valid/side-hole-reverse-x-v2.valid.firmfixture"));
+ Assert.Equal(0, exitCode);
+ Assert.Contains("On: face(-X)", output);
+ Assert.Contains("Through: face(+X)", output);
+ Assert.Contains("Route: -X -> +X", output);
+ Assert.Contains("Center frame: face(-X) local u=+Y, v=+Z", output);
+ }
+
+ [Fact]
+ public void FirmamentV2SideHoleReverseX_ArtifactsEmit()
+ {
+ var dir = Path.Combine(Path.GetTempPath(), "aetheris-trace-tests", Guid.NewGuid().ToString("N"));
+ Assert.Equal(0, Run("trace", "--fixture", FirmamentV2Fixture("Region/valid/side-hole-reverse-x-v2.valid.firmfixture"), "--out-dir", dir).ExitCode);
+ foreach (var name in new[] { "side-hole-reverse-x-v2.step", "side-hole-reverse-x-v2.trace.json", "side-hole-reverse-x-v2.trace.txt", "manifest.json" })
+ {
+ var path = Path.Combine(dir, name);
+ Assert.True(File.Exists(path), path);
+ Assert.True(new FileInfo(path).Length > 0, path);
+ }
+ using var manifest = JsonDocument.Parse(File.ReadAllText(Path.Combine(dir, "manifest.json")));
+ var route = manifest.RootElement.GetProperty("route");
+ Assert.Equal("-X->+X", route.GetProperty("direction").GetString());
+ Assert.Equal("-X", route.GetProperty("attachFace").GetString());
+ Assert.Equal("+X", route.GetProperty("throughFace").GetString());
+ }
+
private static string Fixture(string relative) => Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "../../../../fixtures/Firmament/Chamfer", relative));
private static string PrimitiveFixture(string relative) => Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "../../../../fixtures/Firmament/Primitive", relative));
private static string RegionFixture(string relative) => Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "../../../../fixtures/Firmament/Region", relative));
diff --git a/Aetheris.CLI/AirTrace.cs b/Aetheris.CLI/AirTrace.cs
index d105d199..dcf6f294 100644
--- a/Aetheris.CLI/AirTrace.cs
+++ b/Aetheris.CLI/AirTrace.cs
@@ -363,7 +363,7 @@ internal static class AirTraceTextRenderer
b.AppendLine($" Radius: {region.Radius:g}");
var cu = region.Center?.U ?? 0; var cv = region.Center?.V ?? 0;
b.AppendLine($" Center: [{cu:g}, {cv:g}]");
- b.AppendLine($" Center frame: face(+X) local u=+Y, v=+Z");
+ b.AppendLine($" Center frame: {((region.ResolvedOn.Contains("-X", StringComparison.Ordinal) ? "face(-X):u=+Y,v=+Z" : "face(+X):u=+Y,v=+Z").Replace(":u=", " local u=").Replace(",v=", ", v="))}");
b.AppendLine($" Through: {region.Through}");
if (!string.Equals(region.Through, region.ResolvedThrough, StringComparison.Ordinal)) b.AppendLine($" Resolved through: {region.ResolvedThrough}");
}
@@ -374,6 +374,7 @@ internal static class AirTraceTextRenderer
b.AppendLine();
b.AppendLine(" Lowering:");
b.AppendLine(" Semantic intent: SideHole");
+ b.AppendLine($" Route: {r.FirmamentV2.SemanticIntent.AttachFace} -> {r.FirmamentV2.SemanticIntent.ThroughFace}");
if (r.FirmamentV2.SemanticIntent.AttachTargetKind == "Alias") b.AppendLine($" Attach alias: {r.FirmamentV2.SemanticIntent.AttachTargetSource} -> face({r.FirmamentV2.SemanticIntent.AttachFace})");
if (r.FirmamentV2.SemanticIntent.ThroughTargetKind == "Alias") b.AppendLine($" Through alias: {r.FirmamentV2.SemanticIntent.ThroughTargetSource} -> face({r.FirmamentV2.SemanticIntent.ThroughFace})");
b.AppendLine($" AIR Region: {(r.Regions is null ? "not-reached" : "FaceAttachedRegion golden trace chain")}");
diff --git a/Aetheris.CLI/CliRunner.cs b/Aetheris.CLI/CliRunner.cs
index d1d5e9d9..e83965d8 100644
--- a/Aetheris.CLI/CliRunner.cs
+++ b/Aetheris.CLI/CliRunner.cs
@@ -35,6 +35,7 @@ internal static class SideHoleGoldenPathArtifacts
parentIntegration = report.FirmamentV2?.ParentIntegration ?? "Integrated",
shellClosure = report.FirmamentV2?.ShellClosure ?? "Closed",
stepSmoke = report.FirmamentV2?.StepSmoke ?? "Succeeded",
+ route = report.FirmamentV2?.SemanticIntent is null ? null : new { axis = "X", direction = report.FirmamentV2.SemanticIntent.Route, attachFace = report.FirmamentV2.SemanticIntent.AttachFace, throughFace = report.FirmamentV2.SemanticIntent.ThroughFace },
radius = report.FirmamentV2?.SemanticIntent?.Radius,
tool = report.FirmamentV2?.SemanticIntent?.Tool,
attachTargetSource = report.FirmamentV2?.SemanticIntent?.AttachTargetSource,
@@ -59,6 +60,8 @@ internal static class SideHoleGoldenPathArtifacts
var radius = report.FirmamentV2!.SemanticIntent!.Radius;
var centerU = report.FirmamentV2!.SemanticIntent!.CenterU;
var centerV = report.FirmamentV2!.SemanticIntent!.CenterV;
+ if (report.FirmamentV2!.SemanticIntent!.Route == "-X->+X" && (report.FirmamentV2!.SemanticIntent!.AttachTargetKind == "Alias" || report.FirmamentV2!.SemanticIntent!.ThroughTargetKind == "Alias")) return "side-hole-aliases-reverse-x-v2";
+ if (report.FirmamentV2!.SemanticIntent!.Route == "-X->+X") return "side-hole-reverse-x-v2";
if (report.FirmamentV2!.SemanticIntent!.AttachTargetKind == "Alias" || report.FirmamentV2!.SemanticIntent!.ThroughTargetKind == "Alias") return "side-hole-aliases-v2";
if (Math.Abs(centerU) > 1e-12 || Math.Abs(centerV) > 1e-12)
{
@@ -82,7 +85,7 @@ internal static class SideHoleGoldenPathArtifacts
"/* stage=region-parent-integrated; parentIntegration=Integrated; shellClosure=Closed; stepSmoke=Succeeded */\n" +
"/* materialized: CutEntryLoop, CutExitLoop, CutWallFace, RegionIntegrationPatchConsumed */\n" +
"/* cylindrical cut wall evidence; CIR analysis-only; Boolean unused/not generally admitted */\n" +
- $"#1=PRODUCT('{(IsFirmamentV2SideHole(report) ? "AIR-FIRMAMENT-X7-SIDE-HOLE-V2" : "AIR-REGION-X13-SIDE-HOLE")}','controlled side-hole golden path','generated-on-demand fixture artifact',());\n" +
+ $"#1=PRODUCT('{(IsFirmamentV2SideHole(report) ? "AIR-FIRMAMENT-X9-SIDE-HOLE-V2" : "AIR-REGION-X13-SIDE-HOLE")}','controlled side-hole golden path','generated-on-demand fixture artifact',());\n" +
"ENDSEC;\nEND-ISO-10303-21;\n";
}
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentV2ParserTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentV2ParserTests.cs
index d795b3ef..3f8fcb9a 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentV2ParserTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentV2ParserTests.cs
@@ -350,6 +350,68 @@ public sealed class FirmamentV2ParserTests
}
+ [Fact]
+ public void FirmamentV2SideHoleReverseX_ParsesDirectReverseRoute()
+ {
+ var intent = FirmamentV2Parser.Parse(Source("Region/valid/side-hole-reverse-x-v2.valid.firmfixture")).Document!.SideHoleIntent!;
+ Assert.Equal("face(-X)", intent.AttachTargetSource);
+ Assert.Equal("DirectSelector", intent.AttachTargetKind);
+ Assert.Equal("-X", intent.AttachFace);
+ Assert.Equal("face(+X)", intent.ThroughTargetSource);
+ Assert.Equal("DirectSelector", intent.ThroughTargetKind);
+ Assert.Equal("+X", intent.ThroughFace);
+ Assert.Equal("-X->+X", intent.Route);
+ Assert.Equal("face(-X):u=+Y,v=+Z", intent.CenterSelectorFrame);
+ }
+
+ [Fact]
+ public void FirmamentV2SideHoleReverseX_DirectReachesGoldenPath()
+ {
+ var result = FirmamentFrontendTraceProbe.ParseV2Only(Source("Region/valid/side-hole-reverse-x-v2.valid.firmfixture"));
+ Assert.True(result.ParseSucceeded, string.Join(", ", result.Diagnostics));
+ Assert.Equal("region-parent-integrated", result.FirmamentV2!.StageReached);
+ Assert.Equal("Integrated", result.FirmamentV2.ParentIntegration);
+ Assert.Equal("Closed", result.FirmamentV2.ShellClosure);
+ Assert.Equal("Succeeded", result.FirmamentV2.StepSmoke);
+ Assert.Null(result.FirmamentV2.Blocker);
+ }
+
+ [Fact]
+ public void FirmamentV2SideHoleReverseX_ParsesAliasReverseRoute()
+ {
+ var doc = FirmamentV2Parser.Parse(Source("Region/valid/side-hole-aliases-reverse-x-v2.valid.firmfixture")).Document!;
+ Assert.Contains(doc.Solid.Box.Exposures, e => e.Alias == "left" && e.Selector == "face(-X)");
+ Assert.Contains(doc.Solid.Box.Exposures, e => e.Alias == "right" && e.Selector == "face(+X)");
+ var region = Assert.Single(Assert.Single(doc.ModifyBlocks!).Regions);
+ Assert.Equal("left", region.Attachment.Source);
+ Assert.Equal("face(-X)", region.Attachment.ResolvedSelector);
+ Assert.Equal("right", region.Cut.Tool.Through.Source);
+ Assert.Equal("face(+X)", region.Cut.Tool.Through.ResolvedSelector);
+ Assert.Equal("-X->+X", doc.SideHoleIntent!.Route);
+ }
+
+ [Fact]
+ public void FirmamentV2SideHoleReverseX_AliasReachesGoldenPath()
+ {
+ var result = FirmamentFrontendTraceProbe.ParseV2Only(Source("Region/valid/side-hole-aliases-reverse-x-v2.valid.firmfixture"));
+ Assert.True(result.ParseSucceeded, string.Join(", ", result.Diagnostics));
+ Assert.Equal("region-parent-integrated", result.FirmamentV2!.StageReached);
+ Assert.Equal("Integrated", result.FirmamentV2.ParentIntegration);
+ Assert.Equal("Closed", result.FirmamentV2.ShellClosure);
+ Assert.Equal("Succeeded", result.FirmamentV2.StepSmoke);
+ Assert.Null(result.FirmamentV2.Blocker);
+ }
+
+ [Fact]
+ public void FirmamentV2SideHoleReverseX_InvalidRoutesRejected()
+ {
+ Assert.Contains(FirmamentV2Parser.SideHoleSameFaceUnsupported, FirmamentV2Parser.Parse(Source("Region/invalid/side-hole-same-face-x-v2.invalid.firmfixture")).Diagnostics);
+ Assert.Contains(FirmamentV2Parser.SideHoleRouteUnsupported, FirmamentV2Parser.Parse(Source("Region/invalid/side-hole-mixed-axis-x-to-y-v2.invalid.firmfixture")).Diagnostics);
+ Assert.Contains(FirmamentV2Parser.SideHoleAxisNotYetSupported, FirmamentV2Parser.Parse(Source("Region/invalid/side-hole-y-axis-not-yet-supported-v2.invalid.firmfixture")).Diagnostics);
+ Assert.Contains(FirmamentV2Parser.SideHoleRouteUnsupported, FirmamentV2Parser.Parse(Source("Region/invalid/side-hole-alias-reverse-x-wrong-through-v2.invalid.firmfixture")).Diagnostics);
+ }
+
+
[Fact]
public void FirmamentV2SideHoleAliases_ParsesExposeAndAliasTargets()
{
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs
index 7363371a..143d4aec 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs
@@ -3,7 +3,7 @@ namespace Aetheris.Kernel.Firmament.FirmamentV2;
public sealed record FirmamentV2Document(string ModelName, string Units, IReadOnlyList<FirmamentV2SolidBinding> Solids, IReadOnlyList<FirmamentV2ModifyBlock>? ModifyBlocks = null)
{
public FirmamentV2SolidBinding Solid => Solids[^1];
- public FirmamentV2SideHoleIntent? SideHoleIntent => ModifyBlocks?.SelectMany(m => m.Regions.Select(r => new FirmamentV2SideHoleIntent(m.TargetSolid, r.Name, r.Attachment.Source, r.Attachment.Kind, r.Attachment.Axis, r.Cut.Tool.Through.Source, r.Cut.Tool.Through.Kind, r.Cut.Tool.Through.Axis, r.Cut.Tool.ToolType, r.Cut.Tool.Radius, r.Cut.Tool.Center?.U ?? 0, r.Cut.Tool.Center?.V ?? 0, r.Cut.Tool.Center is not null, r.Cut.Tool.Center?.Convention ?? FirmamentV2FaceLocalPoint2D.PlusXConvention, Units))).SingleOrDefault();
+ public FirmamentV2SideHoleIntent? SideHoleIntent => ModifyBlocks?.SelectMany(m => m.Regions.Select(r => new FirmamentV2SideHoleIntent(m.TargetSolid, r.Name, r.Attachment.Source, r.Attachment.Kind, r.Attachment.Axis, r.Cut.Tool.Through.Source, r.Cut.Tool.Through.Kind, r.Cut.Tool.Through.Axis, r.Cut.Tool.ToolType, r.Cut.Tool.Radius, r.Cut.Tool.Center?.U ?? 0, r.Cut.Tool.Center?.V ?? 0, r.Cut.Tool.Center is not null, FirmamentV2FaceLocalPoint2D.ConventionFor(r.Attachment.Axis), Units))).SingleOrDefault();
}
public sealed record FirmamentV2SolidBinding(string Name, string RecordType, FirmamentV2BoxRecord Box, string? DerivedFrom = null, IReadOnlyDictionary<string, IReadOnlyList<double>>? Overrides = null)
@@ -30,8 +30,15 @@ public sealed record FirmamentV2CylinderTool(string ToolType, double Radius, Fir
public sealed record FirmamentV2FaceLocalPoint2D(double U, double V, string Convention)
{
public const string PlusXConvention = "face(+X):u=+Y,v=+Z";
+ public const string MinusXConvention = "face(-X):u=+Y,v=+Z";
+ public static string ConventionFor(string attachFace) => attachFace == "-X" ? MinusXConvention : PlusXConvention;
}
-public sealed record FirmamentV2SideHoleIntent(string TargetSolid, string RegionName, string AttachTargetSource, string AttachTargetKind, string AttachFace, string ThroughTargetSource, string ThroughTargetKind, string ThroughFace, string Tool, double Radius, double CenterU, double CenterV, bool CenterExplicit, string CenterSelectorFrame, string Units);
+public sealed record FirmamentV2SideHoleIntent(string TargetSolid, string RegionName, string AttachTargetSource, string AttachTargetKind, string AttachFace, string ThroughTargetSource, string ThroughTargetKind, string ThroughFace, string Tool, double Radius, double CenterU, double CenterV, bool CenterExplicit, string CenterSelectorFrame, string Units)
+{
+ public string Route => $"{AttachFace}->{ThroughFace}";
+ public FirmamentV2SideHoleRouteEvidence RouteEvidence => new("X", Route, AttachFace, ThroughFace);
+}
+public sealed record FirmamentV2SideHoleRouteEvidence(string Axis, string Direction, string AttachFace, string ThroughFace);
public sealed record FirmamentV2ParseResult(bool IsSuccess, FirmamentV2Document? Document, IReadOnlyList<string> Diagnostics)
{
public static FirmamentV2ParseResult Success(FirmamentV2Document document, IReadOnlyList<string> diagnostics) => new(true, document, diagnostics);
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs
index 68722e75..7697b82b 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs
@@ -45,6 +45,9 @@ public static class FirmamentV2Parser
public const string SideHoleAliasMustResolveToFace = "firmament-v2-side-hole-alias-must-resolve-to-face";
public const string SideHoleAliasResolvesToUnsupportedFace = "firmament-v2-side-hole-alias-resolves-to-unsupported-face";
public const string SideHoleOnlyPlusXMinusXSupported = "firmament-v2-side-hole-only-plus-x-minus-x-supported";
+ public const string SideHoleRouteUnsupported = "firmament-v2-side-hole-route-unsupported";
+ public const string SideHoleSameFaceUnsupported = "firmament-v2-side-hole-same-face-unsupported";
+ public const string SideHoleAxisNotYetSupported = "firmament-v2-side-hole-axis-not-yet-supported";
public const string SideHoleRadiusExceedsClearance = "firmament-v2-side-hole-radius-exceeds-clearance";
public const string CylinderRadiusNotFinite = "firmament-v2-side-hole-radius-not-finite";
public const string CylinderCenterInvalid = "firmament-v2-cylinder-center-invalid";
@@ -144,7 +147,7 @@ public static class FirmamentV2Parser
return new(name, "Box", new(values, []), baseName, new Dictionary<string, IReadOnlyList<double>>(StringComparer.Ordinal) { ["size"] = values });
}
- private static bool IsFatalDiagnostic(string code) => code is MissingModel or MissingUnits or MissingSolid or UnsupportedConstruct or UnknownRecordType or BoxMissingSize or BoxSizeArity or DegenerateDimension or NameUnresolved or DuplicateName or WithRequiresRecord or WithRequiresBoxRecord or WithFieldNotFound or WithFieldTypeMismatch or WithForwardReference or WithDerivedRecordInvalid or ExposeBlockUnsupported or ExposeRequiresBoxRecord or ExposeAliasDuplicate or ExposeAliasInvalid or SelectorUnsupported or SelectorAxisInvalid or SelectorSubselectorUnsupported or FatArrowOutsideExpose or RawBackendIdReferenceForbidden or ModifyTargetUnresolved or ModifyTargetNotSolid or RegionUnsupported or RegionAttachmentSelectorUnsupported or CutUnsupported or CutToolUnsupported or CylinderRadiusMissing or CylinderRadiusInvalid or CylinderRadiusNotFinite or ThroughSelectorUnsupported or AliasUnresolved or AliasRefTypeUnsupported or SideHoleAliasMustResolveToFace or SideHoleAliasResolvesToUnsupportedFace or SideHoleOnlyPlusXMinusXSupported or SideHoleRadiusExceedsClearance or CylinderCenterInvalid or CylinderCenterArityInvalid or CylinderCenterNotFinite or SideHoleCenterExceedsClearance;
+ private static bool IsFatalDiagnostic(string code) => code is MissingModel or MissingUnits or MissingSolid or UnsupportedConstruct or UnknownRecordType or BoxMissingSize or BoxSizeArity or DegenerateDimension or NameUnresolved or DuplicateName or WithRequiresRecord or WithRequiresBoxRecord or WithFieldNotFound or WithFieldTypeMismatch or WithForwardReference or WithDerivedRecordInvalid or ExposeBlockUnsupported or ExposeRequiresBoxRecord or ExposeAliasDuplicate or ExposeAliasInvalid or SelectorUnsupported or SelectorAxisInvalid or SelectorSubselectorUnsupported or FatArrowOutsideExpose or RawBackendIdReferenceForbidden or ModifyTargetUnresolved or ModifyTargetNotSolid or RegionUnsupported or RegionAttachmentSelectorUnsupported or CutUnsupported or CutToolUnsupported or CylinderRadiusMissing or CylinderRadiusInvalid or CylinderRadiusNotFinite or ThroughSelectorUnsupported or AliasUnresolved or AliasRefTypeUnsupported or SideHoleAliasMustResolveToFace or SideHoleAliasResolvesToUnsupportedFace or SideHoleOnlyPlusXMinusXSupported or SideHoleRouteUnsupported or SideHoleSameFaceUnsupported or SideHoleAxisNotYetSupported or SideHoleRadiusExceedsClearance or CylinderCenterInvalid or CylinderCenterArityInvalid or CylinderCenterNotFinite or SideHoleCenterExceedsClearance;
private static IReadOnlyList<FirmamentV2Exposure> ParseExposures(string body, List<string> diagnostics)
{
@@ -234,9 +237,17 @@ public static class FirmamentV2Parser
if (close < 0) { diagnostics.Add(RegionUnsupported); return null; }
var cut = ParseCut(body[(open + 1)..close], solid, diagnostics);
if (attach is null || cut is null) return null;
- if (attach.Kind == "Alias" && attach.Axis != "+X") diagnostics.Add(SideHoleAliasResolvesToUnsupportedFace);
- if (cut.Tool.Through.Kind == "Alias" && cut.Tool.Through.Axis != "-X") diagnostics.Add(SideHoleAliasResolvesToUnsupportedFace);
- if (attach.Axis != "+X" || cut.Tool.Through.Axis != "-X") diagnostics.Add(SideHoleOnlyPlusXMinusXSupported);
+ var supportedCanonical = attach.Axis == "+X" && cut.Tool.Through.Axis == "-X";
+ var supportedReverseX = attach.Axis == "-X" && cut.Tool.Through.Axis == "+X";
+ if (!supportedCanonical && !supportedReverseX)
+ {
+ if (attach.Axis == cut.Tool.Through.Axis) diagnostics.Add(SideHoleSameFaceUnsupported);
+ else if (AxisName(attach.Axis) != AxisName(cut.Tool.Through.Axis)) diagnostics.Add(SideHoleRouteUnsupported);
+ else if (AxisName(attach.Axis) is "Y" or "Z") diagnostics.Add(SideHoleAxisNotYetSupported);
+ else diagnostics.Add(SideHoleRouteUnsupported);
+ if (attach.Kind == "Alias" || cut.Tool.Through.Kind == "Alias") diagnostics.Add(SideHoleAliasResolvesToUnsupportedFace);
+ diagnostics.Add(SideHoleOnlyPlusXMinusXSupported);
+ }
var yHalfExtent = solid.Box.Size[1] / 2.0;
var zHalfExtent = solid.Box.Size[2] / 2.0;
if (cut.Tool.Radius >= Math.Min(yHalfExtent, zHalfExtent)) diagnostics.Add(SideHoleRadiusExceedsClearance);
@@ -279,6 +290,8 @@ public static class FirmamentV2Parser
return new FirmamentV2FaceLocalPoint2D(u, v, FirmamentV2FaceLocalPoint2D.PlusXConvention);
}
+ private static string AxisName(string faceAxis) => faceAxis.Length == 2 ? faceAxis[1].ToString() : string.Empty;
+
private static FirmamentV2FaceSelector? ParseFaceSelector(string selector, string diagnostic, List<string> diagnostics)
{
var face = FaceSelectorRegex.Match(selector);
diff --git a/docs/air-firmament-a1-firmament-fixture-corpus.md b/docs/air-firmament-a1-firmament-fixture-corpus.md
index dd7fd03a..052c4c18 100644
--- a/docs/air-firmament-a1-firmament-fixture-corpus.md
+++ b/docs/air-firmament-a1-firmament-fixture-corpus.md
@@ -195,3 +195,8 @@ The Firmament V2 region corpus now includes controlled valid side-hole radius va
## AIR-FIRMAMENT-X7 fixture taxonomy update
X7 adds controlled Firmament V2 Region side-hole center-offset fixtures under `fixtures/FirmamentV2/Region/valid` and matching clearance/arity invalid fixtures under `fixtures/FirmamentV2/Region/invalid`. These remain parser-backed controlled Region fixtures, not broad corpus migration or general side-hole support.
+
+
+## AIR-FIRMAMENT-X9 fixture taxonomy note
+
+The Firmament V2 region fixture set now includes controlled reverse-X side-hole valid fixtures (`side-hole-reverse-x-v2`, `side-hole-aliases-reverse-x-v2`) and invalid route fixtures for same-face, mixed-axis, Y-axis-not-yet-supported, and alias wrong-through cases.
diff --git a/docs/air-firmament-x9-v2-side-hole-reverse-x.md b/docs/air-firmament-x9-v2-side-hole-reverse-x.md
new file mode 100644
index 00000000..e5fca074
--- /dev/null
+++ b/docs/air-firmament-x9-v2-side-hole-reverse-x.md
@@ -0,0 +1,105 @@
+# AIR-FIRMAMENT-X9 — controlled V2 side-hole reverse-X face-pair variation
+
+## Purpose and scope
+
+X9 extends the parser-backed Firmament V2 side-hole path from the canonical `face(+X) -> face(-X)` route to the controlled reverse route `face(-X) -> face(+X)`. This milestone proves the side-hole semantic intent and golden trace path are not hardcoded to attach only to `+X`.
+
+## Relationship to X4-X8
+
+- X4 introduced direct-selector V2 side-hole syntax for `+X -> -X`.
+- X5 locked generated artifacts and parity for the canonical V2 route.
+- X6 added radius variation.
+- X7 added face-local center offsets.
+- X8 added semantic alias targets for attach and through faces.
+- X9 keeps those paths intact and adds only the controlled reverse-X pair.
+
+## Supported route set
+
+- `+X -> -X`
+- `-X -> +X`
+
+## Unsupported routes
+
+Y-axis, Z-axis, mixed-axis, and same-face routes remain unsupported. Blind holes and arbitrary face pairs are not admitted.
+
+## Source syntax examples
+
+Direct reverse-X:
+
+```firmament
+region sideHole on face(-X) {
+ cut Cylinder {
+ radius: 1
+ center: [1, 0]
+ through: face(+X)
+ }
+}
+```
+
+Alias reverse-X:
+
+```firmament
+expose {
+ face(-X) => left
+ face(+X) => right
+}
+
+modify base {
+ region sideHole on left {
+ cut Cylinder {
+ radius: 1
+ center: [1, 0]
+ through: right
+ }
+ }
+}
+```
+
+## Face-local coordinate convention
+
+- `face(+X)`: `u=+Y`, `v=+Z`.
+- `face(-X)`: `u=+Y`, `v=+Z`.
+
+For a `[10, 8, 6]` box, clearance remains strict: `abs(u) + radius < 4` and `abs(v) + radius < 3`.
+
+## Route admissibility
+
+The parser admits only opposite X-face routes in either direction. Same-face, mixed-axis, Y-axis, Z-axis, unknown aliases, aliases resolving to non-face refs, and aliases resolving to unsupported faces are rejected with stable diagnostics.
+
+## Trace JSON/text route evidence
+
+Trace JSON preserves attach and through target sources, target kinds, resolved faces, route direction (`+X->-X` or `-X->+X`), radius, center, and center frame. Trace text prints the original target, alias resolution when applicable, route direction, and the face-local center frame.
+
+## Artifact/manifest behavior
+
+Reverse-X fixtures emit STEP, trace JSON, trace text, and manifest artifacts using reverse-X stems. Manifest data includes route direction, attach face, through face, target source facts, resolved selectors, radius, center, center frame, `controlledFixtureOnly=true`, and `generalSideHoleSupport=false`.
+
+## Valid and invalid fixtures
+
+Valid fixtures added:
+
+- `fixtures/FirmamentV2/Region/valid/side-hole-reverse-x-v2.valid.firmfixture`
+- `fixtures/FirmamentV2/Region/valid/side-hole-aliases-reverse-x-v2.valid.firmfixture`
+
+Invalid fixtures added:
+
+- `fixtures/FirmamentV2/Region/invalid/side-hole-same-face-x-v2.invalid.firmfixture`
+- `fixtures/FirmamentV2/Region/invalid/side-hole-mixed-axis-x-to-y-v2.invalid.firmfixture`
+- `fixtures/FirmamentV2/Region/invalid/side-hole-y-axis-not-yet-supported-v2.invalid.firmfixture`
+- `fixtures/FirmamentV2/Region/invalid/side-hole-alias-reverse-x-wrong-through-v2.invalid.firmfixture`
+
+## What this proves
+
+The parser-backed side-hole lowering path is not hardcoded to attach `+X` only; both direct and alias reverse-X fixtures reach the controlled golden trace path.
+
+## What this does not prove
+
+X9 does not add arbitrary face-pair support, Y/Z axes, arbitrary local frames beyond controlled X faces, blind holes, generic Boolean admission, CIR topology authority, shell/fillet/chamfer/surfacing/pattern/material/FEA features, templates/concepts/PMI/where parsing, STEP PMI export, STEP importer behavior changes, or production route replacement.
+
+## Tests run
+
+Use the active suite and targeted parser/CLI tests for reverse-X, aliases, radius, center offsets, artifacts, traces, and invalid diagnostics.
+
+## Next milestone recommendation
+
+AIR-FIRMAMENT-X10 — controlled V2 side-hole Y-axis face-pair variation. X10 must define `face(+Y)` and `face(-Y)` local frames before implementation; a possible policy is `u=+X`, `v=+Z` for both Y faces.
diff --git a/fixtures/FirmamentV2/Region/invalid/side-hole-alias-reverse-x-wrong-through-v2.invalid.firmfixture b/fixtures/FirmamentV2/Region/invalid/side-hole-alias-reverse-x-wrong-through-v2.invalid.firmfixture
new file mode 100644
index 00000000..3d84175b
--- /dev/null
+++ b/fixtures/FirmamentV2/Region/invalid/side-hole-alias-reverse-x-wrong-through-v2.invalid.firmfixture
@@ -0,0 +1,19 @@
+// fixture-id: side-hole-alias-reverse-x-wrong-through-v2
+// case: firmament-v2-side-hole-alias-reverse-x-wrong-through-invalid
+// category: Region
+// syntax-version: FirmamentV2
+// validity: invalid
+// implementation: parser-backed
+// expected: invalid
+// expected-stage: parsed
+// expected-diagnostic: firmament-v2-side-hole-route-unsupported
+
+model SideHoleAliasReverseWrongThroughV2 {
+ units mm
+ solid base: Box {
+ size: [10, 8, 6]
+ expose { face(-X) => left
+ face(+Y) => front }
+ }
+ modify base { region sideHole on left { cut Cylinder { radius: 1 through: front } } }
+}
diff --git a/fixtures/FirmamentV2/Region/invalid/side-hole-mixed-axis-x-to-y-v2.invalid.firmfixture b/fixtures/FirmamentV2/Region/invalid/side-hole-mixed-axis-x-to-y-v2.invalid.firmfixture
new file mode 100644
index 00000000..1d4270c0
--- /dev/null
+++ b/fixtures/FirmamentV2/Region/invalid/side-hole-mixed-axis-x-to-y-v2.invalid.firmfixture
@@ -0,0 +1,15 @@
+// fixture-id: side-hole-mixed-axis-x-to-y-v2
+// case: firmament-v2-side-hole-mixed-axis-invalid
+// category: Region
+// syntax-version: FirmamentV2
+// validity: invalid
+// implementation: parser-backed
+// expected: invalid
+// expected-stage: parsed
+// expected-diagnostic: firmament-v2-side-hole-route-unsupported
+
+model SideHoleMixedAxisV2 {
+ units mm
+ solid base: Box { size: [10, 8, 6] }
+ modify base { region sideHole on face(-X) { cut Cylinder { radius: 1 through: face(+Y) } } }
+}
diff --git a/fixtures/FirmamentV2/Region/invalid/side-hole-same-face-x-v2.invalid.firmfixture b/fixtures/FirmamentV2/Region/invalid/side-hole-same-face-x-v2.invalid.firmfixture
new file mode 100644
index 00000000..37e255b2
--- /dev/null
+++ b/fixtures/FirmamentV2/Region/invalid/side-hole-same-face-x-v2.invalid.firmfixture
@@ -0,0 +1,15 @@
+// fixture-id: side-hole-same-face-x-v2
+// case: firmament-v2-side-hole-same-face-x-invalid
+// category: Region
+// syntax-version: FirmamentV2
+// validity: invalid
+// implementation: parser-backed
+// expected: invalid
+// expected-stage: parsed
+// expected-diagnostic: firmament-v2-side-hole-same-face-unsupported
+
+model SideHoleSameFaceXV2 {
+ units mm
+ solid base: Box { size: [10, 8, 6] }
+ modify base { region sideHole on face(-X) { cut Cylinder { radius: 1 through: face(-X) } } }
+}
diff --git a/fixtures/FirmamentV2/Region/invalid/side-hole-y-axis-not-yet-supported-v2.invalid.firmfixture b/fixtures/FirmamentV2/Region/invalid/side-hole-y-axis-not-yet-supported-v2.invalid.firmfixture
new file mode 100644
index 00000000..b2024da6
--- /dev/null
+++ b/fixtures/FirmamentV2/Region/invalid/side-hole-y-axis-not-yet-supported-v2.invalid.firmfixture
@@ -0,0 +1,15 @@
+// fixture-id: side-hole-y-axis-not-yet-supported-v2
+// case: firmament-v2-side-hole-y-axis-not-yet-supported-invalid
+// category: Region
+// syntax-version: FirmamentV2
+// validity: invalid
+// implementation: parser-backed
+// expected: invalid
+// expected-stage: parsed
+// expected-diagnostic: firmament-v2-side-hole-axis-not-yet-supported
+
+model SideHoleYAxisNotYetSupportedV2 {
+ units mm
+ solid base: Box { size: [10, 8, 6] }
+ modify base { region sideHole on face(+Y) { cut Cylinder { radius: 1 through: face(-Y) } } }
+}
diff --git a/fixtures/FirmamentV2/Region/valid/side-hole-aliases-reverse-x-v2.valid.firmfixture b/fixtures/FirmamentV2/Region/valid/side-hole-aliases-reverse-x-v2.valid.firmfixture
new file mode 100644
index 00000000..123c9db5
--- /dev/null
+++ b/fixtures/FirmamentV2/Region/valid/side-hole-aliases-reverse-x-v2.valid.firmfixture
@@ -0,0 +1,35 @@
+// fixture-id: side-hole-aliases-reverse-x-v2
+// case: firmament-v2-side-hole-aliases-reverse-x-design
+// category: Region
+// syntax-version: FirmamentV2
+// validity: valid
+// implementation: parser-backed
+// expected: valid
+// expected-stage: region-parent-integrated
+// expected-parent-integration: Integrated
+// expected-shell-closure: Closed
+// expected-step-smoke: Succeeded
+// expected-feature: sideHole
+
+model SideHoleAliasReverseXV2 {
+ units mm
+
+ solid base: Box {
+ size: [10, 8, 6]
+
+ expose {
+ face(-X) => left
+ face(+X) => right
+ }
+ }
+
+ modify base {
+ region sideHole on left {
+ cut Cylinder {
+ radius: 1
+ center: [1, 0]
+ through: right
+ }
+ }
+ }
+}
diff --git a/fixtures/FirmamentV2/Region/valid/side-hole-reverse-x-v2.valid.firmfixture b/fixtures/FirmamentV2/Region/valid/side-hole-reverse-x-v2.valid.firmfixture
new file mode 100644
index 00000000..19d5fbd5
--- /dev/null
+++ b/fixtures/FirmamentV2/Region/valid/side-hole-reverse-x-v2.valid.firmfixture
@@ -0,0 +1,30 @@
+// fixture-id: side-hole-reverse-x-v2
+// case: firmament-v2-side-hole-reverse-x-design
+// category: Region
+// syntax-version: FirmamentV2
+// validity: valid
+// implementation: parser-backed
+// expected: valid
+// expected-stage: region-parent-integrated
+// expected-parent-integration: Integrated
+// expected-shell-closure: Closed
+// expected-step-smoke: Succeeded
+// expected-feature: sideHole
+
+model SideHoleReverseXV2 {
+ units mm
+
+ solid base: Box {
+ size: [10, 8, 6]
+ }
+
+ modify base {
+ region sideHole on face(-X) {
+ cut Cylinder {
+ radius: 1
+ center: [1, 0]
+ through: face(+X)
+ }
+ }
+ }
+}