Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Expose engineering feature inventory in build output

Yuechen Li78f62a4e8ca7
diff --git a/Aetheris.CLI.Tests/PublicDocumentationQualificationTests.cs b/Aetheris.CLI.Tests/PublicDocumentationQualificationTests.cs
index f5a09752..5fd58e17 100644
--- a/Aetheris.CLI.Tests/PublicDocumentationQualificationTests.cs
+++ b/Aetheris.CLI.Tests/PublicDocumentationQualificationTests.cs
@@ -45,6 +45,30 @@ public sealed class PublicDocumentationQualificationTests
Assert.Equal(diameters, report.RootElement.GetProperty("pmiExportEvidence").GetProperty("diameter").GetArrayLength());
}
+ [Fact]
+ public void PublicBossPocketWitness_BuildsWithTruthfulFeatureInventory_AndReimportsEnclosed()
+ {
+ using var temp = TempDirectory.Create();
+ var output = new StringWriter(); var error = new StringWriter();
+ var source = Path.Combine(RepoRoot, "fixtures/FirmamentV2/Canonical/valid/boss-pocket-mounting-block.firmament");
+ var step = Path.Combine(temp.Path, "boss-pocket.step");
+ Assert.Equal(0, CliRunner.Run(["build", source, "--output", step, "--json"], output, error));
+ Assert.Empty(error.ToString());
+ using (var build = JsonDocument.Parse(output.ToString()))
+ {
+ Assert.Equal(3, build.RootElement.GetProperty("featureCount").GetInt32());
+ Assert.Equal("Hole<Shaft>", build.RootElement.GetProperty("features")[0].GetProperty("kind").GetString());
+ Assert.Equal(["Boss", "Pocket"], build.RootElement.GetProperty("engineeringFeatures").EnumerateArray().Select(item => item.GetProperty("kind").GetString()!).Order().ToArray());
+ }
+ output.GetStringBuilder().Clear();
+ Assert.Equal(0, CliRunner.Run(["analyze", step, "--json"], output, error));
+ using var analysis = JsonDocument.Parse(output.ToString());
+ var summary = analysis.RootElement.GetProperty("summary");
+ Assert.Equal("enclosed-manifold", summary.GetProperty("structuralAssessment").GetString());
+ Assert.Equal(1, summary.GetProperty("bodyCount").GetInt32());
+ Assert.Equal(32, summary.GetProperty("faceCount").GetInt32());
+ }
+
[Theory]
[InlineData("fixtures/FirmamentV2/SheetMetal/preview3-l-bracket-hole.firmament")]
[InlineData("fixtures/FirmamentV2/PublicDogfood/ai-sheet-metal.firmament")]
diff --git a/Aetheris.CLI/CliRunner.cs b/Aetheris.CLI/CliRunner.cs
index 4e520204..38b4546c 100644
--- a/Aetheris.CLI/CliRunner.cs
+++ b/Aetheris.CLI/CliRunner.cs
@@ -456,6 +456,8 @@ public static class CliRunner
standardPart = build.Value.Export.StandardPart,
assertions = build.Value.Export.Assertions,
features = build.Value.Export.Features,
+ engineeringFeatures = build.Value.Export.EngineeringFeatures,
+ featureCount = (build.Value.Export.Features?.Count ?? 0) + (build.Value.Export.EngineeringFeatures?.Count ?? 0),
inlineStepMigration = build.Value.Export.InlineStepMigration,
inlineStepReplacementAssist = build.Value.Export.InlineStepReplacementAssist,
diagnostics = build.Diagnostics.Select(d => new { d.Source, d.Message, severity = d.Severity.ToString() }),
@@ -959,13 +961,21 @@ Model CanonicalPanel {
var parse = FirmamentV2Parser.Parse(source, Path.GetDirectoryName(fullPath));
var document = parse.Document;
var success = parse.IsSuccess && document is not null;
- var features = document?.ModifyBlocks?.SelectMany(block =>
+ var features = (document?.ModifyBlocks?.SelectMany(block =>
block.SemanticHoles.Select(hole => $"Hole<{hole.Variant}> {hole.Name}")
- .Concat((block.EdgeFinishes ?? []).Select(finish => $"{finish.Kind} {finish.Name}"))) ?? [];
+ .Concat((block.EdgeFinishes ?? []).Select(finish => $"{finish.Kind} {finish.Name}"))) ?? [])
+ .Concat((document?.Bosses ?? []).Select(feature => $"Boss {feature.Name}"))
+ .Concat((document?.Pockets ?? []).Select(feature => $"Pocket {feature.Name}"))
+ .ToList();
var semanticValues = FirmamentSemanticValues.FromProfilesAndConceptPaths(source, fullPath).ToList();
if (PrismaticProfileCompositionParser.IsCompositionSource(source))
{
var composition = PrismaticProfileCompositionParser.Parse(source);
+ if (composition.Feature is { } compositionFeature)
+ {
+ features.AddRange((compositionFeature.ShaftHoles ?? []).Select(feature => $"Hole<Shaft> {feature.Name}"));
+ features.AddRange((compositionFeature.CounterboreHoles ?? []).Select(feature => $"Hole<Counterbore> {feature.Name}"));
+ }
semanticValues.AddRange(composition.Profiles.Values.OrderBy(profile => profile.Name, StringComparer.Ordinal).Select(profile =>
FirmamentSemanticValues.FromProfile(profile, SemanticSourceSpan.Generated(fullPath),
[new("firmament-profile", profile.Name, "named Profile normalized before consumer")])));
@@ -1408,6 +1418,8 @@ Model CanonicalPanel {
operations = stack.Feature.Operations.Select(x => new { x.Name, intent = x.Intent.ToString(), profile = x.ProfileReference, x.From, x.To, x.SemanticRole, x.SourceSpan, x.SemanticFeatureId, x.SemanticFeatureKind, x.Diameter, signature = Hash($"{x.Intent}|{x.ProfileReference}|{x.From:R}|{x.To:R}|{x.SemanticRole}|{x.SemanticFeatureId}|{x.Diameter:R}") }),
shaftHoles = (stack.Feature.ShaftHoles ?? []).Select(x => new { x.Name, x.StableId, profile = x.ProfileReference, center = new[] { x.CenterX, x.CenterY }, x.Diameter, x.From, x.To, endCondition = "ThroughAll", x.SemanticRole, x.SourceSpan }),
counterboreHoles = (stack.Feature.CounterboreHoles ?? []).Select(x => new { x.Name, x.StableId, shaftProfile = x.ShaftProfileReference, counterboreProfile = x.CounterboreProfileReference, center = new[] { x.CenterX, x.CenterY }, x.Diameter, x.CounterboreDiameter, x.CounterboreDepth, x.From, x.To, endCondition = "ThroughAll", x.SemanticRole, x.SourceSpan }),
+ bosses = (stack.Feature.Bosses ?? []).Select(x => new { x.Name, x.StableId, host = x.Host, on = x.SupportFace, profile = x.ProfileReference, x.Height, x.From, x.To, materialEffect = "Add", lowering = "PrismaticSectionStack/Add" }),
+ pockets = (stack.Feature.Pockets ?? []).Select(x => new { x.Name, x.StableId, host = x.Host, on = x.SupportFace, profile = x.ProfileReference, x.Depth, x.HostThickness, x.RemainingFloor, x.MinimumFloorThickness, x.MinimumFloorPolicySource, x.From, x.To, materialEffect = "Remove", lowering = "PrismaticSectionStack/Remove" }),
capsuleSlots = (stack.Feature.CapsuleSlots ?? []).Select(x => new { x.Name, x.StableId, kind = "Slot<Capsule>", profile = x.ProfileReference, center = new[] { x.CenterX, x.CenterY }, direction = new[] { x.DirectionX, x.DirectionY }, x.Length, x.Width, radius = x.Radius, straightSpan = x.StraightSpan, endCenters = new[] { new[] { x.CenterX - x.DirectionX * x.StraightSpan / 2d, x.CenterY - x.DirectionY * x.StraightSpan / 2d }, new[] { x.CenterX + x.DirectionX * x.StraightSpan / 2d, x.CenterY + x.DirectionY * x.StraightSpan / 2d } }, x.From, x.To, x.Extent, x.SemanticRole, x.SourceSpan, segments = parsed.Profiles[x.ProfileReference].Loops.Single().Segments.Select(s => s.Name) }),
roundedRectangleSlots = (stack.Feature.RoundedRectangleSlots ?? []).Select(x => new { x.Name, x.StableId, kind = "Slot<RoundedRectangle>", profile = x.ProfileReference, center = new[] { x.CenterX, x.CenterY }, direction = new[] { x.DirectionX, x.DirectionY }, x.Length, x.Width, x.CornerRadius, x.From, x.To, x.Extent, x.SemanticRole, x.SourceSpan, segments = parsed.Profiles[x.ProfileReference].Loops.Single().Segments.Select(s => s.Name) }),
criticalLevels = stack.Feature.CriticalLevels,
diff --git a/Aetheris.Kernel.Firmament.Tests/BossPocketSemanticFeatureTests.cs b/Aetheris.Kernel.Firmament.Tests/BossPocketSemanticFeatureTests.cs
new file mode 100644
index 00000000..56ac5083
--- /dev/null
+++ b/Aetheris.Kernel.Firmament.Tests/BossPocketSemanticFeatureTests.cs
@@ -0,0 +1,173 @@
+using Aetheris.Kernel.Core.Brep.Verification;
+using Aetheris.Kernel.Core.Step242;
+using Aetheris.Kernel.Firmament.FirmamentV2;
+using Aetheris.Kernel.Firmament.Materializer;
+
+namespace Aetheris.Kernel.Firmament.Tests;
+
+public sealed class BossPocketSemanticFeatureTests
+{
+ [Fact]
+ public void PracticalBossPocketWitness_LowersThroughOneSectionStack_AndRoundTripsStep()
+ {
+ var parsed = PrismaticProfileCompositionParser.Parse(File.ReadAllText(Fixture("Canonical/valid/boss-pocket-mounting-block.firmament")));
+ Assert.Empty(parsed.Diagnostics);
+ var stack = Assert.IsType<PrismaticSectionStackConstruction>(PrismaticSectionStackCompiler.Normalize(parsed, out var diagnostics));
+ Assert.Empty(diagnostics);
+ var boss = Assert.Single(stack.Feature.Bosses!);
+ var pocket = Assert.Single(stack.Feature.Pockets!);
+ Assert.Equal("boss:Body.MountBoss", boss.StableId);
+ Assert.Equal(6d, boss.Height);
+ Assert.Equal("pocket:Body.ElectronicsRecess", pocket.StableId);
+ Assert.Equal(4d, pocket.Depth);
+ Assert.Equal(6d, pocket.RemainingFloor);
+ Assert.Equal(2d, pocket.MinimumFloorThickness);
+ Assert.Contains(stack.Feature.Operations, operation => operation.SemanticFeatureKind == "Boss" && operation.Intent == PrismaticProfileIntent.Add);
+ Assert.Contains(stack.Feature.Operations, operation => operation.SemanticFeatureKind == "Pocket" && operation.Intent == PrismaticProfileIntent.Remove);
+
+ var emitted = PrismaticSectionStackEmitter.Emit(stack);
+ Assert.NotNull(emitted.Body);
+ var mass = BrepMassProperties.Evaluate(emitted.Body!);
+ Assert.True(mass.IsEnclosed, string.Join("; ", mass.Diagnostics));
+ Assert.True(mass.IsOrientationConsistent, string.Join("; ", mass.Diagnostics));
+ var expectedVolume = 40d * 24d * 10d + Math.PI * 6d * 6d * 6d - 8d * 8d * 4d - Math.PI * 3d * 3d * 16d;
+ Assert.Equal(expectedVolume, stack.AnalyticVolume, 6);
+ var step = Step242Exporter.ExportBody(emitted.Body!);
+ Assert.True(step.IsSuccess, string.Join("; ", step.Diagnostics.Select(item => item.Message)));
+ var imported = Step242Importer.ImportBody(step.Value!);
+ Assert.True(imported.IsSuccess, string.Join("; ", imported.Diagnostics.Select(item => item.Message)));
+ var importedMass = BrepMassProperties.Evaluate(imported.Value!);
+ Assert.True(importedMass.IsEnclosed, string.Join("; ", importedMass.Diagnostics));
+ Assert.True(importedMass.IsOrientationConsistent, string.Join("; ", importedMass.Diagnostics));
+ }
+
+ [Fact]
+ public void PublicParserAndBuild_ReportFirstClassBossAndPocketIdentity()
+ {
+ var source = File.ReadAllText(Fixture("Canonical/valid/boss-pocket-mounting-block.firmament"));
+ var parse = FirmamentV2Parser.Parse(source);
+ Assert.True(parse.IsSuccess, string.Join("; ", parse.Diagnostics));
+ Assert.Equal("MountBoss", Assert.Single(parse.Document!.Bosses!).Name);
+ Assert.Equal("ElectronicsRecess", Assert.Single(parse.Document.Pockets!).Name);
+ Assert.Equal(FirmamentV2CanonicalSymbolKind.Boss, parse.Document.SymbolTable!.Resolve("MountBoss")!.Kind);
+ Assert.Equal(FirmamentV2CanonicalSymbolKind.Pocket, parse.Document.SymbolTable.Resolve("ElectronicsRecess")!.Kind);
+ var build = FirmamentBuildAndExport.CompileSource(source);
+ Assert.True(build.IsSuccess, string.Join("; ", build.Diagnostics.Select(item => item.Message)));
+ Assert.Collection(build.Value!.EngineeringFeatures!.OrderBy(item => item.Kind, StringComparer.Ordinal),
+ boss => { Assert.Equal("Boss", boss.Kind); Assert.Equal("PrismaticSectionStack/Add", boss.MaterializationRoute); },
+ pocket => { Assert.Equal("Pocket", pocket.Kind); Assert.Equal(6d, pocket.RemainingFloor); Assert.Equal("PrismaticSectionStack/Remove", pocket.MaterializationRoute); });
+ }
+
+ [Theory]
+ [InlineData("minimumFloorThickness", "7", "Template.minimumFloorThickness")]
+ [InlineData("minimumWallThickness", "7", "Template.minimumWallThickness")]
+ public void PocketMinimumFloor_UsesExistingTemplateConceptChannel(string concept, string value, string policy)
+ {
+ var source = File.ReadAllText(Fixture("Canonical/valid/boss-pocket-mounting-block.firmament"))
+ .Replace("; MinimumFloorThickness: 2mm", string.Empty, StringComparison.Ordinal)
+ .Replace(" Concept Struct Layout On XY", $" template<CNC> ShopDefault {{ concept {concept}: {value} mm }}\n\n Concept Struct Layout On XY", StringComparison.Ordinal);
+ var parsed = PrismaticProfileCompositionParser.Parse(source);
+ Assert.Null(parsed.Feature);
+ Assert.Contains(parsed.Diagnostics, diagnostic => diagnostic.StartsWith("firmament-pocket-minimum-floor-thickness:ElectronicsRecess", StringComparison.Ordinal) && diagnostic.Contains($"policy={policy}", StringComparison.Ordinal));
+ }
+
+ [Fact]
+ public void PocketTemplateFloorPolicy_ParticipatesInRealBuildPath()
+ {
+ var source = File.ReadAllText(Fixture("Canonical/valid/boss-pocket-mounting-block.firmament"))
+ .Replace("; MinimumFloorThickness: 2mm", string.Empty, StringComparison.Ordinal)
+ .Replace(" Concept Struct Layout On XY", " template<CNC> ShopDefault { concept minimumFloorThickness: 5 mm }\n\n Concept Struct Layout On XY", StringComparison.Ordinal);
+ var build = FirmamentBuildAndExport.CompileSource(source);
+ Assert.True(build.IsSuccess, string.Join("; ", build.Diagnostics.Select(item => item.Message)));
+ var pocket = Assert.Single(build.Value!.EngineeringFeatures!, item => item.Kind == "Pocket");
+ Assert.Equal(5d, pocket.MinimumFloorThickness);
+ Assert.Equal("Template.minimumFloorThickness", pocket.PolicySource);
+ }
+
+ [Fact]
+ public void BossPocketCounterboreCombination_BuildsAndReimports()
+ {
+ var source = File.ReadAllText(Fixture("Canonical/valid/boss-pocket-mounting-block.firmament"))
+ .Replace("Hole<Shaft> MountHole { On: +Z; Center: [-12mm, 0mm]; Diameter: 6mm; End: ThroughAll; Role: MountingHole }",
+ "Hole<Counterbore> MountHole { On: +Z; Center: [-12mm, 0mm]; Diameter: 6mm; CounterboreDiameter: 10mm; CounterboreDepth: 3mm; End: ThroughAll; Role: MountingHole }", StringComparison.Ordinal);
+ var build = FirmamentBuildAndExport.CompileSource(source);
+ Assert.True(build.IsSuccess, string.Join("; ", build.Diagnostics.Select(item => item.Message)));
+ var imported = Step242Importer.ImportBody(build.Value!.StepText);
+ Assert.True(imported.IsSuccess, string.Join("; ", imported.Diagnostics.Select(item => item.Message)));
+ Assert.True(BrepMassProperties.Evaluate(imported.Value!).IsEnclosed);
+ }
+
+ [Fact]
+ public void BossPocketEdgeFinishCombination_PreservesSemanticInventory_WhenAdmitted()
+ {
+ var source = File.ReadAllText(Fixture("Canonical/valid/boss-pocket-mounting-block.firmament"))
+ .Replace("Boss MountBoss { On: Top; Profile: BossProfile;", "Boss MountBoss { On: Top; Profile: RectBossProfile;", StringComparison.Ordinal);
+ source = AddBeforeModelClose(source,
+ " Modify Body { EdgeFinish BossTop { Target: RectBossProfile.Outer On: Top Kind: Chamfer Distance: 1mm } }\n");
+ var build = FirmamentBuildAndExport.CompileSource(source);
+ Assert.True(build.IsSuccess, string.Join("; ", build.Diagnostics.Select(item => item.Message)));
+ Assert.Equal(["Boss", "Pocket"], build.Value!.EngineeringFeatures!.Select(item => item.Kind).Order().ToArray());
+ var imported = Step242Importer.ImportBody(build.Value.StepText);
+ Assert.True(imported.IsSuccess, string.Join("; ", imported.Diagnostics.Select(item => item.Message)));
+ Assert.True(BrepMassProperties.Evaluate(imported.Value!).IsEnclosed);
+ }
+
+ [Theory]
+ [InlineData("9.5", "firmament-pocket-minimum-floor-thickness", "remainingFloor=0.5mm")]
+ [InlineData("10", "firmament-pocket-through-depth", "remainingFloor=0mm")]
+ [InlineData("11", "firmament-pocket-through-depth", "remainingFloor=-1mm")]
+ public void PocketFloorGuardrails_RejectWithEngineeringQuantities(string depth, string code, string quantity)
+ {
+ var source = File.ReadAllText(Fixture("Canonical/valid/boss-pocket-mounting-block.firmament"))
+ .Replace("Depth: 4mm", $"Depth: {depth}mm", StringComparison.Ordinal);
+ var parsed = PrismaticProfileCompositionParser.Parse(source);
+ Assert.Null(parsed.Feature);
+ Assert.Contains(parsed.Diagnostics, diagnostic => diagnostic.StartsWith(code + ":ElectronicsRecess", StringComparison.Ordinal) && diagnostic.Contains(quantity, StringComparison.Ordinal));
+ }
+
+ [Theory]
+ [InlineData("Height: 6mm", "Height: 0mm", "firmament-boss-height-must-be-positive")]
+ [InlineData("On: Top; Profile: BossProfile", "On: Bottom; Profile: BossProfile", "firmament-boss-invalid-target")]
+ [InlineData("On: Top; Profile: BossProfile", "On: Top; Profile: MissingProfile", "firmament-boss-invalid-profile")]
+ public void BossGuardrails_AreTyped(string before, string after, string code)
+ {
+ var source = File.ReadAllText(Fixture("Canonical/valid/boss-pocket-mounting-block.firmament")).Replace(before, after, StringComparison.Ordinal);
+ var parsed = PrismaticProfileCompositionParser.Parse(source);
+ Assert.Null(parsed.Feature);
+ Assert.Contains(parsed.Diagnostics, diagnostic => diagnostic.StartsWith(code + ":MountBoss", StringComparison.Ordinal));
+ }
+
+ [Theory]
+ [InlineData("[30mm, 0mm]", "disjoint")]
+ [InlineData("[25mm, 0mm]", "tangent")]
+ public void BossConnectivity_RejectsDisjointAndPointContact(string center, string _)
+ {
+ var source = File.ReadAllText(Fixture("Canonical/valid/boss-pocket-mounting-block.firmament"))
+ .Replace("Boss MountBoss { On: Top; Profile: BossProfile;", "Boss MountBoss { On: Top; Profile: RectBossProfile;", StringComparison.Ordinal)
+ .Replace("Rect2 BossPad { Center: [-12mm, 0mm]", $"Rect2 BossPad {{ Center: {center}", StringComparison.Ordinal);
+ var parsed = PrismaticProfileCompositionParser.Parse(source);
+ Assert.Null(parsed.Feature);
+ Assert.Contains(parsed.Diagnostics, diagnostic => diagnostic.StartsWith("firmament-boss-disconnected-from-host:MountBoss", StringComparison.Ordinal));
+ }
+
+ [Theory]
+ [InlineData("Depth: 4mm", "Depth: 0mm", "firmament-pocket-depth-must-be-positive")]
+ [InlineData("On: Top; Profile: PocketProfile", "On: Bottom; Profile: PocketProfile", "firmament-pocket-invalid-target")]
+ [InlineData("On: Top; Profile: PocketProfile", "On: Top; Profile: MissingProfile", "firmament-pocket-invalid-profile")]
+ [InlineData("MinimumFloorThickness: 2mm", "MinimumFloorThickness: 0mm", "firmament-pocket-minimum-floor-policy-invalid")]
+ public void PocketGuardrails_AreTyped(string before, string after, string code)
+ {
+ var source = File.ReadAllText(Fixture("Canonical/valid/boss-pocket-mounting-block.firmament")).Replace(before, after, StringComparison.Ordinal);
+ var parsed = PrismaticProfileCompositionParser.Parse(source);
+ Assert.Null(parsed.Feature);
+ Assert.Contains(parsed.Diagnostics, diagnostic => diagnostic.StartsWith(code + ":ElectronicsRecess", StringComparison.Ordinal));
+ }
+
+ private static string Fixture(string relative) => Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "../../../../fixtures/FirmamentV2", relative));
+
+ private static string AddBeforeModelClose(string source, string addition)
+ {
+ var close = source.LastIndexOf('}');
+ return source.Insert(close, addition);
+ }
+}
diff --git a/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs b/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs
index 880822a0..67eca174 100644
--- a/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs
@@ -221,7 +221,9 @@ public static class FirmamentBuildAndExport
if (!step.IsSuccess) return KernelResult<FirmamentStepExportResult>.Failure(step.Diagnostics);
return KernelResult<FirmamentStepExportResult>.Success(new FirmamentStepExportResult(step.Value, stack.Feature.Name, 0, "prismatic-section-stack", "line-arc-profile-composition",
DatumInspection: v2Parse.Document?.Pmi?.Where(p => p.Kind == FirmamentV2PmiKind.DatumPlane).Select(p => new FirmamentPmiInspectionDatum(p.Name, "planar", p.Target)).ToArray() ?? [],
- DimensionInspection: v2Parse.Document?.Pmi?.Where(p => p.Kind == FirmamentV2PmiKind.HoleDiameter).Select(p => new FirmamentPmiInspectionDimension("Diameter", p.Target, null, p.Value ?? 0d, "explicit-v2-record-pmi", p.Name)).ToArray() ?? []));
+ DimensionInspection: v2Parse.Document?.Pmi?.Where(p => p.Kind == FirmamentV2PmiKind.HoleDiameter).Select(p => new FirmamentPmiInspectionDimension("Diameter", p.Target, null, p.Value ?? 0d, "explicit-v2-record-pmi", p.Name)).ToArray() ?? [],
+ Features: CompositionHoleReports(stack.Feature),
+ EngineeringFeatures: EngineeringFeatureReports(stack.Feature)));
}
if (ProfileAuthoringParser.IsProfileSource(materializerSource))
{
@@ -529,7 +531,9 @@ public static class FirmamentBuildAndExport
if (!plannedReimport.IsSuccess || plannedReimport.Value is null || !FirmamentManifoldChecker.IsManifold(plannedReimport.Value)) return Fail("ProfileBoundaryChamferStepReimportFailed");
return KernelResult<FirmamentStepExportResult>.Success(new FirmamentStepExportResult(plannedStep.Value, target.StableId, 0, "composed-profile-boundary-chamfer-section-stack", "source-grounded-composed-profile-boundary-chamfer",
DatumInspection: canonicalDocument?.Pmi?.Where(p => p.Kind == FirmamentV2PmiKind.DatumPlane).Select(p => new FirmamentPmiInspectionDatum(p.Name, "planar", p.Target)).ToArray() ?? [],
- DimensionInspection: canonicalDocument?.Pmi?.Where(p => p.Kind == FirmamentV2PmiKind.HoleDiameter).Select(p => new FirmamentPmiInspectionDimension("Diameter", p.Target, null, p.Value ?? 0d, "explicit-v2-record-pmi", p.Name)).ToArray() ?? []));
+ DimensionInspection: canonicalDocument?.Pmi?.Where(p => p.Kind == FirmamentV2PmiKind.HoleDiameter).Select(p => new FirmamentPmiInspectionDimension("Diameter", p.Target, null, p.Value ?? 0d, "explicit-v2-record-pmi", p.Name)).ToArray() ?? [],
+ Features: CompositionHoleReports(stack.Feature),
+ EngineeringFeatures: EngineeringFeatureReports(stack.Feature)));
}
if (emitted.Body is null || emitted.Correspondence is null) return Fail("MissingCorrespondenceEvidence");
var composedCurves = stack.Slabs.MaxBy(s => s.To)!.Region.Outer.Loops.Single().Segments.Select(segment => segment.Geometry).ToArray();
@@ -1934,6 +1938,29 @@ public static class FirmamentBuildAndExport
_ => selector
};
+ private static IReadOnlyList<FirmamentEngineeringFeatureReport> EngineeringFeatureReports(PrismaticProfileCompositionFeature feature) =>
+ (feature.Bosses ?? []).Select(item => new FirmamentEngineeringFeatureReport(
+ item.Name, "Boss", item.StableId, item.Host, item.SupportFace, item.ProfileReference,
+ item.Height, "Height", "Add", MaterializationRoute: "PrismaticSectionStack/Add"))
+ .Concat((feature.Pockets ?? []).Select(item => new FirmamentEngineeringFeatureReport(
+ item.Name, "Pocket", item.StableId, item.Host, item.SupportFace, item.ProfileReference,
+ item.Depth, "Depth", "Remove", item.RemainingFloor, item.MinimumFloorThickness,
+ item.MinimumFloorPolicySource, "PrismaticSectionStack/Remove")))
+ .OrderBy(item => item.FeatureId, StringComparer.Ordinal)
+ .ToArray();
+
+ private static IReadOnlyList<FirmamentHoleFeatureReport> CompositionHoleReports(PrismaticProfileCompositionFeature feature) =>
+ (feature.ShaftHoles ?? []).Select(item => new FirmamentHoleFeatureReport(
+ item.Name, "Hole<Shaft>", item.StableId, item.Diameter, item.CenterX, item.CenterY,
+ null, "ProfileCompose.Center", null, null, "+Z", item.SourceSpan,
+ "PrismaticSectionStack/Remove", "SemanticShaftProfile", "ThroughAll"))
+ .Concat((feature.CounterboreHoles ?? []).Select(item => new FirmamentHoleFeatureReport(
+ item.Name, "Hole<Counterbore>", item.StableId, item.Diameter, item.CenterX, item.CenterY,
+ null, "ProfileCompose.Center", null, null, "+Z", item.SourceSpan,
+ "PrismaticSectionStack/Remove", "SemanticCounterboreProfiles", "ThroughAll")))
+ .OrderBy(item => item.FeatureId, StringComparer.Ordinal)
+ .ToArray();
+
private static KernelResult<FirmamentStepExportResult> SemanticHoleFailure(IEnumerable<string> diagnostics) =>
KernelResult<FirmamentStepExportResult>.Failure(diagnostics.Select(d => new Kernel.Core.Diagnostics.KernelDiagnostic(
Kernel.Core.Diagnostics.KernelDiagnosticCode.ValidationFailed,
diff --git a/Aetheris.Kernel.Firmament/FirmamentStepExportResult.cs b/Aetheris.Kernel.Firmament/FirmamentStepExportResult.cs
index f969328b..4b4d5f8b 100644
--- a/Aetheris.Kernel.Firmament/FirmamentStepExportResult.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentStepExportResult.cs
@@ -20,7 +20,24 @@ public sealed record FirmamentStepExportResult(
FirmamentStandaloneLatticeReport? Lattice = null,
FirmamentCombinedFeaturePlanReport? Combined = null,
IReadOnlyList<Aetheris.Kernel.Firmament.FirmamentV2.FirmamentV2VolumeAssertionResult>? Assertions = null,
- FirmamentStandardPartReport? StandardPart = null);
+ FirmamentStandardPartReport? StandardPart = null,
+ IReadOnlyList<FirmamentEngineeringFeatureReport>? EngineeringFeatures = null);
+
+/// <summary>Public semantic feature inventory; geometry implementation details are deliberately omitted.</summary>
+public sealed record FirmamentEngineeringFeatureReport(
+ string Name,
+ string Kind,
+ string FeatureId,
+ string Host,
+ string Support,
+ string Profile,
+ double Extent,
+ string ExtentKind,
+ string MaterialEffect,
+ double? RemainingFloor = null,
+ double? MinimumFloorThickness = null,
+ string? PolicySource = null,
+ string MaterializationRoute = "PrismaticSectionStack");
public sealed record FirmamentStandardPartReport(
string Family,
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/CanonicalSymbolTable.cs b/Aetheris.Kernel.Firmament/FirmamentV2/CanonicalSymbolTable.cs
index 44537567..817a3c90 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/CanonicalSymbolTable.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/CanonicalSymbolTable.cs
@@ -14,6 +14,8 @@ public enum FirmamentV2CanonicalSymbolKind
Require,
Profile,
Compose,
+ Boss,
+ Pocket,
Hole,
Slot,
Selection,
@@ -83,6 +85,8 @@ internal static class FirmamentV2CanonicalSymbolBinder
foreach (var profile in document.Profiles ?? []) Add(profile.Name, FirmamentV2CanonicalSymbolKind.Profile, profile.SourceSpan);
foreach (var compose in document.Composes ?? []) Add(compose.Name, FirmamentV2CanonicalSymbolKind.Compose, compose.SourceSpan);
+ foreach (var boss in document.Bosses ?? []) Add(boss.Name, FirmamentV2CanonicalSymbolKind.Boss, boss.SourceSpan);
+ foreach (var pocket in document.Pockets ?? []) Add(pocket.Name, FirmamentV2CanonicalSymbolKind.Pocket, pocket.SourceSpan);
var profileOrComposeNames = (document.Profiles ?? []).Select(profile => profile.Name).Concat((document.Composes ?? []).Select(compose => compose.Name)).ToHashSet(StringComparer.Ordinal);
foreach (var solid in document.Solids.Where(solid => !profileOrComposeNames.Contains(solid.Name))) Add(solid.Name, FirmamentV2CanonicalSymbolKind.Body, new(0, 0));
foreach (Match body in Regex.Matches(source, @"(?<!Concept\s)\bStruct\s+(?<name>[A-Za-z_]\w*)\s*\{", RegexOptions.CultureInvariant)) Add(body.Groups["name"].Value, FirmamentV2CanonicalSymbolKind.Body, new(body.Index, body.Length));
@@ -97,6 +101,16 @@ internal static class FirmamentV2CanonicalSymbolBinder
foreach (var selection in document.Selections ?? []) Add(selection.Name, FirmamentV2CanonicalSymbolKind.Selection, selection.SourceSpan);
var bindings = new List<FirmamentV2CanonicalSymbolBinding>();
+ foreach (var boss in document.Bosses ?? [])
+ {
+ if (byName.TryGetValue(boss.Host, out var host)) bindings.Add(new($"Boss:{boss.Name}", "Host", host.CanonicalId, boss.SourceSpan));
+ if (byName.TryGetValue(boss.Profile, out var profile)) bindings.Add(new($"Boss:{boss.Name}", "Profile", profile.CanonicalId, boss.SourceSpan));
+ }
+ foreach (var pocket in document.Pockets ?? [])
+ {
+ if (byName.TryGetValue(pocket.Host, out var host)) bindings.Add(new($"Pocket:{pocket.Name}", "Host", host.CanonicalId, pocket.SourceSpan));
+ if (byName.TryGetValue(pocket.Profile, out var profile)) bindings.Add(new($"Pocket:{pocket.Name}", "Profile", profile.CanonicalId, pocket.SourceSpan));
+ }
foreach (var selection in document.Selections ?? [])
{
var reference = ParseSelectionReference(selection.Source);
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs
index 614967e5..cd5af1c5 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Ast.cs
@@ -3,7 +3,7 @@ using Aetheris.Surfacing;
namespace Aetheris.Kernel.Firmament.FirmamentV2;
-public sealed record FirmamentV2Document(string ModelName, string Units, IReadOnlyList<FirmamentV2SolidBinding> Solids, IReadOnlyList<FirmamentV2ModifyBlock>? ModifyBlocks = null, IReadOnlyList<FirmamentV2TemplateDecl>? Templates = null, IReadOnlyList<FirmamentV2PmiDecl>? Pmi = null, IReadOnlyList<FirmamentV2RecognizedRegion>? RecognizedRegions = null, IReadOnlyList<FirmamentV2ReplacementDecl>? Replacements = null, IReadOnlyList<FirmamentV2LetDeclaration>? Lets = null, IReadOnlyList<FirmamentV2BoundLet>? BoundLets = null, IReadOnlyList<FirmamentV2LetRecordDeclaration>? LetRecords = null, IReadOnlyList<FirmamentV2BoundLetRecord>? BoundLetRecords = null, IReadOnlyList<FirmamentV2ManufacturingConceptDeclaration>? ManufacturingConcepts = null, IReadOnlyList<FirmamentV2FeatureConceptDeclaration>? FeatureConcepts = null, FirmamentV2PmiBlock? PmiBlock = null, FirmamentV2BoundPmiBlock? BoundPmi = null, ConceptIrDocument? ConceptIr = null, IReadOnlyList<FirmamentV2LatticeFillDecl>? LatticeFills = null, IReadOnlyList<FirmamentV2StandaloneLatticeFillDecl>? StandaloneLatticeFills = null, IReadOnlyList<FirmamentV2ProfileDecl>? Profiles = null, IReadOnlyList<FirmamentV2ComposeDecl>? Composes = null, IReadOnlyList<FirmamentV2SelectionDecl>? Selections = null, FirmamentV2StaticAuthoringDocument? StaticAuthoring = null, FirmamentV2CanonicalSymbolTable? SymbolTable = null, IReadOnlyList<FirmamentV2VolumeAssertion>? VolumeAssertions = null, IReadOnlyList<ConceptIrTemplateInstantiation>? TemplateInstantiations = null, IReadOnlyList<PanelIr>? Panels = null)
+public sealed record FirmamentV2Document(string ModelName, string Units, IReadOnlyList<FirmamentV2SolidBinding> Solids, IReadOnlyList<FirmamentV2ModifyBlock>? ModifyBlocks = null, IReadOnlyList<FirmamentV2TemplateDecl>? Templates = null, IReadOnlyList<FirmamentV2PmiDecl>? Pmi = null, IReadOnlyList<FirmamentV2RecognizedRegion>? RecognizedRegions = null, IReadOnlyList<FirmamentV2ReplacementDecl>? Replacements = null, IReadOnlyList<FirmamentV2LetDeclaration>? Lets = null, IReadOnlyList<FirmamentV2BoundLet>? BoundLets = null, IReadOnlyList<FirmamentV2LetRecordDeclaration>? LetRecords = null, IReadOnlyList<FirmamentV2BoundLetRecord>? BoundLetRecords = null, IReadOnlyList<FirmamentV2ManufacturingConceptDeclaration>? ManufacturingConcepts = null, IReadOnlyList<FirmamentV2FeatureConceptDeclaration>? FeatureConcepts = null, FirmamentV2PmiBlock? PmiBlock = null, FirmamentV2BoundPmiBlock? BoundPmi = null, ConceptIrDocument? ConceptIr = null, IReadOnlyList<FirmamentV2LatticeFillDecl>? LatticeFills = null, IReadOnlyList<FirmamentV2StandaloneLatticeFillDecl>? StandaloneLatticeFills = null, IReadOnlyList<FirmamentV2ProfileDecl>? Profiles = null, IReadOnlyList<FirmamentV2ComposeDecl>? Composes = null, IReadOnlyList<FirmamentV2SelectionDecl>? Selections = null, FirmamentV2StaticAuthoringDocument? StaticAuthoring = null, FirmamentV2CanonicalSymbolTable? SymbolTable = null, IReadOnlyList<FirmamentV2VolumeAssertion>? VolumeAssertions = null, IReadOnlyList<ConceptIrTemplateInstantiation>? TemplateInstantiations = null, IReadOnlyList<PanelIr>? Panels = null, IReadOnlyList<FirmamentV2BossDecl>? Bosses = null, IReadOnlyList<FirmamentV2PocketDecl>? Pockets = null)
{
public FirmamentV2SolidBinding Solid => Solids[^1];
public FirmamentV2SideHoleIntent? SideHoleIntent => ModifyBlocks?.SelectMany(m => m.Regions.Select(r =>
@@ -225,6 +225,8 @@ public sealed record FirmamentV2FillRegionDecl(string Name, IReadOnlyList<double
/// The materializers consume the same resolved profile/composition semantics regardless of source origin.</summary>
public sealed record FirmamentV2ProfileDecl(string Name, string Frame, double From, double To, FirmamentV2SourceSpan SourceSpan);
public sealed record FirmamentV2ComposeDecl(string Name, IReadOnlyList<string> Operations, FirmamentV2SourceSpan SourceSpan);
+public sealed record FirmamentV2BossDecl(string Name, string Host, string On, string Profile, double Height, string StableId, FirmamentV2SourceSpan SourceSpan);
+public sealed record FirmamentV2PocketDecl(string Name, string Host, string On, string Profile, double Depth, double HostThickness, double RemainingFloor, double MinimumFloorThickness, string MinimumFloorPolicySource, string StableId, FirmamentV2SourceSpan SourceSpan);
public sealed record FirmamentV2SelectionDecl(string Name, string Target, string Source, string Requirement, FirmamentV2SourceSpan SourceSpan);
/// <summary>Normalized, erased-before-materialization evidence for canonical static authoring.</summary>
public sealed record FirmamentV2StaticAuthoringDocument(IReadOnlyList<FirmamentV2RecordTypeDecl> RecordTypes, IReadOnlyList<FirmamentV2StaticArrayDecl> Arrays, IReadOnlyList<FirmamentV2CanonicalTemplateDecl> Templates, IReadOnlyList<FirmamentV2CanonicalPatternDecl> Patterns, IReadOnlyList<FirmamentV2RequireDecl> Requires, IReadOnlyList<FirmamentV2SemanticConstraint>? SemanticConstraints = null, IReadOnlyDictionary<string, FirmamentV2PmiProjection>? PmiProjections = null, IReadOnlyList<FirmamentV2StaticRecordDecl>? StaticRecords = null, IReadOnlyList<FirmamentV2StaticTableDecl>? Tables = null);
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs
index 5fe2f0ac..c29e1e2a 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentV2Parser.cs
@@ -901,8 +901,8 @@ public static class FirmamentV2Parser
var known = new HashSet<string>(StringComparer.Ordinal)
{
- "Box", "Cylinder", "RoundedBox", "Frustum", "StandardPart", "ExactCoaxialPart", "Concept", "Struct", "Construction", "Profile", "Compose", "EdgeFinish",
- "Record", "Static", "Template", "ProfileDelta", "Selection", "InlineStep", "Recognize", "Replace", "Pmi", "Modify", "Match", "Require", "Assert"
+ "Box", "Cylinder", "RoundedBox", "Frustum", "StandardPart", "ExactCoaxialPart", "Concept", "Struct", "Construction", "Profile", "Compose", "Boss", "Pocket", "EdgeFinish",
+ "Record", "Static", "Template", "template", "ProfileDelta", "Selection", "InlineStep", "Recognize", "Replace", "Pmi", "Modify", "Match", "Require", "Assert"
};
var compatibilityOnly = new HashSet<string>(StringComparer.Ordinal)
{
@@ -996,6 +996,9 @@ public static class FirmamentV2Parser
[new FirmamentV2SolidBinding(feature.Name, "Compose", new FirmamentV2AdvancedMaterialRecord("Compose"))],
Profiles: composition.Profiles.Values.Select(profile => new FirmamentV2ProfileDecl(profile.Name, profile.EffectiveConstructionPlane.StableId, profile.LocalStartDepth ?? 0d, profile.LocalEndDepth ?? 0d, new(0, 0))).ToArray(),
Composes: [new FirmamentV2ComposeDecl(feature.Name, feature.Operations.Select(operation => operation.Name).ToArray(), new(0, body.Length))],
+ Bosses: (feature.Bosses ?? []).Select(item => new FirmamentV2BossDecl(item.Name, item.Host, item.SupportFace, item.ProfileReference, item.Height, item.StableId, new(0, body.Length))).ToArray(),
+ Pockets: (feature.Pockets ?? []).Select(item => new FirmamentV2PocketDecl(item.Name, item.Host, item.SupportFace, item.ProfileReference, item.Depth, item.HostThickness, item.RemainingFloor, item.MinimumFloorThickness, item.MinimumFloorPolicySource, item.StableId, new(0, body.Length))).ToArray(),
+ Templates: ParseTemplates(body, diagnostics),
Pmi: compositionPmi,
PmiBlock: compositionPmiBlock,
BoundPmi: compositionBoundPmi,
diff --git a/Aetheris.Kernel.Firmament/Materializer/PrismaticProfileComposition.cs b/Aetheris.Kernel.Firmament/Materializer/PrismaticProfileComposition.cs
index 0bd80c07..84801fac 100644
--- a/Aetheris.Kernel.Firmament/Materializer/PrismaticProfileComposition.cs
+++ b/Aetheris.Kernel.Firmament/Materializer/PrismaticProfileComposition.cs
@@ -15,6 +15,15 @@ public sealed record PrismaticProfileOperation(
string Name, PrismaticProfileIntent Intent, string ProfileReference, double From, double To,
string SemanticRole, string SourceSpan, string? SemanticFeatureId = null, string? SemanticFeatureKind = null,
double? Diameter = null);
+/// <summary>First-class connected material addition lowered through the section-stack Add operation.</summary>
+public sealed record PrismaticBossFeature(
+ string Name, string StableId, string Host, string SupportFace, string ProfileReference,
+ double Height, double From, double To, string SourceSpan);
+/// <summary>First-class finite material removal lowered through the section-stack Remove operation.</summary>
+public sealed record PrismaticPocketFeature(
+ string Name, string StableId, string Host, string SupportFace, string ProfileReference,
+ double Depth, double HostThickness, double RemainingFloor, double MinimumFloorThickness,
+ string MinimumFloorPolicySource, double From, double To, string SourceSpan);
public sealed record PrismaticShaftHoleFeature(
string Name, string StableId, string ProfileReference, double CenterX, double CenterY, double Diameter,
double From, double To, string SemanticRole, string SourceSpan);
@@ -56,7 +65,9 @@ public sealed record PrismaticProfileCompositionFeature(
IReadOnlyList<PrismaticCapsuleSlotFeature>? CapsuleSlots = null,
IReadOnlyList<PrismaticRoundedRectangleSlotFeature>? RoundedRectangleSlots = null,
IReadOnlyList<PrismaticConstructionPlaneBlindDrillFeature>? ConstructionPlaneBlindDrills = null,
- IReadOnlyList<PrismaticCounterboreHoleFeature>? CounterboreHoles = null)
+ IReadOnlyList<PrismaticCounterboreHoleFeature>? CounterboreHoles = null,
+ IReadOnlyList<PrismaticBossFeature>? Bosses = null,
+ IReadOnlyList<PrismaticPocketFeature>? Pockets = null)
{
public IEnumerable<(string Name, string StableId, string ProfileReference)> AllSlotProfiles =>
(CapsuleSlots ?? []).Select(x => (x.Name, x.StableId, x.ProfileReference))
@@ -94,6 +105,14 @@ public static class PrismaticProfileCompositionParser
private static readonly Regex ModifyHead = new(@"\bModify\s+(?<target>\w+)\s*\{", RegexOptions.CultureInvariant);
private static readonly Regex Placement = new(@"\bPlacement\s+(?<n>\w+)\s*\{\s*Anchor\s*:\s*\[(?<x>[-+.\d]+)mm\s*,\s*(?<y>[-+.\d]+)mm\s*,\s*(?<z>[-+.\d]+)mm\]\s*;?\s*ProfilePlane\s*:\s*(?<plane>\w+)\s*;?\s*Axis\s*:\s*(?<axis>[+-][XYZ])\s*;?\s*ReferenceDirection\s*:\s*(?<reference>[+-][XYZ])", RegexOptions.Singleline | RegexOptions.CultureInvariant);
private static readonly Regex Operation = new(@"\b(?<intent>Base|Add|Remove)\s+(?<n>\w+)\s*\{\s*Profile\s*:\s*(?<profile>\w+)\s*;?\s*From\s*:\s*(?<from>[-+.\d]+)mm\s*;?\s*To\s*:\s*(?<to>[-+.\d]+)mm(?:\s*;?\s*Role\s*:\s*(?<role>\w+))?", RegexOptions.Singleline | RegexOptions.CultureInvariant);
+ private static readonly Regex BossHeader = new(@"\bBoss\s+(?<n>\w+)\s*\{", RegexOptions.CultureInvariant);
+ private static readonly Regex PocketHeader = new(@"\bPocket\s+(?<n>\w+)\s*\{", RegexOptions.CultureInvariant);
+ private static readonly Regex SemanticProfile = new(@"\bProfile\s*:\s*(?<profile>\w+)", RegexOptions.CultureInvariant);
+ private static readonly Regex SemanticSupport = new(@"\bOn\s*:\s*(?<face>\w+|[+-][XYZ])", RegexOptions.CultureInvariant);
+ private static readonly Regex BossHeight = new(@"\bHeight\s*:\s*(?<value>[-+.\d]+)mm", RegexOptions.CultureInvariant);
+ private static readonly Regex PocketDepth = new(@"\bDepth\s*:\s*(?<value>[-+.\d]+)mm", RegexOptions.CultureInvariant);
+ private static readonly Regex PocketMinimumFloor = new(@"\bMinimumFloorThickness\s*:\s*(?<value>[-+.\d]+)mm", RegexOptions.CultureInvariant);
+ private static readonly Regex TemplateMinimumFloor = new(@"\bconcept\s+(?<name>minimumFloorThickness|minimumWallThickness)\s*:\s*(?<value>[-+.\d]+)\s*mm", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
private static readonly Regex HoleHeader = new(@"\bHole\s*<\s*(?<variant>\w+)\s*>\s+(?<n>\w+)\s*\{", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
private static readonly Regex HoleCenter = new(@"\bCenter\s*:\s*\[(?<x>[-+.\d]+)mm\s*,\s*(?<y>[-+.\d]+)mm\]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
private static readonly Regex HolePoint2Center = new(@"\bCenter\s*:\s*Point2\s*\(\s*(?<x>[-+.\d]+)mm\s*,\s*(?<y>[-+.\d]+)mm\s*\)", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
@@ -221,6 +240,64 @@ public static class PrismaticProfileCompositionParser
operations.Add(new(name, Enum.Parse<PrismaticProfileIntent>(match.Groups["intent"].Value), profile, from, to, match.Groups["role"].Success ? match.Groups["role"].Value : match.Groups["intent"].Value, $"offset:{match.Index}"));
}
if (operations.Count(o => o.Intent == PrismaticProfileIntent.Base) != 1) diagnostics.Add("compose-requires-exactly-one-base-operation");
+ var bosses = new List<PrismaticBossFeature>();
+ var pockets = new List<PrismaticPocketFeature>();
+ var stock = operations.SingleOrDefault(operation => operation.Intent == PrismaticProfileIntent.Base);
+ if (stock is not null)
+ {
+ foreach (Match header in BossHeader.Matches(composeBody))
+ {
+ var name = header.Groups["n"].Value;
+ var body = Block(composeBody, header.Index + header.Length - 1);
+ if (body is null) { diagnostics.Add($"firmament-boss-malformed:{name}:unclosed"); continue; }
+ var profileMatch = SemanticProfile.Match(body); var support = SemanticSupport.Match(body); var heightMatch = BossHeight.Match(body);
+ if (!profileMatch.Success || !support.Success || !heightMatch.Success) { diagnostics.Add($"firmament-boss-missing-required-field:{name}:required=On,Profile,Height"); continue; }
+ var profileName = profileMatch.Groups["profile"].Value; var face = support.Groups["face"].Value; var height = N(heightMatch, "value");
+ if (!names.Add(name)) { diagnostics.Add($"compose-duplicate-operation:{name}"); continue; }
+ if (!profiles.TryGetValue(profileName, out var bossProfile)) { diagnostics.Add($"firmament-boss-invalid-profile:{name}:profile={profileName}"); continue; }
+ if (face is not ("Top" or "+Z")) { diagnostics.Add($"firmament-boss-invalid-target:{name}:On={face}:supported=Top"); continue; }
+ if (!double.IsFinite(height) || height <= 0d) { diagnostics.Add($"firmament-boss-height-must-be-positive:{name}:height={height:R}mm"); continue; }
+ if (!HasConnectedBossSupport(stock, bossProfile, profiles)) { diagnostics.Add($"firmament-boss-disconnected-from-host:{name}:host={compose.Groups["n"].Value}:profile={profileName}:support=Top"); continue; }
+ var stableId = $"boss:{compose.Groups["n"].Value}.{name}"; var sourceSpan = $"offset:{header.Index}";
+ bosses.Add(new(name, stableId, compose.Groups["n"].Value, "Top", profileName, height, stock.To, stock.To + height, sourceSpan));
+ operations.Add(new(name, PrismaticProfileIntent.Add, profileName, stock.To, stock.To + height, "Boss", sourceSpan, stableId, "Boss"));
+ }
+
+ foreach (Match header in PocketHeader.Matches(composeBody))
+ {
+ var name = header.Groups["n"].Value;
+ var body = Block(composeBody, header.Index + header.Length - 1);
+ if (body is null) { diagnostics.Add($"firmament-pocket-malformed:{name}:unclosed"); continue; }
+ var profileMatch = SemanticProfile.Match(body); var support = SemanticSupport.Match(body); var depthMatch = PocketDepth.Match(body);
+ if (!profileMatch.Success || !support.Success || !depthMatch.Success) { diagnostics.Add($"firmament-pocket-missing-required-field:{name}:required=On,Profile,Depth"); continue; }
+ var profileName = profileMatch.Groups["profile"].Value; var face = support.Groups["face"].Value; var depth = N(depthMatch, "value");
+ if (!names.Add(name)) { diagnostics.Add($"compose-duplicate-operation:{name}"); continue; }
+ if (!profiles.TryGetValue(profileName, out var pocketProfile)) { diagnostics.Add($"firmament-pocket-invalid-profile:{name}:profile={profileName}"); continue; }
+ if (face is not ("Top" or "+Z")) { diagnostics.Add($"firmament-pocket-invalid-target:{name}:On={face}:supported=Top"); continue; }
+ if (!double.IsFinite(depth) || depth <= 0d) { diagnostics.Add($"firmament-pocket-depth-must-be-positive:{name}:depth={depth:R}mm"); continue; }
+ if (!IsPocketFootprintInsideStock(stock, pocketProfile, profiles)) { diagnostics.Add($"firmament-pocket-invalid-profile:{name}:profile={profileName}:footprint-must-be-enclosed-by-host"); continue; }
+ var hostThickness = stock.To - stock.From; var remaining = hostThickness - depth;
+ var (minimumFloor, policySource) = ResolveMinimumFloor(source, body);
+ if (!double.IsFinite(minimumFloor) || minimumFloor <= 0d)
+ {
+ diagnostics.Add($"firmament-pocket-minimum-floor-policy-invalid:{name}:requiredFloor={minimumFloor:R}mm:policy={policySource}");
+ continue;
+ }
+ if (remaining <= 1e-7d)
+ {
+ diagnostics.Add($"firmament-pocket-through-depth:{name}:host={compose.Groups["n"].Value}:depth={depth:R}mm:hostThickness={hostThickness:R}mm:remainingFloor={remaining:R}mm:requiredFloor={minimumFloor:R}mm");
+ continue;
+ }
+ if (remaining + 1e-7d < minimumFloor)
+ {
+ diagnostics.Add($"firmament-pocket-minimum-floor-thickness:{name}:host={compose.Groups["n"].Value}:depth={depth:R}mm:hostThickness={hostThickness:R}mm:remainingFloor={remaining:R}mm:requiredFloor={minimumFloor:R}mm:policy={policySource}");
+ continue;
+ }
+ var stableId = $"pocket:{compose.Groups["n"].Value}.{name}"; var sourceSpan = $"offset:{header.Index}";
+ pockets.Add(new(name, stableId, compose.Groups["n"].Value, "Top", profileName, depth, hostThickness, remaining, minimumFloor, policySource, stock.To - depth, stock.To, sourceSpan));
+ operations.Add(new(name, PrismaticProfileIntent.Remove, profileName, stock.To - depth, stock.To, "Pocket", sourceSpan, stableId, "Pocket"));
+ }
+ }
var shaftHoles = new List<PrismaticShaftHoleFeature>();
var counterboreHoles = new List<PrismaticCounterboreHoleFeature>();
var constructionPlaneBlindDrills = new List<PrismaticConstructionPlaneBlindDrillFeature>();
@@ -351,10 +428,43 @@ public static class PrismaticProfileCompositionParser
}
}
var levels = operations.SelectMany(o => new[] { o.From, o.To }).Distinct().Order().ToArray();
- var feature = diagnostics.Count == 0 ? new PrismaticProfileCompositionFeature(compose.Groups["n"].Value, "XY", "+Z", placement, operations, levels, "parser-backed-scaffold-profile-composition", shaftHoles, capsuleSlots, roundedRectangleSlots, constructionPlaneBlindDrills, counterboreHoles) : null;
+ var feature = diagnostics.Count == 0 ? new PrismaticProfileCompositionFeature(compose.Groups["n"].Value, "XY", "+Z", placement, operations, levels, "parser-backed-scaffold-profile-composition", shaftHoles, capsuleSlots, roundedRectangleSlots, constructionPlaneBlindDrills, counterboreHoles, bosses, pockets) : null;
return new(feature, profiles, diagnostics.Distinct().ToArray(), expansion.Evidence);
}
+ private static bool HasConnectedBossSupport(PrismaticProfileOperation stock, ResolvedProfile2D boss, IReadOnlyDictionary<string, ResolvedProfile2D> profiles)
+ {
+ var probe = ProfileArrangementBuilder.Compose("XY", [stock with { From = 0d, To = 1d }, new("BossSupportProbe", PrismaticProfileIntent.Add, boss.Name, 0d, 1d, "Boss", "generated")], profiles, "boss-connectivity-probe");
+ if (probe.Region is null || probe.Arrangement.Diagnostics.Count > 0) return false;
+ var stockArea = Math.Abs(PrismaticSectionStackCompiler.ProfileArea(profiles[stock.ProfileReference]));
+ var bossArea = Math.Abs(PrismaticSectionStackCompiler.ProfileArea(boss));
+ var overlapArea = stockArea + bossArea - PrismaticSectionStackCompiler.Area(probe.Region);
+ return overlapArea > Math.Max(1e-7d, Math.Min(stockArea, bossArea) * 1e-8d);
+ }
+
+ private static bool IsPocketFootprintInsideStock(PrismaticProfileOperation stock, ResolvedProfile2D pocket, IReadOnlyDictionary<string, ResolvedProfile2D> profiles)
+ {
+ var probe = ProfileArrangementBuilder.Compose("XY", [stock with { From = 0d, To = 1d }, new("PocketContainmentProbe", PrismaticProfileIntent.Remove, pocket.Name, 0d, 1d, "Pocket", "generated")], profiles, "pocket-containment-probe");
+ if (probe.Region is null || probe.Arrangement.Diagnostics.Count > 0 || probe.Region.Holes.Count == 0) return false;
+ var stockArea = Math.Abs(PrismaticSectionStackCompiler.ProfileArea(profiles[stock.ProfileReference]));
+ var pocketArea = Math.Abs(PrismaticSectionStackCompiler.ProfileArea(pocket));
+ var retainedArea = PrismaticSectionStackCompiler.Area(probe.Region);
+ return Math.Abs((stockArea - retainedArea) - pocketArea) <= Math.Max(1e-7d, pocketArea * 1e-8d);
+ }
+
+ private static (double Value, string Source) ResolveMinimumFloor(string source, string pocketBody)
+ {
+ var local = PocketMinimumFloor.Match(pocketBody);
+ if (local.Success) return (N(local, "value"), "Pocket.MinimumFloorThickness");
+ var concepts = TemplateMinimumFloor.Matches(source).Cast<Match>().ToArray();
+ var floors = concepts.Where(match => string.Equals(match.Groups["name"].Value, "minimumFloorThickness", StringComparison.OrdinalIgnoreCase)).ToArray();
+ if (floors.Length > 1) return (double.NaN, "Template.minimumFloorThickness:ambiguous-multiple-authorities");
+ if (floors.Length == 1) return (N(floors[0], "value"), "Template.minimumFloorThickness");
+ var walls = concepts.Where(match => string.Equals(match.Groups["name"].Value, "minimumWallThickness", StringComparison.OrdinalIgnoreCase)).ToArray();
+ if (walls.Length > 1) return (double.NaN, "Template.minimumWallThickness:ambiguous-multiple-authorities");
+ return walls.Length == 1 ? (N(walls[0], "value"), "Template.minimumWallThickness") : (1d, "Preview3.boundedDefault");
+ }
+
// The canonical Modify form is body-level syntax. Bind feature declarations
// targeting this Compose body into the existing section-stack feature path so
// they cannot be admitted and then silently omitted from exported geometry.
diff --git a/Aetheris.Kernel.Firmament/Materializer/PrismaticSectionStackCompiler.cs b/Aetheris.Kernel.Firmament/Materializer/PrismaticSectionStackCompiler.cs
index b658ed01..266b7cf5 100644
--- a/Aetheris.Kernel.Firmament/Materializer/PrismaticSectionStackCompiler.cs
+++ b/Aetheris.Kernel.Firmament/Materializer/PrismaticSectionStackCompiler.cs
@@ -274,6 +274,14 @@ public static class PrismaticSectionStackEmitter
var source = fragment.Source.Provenance.StableId;
descendants.Add(new($"construction:{stack.Feature.Name}:{fragment.StableId}", "ArrangementFragment", SemanticTopologyRole.Unknown, source, ParentStableId: fragment.Source.StableId));
}
+ foreach (var feature in (stack.Feature.Bosses ?? []).Select(item => (item.StableId, item.ProfileReference, Kind: "Boss"))
+ .Concat((stack.Feature.Pockets ?? []).Select(item => (item.StableId, item.ProfileReference, Kind: "Pocket"))))
+ {
+ var prefix = $"profile:{feature.ProfileReference}.Outer.";
+ foreach (var item in sideFaces.Select((side, index) => (Side: side, Face: faces[capFaces.Count + index]))
+ .Where(item => item.Side.Source.StartsWith(prefix, StringComparison.Ordinal)))
+ descendants.Add(new($"material:{feature.StableId}:wall:{item.Face.Value}", "Face", SemanticTopologyRole.ExtrusionSideFace, feature.StableId, Face: item.Face, ParentStableId: feature.StableId, GeometryPreview: feature.Kind));
+ }
foreach (var hole in stack.Feature.ShaftHoles ?? [])
{
var profilePrefix = $"profile:{hole.ProfileReference}.Outer.";
diff --git a/docs/public/firmament/geometry.md b/docs/public/firmament/geometry.md
index 2e2fccb2..08ef845e 100644
--- a/docs/public/firmament/geometry.md
+++ b/docs/public/firmament/geometry.md
@@ -8,4 +8,118 @@ Use named features and selectors, never raw internal B-rep IDs in native authori
`HoleDiameter` on a `Hole<Counterbore>` targets the shaft `Diameter`; `CounterboreDiameter` remains a distinct feature field and has no separate public PMI record kind in Preview 3. Pattern generation supports geometry as a semantic whole; authored names for generated instances are not a stable public instance-selector family in Preview 3.
-Profile `Compose` supplies the bounded raised-pad and shallow-pocket routes. It is the current V2 answer for those prismatic cases, not a general-purpose Boss/Pocket command or arbitrary solid boolean. Sheet Metal has its own `Hole Name` syntax for planar circular openings; countersink and counterbore forms are Model-domain features and deliberately fail in Sheet Metal rather than being ignored.
+## Boss
+
+`Boss` is the first-class finite profile feature for adding connected material. In Preview 3 it is declared inside the active `Compose` body, targets that body's top support (`On: Top`), consumes an already-admitted line/arc `Profile`, and extrudes outward along `+Z` by a positive `Height`:
+
+```firmament
+Compose Body {
+ Base Stock { Profile: BaseProfile; From: 0mm; To: 10mm; Role: Stock }
+ Boss MountBoss { On: Top; Profile: BossProfile; Height: 6mm }
+}
+```
+
+The active Compose body is the semantic target; `On: Top` is its admitted support face. The boss footprint must overlap the host with a proper connected region. A disjoint or point-tangent footprint, missing profile, unsupported support, or non-positive height fails with a `firmament-boss-*` diagnostic. Boss retains a stable `boss:<host>.<name>` identity, then lowers to the existing section-stack `Add` operation. It never emits an arbitrary second solid and does not introduce public Boolean authoring.
+
+### Complete Boss + through-hole source
+
+The following is a complete parseable file, including the required wrapper and admitted low-level circle Profile. `Hole<Shaft>` belongs inside the same Compose and uses `End: ThroughAll` (not `Through: true`):
+
+```firmament
+Model BossPlate {
+ Units: mm
+ Concept Struct Layout On XY {
+ Rect2 Stock { Center: [0mm, 0mm]; Size: [50mm, 30mm] }
+ Point2 C { Position: [0mm, 0mm] }
+ Point2 E { Position: [8mm, 0mm] }
+ Point2 N { Position: [0mm, 8mm] }
+ Point2 W { Position: [-8mm, 0mm] }
+ Point2 S { Position: [0mm, -8mm] }
+ Circle2 BossCircle { Center: C; Radius: 8mm }
+ }
+ Profile BaseProfile Using Layout { Loop Outer {
+ Segment Bottom { Trace: Stock.Bottom; From: Stock.BottomLeft; To: Stock.BottomRight }
+ Segment Right { Trace: Stock.Right; From: Stock.BottomRight; To: Stock.TopRight }
+ Segment Top { Trace: Stock.Top; From: Stock.TopRight; To: Stock.TopLeft }
+ Segment Left { Trace: Stock.Left; From: Stock.TopLeft; To: Stock.BottomLeft }
+ } }
+ Profile BossProfile Using Layout { Loop Outer {
+ Segment Q1 { Trace: BossCircle; From: E; To: N; Sweep: CounterClockwise }
+ Segment Q2 { Trace: BossCircle; From: N; To: W; Sweep: CounterClockwise }
+ Segment Q3 { Trace: BossCircle; From: W; To: S; Sweep: CounterClockwise }
+ Segment Q4 { Trace: BossCircle; From: S; To: E; Sweep: CounterClockwise }
+ } }
+ Struct Plate { Compose Body {
+ Base Stock { Profile: BaseProfile; From: 0mm; To: 6mm; Role: Stock }
+ Boss MountBoss { On: Top; Profile: BossProfile; Height: 8mm }
+ Hole<Shaft> ThroughBoss { On: +Z; Center: [0mm, 0mm]; Diameter: 5mm; End: ThroughAll; Role: MountingHole }
+ } }
+}
+```
+
+## Pocket
+
+`Pocket` is the first-class finite profile feature for accessible prismatic removal from the active Compose body's top support. It deliberately leaves a floor:
+
+```firmament
+Compose Body {
+ Base Stock { Profile: BaseProfile; From: 0mm; To: 10mm; Role: Stock }
+ Pocket ElectronicsRecess {
+ On: Top
+ Profile: PocketProfile
+ Depth: 4mm
+ MinimumFloorThickness: 2mm
+ }
+}
+```
+
+Preview 3 admits only `On: Top` / `+Z`, an enclosed admitted line/arc profile, and a positive finite `Depth`. The compiler derives `hostThickness` from the unique Base interval and calculates `remainingFloor = hostThickness - Depth`. `Depth == hostThickness`, greater depth, and tolerance-close through depth fail as `firmament-pocket-through-depth`; a positive remaining floor below policy fails as `firmament-pocket-minimum-floor-thickness`. Diagnostics include feature, host, requested depth, host thickness, remaining floor, and required floor.
+
+Minimum-floor precedence is:
+
+1. `MinimumFloorThickness` on the Pocket;
+2. an active template `minimumFloorThickness` concept;
+3. the existing template `minimumWallThickness` concept;
+4. the documented Preview 3 bounded default of `1mm`.
+
+Every supplied policy value must be positive and finite. Pocket retains a stable `pocket:<host>.<name>` identity and lowers through the existing section-stack `Remove` operation. It is intentionally not arbitrary solid subtraction and never means through-all. Use semantic `Hole`, `Slot`, or another documented opening feature for through removal.
+
+### Complete rectangular Pocket source
+
+`Rect2` exposes the four named corners and sides used below. This complete file creates 10 mm stock, a 4 mm pocket, and a 6 mm floor against a 2 mm requirement:
+
+```firmament
+Model PocketBlock {
+ Units: mm
+ Concept Struct Layout On XY {
+ Rect2 Stock { Center: [0mm, 0mm]; Size: [40mm, 30mm] }
+ Rect2 Recess { Center: [0mm, 0mm]; Size: [20mm, 14mm] }
+ }
+ Profile BaseProfile Using Layout { Loop Outer {
+ Segment Bottom { Trace: Stock.Bottom; From: Stock.BottomLeft; To: Stock.BottomRight }
+ Segment Right { Trace: Stock.Right; From: Stock.BottomRight; To: Stock.TopRight }
+ Segment Top { Trace: Stock.Top; From: Stock.TopRight; To: Stock.TopLeft }
+ Segment Left { Trace: Stock.Left; From: Stock.TopLeft; To: Stock.BottomLeft }
+ } }
+ Profile PocketProfile Using Layout { Loop Outer {
+ Segment Bottom { Trace: Recess.Bottom; From: Recess.BottomLeft; To: Recess.BottomRight }
+ Segment Right { Trace: Recess.Right; From: Recess.BottomRight; To: Recess.TopRight }
+ Segment Top { Trace: Recess.Top; From: Recess.TopRight; To: Recess.TopLeft }
+ Segment Left { Trace: Recess.Left; From: Recess.TopLeft; To: Recess.BottomLeft }
+ } }
+ Struct Block { Compose Body {
+ Base Stock { Profile: BaseProfile; From: 0mm; To: 10mm; Role: Stock }
+ Pocket RecessPocket { On: Top; Profile: PocketProfile; Depth: 4mm; MinimumFloorThickness: 2mm }
+ } }
+}
+```
+
+To author a block containing both features, declare all three profiles in one `Concept Struct ... On XY`, then place both the documented `Boss` and `Pocket` declarations after the unique `Base` in the same Compose. Feature declaration order does not replace their explicit finite intervals.
+
+The canonical [Boss + Pocket mounting block](../../../fixtures/FirmamentV2/Canonical/valid/boss-pocket-mounting-block.firmament) combines a cylindrical boss, through shaft hole, and shallow rectangular pocket using public Firmament only. Existing lower-level `Compose Add` / `Remove` remains compatible for bounded blockout work.
+
+Sheet Metal has its own `Hole Name` syntax for planar circular openings; countersink and counterbore forms are Model-domain features and deliberately fail in Sheet Metal rather than being ignored.
+
+## Intentional Boolean boundary
+
+Sphere remains a supported standalone analytic solid. Pocket is a supported finite prismatic profile feature. Subtracting a Sphere from a block, a hemispherical arbitrary cavity, public `Union` / `Subtract` / `Intersect`, and general CSG trees are not Preview 3 Firmament features. A future `SphericalSeat`, `Dish`, or tool-profile feature would require an engineering contract; geometric possibility alone is not one.
diff --git a/docs/public/reference/supported-features.md b/docs/public/reference/supported-features.md
index d86c0e0d..23eb94e5 100644
--- a/docs/public/reference/supported-features.md
+++ b/docs/public/reference/supported-features.md
@@ -6,7 +6,9 @@
|---|---|---|
| Firmament V2 native primitives/profiles | Bounded | Named Box/Cylinder/Frustum/RoundedBox and admitted line/arc profile construction/composition |
| Firmament V2 analytic `model` / `solid` primitives | Bounded | Parser-backed single-solid Sphere, Cone (including zero-radius pointed end), and Torus routes round-trip through AP242; this is not a general boolean/composition promise |
-| Profile-composed pads and pockets | Bounded | Admitted prismatic `Compose` `Add`/`Remove` profile operations; no universal named Boss/Pocket feature or arbitrary solid boolean |
+| Boss | Bounded | First-class connected finite `On: Top` profile addition on an admitted Compose host; positive height; lowers through existing `Add`; no arbitrary solid union |
+| Pocket | Bounded | First-class enclosed finite-depth `On: Top` profile removal; positive depth, non-through termination, and minimum remaining floor enforced; lowers through existing `Remove` |
+| Lower-level profile composition | Bounded | Existing prismatic `Compose` `Add`/`Remove` remains compatible for bounded blockout authoring |
| Semantic holes, slots, patterns | Bounded | Qualified shaft/counterbore/countersink and finite static pattern routes; no stable generated-instance selector |
| Edge finishes/hollow/lattice | Bounded | Documented admitted chamfer/fillet, hollow, and cubic-truss routes; not arbitrary topology |
| Templates/Records/Static/Tables | Supported | Typed compile-time specialization, finite data, `with`, and `Require` |
@@ -24,3 +26,5 @@
| Linux/macOS release binaries | Not in Preview 3 | Framework logic tests do not constitute binary qualification |
| New geometry/PMI/FEA/Forge families | Not in Preview 3 | Feature-frozen until after Preview 3 |
| General loft, helix, and freeform surface features | Not in Preview 3 | No public native V2 authoring and qualification route |
+| Through profile removal | Bounded semantic operations | Use qualified `Hole`, `Slot`, or another documented opening feature; Pocket never means through-all |
+| Arbitrary solid Boolean subtraction / hemispherical cavity | Not in Preview 3 | No public `Union`, `Subtract`, `Intersect`, CSG tree, Sphere-from-Block subtraction, or hemisphere special case |
diff --git a/docs/release/PREVIEW3-HARDEN-A3b.md b/docs/release/PREVIEW3-HARDEN-A3b.md
new file mode 100644
index 00000000..479b8d5d
--- /dev/null
+++ b/docs/release/PREVIEW3-HARDEN-A3b.md
@@ -0,0 +1,103 @@
+# PREVIEW3-HARDEN-A3b
+
+## Executive result
+
+Yes. Users can author ordinary connected bosses and finite, floored pockets directly with first-class `Boss` and `Pocket` declarations. Both retain semantic identity while lowering through the existing profile-composition section stack. No general Boolean authoring was added.
+
+## Boss contract
+
+- Target: the active `Compose` body.
+- Support: `On: Top` (equivalently the admitted `+Z` support).
+- Profile: an existing admitted closed line/arc Profile; A3b did not widen profile vocabulary.
+- Height: positive and finite.
+- Connectivity: the profile must make proper region contact with the host support. Disjoint and point/tangent-only results fail before materialization.
+- DFM: positive height, admitted profile, valid support, and connected material.
+- Lowering: `PrismaticBossFeature` -> semantic `PrismaticProfileOperation(Add)` -> existing `PrismaticSectionStackConstruction` -> BRep -> AP242.
+
+## Pocket contract
+
+- Target: the active `Compose` body.
+- Entry/support: `On: Top`; the feature is accessible along the admitted inward `-Z` route.
+- Profile: an admitted closed line/arc Profile fully enclosed by stock; edge-breaking notches are not Pocket.
+- Depth: positive and finite. Pocket cannot silently become through-all.
+- Remaining floor: `Base.To - Depth - Base.From`, equivalently `hostThickness - Depth` for the admitted support direction.
+- Minimum floor: explicit Pocket value, then template `minimumFloorThickness`, then existing template `minimumWallThickness`, then the documented bounded `1mm` Preview 3 default.
+- DFM: invalid target/profile/depth, through depth, and insufficient floor all fail with stable `firmament-pocket-*` diagnostics containing engineering quantities.
+- Lowering: `PrismaticPocketFeature` -> semantic `PrismaticProfileOperation(Remove)` -> the same section-stack/BRep/AP242 path as existing bounded Compose removal.
+
+## Why no arbitrary Booleans
+
+Firmament exposes engineering intent, not arbitrary CSG. `Sphere` remains an analytic standalone solid; `Pocket` is a finite prismatic feature. Sphere-from-Block subtraction, hemispherical special casing, and public `Union` / `Subtract` / `Intersect` remain outside Preview 3. A future spherical-seat or tool-profile feature requires its own manufacturability contract.
+
+## Combination matrix
+
+| Part/combination | Build | STEP reimport | DFM | Result |
+| ---------------- | ----- | ------------- | --- | ------ |
+| Cylindrical Boss + through shaft Hole | Pass | Enclosed, orientation-consistent | Pass | Qualified in canonical mounting-block witness |
+| Boss + Counterbore + Pocket | Pass | Enclosed | Pass | Qualified by focused semantic test |
+| Rectangular Boss + Pocket + EdgeFinish | Pass | Enclosed | Pass | Qualified on admitted line-only top boundary |
+| Boss + Hole + Pocket | Pass | Enclosed, expected `[-20,-12,0]..[20,12,16]` bounds | Pass | Canonical practical witness |
+| Pocket depth 4 mm in 10 mm stock, local floor 2 mm | Pass | Same practical witness | 6 mm floor | Accepted |
+| Pocket depth 9.5 mm in 10 mm stock, required floor 2 mm | Reject | Not emitted | 0.5 mm floor | `firmament-pocket-minimum-floor-thickness` |
+| Pocket depth 10/11 mm in 10 mm stock | Reject | Not emitted | 0/-1 mm floor | `firmament-pocket-through-depth` |
+| Compose-host Countersink | Not admitted | Not emitted | Explicit boundary | Existing composed section-stack hole family remains Shaft/Counterbore; general Model countersink is unchanged |
+
+The canonical circular witness has exact section-stack analytic volume `9570.194671058465 mm^3`. AP242 reimport reports one body, one shell, 32 faces, 72 edges, 44 vertices, 16 planes, 16 cylinders, enclosed-manifold structure, and bounds `[-20,-12,0]..[20,12,16]`. The generic tessellated mass verifier cannot triangulate one planar face in this combined circular witness and reports `Unavailable`; enclosure, orientation, analytic volume, surface families, and bounds are therefore recorded separately rather than overstating independent mass verification.
+
+Structured build output reports `featureCount: 3`: `Hole<Shaft> MountHole`, `Boss MountBoss`, and `Pocket ElectronicsRecess`. Boss/Pocket reports include stable semantic IDs, host/support/profile, extent, material effect, floor policy where applicable, and the reused section-stack route.
+
+## Fresh-user friction
+
+Three isolated agents received only `docs/public/firmament/geometry.md` and the support matrix. None inspected implementation, tests, or fixtures.
+
+| Task | Initial attempt | Documentation-driven correction | Second attempt |
+|---|---|---|---|
+| A: plate + cylindrical Boss + through Hole | Compose/Boss intent correct; guessed invalid profile and `Through: true` syntax | Added complete wrapper, circle Profile, and `End: ThroughAll` example | Parsed and built first try; AP242 reimport enclosed-manifold, 1 reported Boss |
+| B: 4 mm rectangular Pocket, floor >= 2 mm | Pocket contract/floor correct; guessed invalid profile syntax and omitted wrapper | Added complete Rect2/Profile/Model example | Parsed and built first try; 6 mm floor, AP242 reimport enclosed-manifold, 1 reported Pocket |
+| C: mounting block with Boss + Pocket | Feature declarations correct; guessed invalid profile syntax and omitted wrapper | Added complete profile construction plus combination guidance | Parsed and built first try; AP242 reimport enclosed-manifold, 2 reported features |
+
+The initial failure was documentation friction, not diagnostic-driven source correction: agents could not write a parser-grounded full file from the original public page. The docs were corrected in place. All three second attempts required zero compiler-diagnostic corrections and zero internal source/test inspection. Exact second-attempt sources are retained under `docs/release/artifacts/a3b/`.
+
+## Public docs delta
+
+- `docs/public/firmament/geometry.md`: first-class Boss/Pocket contracts, syntax, floor precedence, diagnostics, canonical example, and Boolean boundary.
+- `docs/public/reference/supported-features.md`: separate Boss, Pocket, through-removal, lower-level Compose, and arbitrary-Boolean support rows.
+- `fixtures/FirmamentV2/Canonical/valid/boss-pocket-mounting-block.firmament`: canonical practical public witness.
+
+## Remaining limitations
+
+- Preview 3 Boss/Pocket support is the trustworthy world-XY / `On: Top` Compose-host class only; arbitrary support orientations are rejected.
+- Profiles remain the pre-A3b admitted line/arc vocabulary.
+- Pocket is enclosed and finite; edge-breaking notches and through cuts use other semantics.
+- Compose-host Countersink is not admitted by the existing section-stack hole route. Model-domain countersink remains supported and unchanged.
+- The generic mass tessellator limitation described above remains verification friction, not a topology or STEP enclosure failure.
+- No general machining-accessibility, tool-reach, draft, molding, or additive-support solver was added.
+
+## Finding classification
+
+- **MustFix (completed):** public Boss/Pocket semantics, stable identity, connected boss admission, finite pocket depth, minimum floor diagnostics, truthful build inventory.
+- **DocsFix (completed):** geometry philosophy and supported-features boundary.
+- **DocumentForPreview:** combined circular witness generic mass-tessellation limitation; Compose-host Countersink boundary.
+- **DeferredPostPreview3:** non-top support faces, broader profile families, specialized spherical/tool-profile cavities, general accessibility analysis.
+- **ReleaseBlocker:** none identified by A3b validation.
+
+## Validation
+
+- Full `dotnet build Aetheris.slnx -c Release --no-restore -m:1`: pass, 0 warnings, 0 errors.
+- Full serial `dotnet test Aetheris.slnx -c Release --no-build -m:1 -- RunConfiguration.MaxCpuCount=1`: 3,011 passed, 0 failed, 0 skipped. `Aetheris.FrictionLab.Tests` has no discoverable tests (pre-existing assembly state).
+- Explicit A3 analytic primitive + hole-family and A2 PMI filter: 11 passed.
+- Explicit profile-composition/BRep/EdgeFinish/PMI filter: 48 passed.
+- Explicit Sheet Metal manufacturing-release regression: 4 passed.
+- Focused Boss/Pocket semantic, DFM, identity, combination, and STEP tests: 19 passed.
+- Public canonical Boss/Pocket CLI build/analyze qualification: pass; 3 semantic features reported and enclosed-manifold reimport.
+- Three fresh-agent sources: all parse/build on the first post-doc-correction attempt and reimport enclosed-manifold.
+- VS Code grammar/core tests: 13 passed; Boss/Pocket keywords and snippets included.
+- `git diff --check`: pass.
+
+## Feature freeze
+
+A3b was a bounded exception for first-class Boss/Pocket semantics and associated DFM.
+
+No general Boolean authoring was added.
+
+Feature freeze is restored.
diff --git a/docs/release/artifacts/a3b/fresh-task-a.firmament b/docs/release/artifacts/a3b/fresh-task-a.firmament
new file mode 100644
index 00000000..2905932a
--- /dev/null
+++ b/docs/release/artifacts/a3b/fresh-task-a.firmament
@@ -0,0 +1,29 @@
+Model BossPlate {
+ Units: mm
+ Concept Struct Layout On XY {
+ Rect2 Stock { Center: [0mm, 0mm]; Size: [50mm, 30mm] }
+ Point2 C { Position: [0mm, 0mm] }
+ Point2 E { Position: [8mm, 0mm] }
+ Point2 N { Position: [0mm, 8mm] }
+ Point2 W { Position: [-8mm, 0mm] }
+ Point2 S { Position: [0mm, -8mm] }
+ Circle2 BossCircle { Center: C; Radius: 8mm }
+ }
+ Profile BaseProfile Using Layout { Loop Outer {
+ Segment Bottom { Trace: Stock.Bottom; From: Stock.BottomLeft; To: Stock.BottomRight }
+ Segment Right { Trace: Stock.Right; From: Stock.BottomRight; To: Stock.TopRight }
+ Segment Top { Trace: Stock.Top; From: Stock.TopRight; To: Stock.TopLeft }
+ Segment Left { Trace: Stock.Left; From: Stock.TopLeft; To: Stock.BottomLeft }
+ } }
+ Profile BossProfile Using Layout { Loop Outer {
+ Segment Q1 { Trace: BossCircle; From: E; To: N; Sweep: CounterClockwise }
+ Segment Q2 { Trace: BossCircle; From: N; To: W; Sweep: CounterClockwise }
+ Segment Q3 { Trace: BossCircle; From: W; To: S; Sweep: CounterClockwise }
+ Segment Q4 { Trace: BossCircle; From: S; To: E; Sweep: CounterClockwise }
+ } }
+ Struct Plate { Compose Body {
+ Base Stock { Profile: BaseProfile; From: 0mm; To: 6mm; Role: Stock }
+ Boss MountBoss { On: Top; Profile: BossProfile; Height: 8mm }
+ Hole<Shaft> ThroughBoss { On: +Z; Center: [0mm, 0mm]; Diameter: 5mm; End: ThroughAll; Role: MountingHole }
+ } }
+}
diff --git a/docs/release/artifacts/a3b/fresh-task-b.firmament b/docs/release/artifacts/a3b/fresh-task-b.firmament
new file mode 100644
index 00000000..20220406
--- /dev/null
+++ b/docs/release/artifacts/a3b/fresh-task-b.firmament
@@ -0,0 +1,23 @@
+Model PocketBlock {
+ Units: mm
+ Concept Struct Layout On XY {
+ Rect2 Stock { Center: [0mm, 0mm]; Size: [40mm, 30mm] }
+ Rect2 Recess { Center: [0mm, 0mm]; Size: [20mm, 14mm] }
+ }
+ Profile BaseProfile Using Layout { Loop Outer {
+ Segment Bottom { Trace: Stock.Bottom; From: Stock.BottomLeft; To: Stock.BottomRight }
+ Segment Right { Trace: Stock.Right; From: Stock.BottomRight; To: Stock.TopRight }
+ Segment Top { Trace: Stock.Top; From: Stock.TopRight; To: Stock.TopLeft }
+ Segment Left { Trace: Stock.Left; From: Stock.TopLeft; To: Stock.BottomLeft }
+ } }
+ Profile PocketProfile Using Layout { Loop Outer {
+ Segment Bottom { Trace: Recess.Bottom; From: Recess.BottomLeft; To: Recess.BottomRight }
+ Segment Right { Trace: Recess.Right; From: Recess.BottomRight; To: Recess.TopRight }
+ Segment Top { Trace: Recess.Top; From: Recess.TopRight; To: Recess.TopLeft }
+ Segment Left { Trace: Recess.Left; From: Recess.TopLeft; To: Recess.BottomLeft }
+ } }
+ Struct Block { Compose Body {
+ Base Stock { Profile: BaseProfile; From: 0mm; To: 10mm; Role: Stock }
+ Pocket RecessPocket { On: Top; Profile: PocketProfile; Depth: 4mm; MinimumFloorThickness: 2mm }
+ } }
+}
diff --git a/docs/release/artifacts/a3b/fresh-task-c.firmament b/docs/release/artifacts/a3b/fresh-task-c.firmament
new file mode 100644
index 00000000..94a335b5
--- /dev/null
+++ b/docs/release/artifacts/a3b/fresh-task-c.firmament
@@ -0,0 +1,36 @@
+Model MountingBlock {
+ Units: mm
+ Concept Struct Layout On XY {
+ Rect2 Stock { Center: [0mm, 0mm]; Size: [60mm, 40mm] }
+ Rect2 Recess { Center: [-12mm, 0mm]; Size: [16mm, 14mm] }
+ Point2 BossCenter { Position: [18mm, 0mm] }
+ Point2 BossEast { Position: [26mm, 0mm] }
+ Point2 BossNorth { Position: [18mm, 8mm] }
+ Point2 BossWest { Position: [10mm, 0mm] }
+ Point2 BossSouth { Position: [18mm, -8mm] }
+ Circle2 BossCircle { Center: BossCenter; Radius: 8mm }
+ }
+ Profile BaseProfile Using Layout { Loop Outer {
+ Segment Bottom { Trace: Stock.Bottom; From: Stock.BottomLeft; To: Stock.BottomRight }
+ Segment Right { Trace: Stock.Right; From: Stock.BottomRight; To: Stock.TopRight }
+ Segment Top { Trace: Stock.Top; From: Stock.TopRight; To: Stock.TopLeft }
+ Segment Left { Trace: Stock.Left; From: Stock.TopLeft; To: Stock.BottomLeft }
+ } }
+ Profile BossProfile Using Layout { Loop Outer {
+ Segment Q1 { Trace: BossCircle; From: BossEast; To: BossNorth; Sweep: CounterClockwise }
+ Segment Q2 { Trace: BossCircle; From: BossNorth; To: BossWest; Sweep: CounterClockwise }
+ Segment Q3 { Trace: BossCircle; From: BossWest; To: BossSouth; Sweep: CounterClockwise }
+ Segment Q4 { Trace: BossCircle; From: BossSouth; To: BossEast; Sweep: CounterClockwise }
+ } }
+ Profile PocketProfile Using Layout { Loop Outer {
+ Segment Bottom { Trace: Recess.Bottom; From: Recess.BottomLeft; To: Recess.BottomRight }
+ Segment Right { Trace: Recess.Right; From: Recess.BottomRight; To: Recess.TopRight }
+ Segment Top { Trace: Recess.Top; From: Recess.TopRight; To: Recess.TopLeft }
+ Segment Left { Trace: Recess.Left; From: Recess.TopLeft; To: Recess.BottomLeft }
+ } }
+ Struct Block { Compose Body {
+ Base Stock { Profile: BaseProfile; From: 0mm; To: 10mm; Role: Stock }
+ Boss MountBoss { On: Top; Profile: BossProfile; Height: 6mm }
+ Pocket MountingRecess { On: Top; Profile: PocketProfile; Depth: 4mm; MinimumFloorThickness: 2mm }
+ } }
+}
diff --git a/fixtures/FirmamentV2/Canonical/valid/boss-pocket-mounting-block.firmament b/fixtures/FirmamentV2/Canonical/valid/boss-pocket-mounting-block.firmament
new file mode 100644
index 00000000..8a50a536
--- /dev/null
+++ b/fixtures/FirmamentV2/Canonical/valid/boss-pocket-mounting-block.firmament
@@ -0,0 +1,49 @@
+Model BossPocketMountingBlock {
+ Units: mm
+
+ Concept Struct Layout On XY {
+ Rect2 Stock { Center: [0mm, 0mm]; Size: [40mm, 24mm] }
+ Point2 BossCenter { Position: [-12mm, 0mm] }
+ Point2 BossEast { Position: [-6mm, 0mm] }
+ Point2 BossNorth { Position: [-12mm, 6mm] }
+ Point2 BossWest { Position: [-18mm, 0mm] }
+ Point2 BossSouth { Position: [-12mm, -6mm] }
+ Circle2 BossCircle { Center: BossCenter; Radius: 6mm }
+ Rect2 BossPad { Center: [-12mm, 0mm]; Size: [10mm, 10mm] }
+ Rect2 Recess { Center: [10mm, 0mm]; Size: [8mm, 8mm] }
+ }
+
+ Profile BaseProfile Using Layout { Loop Outer {
+ Segment Bottom { Trace: Stock.Bottom; From: Stock.BottomLeft; To: Stock.BottomRight }
+ Segment Right { Trace: Stock.Right; From: Stock.BottomRight; To: Stock.TopRight }
+ Segment Top { Trace: Stock.Top; From: Stock.TopRight; To: Stock.TopLeft }
+ Segment Left { Trace: Stock.Left; From: Stock.TopLeft; To: Stock.BottomLeft }
+ } }
+ Profile BossProfile Using Layout { Loop Outer {
+ Segment Q1 { Trace: BossCircle; From: BossEast; To: BossNorth; Sweep: CounterClockwise }
+ Segment Q2 { Trace: BossCircle; From: BossNorth; To: BossWest; Sweep: CounterClockwise }
+ Segment Q3 { Trace: BossCircle; From: BossWest; To: BossSouth; Sweep: CounterClockwise }
+ Segment Q4 { Trace: BossCircle; From: BossSouth; To: BossEast; Sweep: CounterClockwise }
+ } }
+ Profile PocketProfile Using Layout { Loop Outer {
+ Segment Bottom { Trace: Recess.Bottom; From: Recess.BottomLeft; To: Recess.BottomRight }
+ Segment Right { Trace: Recess.Right; From: Recess.BottomRight; To: Recess.TopRight }
+ Segment Top { Trace: Recess.Top; From: Recess.TopRight; To: Recess.TopLeft }
+ Segment Left { Trace: Recess.Left; From: Recess.TopLeft; To: Recess.BottomLeft }
+ } }
+ Profile RectBossProfile Using Layout { Loop Outer {
+ Segment Bottom { Trace: BossPad.Bottom; From: BossPad.BottomLeft; To: BossPad.BottomRight }
+ Segment Right { Trace: BossPad.Right; From: BossPad.BottomRight; To: BossPad.TopRight }
+ Segment Top { Trace: BossPad.Top; From: BossPad.TopRight; To: BossPad.TopLeft }
+ Segment Left { Trace: BossPad.Left; From: BossPad.TopLeft; To: BossPad.BottomLeft }
+ } }
+
+ Struct MountingBlock {
+ Compose Body {
+ Base Stock { Profile: BaseProfile; From: 0mm; To: 10mm; Role: Stock }
+ Boss MountBoss { On: Top; Profile: BossProfile; Height: 6mm }
+ Pocket ElectronicsRecess { On: Top; Profile: PocketProfile; Depth: 4mm; MinimumFloorThickness: 2mm }
+ Hole<Shaft> MountHole { On: +Z; Center: [-12mm, 0mm]; Diameter: 6mm; End: ThroughAll; Role: MountingHole }
+ }
+ }
+}
diff --git a/tools/vscode-firmament/snippets/firmament.json b/tools/vscode-firmament/snippets/firmament.json
index 7957b36d..dd6e702c 100644
--- a/tools/vscode-firmament/snippets/firmament.json
+++ b/tools/vscode-firmament/snippets/firmament.json
@@ -31,6 +31,29 @@
"body": ["Profile ${1:Section} From ${2:Outline}"],
"description": "Profile derived from a Concept Path"
},
+ "Boss": {
+ "prefix": "boss",
+ "body": [
+ "Boss ${1:BossName} {",
+ " On: Top",
+ " Profile: ${2:BossProfile}",
+ " Height: ${3:8mm}",
+ "}"
+ ],
+ "description": "Connected finite top-support Boss"
+ },
+ "Pocket": {
+ "prefix": "pocket",
+ "body": [
+ "Pocket ${1:PocketName} {",
+ " On: Top",
+ " Profile: ${2:PocketProfile}",
+ " Depth: ${3:4mm}",
+ " MinimumFloorThickness: ${4:1mm}",
+ "}"
+ ],
+ "description": "Finite top-support Pocket with explicit minimum floor"
+ },
"Hole Shaft": {
"prefix": "hole-shaft",
"body": [
diff --git a/tools/vscode-firmament/syntaxes/firmament.tmLanguage.json b/tools/vscode-firmament/syntaxes/firmament.tmLanguage.json
index ad876d78..62811ddd 100644
--- a/tools/vscode-firmament/syntaxes/firmament.tmLanguage.json
+++ b/tools/vscode-firmament/syntaxes/firmament.tmLanguage.json
@@ -49,7 +49,7 @@
},
{
"name": "keyword.declaration.firmament",
- "match": "\\b(?:Model|Box|Cylinder|RoundedBox|Frustum|Concept|Struct|Construction|Plane|Path|Profile|Compose|Modify|Selection|Record|Static|Table|Template|Pattern|Match|Require|Pmi|Datum|Assert|InlineStep|Recognize|Replace|EdgeFinish|Hole|Slot|Region|Segment|Loop|Base|Extrude)\\b"
+ "match": "\\b(?:Model|Box|Cylinder|RoundedBox|Frustum|Concept|Struct|Construction|Plane|Path|Profile|Compose|Boss|Pocket|Modify|Selection|Record|Static|Table|Template|Pattern|Match|Require|Pmi|Datum|Assert|InlineStep|Recognize|Replace|EdgeFinish|Hole|Slot|Region|Segment|Loop|Base|Extrude)\\b"
},
{ "name": "keyword.control.firmament", "match": "\\b(?:with|With|From|Using|On|Over|As|Current|Key)\\b" }
]
diff --git a/tools/vscode-firmament/tests/grammar.test.ts b/tools/vscode-firmament/tests/grammar.test.ts
index 3da4dddf..d701242f 100644
--- a/tools/vscode-firmament/tests/grammar.test.ts
+++ b/tools/vscode-firmament/tests/grammar.test.ts
@@ -33,6 +33,8 @@ test("critical canonical syntax receives stable TextMate scopes", async () => {
const source = `Model Plate {
Concept Path Outline On XY { Start: Point2(0mm, 0mm) }
Profile Face From Outline
+ Boss MountBoss { On: Top Profile: Face Height: 8mm }
+ Pocket Recess { On: Top Profile: Face Depth: 4mm MinimumFloorThickness: 1mm }
Hole<Counterbore> Mount { Diameter: 8mm }
Pattern Mounts Over Specs { ShaftHole(Current) }
EdgeFinish Rim { Kind: Chamfer }
@@ -53,6 +55,8 @@ test("critical canonical syntax receives stable TextMate scopes", async () => {
return token.scopes;
};
assert.ok(scopeAt("Model").includes("keyword.declaration.firmament"));
+ assert.ok(scopeAt("Boss").includes("keyword.declaration.firmament"));
+ assert.ok(scopeAt("Pocket").includes("keyword.declaration.firmament"));
assert.ok(scopeAt("Concept Path").includes("keyword.declaration.compound.firmament"));
assert.ok(scopeAt("Counterbore").includes("entity.name.type.variant.firmament"));
assert.ok(scopeAt("Diameter:").includes("variable.other.property.firmament"));