Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Pocket: honour camelCase minimumFloorThickness instead of ignoring it

Claude476883bc8c48
diff --git a/Aetheris.Kernel.Firmament.Tests/BossPocketSemanticFeatureTests.cs b/Aetheris.Kernel.Firmament.Tests/BossPocketSemanticFeatureTests.cs
index 1b113e36..c77d608e 100644
--- a/Aetheris.Kernel.Firmament.Tests/BossPocketSemanticFeatureTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/BossPocketSemanticFeatureTests.cs
@@ -58,6 +58,21 @@ public sealed class BossPocketSemanticFeatureTests
pocket => { Assert.Equal("Pocket", pocket.Kind); Assert.Equal(6d, pocket.RemainingFloor); Assert.Equal("PrismaticSectionStack/Remove", pocket.MaterializationRoute); });
}
+ [Theory]
+ [InlineData("MinimumFloorThickness")]
+ [InlineData("minimumFloorThickness")]
+ public void PocketLocalMinimumFloor_IsEnforcedInEitherFieldSpelling(string field)
+ {
+ // The field reader admits camelCase; the floor policy must read the same spelling
+ // instead of silently falling back to the bounded default.
+ var source = FirmamentCorpusHarness.CanonicalMutationSource(File.ReadAllText(Fixture("Canonical/Features/Boss/boss-pocket-block.firmament")))
+ .Replace("MinimumFloorThickness: 2mm", $"{field}: 7mm", 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=Pocket.MinimumFloorThickness", StringComparison.Ordinal));
+ }
+
[Theory]
[InlineData("minimumFloorThickness", "7", "Template.minimumFloorThickness")]
[InlineData("minimumWallThickness", "7", "Template.minimumWallThickness")]
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentLanguageEdit.Authoring.cs b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentLanguageEdit.Authoring.cs
index 1ae9bfb2..905c9e57 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentLanguageEdit.Authoring.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/FirmamentLanguageEdit.Authoring.cs
@@ -111,7 +111,7 @@ public static partial class FirmamentLanguageEditService
var declarations = FirmamentLanguageOutlineService.Declarations(parse);
if (declarations.First(d => d.Id == profileId).ParentId != declarations.First(d => d.Id == bodyId).ParentId)
throw new FirmamentLanguageEditException("edit-profile-scope", "The pocket Profile and body must belong to the same container.");
- var pocket = $"Pocket {RequireIdentifier(op.Name ?? "Recess", "pocket name")} {{ on: Top; profile: {profile.Name.Text}; depth: {RequireValue(op.Value, "depth")}; minimumFloorThickness: 0mm; }}";
+ var pocket = $"Pocket {RequireIdentifier(op.Name ?? "Recess", "pocket name")} {{ on: Top; profile: {profile.Name.Text}; depth: {RequireValue(op.Value, "depth")}; }}";
if (body.Type.Name.Text == "Compose")
return InsertDeclaration(text, parse, new("insertDeclaration") { Parent = bodyId, Source = pocket });
if (body.Clauses.Count > 0 || BodyOf(body)?.Statements.Any(s => s is not FieldSyntax) == true)
diff --git a/Aetheris.Kernel.Firmament/Materializer/PrismaticProfileComposition.cs b/Aetheris.Kernel.Firmament/Materializer/PrismaticProfileComposition.cs
index c5623f14..3b132951 100644
--- a/Aetheris.Kernel.Firmament/Materializer/PrismaticProfileComposition.cs
+++ b/Aetheris.Kernel.Firmament/Materializer/PrismaticProfileComposition.cs
@@ -210,7 +210,7 @@ public static class PrismaticProfileCompositionParser
private static readonly Regex SemanticSupport = new(@"\bOn\s*:\s*(?<face>[A-Za-z_]\w*(?:\.Top)?|[+-][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 PocketMinimumFloor = new(@"\b[Mm]inimumFloorThickness\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 CncPolicyHead = new(@"\bConcept\s+Struct\s+(?<name>[A-Za-z_]\w*)\s*:\s*CncManufacturingPolicy\s*\{", RegexOptions.CultureInvariant);
private static readonly Regex HoleHeader = new(@"\bHole\s*<\s*(?<variant>\w+)\s*>\s+(?<n>\w+)\s*\{", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
@@ -1109,7 +1109,7 @@ public static class PrismaticProfileCompositionParser
{
var floor = PocketMinimumFloor.Match(canonical[0].Body!);
if (floor.Success) return (N(floor, "value"), "CncManufacturingPolicy.MinimumFloorThickness");
- var wall = Regex.Match(canonical[0].Body!, @"\bMinimumWallThickness\s*:\s*(?<value>[-+.\d]+)mm", RegexOptions.CultureInvariant);
+ var wall = Regex.Match(canonical[0].Body!, @"\b[Mm]inimumWallThickness\s*:\s*(?<value>[-+.\d]+)mm", RegexOptions.CultureInvariant);
if (wall.Success) return (N(wall, "value"), "CncManufacturingPolicy.MinimumWallThickness");
}