Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Add authored frame placements and fixed interface seating
Yuechen Li1f2891546568
diff --git a/Aetheris.Kernel.Firmament.Tests/Assembly/AssemblyAuthoringFoundationTests.cs b/Aetheris.Kernel.Firmament.Tests/Assembly/AssemblyAuthoringFoundationTests.csnew file mode 100644index 00000000..42df9ea8--- /dev/null+++ b/Aetheris.Kernel.Firmament.Tests/Assembly/AssemblyAuthoringFoundationTests.cs@@ -0,0 +1,225 @@+using Aetheris.Kernel.Firmament.Assembly;++namespace Aetheris.Kernel.Firmament.Tests.Assembly;++public sealed class AssemblyAuthoringFoundationTests+{+ [Fact]+ public void ReusableAssembliesSolveNamedFramesOnceInTheirLocalScope()+ {+ const string source = """+ Subassembly Unit {+ <Assembly Unit>+ <Part Pin = PinPart>+ Semantic Mount { DatumFrame Frame = [0,0,0] x [1,0,0] y [0,1,0] z [0,0,1]; }+ Placement { From: Mount.Frame; To: Offset.Frame; }+ </Part>+ </Assembly>+ FrameTransform Offset { From: World; TranslateLocal: [5mm,0mm,0mm]; }+ Expose { DatumFrame Mount = Pin.Mount.Frame; }+ Anchor: Unit;+ }+ Assembly Demo {+ <Assembly Demo>+ <Assembly First = Unit> Placement { From: Origin; To: World; TranslateLocal: [10mm,0mm,0mm]; } </Assembly>+ <Assembly Second = Unit> Placement { From: Origin; To: World; TranslateLocal: [20mm,0mm,0mm]; } </Assembly>+ </Assembly>+ Anchor: Demo;+ }+ """;+ var parsed = new AssemblyM0Parser().Parse(source);+ Assert.True(parsed.IsSuccess, string.Join("\n", parsed.Diagnostics));+ var result = new AssemblyM0Compiler().Compile(parsed.Source!);+ Assert.True(result.IsSuccess, string.Join("\n", result.Diagnostics));+ Assert.Single(result.Ir!.AssemblyDefinitions!);+ Assert.Equal(15, result.Ir.Instances.Single(i => i.Path.ToString() == "Demo.First.Pin").ResolvedTransform!.Matrix[12], 6);+ Assert.Equal(25, result.Ir.Instances.Single(i => i.Path.ToString() == "Demo.Second.Pin").ResolvedTransform!.Matrix[12], 6);+ }+ [Fact]+ public void FixedSeatingRequiresFrameMembersRatherThanCompositePorts()+ {+ var path = FirmamentCorpusHarness.ResolveFixtureFullPath("fixtures/Canonical/AssemblyInterfaces/AuthoringFoundation/published-ports.firmament");+ var source = File.ReadAllText(path).Replace("Placement { From: Bottom.Frame; To: PublishedPorts.Base.Top.Frame; }", "");+ source = source.Insert(source.LastIndexOf('}'), "Interface<Fixed> Seat { A: PublishedPorts.Base.Top; B: PublishedPorts.Child.Bottom.Frame; Gap: 0mm; }");+ var result = new AssemblyM1Pipeline().Compile(source, path);+ Assert.False(result.IsSuccess);+ Assert.Contains(result.Diagnostics, d => d.Code == "assembly-interface-seating-member-type");+ }++ [Fact]+ public void UndeclaredMateRolesAreRejected()+ {+ var source = Layout.Insert(Layout.LastIndexOf('}'), "Interface Mount { Role Moving requires DatumFrameCapable; Role Target requires DatumFrameCapable; Lower FrameCoincident Moving Target; } Mate Bad: Mount { Moving: Layout.Base.Mount.Frame; Target: Layout.Base.Mount.Frame; Extra: Layout.Base.Mount.Frame; }");+ var parsed = new AssemblyM0Parser().Parse(source);+ Assert.True(parsed.IsSuccess, string.Join("\n", parsed.Diagnostics));+ var result = new AssemblyM0Compiler().Compile(parsed.Source!);+ Assert.Contains(result.Diagnostics, d => d.Code == "assembly-mate-unknown-role");+ }+ [Theory]+ [InlineData("Gap: 2deg", "assembly-interface-invalid-seating")]+ [InlineData("Orientation: 123", "assembly-interface-invalid-seating")]+ [InlineData("Orientation: SameDirection; Orientation: OpposedDirection", "assembly-interface-invalid-seating")]+ [InlineData("Gap: 0mm; Clocking: NaNdeg", "assembly-interface-invalid-seating")]+ public void SeatingRejectsMalformedFields(string fields, string code)+ {+ var parsed = new AssemblyM0Parser().Parse(Layout.Insert(Layout.LastIndexOf('}'),+ $"Interface<Fixed> Bad {{ A: Layout.Base.Mount.Frame; B: Layout.Child; {fields}; }}"));+ Assert.Contains(parsed.Diagnostics, d => d.Code == code);+ }++ [Theory]+ [InlineData("DatumFrame Bad = Missing.Frame;", "assembly-semantic-unresolved-member")]+ [InlineData("UnknownMember Bad = 7mm;", "assembly-semantic-unresolved-member")]+ [InlineData("DatumFrame Frame = [0,0,0] x [1,0,0] y [0,1,0] z [0,0,1];", "assembly-semantic-duplicate-member")]+ public void PublishedPortsRejectUnresolvedAndDuplicateMembers(string extra, string code)+ {+ var path = FirmamentCorpusHarness.ResolveFixtureFullPath("fixtures/Canonical/AssemblyInterfaces/AuthoringFoundation/published-ports.firmament");+ var source = File.ReadAllText(path).Replace("Semantic Top {", "Semantic Top { " + extra);+ var result = new AssemblyM1Pipeline().Compile(source, path);+ Assert.False(result.IsSuccess);+ Assert.Contains(result.Diagnostics, d => d.Code == code);+ }++ [Fact]+ public void LayoutRejectsAnotherPlacementAuthority()+ {+ var source = Layout.Insert(Layout.LastIndexOf('}'), "Interface<Fixed> Seat { A: Layout.Base.Mount.Frame; B: Layout.Child; }");+ var parsed = new AssemblyM0Parser().Parse(source);+ var result = new AssemblyM0Compiler().Compile(parsed.Source!);+ Assert.Contains(result.Diagnostics, d => d.Code == "assembly-placement-authority-conflict");+ }++ [Fact]+ public void ReversedFixedAnchorStillRejectsTwoPlacementAuthorities()+ {+ var source = Layout.Replace("Placement { From: Origin; To: Tilt.Frame; TranslateLocal: [0mm,0mm,3mm]; }", "")+ .Replace("Anchor: Layout;", "Anchor: Layout.Child;");+ source = source.Insert(source.LastIndexOf('}'), "Interface<Fixed> Seat { A: Layout.Base.Mount.Frame; B: Layout.Child; }");+ var parsed = new AssemblyM0Parser().Parse(source);+ var result = new AssemblyM0Compiler().Compile(parsed.Source!);+ Assert.Contains(result.Diagnostics, d => d.Code == "assembly-placement-authority-conflict");+ }++ [Fact]+ public void LayoutDependencyCycleFailsInsteadOfLeavingUnderconstrainedInstances()+ {+ var source = Layout.Replace("To: World", "To: Layout.Child.Mount.Frame")+ .Replace("<Part Child = ChildPart>", "<Part Child = ChildPart> Semantic Mount { DatumFrame Frame = [0,0,0] x [1,0,0] y [0,1,0] z [0,0,1]; }");+ var parsed = new AssemblyM0Parser().Parse(source);+ var result = new AssemblyM0Compiler().Compile(parsed.Source!);+ Assert.Contains(result.Diagnostics, d => d.Code == "assembly-layout-unresolved");+ }+ [Fact]+ public void FixedSeatingIsOneRelationAndZeroPosePreservesGapAndClocking()+ {+ var path = FirmamentCorpusHarness.ResolveFixtureFullPath("fixtures/Canonical/AssemblyInterfaces/AuthoringFoundation/published-ports.firmament");+ var source = File.ReadAllText(path).Replace("Placement { From: Bottom.Frame; To: PublishedPorts.Base.Top.Frame; }", "");+ var index=source.LastIndexOf('}');+ source=source.Insert(index,"Interface<Fixed> Seat { A: PublishedPorts.Base.Top.Frame; B: PublishedPorts.Child.Bottom.Frame; Gap: 2mm; Clocking: 90deg; Orientation: OpposedDirection; }");+ var compiled=new AssemblyM1Pipeline().Compile(source,path);+ Assert.True(compiled.IsSuccess,string.Join("\n",compiled.Diagnostics));+ var child=compiled.Ir!.Instances.Single(i=>i.Path.ToString()=="PublishedPorts.Child");+ Assert.Equal(16,child.ResolvedTransform!.Matrix[14],6);+ Assert.Equal(1,child.ResolvedTransform.Matrix[1],6);+ Assert.Equal(-1,child.ResolvedTransform.Matrix[10],6);+ Assert.Single(compiled.Ir.Joints!);+ var posed=AssemblyKinematics.Evaluate(compiled.Ir,new Dictionary<string,double>());+ Assert.True(posed.IsSuccess,string.Join("\n",posed.Diagnostics));+ Assert.Equal(child.ResolvedTransform.Matrix,posed.Instances.Single(i=>i.Path.ToString()=="PublishedPorts.Child").ResolvedTransform!.Matrix);+ }++ [Fact]+ public void AssemblyPatternsUseCheckedSetsAndPreserveKeyedIdentity()+ {+ const string source="""+ Record Site { X: Length }+ Static Sites: Set<Site> { Left => Site { X: -5mm } Right => Site { X: 5mm } }+ Assembly Patterned {+ <Assembly Patterned>+ Pattern Poles Over Sites {+ site => <Part Pole = PolePart>+ Placement { From: Origin; To: World; TranslateLocal: [site.X,0mm,0mm]; }+ </Part>+ }+ </Assembly>+ Anchor: Patterned;+ }+ """;+ AssemblyCompilationResult Compile(string text)+ {+ var parsed=new AssemblyM0Parser().Parse(text);+ Assert.True(parsed.IsSuccess,string.Join("\n",parsed.Diagnostics));+ var result=new AssemblyM0Compiler().Compile(parsed.Source!);+ Assert.True(result.IsSuccess,string.Join("\n",result.Diagnostics));+ return result;+ }+ var first=Compile(source);+ var reordered=Compile(source.Replace("Left => Site { X: -5mm } Right => Site { X: 5mm }","Right => Site { X: 5mm } Left => Site { X: -5mm }"));+ foreach (var key in new[]{"Left","Right"})+ {+ var a=first.Ir!.Instances.Single(i=>i.Path.ToString()==$"Patterned.Poles.{key}.Pole");+ var b=reordered.Ir!.Instances.Single(i=>i.Path.ToString()==a.Path.ToString());+ Assert.Equal(a.StableId,b.StableId);+ Assert.Equal(a.ResolvedTransform!.Matrix,b.ResolvedTransform!.Matrix);+ Assert.Contains(a.Provenance,p=>p.Stage=="assembly-pattern" && p.Evidence.Contains("Key:"+key));+ }+ Assert.Single(first.Ir!.Patterns!);+ var invalid=new AssemblyM0Parser().Parse(source.Replace("X: -5mm","X: 90deg"));+ Assert.False(invalid.IsSuccess);+ Assert.Contains(invalid.Diagnostics,d=>d.Message.Contains("field-type-mismatch"));+ }+ [Fact]+ public void TemplatePublishesSpecializedPortsAndSharesExactDefinition()+ {+ var path = FirmamentCorpusHarness.ResolveFixtureFullPath("fixtures/Canonical/AssemblyInterfaces/AuthoringFoundation/published-ports.firmament");+ var compiled = new AssemblyM1Pipeline().CompileFile(path);+ Assert.True(compiled.IsSuccess,string.Join("\n",compiled.Diagnostics));+ var child = compiled.Ir!.Instances.Single(i => i.Path.ToString() == "PublishedPorts.Child");+ Assert.Equal(14,child.ResolvedTransform!.Matrix[14],6);+ Assert.Single(compiled.Geometry!.DefinitionBodies);+ Assert.True(child.SemanticRoot.ExposedMembers.ContainsKey("Top"));+ }+ private const string Layout = """+ Assembly Layout {+ <Assembly Layout>+ <Part Base = BasePart>+ Placement { From: Origin; To: World; TranslateLocal: [10mm,20mm,30mm]; RotateLocal: { Axis: Z; Angle: 90deg } }+ Semantic Mount { DatumFrame Frame = [2,0,0] x [1,0,0] y [0,1,0] z [0,0,1]; }+ </Part>+ <Part Child = ChildPart>+ Placement { From: Origin; To: Tilt.Frame; TranslateLocal: [0mm,0mm,3mm]; }+ </Part>+ </Assembly>+ FrameTransform Tilt { From: Layout.Base.Mount.Frame; TranslateLocal: [1mm,0mm,0mm]; RotateLocal: { Axis: X; Angle: 90deg } }+ Anchor: Layout;+ }+ """;++ [Fact]+ public void LayoutComposesLocalFramesThroughOrdinaryConstraints()+ {+ var parsed = new AssemblyM0Parser().Parse(Layout);+ Assert.True(parsed.IsSuccess, string.Join("\n",parsed.Diagnostics));+ var compiled = new AssemblyM0Compiler().Compile(parsed.Source!);+ Assert.True(compiled.IsSuccess,string.Join("\n",compiled.Diagnostics));+ var child = compiled.Ir!.Instances.Single(i => i.Path.ToString() == "Layout.Child");+ Assert.Equal(PlacementAuthority.AuthoredFrame,child.PlacementAuthority);+ Assert.Equal(13,child.ResolvedTransform!.Matrix[12],6);+ Assert.Equal(23,child.ResolvedTransform.Matrix[13],6);+ Assert.Equal(30,child.ResolvedTransform.Matrix[14],6);+ Assert.Empty(compiled.Ir.Joints!); // Layout is not a mechanical Interface.+ }++ [Theory]+ [InlineData("TranslateLocal: [10mm,20mm,30mm]", "TranslateLocal: [10,20mm,30mm]", "assembly-frame-invalid-unit")]+ [InlineData("To: Tilt.Frame", "To: Missing.Frame", "assembly-frame-unresolved")]+ [InlineData("From: Layout.Base.Mount.Frame", "From: Tilt.Frame", "assembly-frame-cycle")]+ [InlineData("To: Tilt.Frame", "To: Tilt.Frame; Normal: [0,0,1]; Up: [0,0,2]", "assembly-frame-invalid-basis")]+ [InlineData("To: Tilt.Frame", "To: Tilt.Frame; Unknown: 7mm", "assembly-frame-invalid-fields")]+ public void InvalidFrameIntentFailsClosed(string before,string after,string code)+ {+ var parsed = new AssemblyM0Parser().Parse(Layout.Replace(before,after));+ var diagnostics = parsed.Diagnostics.Concat(parsed.Source is null ? [] : new AssemblyM0Compiler().Compile(parsed.Source).Diagnostics);+ Assert.Contains(diagnostics,d => d.Code == code);+ }+}diff --git a/Aetheris.Kernel.Firmament.Tests/Assembly/AssemblyKinematicsX0Tests.cs b/Aetheris.Kernel.Firmament.Tests/Assembly/AssemblyKinematicsX0Tests.csindex b96cd15b..deb677e0 100644--- a/Aetheris.Kernel.Firmament.Tests/Assembly/AssemblyKinematicsX0Tests.cs+++ b/Aetheris.Kernel.Firmament.Tests/Assembly/AssemblyKinematicsX0Tests.cs@@ -181,8 +181,9 @@ public sealed class AssemblyKinematicsX0Tests{var schema = FirmamentSemanticSchemas.Get($"Interface<{family}>");Assert.NotNull(schema);- Assert.Equal(["A", "B"], schema.Fields.Select(field => field.Name));- Assert.All(schema.Fields, field => Assert.True(field.Required));+ Assert.Equal(["A", "B"], schema.Fields.Where(field => field.Required).Select(field => field.Name));+ Assert.Equal(family == "Fixed" ? ["Clocking", "Gap", "Orientation"] : Array.Empty<string>(),+ schema.Fields.Where(field => !field.Required).Select(field => field.Name));}const string source = "Assembly A { Interface<Revolute> Joint { ";var completion = FirmamentLanguageService.Complete(source, "arm.firmament", "1", source.Length);diff --git a/Aetheris.Kernel.Firmament.Tests/Assembly/GuitarSurfacingWitnessTests.cs b/Aetheris.Kernel.Firmament.Tests/Assembly/GuitarSurfacingWitnessTests.csindex 0a4f3c19..7623369b 100644--- a/Aetheris.Kernel.Firmament.Tests/Assembly/GuitarSurfacingWitnessTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/Assembly/GuitarSurfacingWitnessTests.cs@@ -14,6 +14,14 @@ public sealed class GuitarSurfacingWitnessTestsAssert.True(compiled.IsSuccess, string.Join("\n", compiled.Diagnostics.Select(d => d.Message)));var mesh = AssemblyDisplayMeshExporter.Export(compiled);Assert.Equal(107, mesh.Occurrences.Count(o => o.DefinitionId is not null));+ Assert.Equal(7, compiled.Ir!.Patterns!.Count);+ Assert.Single(compiled.Ir.Joints!);+ Assert.DoesNotContain(File.ReadAllText(path), "LegacyExplicit");+ Assert.Contains(compiled.Ir.Instances, i => i.Path.ToString() == "GuitarX0.TunerPosts.TunerPost00.TunerPost"+ && i.Provenance.Any(p => p.Stage == "assembly-pattern"));+ var head = compiled.Ir.Instances.Single(i => i.Path.ToString() == "GuitarX0.Headstock");+ Assert.Equal(660, head.ResolvedTransform!.Matrix[13], 6);+ Assert.Equal(48, head.ResolvedTransform.Matrix[14], 6);Assert.Equal(6, mesh.Definitions.Count(d => d.Identity.StartsWith("GuitarString<", StringComparison.Ordinal)));var surfaced = mesh.Definitions.Where(d => d.Identity.StartsWith("SectionChainFile", StringComparison.Ordinal)).ToArray();Assert.Equal(4, surfaced.Length);diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentSemanticSchemaTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentSemanticSchemaTests.csindex 3cff578b..5895c8bb 100644--- a/Aetheris.Kernel.Firmament.Tests/FirmamentSemanticSchemaTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentSemanticSchemaTests.cs@@ -8,7 +8,7 @@ public sealed class FirmamentSemanticSchemaTestspublic void GeneratedRegistry_IsStableOptInAndCoversFirstConstructs(){Assert.Equal("firmament-semantic-schema/1", FirmamentSemanticSchemas.Version);- Assert.Equal(["Box", "Concept", "Helix", "Hole", "Interface<Fixed>", "Interface<Prismatic>", "Interface<Revolute>", "Loft", "Perforation", "Thread"], FirmamentSemanticSchemas.All.Select(s => s.Name));+ Assert.Equal(["FrameTransform", "Placement", "Box", "Concept", "Helix", "Hole", "Interface<Fixed>", "Interface<Prismatic>", "Interface<Revolute>", "Loft", "Perforation", "Thread"], FirmamentSemanticSchemas.All.Select(s => s.Name));var hole = Assert.IsType<FirmamentConstructSchema>(FirmamentSemanticSchemas.Get("Hole"));var diameter = Assert.Single(hole.Fields, f => f.Name == "Diameter");Assert.Equal("Hole.Diameter", diameter.Id.Value);diff --git a/Aetheris.Kernel.Firmament/Assembly/AssemblyFrameAuthoring.cs b/Aetheris.Kernel.Firmament/Assembly/AssemblyFrameAuthoring.csnew file mode 100644index 00000000..0a23793a--- /dev/null+++ b/Aetheris.Kernel.Firmament/Assembly/AssemblyFrameAuthoring.cs@@ -0,0 +1,181 @@+using System.Globalization;+using System.Text.RegularExpressions;+using Aetheris.Kernel.Core.Math;+using Aetheris.Semantics;++namespace Aetheris.Kernel.Firmament.Assembly;++/// <summary>Bounded frame authoring; lowers layout to the existing frame constraint solver.</summary>+internal static class AssemblyFrameAuthoring+{+ internal static AssemblyFrameTransformSource? Parse(string name, string body, string targetField,+ string sourceIdentity, List<AssemblyDiagnostic> diagnostics)+ {+ var remaining = body;+ string? Field(string pattern, string group = "value")+ {+ var matches = Regex.Matches(remaining, pattern, RegexOptions.CultureInvariant);+ if (matches.Count > 1) diagnostics.Add(new("assembly-frame-duplicate-field", $"Frame '{name}' repeats a field."));+ if (matches.Count == 0) return null;+ remaining = Regex.Replace(remaining, pattern, "", RegexOptions.CultureInvariant);+ return matches[0].Groups[group].Value;+ }+ var from = Field($@"\b{targetField}\s*:\s*(?<value>[A-Za-z_]\w*(?:\.[A-Za-z_]\w*)*)\s*;?");+ var translate = Field(@"\bTranslateLocal\s*:\s*\[(?<value>[^]]+)\]\s*;?");+ var normal = Field(@"\bNormal\s*:\s*\[(?<value>[^]]+)\]\s*;?");+ var up = Field(@"\bUp\s*:\s*\[(?<value>[^]]+)\]\s*;?");+ var rotate = Field(@"\bRotateLocal\s*:\s*\{(?<value>[^{}]*)\}\s*;?");+ var axis = "Z"; double angle = 0;+ if (rotate is not null)+ {+ var m = Regex.Match(rotate, @"^\s*Axis\s*:\s*(?<axis>X|Y|Z)\s*;\s*Angle\s*:\s*(?<angle>[-+0-9.eE]+)deg\s*;?\s*$");+ if (!m.Success || !double.TryParse(m.Groups["angle"].Value, NumberStyles.Float, CultureInfo.InvariantCulture, out angle) || !double.IsFinite(angle))+ diagnostics.Add(new("assembly-frame-invalid-rotation", $"Frame '{name}' requires Axis X/Y/Z and a finite Angle in deg."));+ axis = m.Success ? m.Groups["axis"].Value : "Z";+ }+ if (from is null || !string.IsNullOrWhiteSpace(remaining.Replace(";", "")))+ diagnostics.Add(new("assembly-frame-invalid-fields", $"Frame '{name}' requires {targetField}; unknown or malformed fields: {remaining.Trim()}."));+ if ((normal is null) != (up is null)) diagnostics.Add(new("assembly-frame-invalid-basis", $"Frame '{name}' requires both Normal and Up."));+ double[]? Vector(string? value, bool lengths)+ {+ if (value is null) return null;+ var values = value.Split(',', StringSplitOptions.TrimEntries);+ var result = new double[3];+ if (values.Length != 3) { diagnostics.Add(new("assembly-frame-invalid-vector", $"Frame '{name}' requires three components.")); return null; }+ for (var i = 0; i < 3; i++)+ {+ var text = values[i];+ if (lengths && !text.EndsWith("mm", StringComparison.Ordinal))+ diagnostics.Add(new("assembly-frame-invalid-unit", $"Frame '{name}' translation components require mm."));+ if (lengths && text.EndsWith("mm", StringComparison.Ordinal)) text = text[..^2];+ if (!double.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out result[i]) || !double.IsFinite(result[i]))+ diagnostics.Add(new("assembly-frame-invalid-vector", $"Frame '{name}' requires finite numeric components."));+ }+ return result;+ }+ return from is null ? null : new(name, from, Vector(translate, true) ?? [0,0,0], axis, angle,+ Vector(normal, false), Vector(up, false), SemanticSourceSpan.Generated(sourceIdentity));+ }++ internal static (AssemblySource Source, IReadOnlyList<AssemblyInstanceIr> Instances) Lower(+ AssemblySource source, IReadOnlyList<AssemblyInstanceIr> original, List<AssemblyDiagnostic> diagnostics)+ {+ var instances = original.ToDictionary(i => i.Path.ToString(), StringComparer.Ordinal);+ var named = (source.FrameTransforms ?? []).GroupBy(f => f.Name).ToDictionary(g => g.Key, g => g.First(), StringComparer.Ordinal);+ foreach (var group in (source.FrameTransforms ?? []).GroupBy(f => f.Name).Where(g => g.Count() > 1))+ diagnostics.Add(new("assembly-frame-duplicate-name", $"FrameTransform '{group.Key}' is duplicated."));+ foreach (var name in named.Keys.Where(n => n is "World" or "Origin" or "Parent" || n.StartsWith("__Layout", StringComparison.Ordinal)))+ diagnostics.Add(new("assembly-frame-reserved-name", $"FrameTransform '{name}' uses a reserved name."));+ var interfaces = source.Interfaces.ToList(); var mates = source.Mates.ToList();+ var root = original.Single(i => i.ParentStableId is null);+ (AssemblyInstanceIr Owner, Transform3D Frame)? Resolve(string path, string context, HashSet<string> visiting)+ {+ var key = path.EndsWith(".Frame", StringComparison.Ordinal) ? path[..^6] : path;+ if (named.TryGetValue(key, out var transform))+ {+ if (!visiting.Add(key)) { diagnostics.Add(new("assembly-frame-cycle", $"FrameTransform cycle at '{key}'.")); return null; }+ var resolved = Resolve(transform.From, root.Path.ToString(), visiting);+ visiting.Remove(key);+ return resolved is { } value ? (value.Owner, Compose(value.Frame, transform, diagnostics)) : null;+ }+ if (path == "World") return (instances[root.Path.ToString()], Transform3D.Identity);+ if (path == "Origin") return (instances[context], Transform3D.Identity);+ if (path == "Parent")+ {+ var parent=instances[context].ParentStableId;+ if (parent is not null) return (instances.Values.Single(i=>i.StableId==parent),Transform3D.Identity);+ diagnostics.Add(new("assembly-frame-unresolved",$"'{context}' has no parent frame.")); return null;+ }+ if (!path.StartsWith(root.Path + ".", StringComparison.Ordinal) && path != root.Path.ToString())+ {+ var self = instances[context];+ var candidate = context + "." + path;+ if (!AssemblyM0Compiler.TryResolve(AssemblyPath.Parse(candidate), instances.Values, out _))+ candidate = self.ParentStableId is null ? root.Path + "." + path+ : instances.Values.Single(i => i.StableId == self.ParentStableId).Path + "." + path;+ path = candidate;+ }+ if (!AssemblyM0Compiler.TryResolve(AssemblyPath.Parse(path), instances.Values, out var reference)+ || !reference!.Value.TryBinding<ExactDatumFrameBinding>(out var frame))+ { diagnostics.Add(new("assembly-frame-unresolved", $"'{context}' cannot resolve exact published DatumFrame '{path}'.")); return null; }+ var owner = instances.Values.Where(i => path == i.Path.ToString() || path.StartsWith(i.Path + ".", StringComparison.Ordinal))+ .OrderByDescending(i => i.Path.Segments.Count).First();+ return (owner, Matrix(frame));+ }+ AssemblyPath Publish(AssemblyInstanceIr owner, string name, Transform3D frame, string origin)+ {+ owner = instances[owner.Path.ToString()];+ var m = frame.ToRowMajor(); var id = owner.SemanticRoot.StableIdentity + ":" + name;+ var value = new SemanticValue(id, new("AssemblyDatumFrame"), [new DatumFrameCapability()],+ [new ExactDatumFrameBinding(m[12],m[13],m[14],m[0],m[1],m[2],m[4],m[5],m[6],m[8],m[9],m[10],id)],+ provenance: [new("frame-layout", origin, name, SemanticSourceSpan.Generated(source.SourceIdentity))], exposedName: name);+ var semantic = owner.SemanticRoot;+ var updated = new SemanticValue(semantic.StableIdentity, semantic.Type, semantic.Capabilities.Values, semantic.Bindings,+ semantic.ExposedMembers.Values.Append(value), semantic.Provenance, semantic.AuthoredSourceSpan, semantic.GeneratedSourceSpan, semantic.ExposedName);+ instances[owner.Path.ToString()] = owner with { SemanticRoot = updated };+ return owner.Path.Append(name);+ }+ foreach (var (member, path) in Walk(source.Root, source.Root.Name))+ {+ if (member.FramePlacement is not { } layout) continue;+ var owner = instances[path];+ if (owner.ParentStableId is null || source.Anchor.ToString() == path || source.Anchor.ToString().StartsWith(path + ".", StringComparison.Ordinal))+ diagnostics.Add(new("assembly-placement-authority-conflict", $"Anchored occurrence '{path}' cannot also have authored placement."));+ bool DrivesOccurrence(MateSource mate)+ {+ var definition = source.Interfaces.FirstOrDefault(d => d.Name == mate.InterfaceName);+ var movingRole = "B";+ if (definition?.Family == MechanicalInterfaceFamily.Fixed)+ {+ var b = mate.Roles.FirstOrDefault(r => r.Role == "B");+ var bOwner = b is null ? null : original.Where(i => b.Participant.ToString() == i.Path.ToString()+ || b.Participant.ToString().StartsWith(i.Path + ".", StringComparison.Ordinal))+ .OrderByDescending(i => i.Path.Segments.Count).FirstOrDefault();+ if (bOwner is not null && (source.Anchor.ToString() == bOwner.Path.ToString()+ || source.Anchor.ToString().StartsWith(bOwner.Path + ".", StringComparison.Ordinal))) movingRole = "A";+ }+ return mate.Roles.Any(r => (r.Role == movingRole || r.Role == "Moving")+ && (r.Participant.ToString() == path || r.Participant.ToString().StartsWith(path + ".", StringComparison.Ordinal)));+ }+ if (member.ExplicitTransform is not null || source.Mates.Any(DrivesOccurrence))+ diagnostics.Add(new("assembly-placement-authority-conflict", $"Occurrence '{path}' has both authored placement and another placement driver."));+ var from = Resolve(layout.From, path, []); var to = Resolve(layout.Target.From, path, []);+ if (from is null || to is null) continue;+ if (from.Value.Owner.StableId != owner.StableId || to.Value.Owner.StableId == owner.StableId)+ { diagnostics.Add(new("assembly-placement-invalid-owner", $"Placement '{path}' requires a source frame on itself and a target on another occurrence.")); continue; }+ var suffix = Convert.ToHexString(System.Security.Cryptography.SHA256.HashData(System.Text.Encoding.UTF8.GetBytes(path)))[..16];+ var a = Publish(owner, "__LayoutSource" + suffix, from.Value.Frame, layout.From);+ var b = Publish(to.Value.Owner, "__LayoutTarget" + suffix, Compose(to.Value.Frame, layout.Target, diagnostics), layout.Target.From);+ var name = "__Layout" + suffix;+ interfaces.Add(new("interface:" + name, name, [new("Moving", ["DatumFrameCapable"]),new("Target", ["DatumFrameCapable"])],+ [new(PlacementConstraintKind.FrameCoincident,"Moving",".","Target",".")], SourceSpan: layout.Target.SourceSpan));+ mates.Add(new(name,name,[new("Moving",a),new("Target",b)],layout.Target.SourceSpan));+ }+ // Validate unused named transforms too: a malformed/cyclic declaration must not disappear.+ foreach (var name in named.Keys) Resolve(name + ".Frame", root.Path.ToString(), []);+ return (source with { Interfaces = interfaces, Mates = mates }, original.Select(i => instances[i.Path.ToString()]).ToArray());+ }++ private static IEnumerable<(AssemblyMemberSource Member, string Path)> Walk(AssemblyMemberSource member, string path)+ {+ yield return (member,path);+ foreach (var child in member.Children) foreach (var item in Walk(child,path + "." + child.Name)) yield return item;+ }+ internal static Transform3D Matrix(ExactDatumFrameBinding f) => Transform3D.FromRowMajor(+ [f.XAxisX,f.XAxisY,f.XAxisZ,0,f.YAxisX,f.YAxisY,f.YAxisZ,0,f.ZAxisX,f.ZAxisY,f.ZAxisZ,0,f.OriginX,f.OriginY,f.OriginZ,1]);+ internal static Transform3D Compose(Transform3D frame, AssemblyFrameTransformSource spec, List<AssemblyDiagnostic> diagnostics)+ {+ var basis = Transform3D.Identity;+ if (spec.Normal is { } n && spec.Up is { } u)+ {+ var z = new Vector3D(n[0],n[1],n[2]); var up = new Vector3D(u[0],u[1],u[2]);+ if (!z.TryNormalize(out z) || !(up - z * up.Dot(z)).TryNormalize(out var y))+ { diagnostics.Add(new("assembly-frame-invalid-basis", $"Frame '{spec.Name}' has zero Normal or parallel Up.")); return frame; }+ var x = y.Cross(z);+ basis = Transform3D.FromRowMajor([x.X,x.Y,x.Z,0,y.X,y.Y,y.Z,0,z.X,z.Y,z.Z,0,0,0,0,1]);+ }+ var radians = spec.RotationDegrees * Math.PI / 180;+ var rotation = spec.RotationAxis switch { "X" => Transform3D.CreateRotationX(radians), "Y" => Transform3D.CreateRotationY(radians), _ => Transform3D.CreateRotationZ(radians) };+ return rotation * basis * Transform3D.CreateTranslation(new(spec.Translation[0],spec.Translation[1],spec.Translation[2])) * frame;+ }+}diff --git a/Aetheris.Kernel.Firmament/Assembly/AssemblyM0Compiler.cs b/Aetheris.Kernel.Firmament/Assembly/AssemblyM0Compiler.csindex b985e0dc..ecdb1fcf 100644--- a/Aetheris.Kernel.Firmament/Assembly/AssemblyM0Compiler.cs+++ b/Aetheris.Kernel.Firmament/Assembly/AssemblyM0Compiler.cs@@ -27,6 +27,7 @@ public sealed class AssemblyM0Compilervar diagnostics = new List<AssemblyDiagnostic>();var bindWatch = Stopwatch.StartNew();var instances = BindInstances(source, diagnostics);+ (source, instances) = AssemblyFrameAuthoring.Lower(source, instances, diagnostics);bindWatch.Stop();var byPath = instances.ToDictionary(x => x.Path.ToString(), StringComparer.Ordinal);var interfaces = source.Interfaces.ToDictionary(x => x.Name, StringComparer.Ordinal);@@ -79,7 +80,7 @@ public sealed class AssemblyM0Compiler.OrderBy(solution => solution.MateStableId, StringComparer.Ordinal).ToArray();var ir = new AssemblyIr("aetheris/assembly-ir/m0", $"assembly:{source.Name}", source.Name,instances.Single(x => x.ParentStableId is null).StableId, instances, source.Interfaces, mates,- constraints, placements, relations, stackups, fits, diagnostics, assemblyDefinitions, panelMateEvidence, datums, datumSolutions, source.SourceDependencies, joints);+ constraints, placements, relations, stackups, fits, diagnostics, assemblyDefinitions, panelMateEvidence, datums, datumSolutions, source.SourceDependencies, joints, source.Patterns);return new(ir, diagnostics, perf);static string SemanticPath(AssemblyInstanceIr instance, SemanticValue value)@@ -130,7 +131,16 @@ public sealed class AssemblyM0Compilerdiagnostics.Add(new("assembly-instance-path-collision", "Assembly contains duplicate deterministic instance paths."));return flat.Select(x => new AssemblyInstanceIr(x.id, x.path, x.member.Kind, x.member.DefinitionIdentity, x.parent,flat.Where(c => c.parent == x.id).Select(c => c.id).Order(StringComparer.Ordinal).ToArray(), x.semantic,- x.member.ExplicitTransform, null, x.member.Provenance ?? [], x.member.PlacementAuthority, x.member.IsEncapsulatedDefinition)).ToArray();+ x.member.ExplicitTransform, null, [.. x.member.Provenance ?? [], .. PatternProvenance(x.path)], x.member.PlacementAuthority, x.member.IsEncapsulatedDefinition)).ToArray();++ IEnumerable<SemanticProvenance> PatternProvenance(AssemblyPath path)+ {+ foreach (var pattern in source.Patterns ?? [])+ foreach (var association in pattern.Associations ?? [])+ if (Enumerable.Range(0,Math.Max(0,path.Segments.Count-1)).Any(i => path.Segments[i]==pattern.Name && path.Segments[i+1]==association.SourceEntry))+ yield return new("assembly-pattern",association.GeneratedId,$"Set:{association.SourceSet};Key:{association.SourceEntry};Row:{association.SourceValue}",+ new(source.SourceIdentity,association.Provenance.Start,association.Provenance.Length));+ }}private static SemanticValue InstanceScope(AssemblyMemberSource member, AssemblyPath path, string sourceIdentity)@@ -159,6 +169,11 @@ public sealed class AssemblyM0Compilervar duplicate = mate.Roles.GroupBy(x => x.Role, StringComparer.Ordinal).FirstOrDefault(x => x.Count() > 1);if (duplicate is not null) diagnostics.Add(new(DuplicateRole, $"Mate '{mate.Name}' assigns Role '{duplicate.Key}' more than once."));var valid = duplicate is null;+ foreach (var assignment in mate.Roles.Where(r => !definition.Roles.Any(d => d.Name == r.Role)))+ {+ valid = false;+ diagnostics.Add(new("assembly-mate-unknown-role", $"Mate '{mate.Name}' assigns undeclared Role '{assignment.Role}'."));+ }var endpoints = new List<MateEndpointIr>();foreach (var role in definition.Roles){@@ -176,6 +191,12 @@ public sealed class AssemblyM0Compilervar frameRevolute = definition.Family == MechanicalInterfaceFamily.Revolute&& reference!.Value.TryBinding<ExactDatumFrameBinding>(out _);var requiredCapabilities = frameRevolute ? ["DatumFrameCapable"] : role.RequiredCapabilities;+ if (definition.Seating is not null && (reference!.Value.Type.Name != "AssemblyDatumFrame"+ || !reference.Value.TryBinding<ExactDatumFrameBinding>(out _)))+ {+ valid = false;+ diagnostics.Add(new("assembly-interface-seating-member-type", $"Fixed seating Role '{role.Name}' requires an exact DatumFrame member."));+ }var missing = requiredCapabilities.Where(c => !HasCapability(reference!.Value, c)).ToArray();if (reference!.Value.Type.Name == "Gear" && definition.Family != MechanicalInterfaceFamily.Gear)missing = [.. missing, $"endpoint type {definition.Family} (Gear is not implicitly coerced)"];@@ -349,7 +370,8 @@ public sealed class AssemblyM0Compilercontinue;}}- result.Add(new($"constraint:{mate.StableId}:{index:D2}", requirement.Kind, mate.StableId, firstId, secondId, requirement.OffsetMm, 0, "admitted", requirement.Orientation));+ result.Add(new($"constraint:{mate.StableId}:{index:D2}", requirement.Kind, mate.StableId, firstId, secondId, requirement.OffsetMm, 0, "admitted", requirement.Orientation,+ definition.Seating is null ? null : firstId,definition.Seating));}}return result;@@ -429,8 +451,8 @@ public sealed class AssemblyM0Compiler}result.Add(new(mate.StableId, mate.Name, family, parent.StableId, child.StableId,parentSemanticId, childSemanticId,- new(FrameMatrix(aFrame, frame.Orientation).ToRowMajor()),- new(FrameMatrix(bFrame, DatumOrientationRelation.SameDirection).ToRowMajor()),+ new((frame.Seating is null ? FrameMatrix(aFrame,frame.Orientation) : frame.SeatFrameSemanticId==parentSemanticId ? SeatMatrix(aFrame,frame.Seating) : FrameMatrix(aFrame,DatumOrientationRelation.SameDirection)).ToRowMajor()),+ new((frame.Seating is not null && frame.SeatFrameSemanticId==childSemanticId ? SeatMatrix(bFrame,frame.Seating) : FrameMatrix(bFrame, DatumOrientationRelation.SameDirection)).ToRowMajor()),family == MechanicalInterfaceFamily.Fixed ? 0 : 1));}foreach (var group in result.Where(joint => joint.DegreesOfFreedom == 1)@@ -562,7 +584,11 @@ public sealed class AssemblyM0Compilerif (overconstrained.Contains(instance.StableId)){ results.Add(new(instance.StableId, PlacementStatus.Overconstrained, null, [], [], relevant.Select(x => x.StableId).ToArray())); continue; }if (relevant.Length == 0 || !known.TryGetValue(instance.StableId, out var transform))- { results.Add(new(instance.StableId, PlacementStatus.Unresolved, null, ["X", "Y", "Z"], ["X", "Y", "Z"], relevant.Select(x => x.StableId).ToArray())); continue; }+ {+ if (instance.PlacementAuthority==PlacementAuthority.AuthoredFrame)+ diagnostics.Add(new("assembly-layout-unresolved",$"Authored frame placement '{instance.Path}' is unresolved; check dependency cycles."));+ results.Add(new(instance.StableId, PlacementStatus.Unresolved, null, ["X", "Y", "Z"], ["X", "Y", "Z"], relevant.Select(x => x.StableId).ToArray())); continue;+ }var hasFrame = relevant.Any(x => x.Kind == PlacementConstraintKind.FrameCoincident);var hasAxis = relevant.Any(x => x.Kind is PlacementConstraintKind.AxisCoincident or PlacementConstraintKind.AxisAligned);var hasPlane = relevant.Any(x => x.Kind == PlacementConstraintKind.PlaneCoincident);@@ -577,7 +603,9 @@ public sealed class AssemblyM0Compilervar status = unadmittedT.Length == 0 && unadmittedR.Length == 0 ? PlacementStatus.Resolved : PlacementStatus.Underconstrained;if (status == PlacementStatus.Underconstrained)diagnostics.Add(new(Underconstrained, $"Instance '{instance.Path}' retains translations [{string.Join(",", unadmittedT)}] and rotations [{string.Join(",", unadmittedR)}].", AssemblyDiagnosticSeverity.Warning));- results.Add(new(instance.StableId, status, transform, unadmittedT, unadmittedR, relevant.Select(x => x.StableId).ToArray(), PlacementAuthority.MateDerived));+ if (instance.PlacementAuthority == PlacementAuthority.AuthoredFrame && status != PlacementStatus.Resolved)+ diagnostics.Add(new("assembly-layout-unresolved", $"Authored frame placement '{instance.Path}' is not resolved; check placement dependency cycles."));+ results.Add(new(instance.StableId, status, transform, unadmittedT, unadmittedR, relevant.Select(x => x.StableId).ToArray(), instance.PlacementAuthority));}return results;}@@ -605,6 +633,11 @@ public sealed class AssemblyM0Compiler{var source = FrameMatrix(sourceFrame, DatumOrientationRelation.SameDirection);var targetFrameMatrix = FrameMatrix(targetFrame, frameConstraint.Orientation);+ if (frameConstraint.Seating is { } seating)+ {+ source = frameConstraint.SeatFrameSemanticId==frameConstraint.FirstSemanticValueId ? SeatMatrix(sourceFrame,seating) : FrameMatrix(sourceFrame,DatumOrientationRelation.SameDirection);+ targetFrameMatrix = frameConstraint.SeatFrameSemanticId==frameConstraint.SecondSemanticValueId ? SeatMatrix(targetFrame,seating) : FrameMatrix(targetFrame,DatumOrientationRelation.SameDirection);+ }var transform = source.Inverse() * targetFrameMatrix;if (targetWorld is not null) transform *= Aetheris.Kernel.Core.Math.Transform3D.FromRowMajor(targetWorld.Matrix);return new(transform.ToRowMajor());@@ -636,6 +669,15 @@ public sealed class AssemblyM0Compilerrotation.M31, rotation.M32, rotation.M33, rotation.M34, rotation.M41, rotation.M42, rotation.M43, rotation.M44]);}+ internal static Aetheris.Kernel.Core.Math.Transform3D SeatMatrix(ExactDatumFrameBinding frame,FixedSeatingOptions seating)+ {+ var flip=seating.Orientation==DatumOrientationRelation.OpposedDirection+ ? Aetheris.Kernel.Core.Math.Transform3D.CreateRotationX(Math.PI) : Aetheris.Kernel.Core.Math.Transform3D.Identity;+ return flip * Aetheris.Kernel.Core.Math.Transform3D.CreateRotationZ(seating.ClockingDegrees*Math.PI/180)+ * Aetheris.Kernel.Core.Math.Transform3D.CreateTranslation(new(0,0,seating.GapMm))+ * FrameMatrix(frame,DatumOrientationRelation.SameDirection);+ }+private static Aetheris.Kernel.Core.Math.Transform3D FrameMatrix(ExactDatumFrameBinding frame, DatumOrientationRelation orientation){new Aetheris.Kernel.Core.Math.Vector3D(frame.XAxisX, frame.XAxisY, frame.XAxisZ).TryNormalize(out var x);diff --git a/Aetheris.Kernel.Firmament/Assembly/AssemblyM0Models.cs b/Aetheris.Kernel.Firmament/Assembly/AssemblyM0Models.csindex 08e039fe..be1bb14b 100644--- a/Aetheris.Kernel.Firmament/Assembly/AssemblyM0Models.cs+++ b/Aetheris.Kernel.Firmament/Assembly/AssemblyM0Models.cs@@ -8,7 +8,7 @@ public enum AssemblyDiagnosticSeverity { Warning, Error }public enum PlacementConstraintKind { AxisCoincident, AxisAligned, PlaneCoincident, PointCoincident, OffsetAlongAxis, FrameCoincident }public enum DatumOrientationRelation { SameDirection, OpposedDirection }public enum PlacementStatus { Anchored, Resolved, Underconstrained, Overconstrained, Unresolved }-public enum PlacementAuthority { MateDerived, ImportedOccurrence, LegacyExplicit }+public enum PlacementAuthority { MateDerived, ImportedOccurrence, LegacyExplicit, AuthoredFrame }public enum MechanicalInterfaceFamily { Custom, Fixed, Axial, Revolute, Prismatic, Gear }public sealed record AssemblyDiagnostic(string Code, string Message, AssemblyDiagnosticSeverity Severity = AssemblyDiagnosticSeverity.Error);@@ -43,7 +43,10 @@ public sealed record InterfaceDefinition(MechanicalInterfaceFamily Family = MechanicalInterfaceFamily.Custom,bool CompilerOwnedExpansion = false,IReadOnlyList<InterfacePredicateRequirementDefinition>? PredicateRequirements = null,- GearInterfaceOptions? GearOptions = null);+ GearInterfaceOptions? GearOptions = null,+ FixedSeatingOptions? Seating = null);++public sealed record FixedSeatingOptions(double GapMm, double ClockingDegrees, DatumOrientationRelation Orientation);public sealed record GearInterfaceOptions(double? ShaftAngleDegrees, double? EngagementPhaseDegrees, string? AllowedDirection);@@ -57,7 +60,13 @@ public sealed record AssemblyMemberSource(PlacementAuthority PlacementAuthority = PlacementAuthority.MateDerived,bool IsEncapsulatedDefinition = false,AssemblyDefinitionIr? SolvedAssemblyDefinition = null,- SemanticValue? TypedEndpoint = null);+ SemanticValue? TypedEndpoint = null,+ AssemblyFramePlacementSource? FramePlacement = null);++public sealed record AssemblyFrameTransformSource(string Name, string From, double[] Translation,+ string RotationAxis, double RotationDegrees, double[]? Normal = null, double[]? Up = null,+ SemanticSourceSpan? SourceSpan = null);+public sealed record AssemblyFramePlacementSource(string From, AssemblyFrameTransformSource Target);/// <summary>A reusable, locally-authored Assembly product definition. Its children/// remain product-visible, while only <see cref="AssemblyMemberSource.ExposedSemantics"/>@@ -70,7 +79,8 @@ public sealed record AssemblyDefinitionSource(IReadOnlyList<DimensionalRelationSource>? LocalDimensionalRelations = null,IReadOnlyList<ToleranceStackupAssertSource>? LocalStackupAsserts = null,IReadOnlyList<AssemblyExposedRelationSource>? ExposedRelations = null,- string? ClaimedConcept = null);+ string? ClaimedConcept = null,+ IReadOnlyList<AssemblyFrameTransformSource>? FrameTransforms = null);public sealed record AssemblyExposedRelationSource(string Name, string PublicFrom, string PublicTo, AssemblyPath InternalFrom, AssemblyPath InternalTo);@@ -87,7 +97,9 @@ public sealed record AssemblySource(string SourceIdentity,string? DefinitionSource = null,IReadOnlyList<AssemblyDefinitionSource>? AssemblyDefinitions = null,- IReadOnlyList<AssemblySourceDependencyIr>? SourceDependencies = null);+ IReadOnlyList<AssemblySourceDependencyIr>? SourceDependencies = null,+ IReadOnlyList<AssemblyFrameTransformSource>? FrameTransforms = null,+ IReadOnlyList<FirmamentV2CanonicalPatternDecl>? Patterns = null);public sealed record AssemblySourceDependencyIr(string Path, string Sha256, bool IsRoot);@@ -122,7 +134,9 @@ public sealed record PlacementConstraintIr(string StableId, PlacementConstraintKind Kind, string MateStableId,string FirstSemanticValueId, string SecondSemanticValueId, double OffsetMm,double Residual, string Status,- DatumOrientationRelation Orientation = DatumOrientationRelation.SameDirection);+ DatumOrientationRelation Orientation = DatumOrientationRelation.SameDirection,+ string? SeatFrameSemanticId = null,+ FixedSeatingOptions? Seating = null);public sealed record PlacementResultIr(string InstanceStableId, PlacementStatus Status, AssemblyTransform? Transform, IReadOnlyList<string> FreeTranslations, IReadOnlyList<string> FreeRotations, IReadOnlyList<string> ConstraintIds, PlacementAuthority Authority = PlacementAuthority.MateDerived);public sealed record DimensionalRelationIr(@@ -192,7 +206,8 @@ public sealed record AssemblyIr(IReadOnlyList<AssemblyDatumIr>? Datums = null,IReadOnlyList<DatumMateSolutionIr>? DatumMateSolutions = null,IReadOnlyList<AssemblySourceDependencyIr>? SourceDependencies = null,- IReadOnlyList<AssemblyJointIr>? Joints = null);+ IReadOnlyList<AssemblyJointIr>? Joints = null,+ IReadOnlyList<FirmamentV2CanonicalPatternDecl>? Patterns = null);public sealed record AssemblyCompilationResult(AssemblyIr? Ir, IReadOnlyList<AssemblyDiagnostic> Diagnostics, AssemblyPerformanceIr? Performance = null){diff --git a/Aetheris.Kernel.Firmament/Assembly/AssemblyM0Parser.cs b/Aetheris.Kernel.Firmament/Assembly/AssemblyM0Parser.csindex a2b453a1..91f388d8 100644--- a/Aetheris.Kernel.Firmament/Assembly/AssemblyM0Parser.cs+++ b/Aetheris.Kernel.Firmament/Assembly/AssemblyM0Parser.cs@@ -96,7 +96,12 @@ public sealed class AssemblyM0Parser{var watch = Stopwatch.StartNew();var diagnostics = new List<AssemblyDiagnostic>();- var source = Regex.Replace(input, @"//[^\r\n]*", string.Empty);+ var source = Regex.Replace(input, @"//[^\r\n]*", m => new string(' ',m.Length));+ var patternDiagnostics = new List<string>();+ var expandedPatterns = CanonicalStaticAuthoring.ExpandAssemblyPatterns(source,patternDiagnostics);+ foreach (var error in patternDiagnostics) diagnostics.Add(new("assembly-pattern-invalid",error));+ if (expandedPatterns is null || patternDiagnostics.Count>0) return new(null,diagnostics,watch.Elapsed.TotalMilliseconds);+ source = expandedPatterns.Source;// Subassembly is a first-class non-parameterized Assembly definition. It// lowers through the existing, locally solved definition authority.source = Regex.Replace(source, @"\bSubassembly\s+(?<name>[A-Za-z_]\w*)\s*\{",@@ -139,12 +144,25 @@ public sealed class AssemblyM0Parserforeach (var range in templateRanges) Array.Fill(declarationChars, ' ', range.Start, range.Length);var declarations = new string(declarationChars);var definitionSource = definitionBoundary > 0 ? declarations[..definitionBoundary].Trim() : null;- var result = new AssemblySource(assemblyHeader.Groups["name"].Value, tree, interfaces, mates, anchor, relations, asserts, sourceIdentity, definitionSource, assemblyDefinitions);+ var frames = ParseFrameTransforms(body, sourceIdentity, diagnostics);+ var result = new AssemblySource(assemblyHeader.Groups["name"].Value, tree, interfaces, mates, anchor, relations, asserts, sourceIdentity, definitionSource, assemblyDefinitions, FrameTransforms: frames, Patterns: expandedPatterns.Document?.Patterns);return Done(result);ParseResult Done(AssemblySource? value) { watch.Stop(); return new(value, diagnostics, watch.Elapsed.TotalMilliseconds); }}+ private static IReadOnlyList<AssemblyFrameTransformSource> ParseFrameTransforms(string body, string sourceIdentity, List<AssemblyDiagnostic> diagnostics)+ {+ var frames = new List<AssemblyFrameTransformSource>();+ foreach (Match header in Regex.Matches(body, @"\bFrameTransform\s+(?<name>[A-Za-z_]\w*)\s*\{"))+ {+ var fields = BalancedBody(body, header.Index + header.Length - 1, diagnostics, "FrameTransform");+ if (fields is not null && AssemblyFrameAuthoring.Parse(header.Groups["name"].Value, fields, "From", sourceIdentity, diagnostics) is { } frame)+ frames.Add(frame);+ }+ return frames;+ }+private static string? LoadSourceGraph(string path, string allowedRoot, IReadOnlyList<string> stack,List<AssemblySourceDependencyIr> dependencies, List<AssemblyDiagnostic> diagnostics){@@ -286,10 +304,34 @@ public sealed class AssemblyM0Parservar gearOptions = family == MechanicalInterfaceFamily.Gear? new GearInterfaceOptions(OptionalAngle(body, "ShaftAngle"), OptionalAngle(body, "EngagementPhase"), OptionalIdentifier(body, "AllowedDirection")): null;+ FixedSeatingOptions? seating = null;+ if (Regex.IsMatch(body,@"\b(?:Gap|Clocking|Orientation)\s*:"))+ {+ double Scalar(string field,string unit)+ {+ var values=Regex.Matches(body,$@"\b{field}\s*:\s*(?<value>[^;}}\r\n]+)\s*;?");+ if (values.Count==0) return 0;+ var value=values[0].Groups["value"].Value.Trim();+ if (values.Count>1 || !value.EndsWith(unit,StringComparison.Ordinal)+ || !double.TryParse(value[..^Math.Min(unit.Length,value.Length)],NumberStyles.Float,CultureInfo.InvariantCulture,out var number) || !double.IsFinite(number))+ { diagnostics.Add(new("assembly-interface-invalid-seating",$"Interface '{name}' requires one finite {field} in {unit}.")); return 0; }+ return number;+ }+ var gapValue=Scalar("Gap","mm"); var clocking=Scalar("Clocking","deg");+ var orientationFields=Regex.Matches(body,@"\bOrientation\s*:\s*(?<value>[^;}\r\n]+)");+ var orientationText=orientationFields.Count==0 ? "SameDirection" : orientationFields[0].Groups["value"].Value.Trim();+ if (orientationFields.Count>1 || !Enum.TryParse<DatumOrientationRelation>(orientationText,out var orientationValue)+ || !Enum.IsDefined(orientationValue))+ diagnostics.Add(new("assembly-interface-invalid-seating",$"Interface '{name}' has invalid Orientation '{orientationText}'."));+ var orientation=orientationText=="OpposedDirection" ? DatumOrientationRelation.OpposedDirection : DatumOrientationRelation.SameDirection;+ if (family!=MechanicalInterfaceFamily.Fixed)+ diagnostics.Add(new("assembly-interface-seating-family-unsupported","Gap/Clocking/Orientation seating fields are admitted only on Interface<Fixed>."));+ seating=new(gapValue,clocking,orientation);+ }result.Add(new($"interface:{name}", name, roles, requirements, fit, free, SemanticSourceSpan.Generated(sourceIdentity),continuity.Success?continuity.Groups["value"].Value:null,correspondence.Success?correspondence.Groups["value"].Value:"OppositeDirections",- gap.Success?Number(gap.Groups["value"].Value):1e-6, family, header.Groups["family"].Success, predicates, gearOptions));+ gap.Success?Number(gap.Groups["value"].Value):1e-6, family, header.Groups["family"].Success, predicates, gearOptions, seating));}return result.OrderBy(x => x.Name, StringComparer.Ordinal).ToArray();}@@ -307,6 +349,7 @@ public sealed class AssemblyM0Parserpublic bool IsEncapsulatedDefinition { get; set; }public AssemblyDefinitionIr? SolvedAssemblyDefinition { get; set; }public SemanticValue? TypedEndpoint { get; set; }+ public AssemblyFramePlacementSource? FramePlacement { get; set; }}private static IReadOnlyList<AssemblyDefinitionSource> ParseAssemblyDefinitions(string source, string sourceIdentity,@@ -351,7 +394,8 @@ public sealed class AssemblyM0Parser[new("assembly-template-definition", name, template.Groups["parameter"].Value + ":" + template.Groups["type"].Value, SemanticSourceSpan.Generated(sourceIdentity)),.. claimedConcept is null ? [] : new[] { new SemanticProvenance("assembly-concept-satisfaction", claimedConcept, name, SemanticSourceSpan.Generated(sourceIdentity)) },.. staticProvenance],- anchor, localMates, ParseRelations(body, diagnostics), ParseAsserts(body, sourceIdentity, diagnostics), exposedRelations, claimedConcept));+ anchor, localMates, ParseRelations(body, diagnostics), ParseAsserts(body, sourceIdentity, diagnostics), exposedRelations, claimedConcept,+ ParseFrameTransforms(body, sourceIdentity, diagnostics)));}return result;}@@ -453,7 +497,7 @@ public sealed class AssemblyM0Parser};var specializedRoot = Replace(definition.LocalRoot) with { IsEncapsulatedDefinition = false };var localSource = new AssemblySource(definition.Name, specializedRoot, interfaces, definition.LocalMates ?? [], definition.LocalAnchor ?? new([definition.Name]),- definition.LocalDimensionalRelations ?? [], definition.LocalStackupAsserts ?? [], sourceIdentity);+ definition.LocalDimensionalRelations ?? [], definition.LocalStackupAsserts ?? [], sourceIdentity, FrameTransforms: definition.FrameTransforms);var watch = Stopwatch.StartNew();var local = new AssemblyM0Compiler().Compile(localSource);watch.Stop();@@ -481,7 +525,7 @@ public sealed class AssemblyM0Parservar parentWorld = Aetheris.Kernel.Core.Math.Transform3D.FromRowMajor(parent.ResolvedTransform!.Matrix);relative = new((world * parentWorld.Inverse()).ToRowMajor());}- return item with { Children = item.Children.Select(child => ApplyLocal(child, path.Append(child.Name))).ToArray(), ExplicitTransform = relative };+ return item with { Children = item.Children.Select(child => ApplyLocal(child, path.Append(child.Name))).ToArray(), ExplicitTransform = relative, FramePlacement = null };}specializedRoot = ApplyLocal(specializedRoot, new([specializedRoot.Name]));var publicSemantics = specializedRoot.ExposedSemantics.Select(value => BindPublicSemantic(value, local.Ir, sourceIdentity)).ToArray();@@ -627,6 +671,24 @@ public sealed class AssemblyM0Parservar nestedTag = nodeBody.IndexOf('<');var placementBody = open.node.Kind == AssemblyInstanceKind.Assembly && nestedTag >= 0 ? nodeBody[..nestedTag] : nodeBody;var placement = Regex.Match(placementBody, @"\bPlacement\s+(?<authority>ImportedOccurrence|LegacyExplicit)\s*=\s*\[(?<matrix>[^]]+)\]\s*;", RegexOptions.CultureInvariant);+ var readable = Regex.Matches(placementBody, @"\bPlacement\s*\{");+ if (readable.Count > 1 || (readable.Count > 0 && placement.Success))+ diagnostics.Add(new("assembly-placement-authority-conflict", $"Instance '{open.node.Name}' declares multiple placements."));+ if (readable.Count > 0)+ {+ var fields = BalancedBody(placementBody, readable[0].Index + readable[0].Length - 1, diagnostics, "Placement");+ if (fields is not null)+ {+ var from = Regex.Match(fields, @"\bFrom\s*:\s*(?<path>[A-Za-z_]\w*(?:\.[A-Za-z_]\w*)*)\s*;?");+ if (!from.Success) diagnostics.Add(new("assembly-placement-missing-source", $"Placement '{open.node.Name}' requires From."));+ var targetFields = from.Success ? fields.Remove(from.Index,from.Length) : fields;+ if (AssemblyFrameAuthoring.Parse(open.node.Name, targetFields, "To", sourceIdentity, diagnostics) is { } target)+ {+ open.node.FramePlacement = new(from.Groups["path"].Value, target);+ open.node.PlacementAuthority = PlacementAuthority.AuthoredFrame;+ }+ }+ }if (placement.Success){var matrix = placement.Groups["matrix"].Value.Split(',', StringSplitOptions.TrimEntries)@@ -645,12 +707,12 @@ public sealed class AssemblyM0Parserif (root is null) diagnostics.Add(new("assembly-tree-missing", "Assembly body requires a nested <Assembly Name> product tree."));AssemblyMemberSource Freeze(MutableNode node) => new(node.Name, node.Kind, node.Definition,node.Children.Select(Freeze).ToArray(), node.Semantics, [], [new("assembly-source", node.Name, node.Definition, SemanticSourceSpan.Generated(sourceIdentity))],- node.ExplicitTransform, node.PlacementAuthority, node.IsEncapsulatedDefinition, node.SolvedAssemblyDefinition, node.TypedEndpoint);+ node.ExplicitTransform, node.PlacementAuthority, node.IsEncapsulatedDefinition, node.SolvedAssemblyDefinition, node.TypedEndpoint, node.FramePlacement);return root is null ? null : Freeze(root);MutableNode ToMutable(AssemblyMemberSource source){- var mutable = new MutableNode(source.Name, source.Kind, source.DefinitionIdentity) { ExplicitTransform = source.ExplicitTransform, PlacementAuthority = source.PlacementAuthority, IsEncapsulatedDefinition = source.IsEncapsulatedDefinition, SolvedAssemblyDefinition = source.SolvedAssemblyDefinition, TypedEndpoint = source.TypedEndpoint };+ var mutable = new MutableNode(source.Name, source.Kind, source.DefinitionIdentity) { ExplicitTransform = source.ExplicitTransform, PlacementAuthority = source.PlacementAuthority, IsEncapsulatedDefinition = source.IsEncapsulatedDefinition, SolvedAssemblyDefinition = source.SolvedAssemblyDefinition, TypedEndpoint = source.TypedEndpoint, FramePlacement = source.FramePlacement };mutable.Semantics.AddRange(source.ExposedSemantics);mutable.Children.AddRange(source.Children.Select(ToMutable));return mutable;@@ -685,7 +747,7 @@ public sealed class AssemblyM0Parserreturn match.Success ? match.Groups["value"].Value : null;}- private static IEnumerable<SemanticValue> ParseSemantics(string body, string definition, string sourceIdentity, List<AssemblyDiagnostic> diagnostics)+ internal static IEnumerable<SemanticValue> ParseSemantics(string body, string definition, string sourceIdentity, List<AssemblyDiagnostic> diagnostics){foreach (Match header in Regex.Matches(body, @"\bSemantic\s+(?<name>[A-Za-z_]\w*)\s*\{", RegexOptions.CultureInvariant)){@@ -735,6 +797,15 @@ public sealed class AssemblyM0Parserprovenance: [new("Firmament-tol", dim.Groups["name"].Value, dim.Value, SemanticSourceSpan.Generated(sourceIdentity))]));caps.Add(new DimensionalCapability()); if (!bindings.OfType<TolerancedDimensionBinding>().Any()) bindings.Add(binding);}+ var duplicate = members.GroupBy(m => m.ExposedName).FirstOrDefault(g => g.Count() > 1);+ if (duplicate is not null)+ {+ diagnostics.Add(new("assembly-semantic-duplicate-member", $"Semantic '{name}' repeats member '{duplicate.Key}'."));+ continue;+ }+ var authoredMembers = Regex.Matches(block, @"\b[A-Za-z_]\w*\s+[A-Za-z_]\w*\s*=");+ if (authoredMembers.Count != members.Count)+ diagnostics.Add(new("assembly-semantic-unresolved-member", $"Semantic '{name}' contains an unresolved or malformed member."));yield return new SemanticValue($"definition:{definition}:{name}", new("Concept"), caps.DistinctBy(x => x.GetType()), bindings, members,[new("part-definition", definition, name, SemanticSourceSpan.Generated(sourceIdentity))], exposedName: name);}@@ -778,7 +849,7 @@ public sealed class AssemblyM0Parserreturn result;}- private static string? BalancedBody(string source, int openingBrace, List<AssemblyDiagnostic> diagnostics, string construct)+ internal static string? BalancedBody(string source, int openingBrace, List<AssemblyDiagnostic> diagnostics, string construct){var depth = 0;for (var i = openingBrace; i < source.Length; i++)diff --git a/Aetheris.Kernel.Firmament/Assembly/AssemblyM1Execution.cs b/Aetheris.Kernel.Firmament/Assembly/AssemblyM1Execution.csindex 3ddbe33b..1c4e70c7 100644--- a/Aetheris.Kernel.Firmament/Assembly/AssemblyM1Execution.cs+++ b/Aetheris.Kernel.Firmament/Assembly/AssemblyM1Execution.cs@@ -104,7 +104,7 @@ internal static class AssemblyDefinitionMaterializer}sectionSource = File.ReadAllText(sectionPath);}- var section = SectionChainAuthoringParser.Compile(sectionSource);+ var section = SectionChainAuthoringParser.Compile(AssemblyPublishedPorts.Strip(sectionSource, diagnostics));if (!section.IsSuccess || section.Materialization?.Body is not { } sectionBody ||section.Materialization.StructureKind != SectionChainStructureKind.ClosedSolid){@@ -131,7 +131,8 @@ internal static class AssemblyDefinitionMaterializervar sectionHash = Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(sectionStep.Value)));var sectionStableId = "assembly-definition:" + Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(definitionIdentity)))[..16];var sectionProvenance = new[] { new SemanticProvenance("section-chain-source", sectionPath, section.Chain!.StableId, SemanticSourceSpan.Generated(sourceIdentity)) };- return new(definitionIdentity, "section-chain:" + sectionHash[..16], sectionImport.Value, [],+ var ports = AssemblyPublishedPorts.Read(sectionSource,section.Chain.StableId,definitionIdentity,sectionPath,diagnostics,section.Chain);+ return new(definitionIdentity, "section-chain:" + sectionHash[..16], sectionImport.Value, ports,new(sectionStableId, definitionIdentity, "section-chain:" + sectionHash[..16], sectionHash, Metrics(sectionImport.Value), sectionProvenance));}var gearDocument = GearAuthoring.ParseDefinitions(definitionSource);@@ -213,6 +214,18 @@ internal static class AssemblyDefinitionMaterializer+ definitionSource + Environment.NewLine+ application+ "}" + Environment.NewLine;+ IReadOnlyList<SemanticValue> publishedPorts = [];+ if (System.Text.RegularExpressions.Regex.IsMatch(module,@"\bExpose\s*\{\s*Semantic\s+[A-Za-z_]\w*\s*\{"))+ {+ var expansion = FirmamentTemplateSourceCompiler.Expand(module,out var expansionDiagnostics);+ if (expansion is null || expansionDiagnostics.Count > 0)+ {+ foreach (var error in expansionDiagnostics) diagnostics.Add(new("assembly-port-specialization-failed",error));+ return null;+ }+ publishedPorts = AssemblyPublishedPorts.Read(expansion.ExpandedSource,"__AssemblyPart",definitionIdentity,sourceIdentity,diagnostics);+ module = AssemblyPublishedPorts.Strip(module,diagnostics);+ }var build = FirmamentBuildAndExport.CompileSource(module, Path.GetDirectoryName(Path.GetFullPath(sourceIdentity)));if (!build.IsSuccess || build.Value is null){@@ -238,7 +251,7 @@ internal static class AssemblyDefinitionMaterializerprovenance.AddRange(records.OrderBy(pair => pair.Key, StringComparer.Ordinal).Select(pair =>new SemanticProvenance("static-record", pair.Value.StaticValue, $"{pair.Key}:{pair.Value.RecordType};{pair.Value.Provenance}", SemanticSourceSpan.Generated(sourceIdentity))));var semantics = (build.Value.ConceptIr is null ? Array.Empty<SemanticValue>() : SemanticValues(build.Value.ConceptIr, provenance, sourceIdentity))- .Concat(WindingSemantics(build.Value.WireForm, provenance, sourceIdentity)).ToArray();+ .Concat(WindingSemantics(build.Value.WireForm, provenance, sourceIdentity)).Concat(publishedPorts).ToArray();var hash = Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(build.Value.StepText)));var stableId = "assembly-definition:" + Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(definitionIdentity)))[..16];var artifact = new AssemblyDefinitionArtifactIr(stableId, definitionIdentity, specialization, hash, Metrics(import.Value), provenance);@@ -507,7 +520,12 @@ public static class AssemblyWorldQueryif (owners.Length != 2 || owners.Any(owner => !materializedInstanceIds.Contains(owner.StableId))) continue;var first = Resolve(ir, constraint.FirstSemanticValueId);var second = Resolve(ir, constraint.SecondSemanticValueId);- var (position, angle) = Residual(constraint.Kind, first, second, constraint.OffsetMm, constraint.Orientation);+ if (constraint.Seating is { } seating && first is ExactDatumFrameBinding seatFrame)+ {+ var m=AssemblyM0Compiler.SeatMatrix(seatFrame,seating).ToRowMajor();+ first=new ExactDatumFrameBinding(m[12],m[13],m[14],m[0],m[1],m[2],m[4],m[5],m[6],m[8],m[9],m[10],seatFrame.FrameStableId+":seat");+ }+ var (position, angle) = Residual(constraint.Kind, first, second, constraint.OffsetMm, constraint.Seating is null ? constraint.Orientation : DatumOrientationRelation.SameDirection);result.Add(new(constraint.StableId, constraint.Kind, position, angle, position <= positionToleranceMm && angle <= angularToleranceRadians, "world exact semantic binding over materialized BRep instance"));}return result;diff --git a/Aetheris.Kernel.Firmament/Assembly/AssemblyPublishedPorts.cs b/Aetheris.Kernel.Firmament/Assembly/AssemblyPublishedPorts.csnew file mode 100644index 00000000..8e5dfa2f--- /dev/null+++ b/Aetheris.Kernel.Firmament/Assembly/AssemblyPublishedPorts.cs@@ -0,0 +1,61 @@+using System.Globalization;+using System.Text.RegularExpressions;+using Aetheris.Semantics;+using Aetheris.Surfacing;++namespace Aetheris.Kernel.Firmament.Assembly;++/// <summary>Definition-owned publication, evaluated after typed template specialization.</summary>+internal static class AssemblyPublishedPorts+{+ internal static string Strip(string source, List<AssemblyDiagnostic> diagnostics)+ {+ var chars = source.ToCharArray();+ foreach (Match expose in Regex.Matches(source,@"\bExpose\s*\{"))+ {+ var body = AssemblyM0Parser.BalancedBody(source,expose.Index+expose.Length-1,diagnostics,"part Expose");+ if (body is not null && Regex.IsMatch(body, @"^\s*Semantic\s+[A-Za-z_]\w*\s*\{"))+ Array.Fill(chars,' ',expose.Index,expose.Length+body.Length+1);+ }+ return new(chars);+ }++ internal static IReadOnlyList<SemanticValue> Read(string source,string owner,string identity,+ string sourceIdentity,List<AssemblyDiagnostic> diagnostics,SectionChain? chain = null)+ {+ var header = Regex.Match(source,$@"\b(?:Struct|Model)\s+{Regex.Escape(owner)}\s*\{{");+ if (!header.Success) return [];+ var body = AssemblyM0Parser.BalancedBody(source,header.Index+header.Length-1,diagnostics,"published part");+ if (body is null) return [];+ var result = new List<SemanticValue>();+ foreach (Match expose in Regex.Matches(body,@"\bExpose\s*\{"))+ {+ var ports = AssemblyM0Parser.BalancedBody(body,expose.Index+expose.Length-1,diagnostics,"part Expose");+ if (ports is null) continue;+ if (!Regex.IsMatch(ports, @"^\s*Semantic\s+[A-Za-z_]\w*\s*\{")) continue;+ ports = Regex.Replace(ports,@"\bDatumFrame\s+(?<name>[A-Za-z_]\w*)\s*=\s*(?<chain>[A-Za-z_]\w*)\.Section\.(?<section>[A-Za-z_]\w*)\.Frame\s*;",m =>+ {+ var section = chain?.Sections.SingleOrDefault(s => s.SectionId == m.Groups["section"].Value);+ if (chain is null || chain.StableId != m.Groups["chain"].Value || section is null)+ { diagnostics.Add(new("assembly-port-section-unresolved",$"Published port references missing authored section '{m.Groups["section"].Value}'.")); return m.Value; }+ var f=section.Frame;+ string V(double x,double y,double z) => FormattableString.Invariant($"[{x:R},{y:R},{z:R}]");+ return $"DatumFrame {m.Groups["name"].Value} = {V(f.Origin.X,f.Origin.Y,f.Origin.Z)} x {V(f.XAxis.X,f.XAxis.Y,f.XAxis.Z)} y {V(f.YAxis.X,f.YAxis.Y,f.YAxis.Z)} z {V(f.Normal.X,f.Normal.Y,f.Normal.Z)};";+ });+ // Origin components inherit the definition's millimetre contract.+ ports = Regex.Replace(ports,@"\[[^]]+\]",m => Regex.Replace(m.Value,@"(?<number>[-+0-9.eE]+)mm\b", "${number}"));+ var values = AssemblyM0Parser.ParseSemantics(ports,identity,sourceIdentity,diagnostics).ToArray();+ foreach (var value in values)+ {+ if (value.ExposedMembers.Count == 0)+ diagnostics.Add(new("assembly-port-empty-or-unresolved",$"Published Semantic '{value.ExposedName}' has no resolved supported members."));+ result.Add(value);+ }+ if (!Regex.IsMatch(ports,@"\bSemantic\s+[A-Za-z_]\w*\s*\{"))+ diagnostics.Add(new("assembly-port-invalid-publication","Part Expose requires named Semantic blocks."));+ }+ foreach (var group in result.GroupBy(p => p.ExposedName).Where(g => g.Count()>1))+ diagnostics.Add(new("assembly-port-duplicate-name",$"Published Semantic '{group.Key}' is duplicated on '{identity}'."));+ return result;+ }+}diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/CanonicalStaticAuthoring.cs b/Aetheris.Kernel.Firmament/FirmamentV2/CanonicalStaticAuthoring.csindex f3d8c422..a1ebf2c7 100644--- a/Aetheris.Kernel.Firmament/FirmamentV2/CanonicalStaticAuthoring.cs+++ b/Aetheris.Kernel.Firmament/FirmamentV2/CanonicalStaticAuthoring.cs@@ -12,6 +12,61 @@ internal static class CanonicalStaticAuthoringinternal sealed record Result(string Source, FirmamentV2StaticAuthoringDocument? Document);private sealed record Template(string Name, string Type, string Parameter, string Body, FirmamentV2SourceSpan Span);+ /// <summary>Assembly consumes the same checked Record/Set values, but yields product-tree declarations.</summary>+ internal static Result? ExpandAssemblyPatterns(string source, List<string> diagnostics)+ {+ var headers = Regex.Matches(source,@"\bPattern\s+(?<name>[A-Za-z_]\w*)\s+Over\s+(?<set>[A-Za-z_]\w*)\s*\{").Cast<Match>()+ .Where(h => Regex.IsMatch(source[(h.Index+h.Length)..],@"^\s*[A-Za-z_]\w*\s*=>\s*<(?:Part|Assembly)\b")).ToArray();+ if (headers.Length == 0) return new(source,null);+ var catalog = source.Select(c => c is '\r' or '\n' ? c : ' ').ToArray();+ foreach (Match header in Regex.Matches(source,@"\b(?:Record\s+[A-Za-z_]\w*|Static\s+[A-Za-z_]\w*\s*:\s*Set\s*<\s*[A-Za-z_]\w*\s*>)\s*\{"))+ {+ var open=source.IndexOf('{',header.Index); var close=MatchPair(source,open,'{','}');+ if (close<0) { diagnostics.Add(Prefix+"assembly-pattern-catalog-malformed"); return null; }+ source.CopyTo(header.Index,catalog,header.Index,close-header.Index+1);+ }+ var data=Expand(new string(catalog),diagnostics);+ if (data?.Document is null || diagnostics.Count>0) return null;+ var sets=(data.Document.Sets ?? []).ToDictionary(s=>s.Name,StringComparer.Ordinal);+ var changes=new List<(int Start,int Length,string Text)>();+ var patterns=new List<FirmamentV2CanonicalPatternDecl>(); var names=new HashSet<string>(); var total=0;+ foreach (var header in headers)+ {+ var name=header.Groups["name"].Value; var open=source.IndexOf('{',header.Index); var close=MatchPair(source,open,'{','}');+ if (!names.Add(name)) { diagnostics.Add(Prefix+"assembly-pattern-duplicate:"+name); continue; }+ if (close<0 || !sets.TryGetValue(header.Groups["set"].Value,out var set)) { diagnostics.Add(Prefix+"pattern-source-invalid:"+name); continue; }+ var body=source[(open+1)..close].Trim();+ var arrow=Regex.Match(body,@"^(?<binder>[A-Za-z_]\w*)\s*=>\s*(?<mapping>[\s\S]+)$");+ if (!arrow.Success || !Regex.IsMatch(arrow.Groups["mapping"].Value,@"^\s*<(?:Part|Assembly)\b") || Regex.IsMatch(body,@"\bPattern\s+"))+ { diagnostics.Add(Prefix+"assembly-pattern-body-invalid:"+name); continue; }+ total+=set.Entries.Count;+ if (set.Entries.Count>MaxPatternExpansion || total>4096) { diagnostics.Add(Prefix+"pattern-expansion-limit:"+name); continue; }+ var output=new List<string>(); var associations=new List<FirmamentV2PatternAssociation>();+ const string identity="Placement LegacyExplicit = [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];";+ foreach (var entry in set.Entries)+ {+ var mapping=SubstituteSetMapping(arrow.Groups["mapping"].Value,arrow.Groups["binder"].Value,entry);+ if (Regex.IsMatch(mapping,$@"\b{Regex.Escape(arrow.Groups["binder"].Value)}\."))+ { diagnostics.Add(Prefix+"assembly-pattern-member-unresolved:"+name+"."+entry.Name); continue; }+ output.Add($"<Assembly {entry.Name}> {identity}\n{mapping}\n</Assembly>");+ associations.Add(new(name+"."+entry.Name,set.Name,entry.Name,entry.Value,entry.SourceOrder,entry.Provenance));+ }+ changes.Add((header.Index,close-header.Index+1,$"<Assembly {name}> {identity}\n{string.Join(Environment.NewLine,output)}\n</Assembly>"));+ patterns.Add(new(name,set.Name,"Assembly",set.Entries.Count,associations.Select(a=>a.GeneratedId).ToArray(),new(header.Index,close-header.Index+1),associations));+ }+ foreach (var change in changes.OrderByDescending(c=>c.Start)) source=source.Remove(change.Start,change.Length).Insert(change.Start,change.Text);+ return new(source,data.Document with { Patterns=patterns });+ }++ private static string SubstituteSetMapping(string mapping,string binder,FirmamentV2StaticSetEntry entry)+ {+ if (entry.RecordFields is not null)+ foreach (var field in entry.RecordFields)+ mapping=Regex.Replace(mapping,$@"\b{Regex.Escape(binder)}\s*\.\s*{Regex.Escape(field.Key)}\b",field.Value,RegexOptions.CultureInvariant);+ else mapping=Regex.Replace(mapping,$@"\b{Regex.Escape(binder)}\b",entry.Value,RegexOptions.CultureInvariant);+ return mapping;+ }+public static Result? Expand(string source, List<string> diagnostics){var symmetry = SemanticSymmetryAuthoring.Expand(source, diagnostics);@@ -332,10 +387,7 @@ internal static class CanonicalStaticAuthoringelse{declaration = mapping;- if (entry.RecordFields is not null)- foreach (var field in entry.RecordFields)- declaration = Regex.Replace(declaration, $@"\b{Regex.Escape(binder)}\s*\.\s*{Regex.Escape(field.Key)}\b", field.Value, RegexOptions.CultureInvariant);- else declaration = Regex.Replace(declaration, $@"\b{Regex.Escape(binder)}\b", entry.Value, RegexOptions.CultureInvariant);+ declaration = SubstituteSetMapping(declaration,binder,entry);var construction = Regex.Match(declaration, @"\b(?:Hole\s*<\s*(?:Shaft|Counterbore|Countersink)\s*>|Slot\s*<\s*(?:Capsule|RoundedRectangle)\s*>|Boss|Pocket|EdgeFinish)\s+(?<name>[A-Za-z_]\w*)\s*\{", RegexOptions.CultureInvariant);if (!construction.Success) { diagnostics.Add(Prefix + "pattern-body-invalid:" + patternName); return; }declaration = declaration.Remove(construction.Groups["name"].Index, construction.Groups["name"].Length).Insert(construction.Groups["name"].Index, materializedId);diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/SemanticConstructDeclarations.cs b/Aetheris.Kernel.Firmament/FirmamentV2/SemanticConstructDeclarations.csindex 7e23bc8e..609ec2c5 100644--- a/Aetheris.Kernel.Firmament/FirmamentV2/SemanticConstructDeclarations.cs+++ b/Aetheris.Kernel.Firmament/FirmamentV2/SemanticConstructDeclarations.cs@@ -75,8 +75,29 @@ public static class ConceptSemanticDeclaration { }[FirmamentConstruct("InterfaceFixed", "Interface<Fixed>", Context = "Assembly", Entry = "Interface<Fixed> Mount { A: Assembly.Base.Mount; B: Assembly.Link.Socket; }", Description = "Two semantic datum frames define one zero-DOF rigid relationship.")][FirmamentField("A", "A", FirmamentSchemaValueKind.ConstructReference, Required = true, Description = "Parent occurrence's source-addressable DatumFrame-capable semantic port.")][FirmamentField("B", "B", FirmamentSchemaValueKind.ConstructReference, Required = true, Description = "Child occurrence's source-addressable DatumFrame-capable semantic port.")]+[FirmamentField("Gap", "Gap", FirmamentSchemaValueKind.Length, Unit = FirmamentUnitKind.Length, Default = "0mm", Description = "Seat translation along A's positive Z.")]+[FirmamentField("Clocking", "Clocking", FirmamentSchemaValueKind.Angle, Unit = FirmamentUnitKind.Angle, Default = "0deg", Description = "Right-handed rotation about A's positive Z.")]+[FirmamentField("Orientation", "Orientation", FirmamentSchemaValueKind.Choice, Default = "SameDirection", Choices = ["SameDirection", "OpposedDirection"])]public static class FixedInterfaceSemanticDeclaration { }+[FirmamentConstruct("AssemblyPlacement", "Placement", Context = "Assembly", Entry = "Placement { From: Origin; To: World; TranslateLocal: [0mm,0mm,0mm]; }", Description = "One authored rigid layout authority; lowered through the existing frame solver.")]+[FirmamentField("From", "From", FirmamentSchemaValueKind.ConstructReference, Required = true)]+[FirmamentField("To", "To", FirmamentSchemaValueKind.ConstructReference, Required = true)]+[FirmamentField("TranslateLocal", "TranslateLocal", FirmamentSchemaValueKind.Vector, Unit = FirmamentUnitKind.Length)]+[FirmamentField("Normal", "Normal", FirmamentSchemaValueKind.Vector)]+[FirmamentField("Up", "Up", FirmamentSchemaValueKind.Vector)]+[FirmamentField("RotateLocal", "RotateLocal", FirmamentSchemaValueKind.ConstructReference)]+public static class AssemblyPlacementSemanticDeclaration { }++[FirmamentConstruct("AssemblyFrameTransform", "FrameTransform", Context = "Assembly", Entry = "FrameTransform Mount { From: World; TranslateLocal: [0mm,0mm,0mm]; }", Description = "A named definition-local composition of an exact published frame.")]+[FirmamentField("From", "From", FirmamentSchemaValueKind.ConstructReference, Required = true)]+[FirmamentField("TranslateLocal", "TranslateLocal", FirmamentSchemaValueKind.Vector, Unit = FirmamentUnitKind.Length)]+[FirmamentField("Normal", "Normal", FirmamentSchemaValueKind.Vector)]+[FirmamentField("Up", "Up", FirmamentSchemaValueKind.Vector)]+[FirmamentField("RotateLocal", "RotateLocal", FirmamentSchemaValueKind.ConstructReference)]+[FirmamentOutput("Frame", "Frame", "DatumFrame", SourceAddressable = true)]+public static class AssemblyFrameTransformSemanticDeclaration { }+[FirmamentConstruct("InterfaceRevolute", "Interface<Revolute>", Context = "Assembly", Entry = "Interface<Revolute> Hinge { A: Assembly.Base.Hinge; B: Assembly.Link.Hinge; }", Description = "One angular DOF about frame Z; frame X defines the zero angle.")][FirmamentField("A", "A", FirmamentSchemaValueKind.ConstructReference, Required = true, Description = "Parent occurrence's source-addressable DatumFrame-capable semantic port.")][FirmamentField("B", "B", FirmamentSchemaValueKind.ConstructReference, Required = true, Description = "Child occurrence's source-addressable DatumFrame-capable semantic port.")]diff --git a/docs/public/firmament/assemblies.md b/docs/public/firmament/assemblies.mdindex 57950068..5638f7c0 100644--- a/docs/public/firmament/assemblies.md+++ b/docs/public/firmament/assemblies.md@@ -1,5 +1,9 @@# Typed interfaces and reusable subassemblies+For readable placement, named FrameTransform composition, definition-owned ports,+keyed occurrence patterns and Fixed Gap/Clocking seating, see the+[assembly authoring foundation](assembly-authoring-foundation.md).+Firmament assemblies have two independent structures: the product tree owns definition/occurrence identity, while the Interface graph owns mechanical relationships. Tree nesting never implies a Mate.Executable assemblies can also [export to OpenUSD](openusd.md), preserving nested hierarchy, shared display geometry, occurrence placement, and the accepted frame-based Fixed/Revolute/Prismatic contracts. STEP remains the engineering/manufacturing interchange output.diff --git a/docs/public/firmament/assembly-authoring-foundation.md b/docs/public/firmament/assembly-authoring-foundation.mdnew file mode 100644index 00000000..1ccd3747--- /dev/null+++ b/docs/public/firmament/assembly-authoring-foundation.md@@ -0,0 +1,187 @@+# Assembly authoring foundation++Implemented slice: readable rigid placement, named frames, definition-owned ports,+keyed finite occurrence patterns, and Fixed seating. These extend the existing+semantic binder, finite Record/Set frontend, exact materializer, and frame solver.+No user-defined Lower language or second placement solver is introduced.++## Readable placement++```firmament+<Part Base = Post<H:14mm>>+ Placement { From: Origin; To: World; TranslateLocal: [10mm,20mm,30mm];+ RotateLocal: { Axis: Z; Angle: 90deg } }+</Part>+FrameTransform Tilt {+ From: Demo.Base.Top.Frame;+ TranslateLocal: [0mm,0mm,2mm];+ RotateLocal: { Axis: X; Angle: 15deg }+}+<Part Child = Post<H:14mm>>+ Placement { From: Bottom.Frame; To: Tilt.Frame; }+</Part>+```++Place Parts inside the assembly tree and FrameTransform declarations in the+owning assembly. `Origin` is the current occurrence origin, `Parent` the immediate+parent origin, and `World` the current assembly root. Relative ports resolve on+the current occurrence, then its parent; qualified paths obey public boundaries.+Named transforms are referenced as `Name.Frame`.++Translations require finite literal mm; rotation requires X/Y/Z and finite deg.+Optional paired Normal/Up vectors are dimensionless and expressed in the target+frame. Normal supplies Z, projected Up supplies Y, and Y cross Z supplies X.+Zero/parallel vectors fail. Rotation applies in that constructed basis,+translation in the referenced frame, then the frame composes with its owner's+resolved transform. Translation is not rotated by RotateLocal.++AuthoredFrame placement lowers to compiler-owned exact frame constraints through+the existing solver, with no mechanical joint. Anchoring, explicit placement and+a moving Interface assignment cannot also drive authored placement. Unresolved+dependencies and cycles fail. LegacyExplicit/ImportedOccurrence remain supported.++## Definition-owned ports++```firmament+Template<H: Length> Struct Post {+ Circle2 Outline { Center: [0mm,0mm]; Radius: 4mm }+ Profile P { Loop Outer { Outline |> TraceLoop } }+ Extrude Body { Profile: P; From: 0mm; To: H }+ Expose {+ Semantic Bottom { DatumFrame Frame = [0,0,0] x [1,0,0] y [0,1,0] z [0,0,1]; }+ Semantic Top { DatumFrame Frame = [0mm,0mm,H] x [1,0,0] y [0,1,0] z [0,0,1]; }+ }+}+```++Ports specialize through the geometry's typed template frontend. Occurrences+share exact definitions. Publication creates no new body and infers no arbitrary+BRep face name. Existing DatumFrame/Axis/Plane/Point/Dimension members are admitted;+malformed and duplicate members fail.++SectionChain-file Models can publish their authored section frames:++```firmament+Expose { Semantic NutMount { DatumFrame Frame = Neck.Section.S5.Frame; } }+```++The chain and section must exist. This aliases the section's exact frame rather+than a tessellation sample. Publication occurs during M1 materialization;+reusable assemblies still solve internal graphs earlier in M0. Ports needed+during that local solve currently require inline authoring; early automatic+publication of geometry-template ports remains a boundary.++## Keyed finite patterns++```firmament+Record Site { X: Length }+Static Sites: Set<Site> {+ Left => Site { X: -5mm }+ Right => Site { X: 5mm }+}+Assembly Demo {+ <Assembly Demo>+ Pattern Posts Over Sites {+ site => <Part Post = Post<H:14mm>>+ Placement { From: Origin; To: World; TranslateLocal: [site.X,0mm,0mm]; }+ </Part>+ }+ </Assembly>+ Anchor: Demo;+}+```++The existing checked Set/Record frontend binds fields and units. Patterns yield+ordinary Parts/Assemblies, not a public text macro facility. Paths include pattern,+key and member: `Demo.Posts.Left.Post`. Reordering rows preserves IDs/placements.+Inspection retains expanded occurrences, associations, keys, values and source-row+provenance; geometry definitions remain shared.++Limits: 1024 keys per pattern, 4096 expanded keys per source, unique pattern names,+no nested assembly patterns or dynamic collections. Group-node identity placement+is compiler-owned. Independent arbitrary Mate-pattern bodies are outside this slice.++## Fixed seating++```firmament+Interface<Fixed> Seat {+ A: Demo.Base.Top.Frame;+ B: Demo.Child.Bottom.Frame;+ Gap: 2mm;+ Clocking: 90deg;+ Orientation: OpposedDirection;+}+```++Gap moves the seated origin along A's positive Z; Clocking rotates about A's+positive Z. OpposedDirection also flips B by 180 degrees around local X.+SameDirection and zero Gap/Clocking are defaults. This remains one zero-DOF+relationship. Placement, world-space residual checks and zero-pose kinematics use+the same transform, including reversed anchoring.++Seating is Fixed-only. Roles must be declared, unique, complete, reachable and+capability-compatible; seating requires an exact frame binding. Bad units,+nonfinite values, duplicate fields and invalid orientation fail diagnostically.++## Guitar reassessment++The fixture has zero authored LegacyExplicit matrices. Neck NutMount/HeelMount+publish section ports; NutWorld/HeadTilt place the headstock; VeneerSeat seats the+veneer. Seven keyed patterns cover pickup seats/coils/poles, saddles and tuner+posts/washers/buttons. Hardware positions preserve the previous witness, with+107 visible parts, 55 shared definitions, six WireForms and four SectionChains.++Python still generates spline controls/sections, computes fret spacing, and+derives WireForm lengths, bend angles and bases from endpoints. Decorative+hardware still uses absolute coordinates where mounting ports are unauthored.+Profile-valued templates, section patterns and point-driven routes are the next+useful authoring slice, deferred pending review. No surfacing-kernel change is+needed to take that step. Appearance remains downstream Cycles shading.++Ground truth:++```powershell+dotnet Aetheris.CLI/bin/Release/net10.0/aetheris.dll asm inspect fixtures/Canonical/AssemblyInterfaces/GuitarX0/guitar-x0.firmament --json --profile+./scripts/qualify-guitar-x0.ps1 -OutDir artifacts/local/guitar-foundation -Render -Viewport+```++Generated reports, STEP/USD and Cycles artifacts go under ignored artifacts/local.++## Qualification on 2026-09-30++Verdict: **success for this bounded foundation slice**. The motivating guitar+now uses the implemented constructs through M1, exact STEP export, shared USD+prototypes and downstream rendering. Authoring D has not been started.++- Release solution build: passed (existing WebAssembly interop warnings).+- Core fast lane: 1005 passed; serial full solution gate: 4034 passed.+- New authoring foundation cases: 22 passed, covering specialization, shared+ geometry, keyed reorder stability, local reusable scopes, seating/zero pose,+ unknown roles/members, malformed fields, cycles and placement authority conflicts.+- Fresh-process cold compilation: 9.653 s; same-process warm recompilation: 4.603 s.+ These include JIT/library initialization as applicable, exclude process startup+ and dotnet build, and use no persistent model cache.+- Display preparation: 0.470 s cold / 0.375 s warm; USD serialization: 0.079 / 0.077 s.+- All 55 definition position/normal/index buffers are exactly equal to the prior+ guitar export. All 107 visible transforms match within 0.000001 mm; maximum+ component delta is 0.000000496067, from authored coordinate rounding.+- usdchecker passes; external USD composition has no errors, with 55 shared+ prototypes and maximum world-transform error 1.23e-15.+- usdview: 36 orbits, identical before/after geometry hashes, zero stage changes,+ compiler calls and geometry rebuilds; mean orbit plus readback 20.49 ms.+ This is evidence for the standalone downstream viewer; it does not qualify+ Helios browser interaction.+- Blender Cycles qualification: five refreshed images and a saved scene; imported+ product topology remains unchanged. Hero rendering took 205.22 s on this run,+ versus 26.17 s in the prior artifact. That offline rendering slowdown is not+ diagnosed here and must not be represented as a compiler or viewport timing.++Evidence: `artifacts/local/guitar-x0/foundation-{build,fast,full}.log` and+`artifacts/local/guitar-foundation/` containing `timings.json`, `display.json`,+`baseline-comparison.json`, `usd-validation.json`, `viewport/viewer.json`,+`guitar.step`, `guitar.usda`, and the Cycles scene/images.++The guitar remains suitable as a presentation witness against the supplied Zoo+example. This qualification establishes Aetheris behavior and preserves its+visual geometry; it does not measure Zoo's build times or certify an independent+head-to-head performance ratio.diff --git a/docs/public/firmament/authoring-composition-proposal.md b/docs/public/firmament/authoring-composition-proposal.mdnew file mode 100644index 00000000..e082b58f--- /dev/null+++ b/docs/public/firmament/authoring-composition-proposal.md@@ -0,0 +1,404 @@+# Firmament authoring and composition: proposals from GUITAR-SURFACING-X0++Status: **roadmap; Foundations A–C now have a bounded implementation.**+See [the implemented assembly authoring foundation](assembly-authoring-foundation.md)+for supported syntax, limits, and the guitar reassessment. Remaining sketches+below retain their proposed status; Authoring D is deferred for review.++The guitar demonstrated that the existing exact geometry and display paths can produce a convincing designed object. It also required a Python source generator to assemble 107 occurrences, calculate transforms, expand repeated hardware, generate spline controls, calculate fret spacing, and construct string routes. That generator emits ordinary Firmament; it does not replace the kernel. Nevertheless, too much design intent lives outside the language.++The objective is to move those responsibilities into typed, finite Firmament authoring and existing compiler owners. This is a proposal for several bounded milestones, not a request for a general scripting language, universal constraint solver, or new surfacing kernel.++All code blocks below are **proposed syntax**, including blocks that reuse existing constructs. They are design sketches, not compile-ready fixtures. Names such as `Body.Top`, `Neck.Nut` and `Pickup.Seat` denote proposed published ports; they are not currently emitted by the guitar fixtures. Implementations must publish those ports before the examples can resolve.++## Evidence and current baseline++The motivating source is [the guitar generator](../../../scripts/create-guitar-x0.py), its [authored fixtures](../../../fixtures/Canonical/AssemblyInterfaces/GuitarX0/guitar-x0.firmament), and the [witness report](../demos/guitar-surfacing-x0.md).++Current capabilities should be extended, not accidentally proposed a second time:++- [Feature Patterns, Records, Static data and Templates](templates.md) already provide finite specialization. The missing pattern target is the assembly occurrence and relationship graph.+- [Typed Interfaces and subassemblies](assemblies.md) already support Fixed, Axial, Revolute, Prismatic, Custom and Gear contracts, public `Expose` ports, and shared solved definitions. Fixed/Revolute/Prismatic datum-frame contracts already derive full 3D placement. Lack of arbitrary orientation is therefore not the fundamental gap.+- Existing reusable Interfaces have named roles, capability checks, atomic lowering, fits and admitted motion. The needed depth is member-specific requirements, parameterized seating and geometry-derived port publication.+- [SectionChain](section-chains.md) already creates capped exact solids from framed profiles, with G0/G1 transitions and bounded local dependencies. It is not necessary to add another loft implementation to simplify this guitar.+- [WireForm](wire-form.md) already constructs exact straight/bend routes and publishes winding semantics. Point-driven routing would be an authoring layer over that machinery.+- [OpenUSD](openusd.md) already preserves shared geometry and occurrence placement. The full sunburst remains downstream Cycles shading in this witness.++During this audit, `aetheris asm inspect fixtures/Canonical/AssemblyInterfaces/two-link-arm.firmament --json` succeeded through the current CLI. The source audit also checked `AssemblyM0Parser`: explicit occurrence placement currently reads matrices, datum frames read explicit bases, and reusable Interface lowering accepts a bounded atomic relation set. These observations are specific to the checkout reviewed on 2026-09-30.++## Suggested order++| Proposal | Priority | First bounded slice | Depends on |+| --- | --- | --- | --- |+| 1. Assembly Patterns | P0 | Named finite sets of parts and fixed relationships | Existing finite expansion; proposal 2 for readable placement |+| 2. Frame composition and placement | P0 | Rigid local offsets/rotations and named frame alignment | Existing datum-frame and placement IR |+| 3. Definition-owned semantic ports | P0 | Authored frames and SectionChain terminal frames | Existing semantic values and Expose |+| 4. Deeper Interface contracts | P0 | Frame member requirements, seating gap and clocking | 2–3 |+| 5. Section/profile family authoring | P1 | Parameterized profiles and finite section sets | Existing Templates, Patterns and SectionChain |+| 6. Explicit straight/fair transition intent | P1 | Endpoint tangent constraints and named transition laws | Existing SectionChain tangent/materializer path |+| 7. Placement on curved supports | P1 | Named analytic support, explicit location and clocking | 2–4; surface evaluator |+| 8. Dimensioned engineering expressions | P1 | Pure scalar arithmetic, small math set and finite sampling | Existing compile-time value evaluator |+| 9. Point-driven WireForm routes | P1 | Three points, one explicit bend radius | 2–3, existing WireForm |+| 10. Semantic appearance binding | P2 | Named simple looks bound to definitions/occurrences | Existing USD appearance path |+| 11. Unified build and source diagnostics | P0 alongside each slice | Dispatch, generated-source provenance and dependency reports | Existing CLI, schema and language analysis |++Ship 2–3 first as a small foundation, then 1 and the first part of 4. Do not require curved-support placement or a material language before making ordinary assemblies pleasant to author.++## 1. Assembly Patterns: repeated parts with stable identity++**Friction:** Python unrolls pickup poles, saddles, frets, tuner groups and controls into occurrence tags. Repetition belongs to the product tree, but the language's current feature pattern path does not offer that assembly expansion.++Extend `Pattern ... Over` to assembly tree content. The collection is finite compile-time data, and the body yields ordinary parts/subassemblies and relationships, rather than source text.++```firmament+Static PoleSites: Set<PoleSite> {+ LowE => PoleSite { X: -25.5mm }+ A => PoleSite { X: -15.3mm }+ D => PoleSite { X: -5.1mm }+ G => PoleSite { X: 5.1mm }+ B => PoleSite { X: 15.3mm }+ HighE => PoleSite { X: 25.5mm }+}++<Assembly BridgePickup>+ <Part Base = PickupBase></Part>+ Pattern Poles Over PoleSites {+ site => <Part Pole = PolePiece<Radius: 2.2mm>>+ Placement {+ From: Pole.Seat+ To: Base.PoleRail+ OffsetLocal: [site.X, 0mm, 0mm]+ }+ </Part>+ }+</Assembly>+```++The pattern contributes a namespace: `BridgePickup.Poles.LowE.Pole`. Changing collection order does not rename a named item. Anonymous arrays may use indices, but inspection must disclose that insertion can change those identities. Do not use rendered names or template arguments as occurrence keys.++Allow keyed row references such as `Guitar.Strings.LowE.Wire`, and permit a generated body's Interface to name its own generated participants. Cross-pattern joins should require explicit matching keys; never zip unrelated collections implicitly. Missing keys, duplicate keys and duplicate generated declarations fail before geometry construction.++The first slice supports finite parts and fixed placements; movable joints and patterned Expose collections can follow. An expansion budget rejects excessive or recursive expansion. Shared specialization identity remains separate from occurrence identity: six identical poles get one BRep definition, not six rebuilds.++**Owner and acceptance:** finite semantic expansion into the existing Assembly parser/binder/IR, with source maps for pattern and row. Replace the guitar's pole and saddle loops; demonstrate stable named paths after reordering, shared definition counts, STEP/USD export and deterministic inspection. Retain the existing feature Pattern spelling and behavior.++## 2. Frame composition and readable placement++**Friction:** the generator calculates trigonometry, basis vectors and 16-element matrices for an angled headstock, veneer, tuners and strings. A placement should express engineering intent in local coordinates.++```firmament+FrameTransform HeadTilt {+ From: Neck.Nut.Frame+ TranslateLocal: [0mm, 0mm, -7mm]+ RotateLocal: { Axis: X; Angle: -13deg }+}++<Part Headstock = HeadstockPart>+ Placement {+ From: Headstock.Base.Frame+ To: HeadTilt.Frame+ }+</Part>+```++`FrameTransform` produces a datum frame, not geometry. Define its order explicitly: translate in the input frame's axes, then rotate the basis about the translated origin. A chain of named transforms expresses another order; do not infer Euler conventions. `Axis: X` refers to the input local X axis.++Placement maps a definition-local source frame to a target frame expressed in its containing occurrence's coordinates. The derived transform is `T_target * inverse(T_source)`. Occurrence-qualified target references compose the existing parent transforms once; they must not be mistaken for definition-local coordinates or transformed twice.++Offer a bounded `DatumFrame` constructor using `Origin`, `Normal` and `Up` as authoring sugar over the complete orthonormal basis. Reject a zero normal or parallel Up; do not silently choose a roll axis. Imported occurrence matrices remain accepted for interchange and compatibility.++A child gets one placement authority: authored frame alignment, mate-derived placement, or imported/legacy explicit transform. A conflicting second driver is an error, not an undocumented override. Frame placement is for layout; a declared Interface is for a relationship with a contract. Both lower to existing rigid-transform machinery.++**Acceptance:** tilt the headstock and place its veneer using composed frames with no Python trigonometry or raw matrices. Check local/world composition, right-handedness, nested subassemblies and export parity. Camera movement must not reevaluate these expressions or build geometry.++## 3. Definition-owned ports: publish construction meaning once++**Friction:** a surface/neck definition knows its sections and support frames, but the assembly repeats attachment coordinates. Inline occurrence datums are useful, yet repeated authored coordinates drift from the constructed part.++```firmament+SectionChain Neck {+ // Existing framed sections and capped construction.+}++Expose {+ Semantic NutMount {+ DatumFrame Frame = Neck.Section.Nut.Frame+ Dimension Width = NutWidth+ }+ Semantic HeelMount {+ DatumFrame Frame = Neck.Section.Heel.Frame+ }+}+```++Extend definition-level semantic publication to ordinary executable parts, including `SectionChainFile` and `LoftFile`. The aliases above reference compiler-owned construction semantics. A terminal section's frame is not automatically a mechanical seating frame: the author must choose or derive its intended origin, orientation and offset through proposal 2.++Start with explicitly authored frames, named SectionChain sections and primitive construction supports. Later add named surface and curve ports where those owners can publish stable bindings. Keep these references independent of face numbers, triangle indices or nearest-surface guesses. Do not claim every kernel face is source-addressable.++Publication preserves local coordinates, capability/type, construction provenance and declaration identity. An occurrence qualifies the port with its own transform. Subassembly `Expose` continues to enforce privacy and can forward it without copying geometry. Private implementation details must not become public merely because a pattern or mate references them.++**Acceptance:** change the neck's nut station once and observe the dependent headstock placement follow its published frame. Verify shared definitions, nested Expose visibility and diagnostics when the section/port is removed.++## 4. Interface depth: member contracts, seating and clocking++**Friction:** a frame coincidence is useful, but often insufficient as an authoring contract. Veneer thickness, pickup seats and mounting gaps currently become absolute Z coordinates. Coarse role capability checks do not express which named members must exist or what dimensions must agree.++First extend the existing Fixed frame contract with explicit local seating fields:++```firmament+Interface<Fixed> VeneerSeat {+ A: Guitar.Headstock.Front+ B: Guitar.Veneer.Back+ Orientation: OpposedDirection+ Gap: 0mm+ Clocking: 0deg+}+```++Define `Gap` along A's outward local Z, and `Clocking` about that axis. `OpposedDirection` must have a documented right-handed mapping, including its X reference; flipping only Z is invalid. The result is a fixed offset, not a hidden translational/rotational DOF. Absence of these new fields preserves current zero-coincident behavior.++Then deepen reusable named Interfaces without inventing a new compiler-owned generic family for every product:++```firmament+Interface MountedHardware {+ Parameter Gap: Length = 0mm+ Role Support requires {+ Frame: DatumFrame+ AvailableWidth: Length+ }+ Role Hardware requires {+ Frame: DatumFrame+ RequiredWidth: Length+ }+ Lower FrameCoincident Support.Frame Hardware.Frame OpposedDirection+ Lower OffsetAlongAxis Support.Frame.Z Hardware.Frame.Origin Gap+ Require WidthFits => Hardware.RequiredWidth <= Support.AvailableWidth+}++Mate BridgeSeat: MountedHardware<Gap: 2mm> {+ Support: Guitar.Body.BridgeSeat+ Hardware: Guitar.Bridge.Mount+}+```++The two `Lower` lines illustrate intent. The implementation must normalize them into **one seated-frame relation** before solving, rather than demand zero frame coincidence and a nonzero offset simultaneously. Prefer exposing that normalized relation directly if the combined spelling is misleading during syntax review.++Role member requirements are checked before lowering, with exact member/type diagnostics. Parameters are finite typed values. `Require` reads resolved semantic dimensions, not arbitrary mesh measurements. A `WidthFits` check is a width contract, not proof that a curved mounting footprint is collision-free.++Reuse current fits, tolerance and capability semantics. Inspection should distinguish fully located, deliberately movable, unresolved and contradictory relationships, name the owning driver, and report meaningful residuals. Do not add generic loop closure, nonlinear contact solving or arbitrary equation solving in this milestone.++**Acceptance:** changing veneer thickness or mounting gap changes placement through one Interface parameter; a missing `Frame` or incompatible width fails before solving; an explicit placement competing with the Interface is rejected. Keep the existing typed-joint and legacy atomic fixtures passing.++## 5. Profile families and finite section authoring++**Friction:** Python repeats cubic control declarations for each body station and each changing D-shaped neck profile. Generic numeric parameters exist, but reusable profile values and finite section expansion are not composable enough here.++```firmament+Template<Width: Length, Depth: Length>+Profile NeckSection {+ // Named cubic spans: BackLeft, BackRight, Seat.+ // Pure parameter expressions replace repeated literal controls.+}++Static Stations: Set<NeckStation> {+ Heel => NeckStation { Y: 145mm; Width: 55.4mm; Depth: 40mm }+ Shaft => NeckStation { Y: 240mm; Width: 53.1mm; Depth: 13mm }+ Nut => NeckStation { Y: 660mm; Width: 43mm; Depth: 7mm }+}++SectionChain Neck {+ Continuity: G1+ Pattern Sections Over Stations {+ station => Section {+ Frame: FrameAtY(station.Y)+ Profile: NeckSection<Width: station.Width, Depth: station.Depth>+ Seam: BackLeft+ }+ }+ Start: Cap+ End: Cap+}+```++`FrameAtY` here is a proposed finite frame-construction helper, not an existing user-defined function. Its final spelling can be the proposal 2 constructor. The example illustrates section family composition, not sufficient stations for the final fairing.++Add `Profile` as a concrete Template output before considering higher-order Profile/Template parameters. For scaled body outlines, add a pure 2D profile transform that preserves named spans, seam and orientation. Start with positive uniform scale about an authored center; reflection, nonuniform arc scaling and arbitrary knot conversion need separate contracts.++A companion bounded interpolation constructor would remove the generator's other large expansion: calculating cubic handles around every body outline point.++```firmament+InterpolatingLoop2 BodyOutline {+ Guides: BodyOutlinePoints+ Law: PeriodicCatmullRom+ Parameterization: Uniform+ Seam: LowerBout+}+Profile BodySection From BodyOutline+```++`BodyOutlinePoints` is a finite ordered keyed set of Point2 guides. This spelling proposes a specific interpolation law, not an unconstrained "make it smooth" request. It computes controls and lowers to existing [CubicBezier2 spans](cubic-bezier-profiles.md), with span identities derived from adjacent guide keys. Guides are interpolated; the selected curve shape is authored design intent, not an exact reconstruction of a photograph. Loop orientation, crossings, seam and compatible span order still require ordinary validation. Inserting a guide changes topology/correspondence and must be reported; positive profile scaling should preserve the original span identities.++Generated sections retain keyed source identity and explicit order. Correspondence remains by semantic spans with the existing validation; no nearest-point rematching. Expanded source must not need to become the durable document.++**Acceptance:** express the body station family and neck profiles in compact source, preserve correspondence/pcurve evidence, and compare exact exports against the current generator-authored fixtures.++## 6. Surfacing intent: straight runs and local fairing controls++**Friction:** the first rounded neck looked acceptable from the front but bulged in side profile. SectionChain's automatic tangent selection cannot know that the author intends a straight shaft and a short fairing at the heel. Adding more coordinates is a poor substitute for expressing that intent.++```firmament+SectionChain Neck {+ Continuity: G1+ // Existing section declarations.+ Transition HeelToShaft {+ From: Heel+ To: Shaft+ Law: SmoothPolynomial+ EndTangent: ShaftDirection+ }+ Transition ShaftToNut {+ From: Shaft+ To: Nut+ Law: Ruled+ }+ Require StraightBack {+ Spans: [BackLeft, BackRight]+ From: Shaft+ To: Nut+ Envelope: ShaftEnvelope+ }+}+```++Per-transition law and tangent references are proposed additions. A named direction alone does not determine a full tangent field or magnitude; the binder must derive the corresponding control-field constraints and disclose any remaining selection. A smooth-to-ruled join must satisfy the requested G1 continuity. Reject incompatible intent rather than silently relaxing G1.++The `StraightBack` form is a candidate declarative requirement over authored support/envelope semantics; its precise proof scope needs review. Do not mark a sampled silhouette check as an exact global proof. The first slice can simply expose deterministic endpoint tangent constraints and report their satisfaction, without implementing this larger envelope predicate.++Keep existing local transition dependencies, polynomial representation, pcurves and eligibility checks. JudgmentEngine may choose among admissible bounded fairing policies; it must never trade away a hard straight-run or continuity requirement for a prettier score. Caps remain independently G0 unless explicitly designed otherwise.++**Acceptance:** recreate the approved flat-ish neck with an explicit straight-run/fairing declaration and stable side silhouette. Contradictory tangent/continuity intent fails with a named section/transition diagnostic.++## 7. Non-planar placement: surface attachments with explicit orientation++**Friction:** guitar controls and hardware use manually chosen heights on a carved top. An arbitrary rigid orientation is already representable; what is missing is deriving a stable attachment frame from a curved support.++```firmament+SurfaceAttachment VolumeKnobSite {+ Support: Body.CarvedTop+ Location: SurfaceUV(0.62, 0.28)+ Side: Outside+ Clocking: Along(Body.Centerline)+ Offset: 1mm+}++Interface<Fixed> VolumeKnobMount {+ A: Guitar.Body.VolumeKnobSite+ B: Guitar.VolumeKnob.Seat+}+```++Resolve the attachment in definition-local geometry, then compose occurrence transforms. The oriented surface normal provides Z; a projected named direction provides X. Reject singular locations, a vanishing clocking projection, points outside trim domains, and ambiguous support selectors.++Start with named analytic planes/cylinders/cones/spheres. Add explicitly identified SectionChain patches and their stable parameter charts next. A raw normalized UV is tied to that chart, not a persistent physical location under all topology edits; inspection and documentation must say so. Later location modes may use an authored curve/section intersection or an explicit projection ray with a selected hit rule. Never silently choose a nearest rendered triangle or nearest geometric hit.++This locates a point/frame. It does **not** prove that a wide flat hardware base conforms to a curved top, cuts a mounting pocket, or makes contact everywhere. Those are separate footprint, seat-construction and clearance contracts.++**Acceptance:** place a control on a known curved support without absolute Z; edit the support and track its attachment; reject seam/singularity/trim failures. Display/export must consume the compiled frame without rerunning surface placement on camera rotation.++## 8. Pure engineering expressions and finite sample sets++**Friction:** fret positions require `ScaleLength * (1 - 2^(-n/12))`; the Python generator also handles taper interpolation and geometry-vector calculations. A finite value calculation should not force source generation.++```firmament+Static ScaleLength: Length = 628mm+Static NutY: Length = 658mm+Static Frets = SampleSet {+ Index: 1..22+ Key: index+ Value: FretSite {+ Y: NutY - ScaleLength * (1 - pow(2, -index / 12.0))+ }+}+```++Extend the existing typed value evaluator rather than inventing an assembly-only expression engine. Admit arithmetic and a small pure math set, including dimensionless `pow`, length interpolation and explicit Angle trigonometry. Define real versus integer division, unit rules, finite results and evaluation ordering. Frame/vector operations should be typed intrinsics, not arbitrary numeric lists.++`SampleSet` is a proposed bounded collection producer, with a finite count limit and stable keys. It is not a runtime loop, recursion, IO, mutable state or source-string macro. Existing Static Record/Set syntax remains valid. Use shared specialization and schema machinery wherever possible.++**Acceptance:** author all 22 frets without Python; diagnose dimensional misuse, nonfinite results and expansion limits at their expressions. Generated sites retain the formula and index in source provenance.++## 9. Point-driven WireForm routes++**Friction:** each guitar string currently needs Python to calculate directions, bend angle, tangent setbacks and its placement basis. WireForm already owns the exact straight/bend construction.++```firmament+WireRoute LowE {+ Diameter: 0.68mm+ Material: Standard.Materials.StainlessSteel.304_Annealed+ Start: Tailpiece.LowE.Exit.Point+ Corner NutBreak {+ At: Nut.LowE.Guide.Point+ Radius: 3mm+ }+ End: Tuners.LowE.Post.Point+}+```++First admit exactly three non-collinear points and one explicit centerline bend radius. `At` is the intersection of the untrimmed straight legs, not a point that the rounded centerline passes through. Derive the plane, tangents, angle and setbacks; lower to the existing WireForm forming sequence. Reject overlapping setbacks, insufficient leg length, degenerate geometry and inadmissible radius.++All inputs must resolve in one declared definition/assembly coordinate scope. If the route depends on other occurrences, evaluate their fixed placement first and retain that dependency; cycles or dynamic-joint endpoints are deferred, not iteratively guessed. Publish Start/End frames and the compiler-derived centerline length through the same semantic authority.++The route is geometry, not string tension/vibration, wound-wire detail, a shortest-path solver, or automatic collision avoidance. Preserve current material and clearance validation.++**Acceptance:** replace `formed_string()` in the generator with six route declarations or an assembly Pattern; compare route endpoints, lengths and exact cylinder/torus construction; retain existing thin-string regression coverage.++## 10. Semantic appearance assignment++**Friction:** preview colors are keyed by specialization strings in JSON, and Cycles material selection uses occurrence-name matching. That makes visual meaning brittle even though geometry remains authoritative.++```firmament+Appearance CherryWood {+ BaseColor: [0.15, 0.025, 0.012]+ Metallic: 0+ Roughness: 0.25+}+AppearanceAssignment NeckFinish {+ Target: Guitar.Neck+ Look: CherryWood+}+```++Start with named portable simple appearances and semantic definition/occurrence selectors. Define precedence explicitly: occurrence assignment over definition assignment over default. Keep engineering stock material separate from visual finish. A look edit changes bindings/scene data, not exact geometry or tessellation.++A later `ExternalLook` may bind a USD material prim or downstream renderer recipe. Do not imply that Cycles node graphs are portable USD PreviewSurface shaders. Procedural sunburst/edge-distance coloration remains an honest downstream capability until an explicit supported shader contract exists. Do not broaden P0 into a shading language or texture-generation project.++**Acceptance:** rename an occurrence without losing its authored finish; export deterministic USD bindings; preserve BRep/display hashes when changing roughness. STEP geometry continues to stand independently of the rendering recipe.++## 11. One compilation experience, with useful expanded-source evidence++**Friction:** the witness uses separate assembly, section-chain and ordinary build commands. Profile/SectionChain source can enter an extrusion parser through ordinary `build`. Generated names and handwritten matrices also obscure which source declaration owns a defect.++```text+aetheris build guitar.firmament --target step,usd --out artifacts/local/guitar+aetheris inspect guitar.firmament --expanded --placements --dependencies --json+```++Unified dispatch should identify the root semantic product and invoke existing domain compilers/exporters. It must not flatten all profiles into an extrusion grammar or replace `asm`/`section-chain` compatibility commands. Requesting unsupported output reports the specific domain boundary.++Expanded inspection is read-only compiler evidence, not another authored source file. For every patterned part/section, retain its declaration span, pattern key, specialization, port binding, placement authority and dependency chain. A contradictory placement should name both drivers and the affected occurrence; a fairing failure should name the transition and intent it violated.++Generate schema/completion/hover data with each new construct, and maintain browser project-snapshot parity. Keep code editing source-owned. Preview and camera changes consume compiled geometry; semantic edits invalidate their dependency neighborhood. CLI timing should separate binding/expansion, exact materialization, tessellation and export rather than call all of them a rebuild.++**Acceptance:** build the compact guitar through one command; inspect the source row behind a selected generated fret or pole; diagnose malformed proposed constructs rather than silently ignore them. Preserve multi-file dependency hashes and existing CLI behavior.++## Review decisions and boundaries++The highest-value initial decision is the composition model: should direct frame placement be an explicit layout authority alongside Interfaces, or syntax that lowers to a fixed Interface? This draft prefers the former, with one driver per occurrence and a common transform owner. Mechanical contracts remain visible when the author declares them.++Review the seated-frame syntax before implementation. A combined relation is clearer than contradictory primitive relations with a hidden precedence rule. Also settle named pattern identity, the coordinate space of frame references, and definition-level port publication before introducing surface attachment syntax.++Each milestone should include one valid guitar-sized fixture, targeted invalid cases, CLI inspection, schema/language-analysis coverage, and the full existing solution test lane. Geometry changes require exact topology/pcurve/STEP qualification; appearance-only changes require binding and unchanged-geometry evidence. Generated artifacts stay under ignored `artifacts/local/`; durable examples belong under `fixtures/`.++Do not promise general nonlinear mating, dynamic geometry-bound routes, arbitrary freeform seat cutting, G2 surfacing, topology-changing lofts, manufacturing-perfect guitar joinery, or a renderer-portable procedural lacquer shader in these slices.++The success criterion is that the guitar becomes compact, editable Firmament whose semantic source carries repetition, attachments and relationships. Python may remain a reproducibility/render harness; it should no longer be the place that knows how the guitar is assembled.diff --git a/fixtures/Canonical/AssemblyInterfaces/AuthoringFoundation/published-ports.firmament b/fixtures/Canonical/AssemblyInterfaces/AuthoringFoundation/published-ports.firmamentnew file mode 100644index 00000000..91a1e3ce--- /dev/null+++ b/fixtures/Canonical/AssemblyInterfaces/AuthoringFoundation/published-ports.firmament@@ -0,0 +1,20 @@+Template<H: Length> Struct Post {+ Circle2 Outline { Center: [0mm,0mm] Radius: 4mm }+ Profile P { Loop Outer { Outline |> TraceLoop } }+ Extrude Body { Profile: P From: 0mm To: H }+ Expose {+ Semantic Top { DatumFrame Frame = [0mm,0mm,H] x [1,0,0] y [0,1,0] z [0,0,1]; }+ Semantic Bottom { DatumFrame Frame = [0,0,0] x [1,0,0] y [0,1,0] z [0,0,1]; }+ }+}+Assembly PublishedPorts {+ <Assembly PublishedPorts>+ <Part Base = Post<H:14mm>>+ Placement { From: Origin; To: World; }+ </Part>+ <Part Child = Post<H:14mm>>+ Placement { From: Bottom.Frame; To: PublishedPorts.Base.Top.Frame; }+ </Part>+ </Assembly>+ Anchor: PublishedPorts;+}diff --git a/fixtures/Canonical/AssemblyInterfaces/GuitarX0/Neck.firmament b/fixtures/Canonical/AssemblyInterfaces/GuitarX0/Neck.firmamentindex 681026fa..80dbdc96 100644--- a/fixtures/Canonical/AssemblyInterfaces/GuitarX0/Neck.firmament+++ b/fixtures/Canonical/AssemblyInterfaces/GuitarX0/Neck.firmament@@ -156,4 +156,6 @@ Model Neck {Start: CapEnd: Cap}+ Expose { Semantic NutMount { DatumFrame Frame = Neck.Section.S5.Frame; }+ Semantic HeelMount { DatumFrame Frame = Neck.Section.S0.Frame; } }}diff --git a/fixtures/Canonical/AssemblyInterfaces/GuitarX0/guitar-x0.firmament b/fixtures/Canonical/AssemblyInterfaces/GuitarX0/guitar-x0.firmamentindex 1fc50d9f..ebe9f187 100644--- a/fixtures/Canonical/AssemblyInterfaces/GuitarX0/guitar-x0.firmament+++ b/fixtures/Canonical/AssemblyInterfaces/GuitarX0/guitar-x0.firmament@@ -39,6 +39,8 @@ Template<H: Length> Struct Board {Extrude Body { Profile: P From: 0mm To: H }}Template<H: Length> Struct Head {+ Expose { Semantic Base { DatumFrame Frame = [0,0,0] x [1,0,0] y [0,1,0] z [0,0,1]; }+ Semantic Front { DatumFrame Frame = [0mm,0mm,H] x [1,0,0] y [0,1,0] z [0,0,1]; } }Point2 RFlare { Position: [34mm,40mm] }Point2 RSide { Position: [39mm,154mm] }Point2 RCrown { Position: [12mm,160mm] }@@ -58,329 +60,297 @@ Template<H: Length> Struct Head {Profile P From OutlineExtrude Body { Profile: P From: 0mm To: H }}+Record HardwareSite { X: Length; Y: Length; Z: Length }+Static PickupSeatsSites: Set<HardwareSite> {+ NeckPickupCream => HardwareSite { X: 0mm; Y: 98mm; Z: 53mm }+ BridgePickupCream => HardwareSite { X: 0mm; Y: 0mm; Z: 53mm }+}+Static PickupCoilsSites: Set<HardwareSite> {+ NeckPickupCoil0 => HardwareSite { X: 0mm; Y: 88mm; Z: 57mm }+ NeckPickupCoil1 => HardwareSite { X: 0mm; Y: 108mm; Z: 57mm }+ BridgePickupCoil0 => HardwareSite { X: 0mm; Y: -10mm; Z: 57mm }+ BridgePickupCoil1 => HardwareSite { X: 0mm; Y: 10mm; Z: 57mm }+}+Static PickupPolesSites: Set<HardwareSite> {+ NeckPickupPole0 => HardwareSite { X: -25.5mm; Y: 108mm; Z: 62mm }+ NeckPickupPole1 => HardwareSite { X: -15.3mm; Y: 108mm; Z: 62mm }+ NeckPickupPole2 => HardwareSite { X: -5.1mm; Y: 108mm; Z: 62mm }+ NeckPickupPole3 => HardwareSite { X: 5.1mm; Y: 108mm; Z: 62mm }+ NeckPickupPole4 => HardwareSite { X: 15.3mm; Y: 108mm; Z: 62mm }+ NeckPickupPole5 => HardwareSite { X: 25.5mm; Y: 108mm; Z: 62mm }+ BridgePickupPole0 => HardwareSite { X: -25.5mm; Y: 10mm; Z: 62mm }+ BridgePickupPole1 => HardwareSite { X: -15.3mm; Y: 10mm; Z: 62mm }+ BridgePickupPole2 => HardwareSite { X: -5.1mm; Y: 10mm; Z: 62mm }+ BridgePickupPole3 => HardwareSite { X: 5.1mm; Y: 10mm; Z: 62mm }+ BridgePickupPole4 => HardwareSite { X: 15.3mm; Y: 10mm; Z: 62mm }+ BridgePickupPole5 => HardwareSite { X: 25.5mm; Y: 10mm; Z: 62mm }+}+Static SaddlesSites: Set<HardwareSite> {+ Saddle0 => HardwareSite { X: -25.5mm; Y: -35mm; Z: 63mm }+ Saddle1 => HardwareSite { X: -15.3mm; Y: -35mm; Z: 63mm }+ Saddle2 => HardwareSite { X: -5.1mm; Y: -35mm; Z: 63mm }+ Saddle3 => HardwareSite { X: 5.1mm; Y: -35mm; Z: 63mm }+ Saddle4 => HardwareSite { X: 15.3mm; Y: -35mm; Z: 63mm }+ Saddle5 => HardwareSite { X: 25.5mm; Y: -35mm; Z: 63mm }+}+Static TunerPostsSites: Set<HardwareSite> {+ TunerPost00 => HardwareSite { X: -27mm; Y: 716.513464mm; Z: 49.56839mm }+ TunerPost01 => HardwareSite { X: -27mm; Y: 751.590786mm; Z: 41.470152mm }+ TunerPost02 => HardwareSite { X: -27mm; Y: 786.668108mm; Z: 33.371914mm }+ TunerPost20 => HardwareSite { X: 27mm; Y: 716.513464mm; Z: 49.56839mm }+ TunerPost21 => HardwareSite { X: 27mm; Y: 751.590786mm; Z: 41.470152mm }+ TunerPost22 => HardwareSite { X: 27mm; Y: 786.668108mm; Z: 33.371914mm }+}+Static TunerWashersSites: Set<HardwareSite> {+ TunerWasher00 => HardwareSite { X: -27mm; Y: 716.513464mm; Z: 49.56839mm }+ TunerWasher01 => HardwareSite { X: -27mm; Y: 751.590786mm; Z: 41.470152mm }+ TunerWasher02 => HardwareSite { X: -27mm; Y: 786.668108mm; Z: 33.371914mm }+ TunerWasher20 => HardwareSite { X: 27mm; Y: 716.513464mm; Z: 49.56839mm }+ TunerWasher21 => HardwareSite { X: 27mm; Y: 751.590786mm; Z: 41.470152mm }+ TunerWasher22 => HardwareSite { X: 27mm; Y: 786.668108mm; Z: 33.371914mm }+}+Static TunerButtonsSites: Set<HardwareSite> {+ TunerButton00 => HardwareSite { X: -49mm; Y: 716.513464mm; Z: 42.56839mm }+ TunerButton01 => HardwareSite { X: -49mm; Y: 751.590786mm; Z: 34.470152mm }+ TunerButton02 => HardwareSite { X: -49mm; Y: 786.668108mm; Z: 26.371914mm }+ TunerButton20 => HardwareSite { X: 49mm; Y: 716.513464mm; Z: 42.56839mm }+ TunerButton21 => HardwareSite { X: 49mm; Y: 751.590786mm; Z: 34.470152mm }+ TunerButton22 => HardwareSite { X: 49mm; Y: 786.668108mm; Z: 26.371914mm }+}Assembly GuitarX0 {<Assembly GuitarX0><Part MahoganyBack = SectionChainFile<"MahoganyBack.firmament">>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,0,0,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,0mm,0mm]; }</Part><Part IvoryBinding = SectionChainFile<"IvoryBinding.firmament">>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,0,0,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,0mm,0mm]; }</Part><Part CarvedMaple = SectionChainFile<"CarvedMaple.firmament">>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,0,0,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,0mm,0mm]; }</Part><Part Neck = SectionChainFile<"Neck.firmament">>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,0,0,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,0mm,0mm]; }</Part><Part BoardBinding = Board<H:5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,0,55,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,0mm,55mm]; }</Part><Part Rosewood = Board<H:2mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,0,60,1];- </Part>- <Part Headstock = Head<H:14mm>>- Placement LegacyExplicit = [1,0,0,0,0,0.974370064785235,-0.224951054343865,0,0,0.224951054343865,0.974370064785235,0,0,660,48,1];- </Part>- <Part HeadVeneer = Head<H:1mm>>- Placement LegacyExplicit = [1,0,0,0,0,0.974370064785235,-0.224951054343865,0,0,0.224951054343865,0.974370064785235,0,0,663.149314760814,61.6411809069933,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,0mm,60mm]; }</Part>+<Part Headstock = Head<H:14mm>>+ Placement { From: Base.Frame; To: HeadTilt.Frame; }+</Part>+<Part HeadVeneer = Head<H:1mm>>+</Part><Part Nut = Panel<L:44mm,W:4mm,H:3mm,R:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,658,62,1];- </Part>- <Part NeckPickupCream = Surround<L:88mm,W:46mm,H:4mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,98,53,1];- </Part>- <Part NeckPickupCoil0 = Panel<L:70mm,W:17mm,H:5mm,R:3mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,88,57,1];- </Part>- <Part NeckPickupCoil1 = Panel<L:70mm,W:17mm,H:5mm,R:3mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,108,57,1];- </Part>- <Part NeckPickupPole0 = Drum<R:2.2mm,H:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,-25.5,108,62,1];- </Part>- <Part NeckPickupPole1 = Drum<R:2.2mm,H:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,-15.3,108,62,1];- </Part>- <Part NeckPickupPole2 = Drum<R:2.2mm,H:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,-5.1,108,62,1];- </Part>- <Part NeckPickupPole3 = Drum<R:2.2mm,H:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,5.1,108,62,1];- </Part>- <Part NeckPickupPole4 = Drum<R:2.2mm,H:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,15.3,108,62,1];- </Part>- <Part NeckPickupPole5 = Drum<R:2.2mm,H:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,25.5,108,62,1];- </Part>- <Part BridgePickupCream = Surround<L:88mm,W:46mm,H:4mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,0,53,1];- </Part>- <Part BridgePickupCoil0 = Panel<L:70mm,W:17mm,H:5mm,R:3mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,-10,57,1];- </Part>- <Part BridgePickupCoil1 = Panel<L:70mm,W:17mm,H:5mm,R:3mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,10,57,1];- </Part>- <Part BridgePickupPole0 = Drum<R:2.2mm,H:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,-25.5,10,62,1];- </Part>- <Part BridgePickupPole1 = Drum<R:2.2mm,H:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,-15.3,10,62,1];- </Part>- <Part BridgePickupPole2 = Drum<R:2.2mm,H:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,-5.1,10,62,1];- </Part>- <Part BridgePickupPole3 = Drum<R:2.2mm,H:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,5.1,10,62,1];- </Part>- <Part BridgePickupPole4 = Drum<R:2.2mm,H:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,15.3,10,62,1];- </Part>- <Part BridgePickupPole5 = Drum<R:2.2mm,H:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,25.5,10,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,658mm,62mm]; }</Part><Part Bridge = Panel<L:82mm,W:12mm,H:6mm,R:5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,-35,57,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,-35mm,57mm]; }</Part><Part Tailpiece = Panel<L:88mm,W:15mm,H:7mm,R:6mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,-75,53,1];- </Part>- <Part Saddle0 = Panel<L:7mm,W:9mm,H:2mm,R:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,-25.5,-35,63,1];- </Part>- <Part Saddle1 = Panel<L:7mm,W:9mm,H:2mm,R:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,-15.3,-35,63,1];- </Part>- <Part Saddle2 = Panel<L:7mm,W:9mm,H:2mm,R:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,-5.1,-35,63,1];- </Part>- <Part Saddle3 = Panel<L:7mm,W:9mm,H:2mm,R:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,5.1,-35,63,1];- </Part>- <Part Saddle4 = Panel<L:7mm,W:9mm,H:2mm,R:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,15.3,-35,63,1];- </Part>- <Part Saddle5 = Panel<L:7mm,W:9mm,H:2mm,R:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,25.5,-35,63,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,-75mm,53mm]; }</Part><Part KnobSkirt0 = Drum<R:12mm,H:3mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,79,-95,50,1];+ Placement { From: Origin; To: World; TranslateLocal: [79mm,-95mm,50mm]; }</Part><Part AmberKnob0 = Drum<R:9mm,H:9mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,79,-95,53,1];+ Placement { From: Origin; To: World; TranslateLocal: [79mm,-95mm,53mm]; }</Part><Part KnobCap0 = Drum<R:5mm,H:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,79,-95,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [79mm,-95mm,62mm]; }</Part><Part KnobSkirt1 = Drum<R:12mm,H:3mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,123,-70,45,1];+ Placement { From: Origin; To: World; TranslateLocal: [123mm,-70mm,45mm]; }</Part><Part AmberKnob1 = Drum<R:9mm,H:9mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,123,-70,48,1];+ Placement { From: Origin; To: World; TranslateLocal: [123mm,-70mm,48mm]; }</Part><Part KnobCap1 = Drum<R:5mm,H:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,123,-70,57,1];+ Placement { From: Origin; To: World; TranslateLocal: [123mm,-70mm,57mm]; }</Part><Part KnobSkirt2 = Drum<R:12mm,H:3mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,75,-156,47,1];+ Placement { From: Origin; To: World; TranslateLocal: [75mm,-156mm,47mm]; }</Part><Part AmberKnob2 = Drum<R:9mm,H:9mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,75,-156,50,1];+ Placement { From: Origin; To: World; TranslateLocal: [75mm,-156mm,50mm]; }</Part><Part KnobCap2 = Drum<R:5mm,H:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,75,-156,59,1];+ Placement { From: Origin; To: World; TranslateLocal: [75mm,-156mm,59mm]; }</Part><Part KnobSkirt3 = Drum<R:12mm,H:3mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,121,-131,43,1];+ Placement { From: Origin; To: World; TranslateLocal: [121mm,-131mm,43mm]; }</Part><Part AmberKnob3 = Drum<R:9mm,H:9mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,121,-131,46,1];+ Placement { From: Origin; To: World; TranslateLocal: [121mm,-131mm,46mm]; }</Part><Part KnobCap3 = Drum<R:5mm,H:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,121,-131,55,1];+ Placement { From: Origin; To: World; TranslateLocal: [121mm,-131mm,55mm]; }</Part><Part SelectorRing = Drum<R:16mm,H:1.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,-73,137,43,1];+ Placement { From: Origin; To: World; TranslateLocal: [-73mm,137mm,43mm]; }</Part><Part SelectorStem = Drum<R:2.5mm,H:12mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,-73,137,44.5,1];+ Placement { From: Origin; To: World; TranslateLocal: [-73mm,137mm,44.5mm]; }</Part><Part SelectorTip = Drum<R:4mm,H:7mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,-73,137,54,1];+ Placement { From: Origin; To: World; TranslateLocal: [-73mm,137mm,54mm]; }</Part><Part ControlCover = Panel<L:63mm,W:93mm,H:1mm,R:15mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,85,-115,-1,1];+ Placement { From: Origin; To: World; TranslateLocal: [85mm,-115mm,-1mm]; }</Part><Part SelectorCover = Drum<R:24mm,H:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,-73,137,-1,1];+ Placement { From: Origin; To: World; TranslateLocal: [-73mm,137mm,-1mm]; }</Part><Part Fret1 = Panel<L:42.896685mm,W:1.2mm,H:1mm,R:0.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,622.753068364104,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,622.753068mm,62mm]; }</Part><Part Fret2 = Panel<L:43.697598mm,W:1.2mm,H:1mm,R:0.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,589.484394992133,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,589.484395mm,62mm]; }</Part><Part Fret3 = Panel<L:44.453559mm,W:1.2mm,H:1mm,R:0.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,558.082948779333,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,558.082949mm,62mm]; }</Part><Part PearlInlay3 = Panel<L:25mm,W:12mm,H:0.3mm,R:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,573.783671885733,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,573.783672mm,62mm]; }</Part><Part Fret4 = Panel<L:45.167091mm,W:1.2mm,H:1mm,R:0.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,528.443930318015,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,528.44393mm,62mm]; }</Part><Part Fret5 = Panel<L:45.840575mm,W:1.2mm,H:1mm,R:0.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,500.468422139278,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,500.468422mm,62mm]; }</Part><Part PearlInlay5 = Panel<L:25mm,W:12mm,H:0.3mm,R:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,514.456176228646,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,514.456176mm,62mm]; }</Part><Part Fret6 = Panel<L:46.47626mm,W:1.2mm,H:1mm,R:0.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,474.063058585152,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,474.063059mm,62mm]; }</Part><Part Fret7 = Panel<L:47.076266mm,W:1.2mm,H:1mm,R:0.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,449.139714209391,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,449.139714mm,62mm]; }</Part><Part PearlInlay7 = Panel<L:25mm,W:12mm,H:0.3mm,R:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,461.601386397271,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,461.601386mm,62mm]; }</Part><Part Fret8 = Panel<L:47.642597mm,W:1.2mm,H:1mm,R:0.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,425.61520966699,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,425.61521mm,62mm]; }</Part><Part Fret9 = Panel<L:48.177142mm,W:1.2mm,H:1mm,R:0.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,403.411034110854,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,403.411034mm,62mm]; }</Part><Part PearlInlay9 = Panel<L:25mm,W:12mm,H:0.3mm,R:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,414.513121888922,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,414.513122mm,62mm]; }</Part><Part Fret10 = Panel<L:48.681685mm,W:1.2mm,H:1mm,R:0.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,382.453083169143,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,382.453083mm,62mm]; }</Part><Part Fret11 = Panel<L:49.15791mm,W:1.2mm,H:1mm,R:0.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,362.671411628819,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,362.671412mm,62mm]; }</Part><Part Fret12 = Panel<L:49.607407mm,W:1.2mm,H:1mm,R:0.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,344,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,344mm,62mm]; }</Part><Part PearlInlay12 = Panel<L:25mm,W:12mm,H:0.3mm,R:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,353.335705814409,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,353.335706mm,62mm]; }</Part><Part Fret13 = Panel<L:50.031676mm,W:1.2mm,H:1mm,R:0.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,326.376534182052,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,326.376534mm,62mm]; }</Part><Part Fret14 = Panel<L:50.432132mm,W:1.2mm,H:1mm,R:0.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,309.742197496067,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,309.742197mm,62mm]; }</Part><Part Fret15 = Panel<L:50.810113mm,W:1.2mm,H:1mm,R:0.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,294.041474389666,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,294.041474mm,62mm]; }</Part><Part PearlInlay15 = Panel<L:25mm,W:12mm,H:0.3mm,R:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,301.891835942866,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,301.891836mm,62mm]; }</Part><Part Fret16 = Panel<L:51.166879mm,W:1.2mm,H:1mm,R:0.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,279.221965159007,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,279.221965mm,62mm]; }</Part><Part Fret17 = Panel<L:51.503621mm,W:1.2mm,H:1mm,R:0.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,265.234211069639,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,265.234211mm,62mm]; }</Part><Part PearlInlay17 = Panel<L:25mm,W:12mm,H:0.3mm,R:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,272.228088114323,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,272.228088mm,62mm]; }</Part><Part Fret18 = Panel<L:51.821463mm,W:1.2mm,H:1mm,R:0.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,252.031529292576,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,252.031529mm,62mm]; }</Part><Part Fret19 = Panel<L:52.121466mm,W:1.2mm,H:1mm,R:0.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,239.569857104695,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,239.569857mm,62mm]; }</Part><Part PearlInlay19 = Panel<L:25mm,W:12mm,H:0.3mm,R:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,245.800693198636,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,245.800693mm,62mm]; }</Part><Part Fret20 = Panel<L:52.404632mm,W:1.2mm,H:1mm,R:0.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,227.807604833495,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,227.807605mm,62mm]; }</Part><Part Fret21 = Panel<L:52.671904mm,W:1.2mm,H:1mm,R:0.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,216.705517055427,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,216.705517mm,62mm]; }</Part><Part PearlInlay21 = Panel<L:25mm,W:12mm,H:0.3mm,R:1mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,222.256560944461,62,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,222.256561mm,62mm]; }</Part><Part Fret22 = Panel<L:52.924176mm,W:1.2mm,H:1mm,R:0.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,0,206.226541584572,62,1];- </Part>- <Part TunerPost00 = Drum<R:4mm,H:8mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,-27,716.513463757544,49.5683898198344,1];- </Part>- <Part TunerWasher00 = Drum<R:7mm,H:1.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,-27,716.513463757544,49.5683898198344,1];- </Part>- <Part TunerButton00 = Panel<L:15mm,W:19mm,H:6mm,R:5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,-49,716.513463757544,42.5683898198344,1];+ Placement { From: Origin; To: World; TranslateLocal: [0mm,206.226542mm,62mm]; }</Part><Part String0 = GuitarString<D:0.28mm,Lead:732.679593mm,Tail:59.754816mm,Deflection:13.639458deg>>- Placement LegacyExplicit = [-0.735853071477427,0.00752919240938704,0.677099378569276,0,0.677063937819737,-0.00692766648519513,0.735891589530075,0,0.0102313880420824,0.999947657979523,0,0,-25.5,-75,65,1];- </Part>- <Part TunerPost01 = Drum<R:4mm,H:8mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,-27,751.590786089812,41.4701518634552,1];- </Part>- <Part TunerWasher01 = Drum<R:7mm,H:1.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,-27,751.590786089812,41.4701518634552,1];- </Part>- <Part TunerButton01 = Panel<L:15mm,W:19mm,H:6mm,R:5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,-49,751.590786089812,34.4701518634552,1];+ Placement { From: Origin; To: World; TranslateLocal: [-25.5mm,-75mm,65mm]; Normal: [0.0102313880420824,0.999947657979523,0]; Up: [0.677063937819737,-0.00692766648519513,0.735891589530075]; }</Part><Part String1 = GuitarString<D:0.36mm,Lead:732.619706mm,Tail:96.378981mm,Deflection:14.968066deg>>- Placement LegacyExplicit = [-0.741339625949553,0.00455119824934923,0.67111462924859,0,0.67110198271469,-0.00411999852962634,0.741353596071758,0,0.00613903847430546,0.999981155925756,0,0,-15.3,-75,65,1];- </Part>- <Part TunerPost02 = Drum<R:4mm,H:8mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,-27,786.668108422081,33.3719139070761,1];- </Part>- <Part TunerWasher02 = Drum<R:7mm,H:1.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,-27,786.668108422081,33.3719139070761,1];- </Part>- <Part TunerButton02 = Panel<L:15mm,W:19mm,H:6mm,R:5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,-49,786.668108422081,26.3719139070761,1];+ Placement { From: Origin; To: World; TranslateLocal: [-15.3mm,-75mm,65mm]; Normal: [0.00613903847430546,0.999981155925756,0]; Up: [0.67110198271469,-0.00411999852962634,0.741353596071758]; }</Part><Part String2 = GuitarString<D:0.44mm,Lead:732.593764mm,Tail:133.054198mm,Deflection:15.480813deg>>- Placement LegacyExplicit = [-0.747493541507803,0.001529659361885,0.664267314826162,0,0.664265923957594,-0.001359343637021,0.747495106641937,0,0.00204638043552803,0.999997906161364,0,0,-5.1,-75,65,1];- </Part>- <Part TunerPost20 = Drum<R:4mm,H:8mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,27,716.513463757544,49.5683898198344,1];- </Part>- <Part TunerWasher20 = Drum<R:7mm,H:1.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,27,716.513463757544,49.5683898198344,1];- </Part>- <Part TunerButton20 = Panel<L:15mm,W:19mm,H:6mm,R:5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,49,716.513463757544,42.5683898198344,1];+ Placement { From: Origin; To: World; TranslateLocal: [-5.1mm,-75mm,65mm]; Normal: [0.00204638043552803,0.999997906161364,0]; Up: [0.664265923957594,-0.001359343637021,0.747495106641937]; }</Part><Part String5 = GuitarString<D:0.68mm,Lead:732.679593mm,Tail:59.754816mm,Deflection:13.639458deg>>- Placement LegacyExplicit = [-0.735853071477427,-0.00752919240938704,-0.677099378569276,0,-0.677063937819737,-0.00692766648519513,0.735891589530075,0,-0.0102313880420824,0.999947657979523,0,0,25.5,-75,65,1];- </Part>- <Part TunerPost21 = Drum<R:4mm,H:8mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,27,751.590786089812,41.4701518634552,1];- </Part>- <Part TunerWasher21 = Drum<R:7mm,H:1.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,27,751.590786089812,41.4701518634552,1];- </Part>- <Part TunerButton21 = Panel<L:15mm,W:19mm,H:6mm,R:5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,49,751.590786089812,34.4701518634552,1];+ Placement { From: Origin; To: World; TranslateLocal: [25.5mm,-75mm,65mm]; Normal: [-0.0102313880420824,0.999947657979523,0]; Up: [-0.677063937819737,-0.00692766648519513,0.735891589530075]; }</Part><Part String4 = GuitarString<D:0.6mm,Lead:732.619706mm,Tail:96.378981mm,Deflection:14.968066deg>>- Placement LegacyExplicit = [-0.741339625949553,-0.00455119824934923,-0.67111462924859,0,-0.67110198271469,-0.00411999852962634,0.741353596071758,0,-0.00613903847430546,0.999981155925756,0,0,15.3,-75,65,1];- </Part>- <Part TunerPost22 = Drum<R:4mm,H:8mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,27,786.668108422081,33.3719139070761,1];- </Part>- <Part TunerWasher22 = Drum<R:7mm,H:1.5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,27,786.668108422081,33.3719139070761,1];- </Part>- <Part TunerButton22 = Panel<L:15mm,W:19mm,H:6mm,R:5mm>>- Placement LegacyExplicit = [1,0,0,0,-0,1,0,0,0,0,1,0,49,786.668108422081,26.3719139070761,1];+ Placement { From: Origin; To: World; TranslateLocal: [15.3mm,-75mm,65mm]; Normal: [-0.00613903847430546,0.999981155925756,0]; Up: [-0.67110198271469,-0.00411999852962634,0.741353596071758]; }</Part><Part String3 = GuitarString<D:0.52mm,Lead:732.593764mm,Tail:133.054198mm,Deflection:15.480813deg>>- Placement LegacyExplicit = [-0.747493541507803,-0.001529659361885,-0.664267314826162,0,-0.664265923957594,-0.001359343637021,0.747495106641937,0,-0.00204638043552803,0.999997906161364,0,0,5.1,-75,65,1];+ Placement { From: Origin; To: World; TranslateLocal: [5.1mm,-75mm,65mm]; Normal: [-0.00204638043552803,0.999997906161364,0]; Up: [-0.664265923957594,-0.001359343637021,0.747495106641937]; }</Part>+Pattern PickupSeats Over PickupSeatsSites {+ site => <Part PickupCream = Surround<L:88mm,W:46mm,H:4mm>>+ Placement { From: Origin; To: World; TranslateLocal: [site.X,site.Y,site.Z]; }+ </Part>+}+Pattern PickupCoils Over PickupCoilsSites {+ site => <Part PickupCoil = Panel<L:70mm,W:17mm,H:5mm,R:3mm>>+ Placement { From: Origin; To: World; TranslateLocal: [site.X,site.Y,site.Z]; }+ </Part>+}+Pattern PickupPoles Over PickupPolesSites {+ site => <Part PickupPole = Drum<R:2.2mm,H:1mm>>+ Placement { From: Origin; To: World; TranslateLocal: [site.X,site.Y,site.Z]; }+ </Part>+}+Pattern Saddles Over SaddlesSites {+ site => <Part Saddle = Panel<L:7mm,W:9mm,H:2mm,R:1mm>>+ Placement { From: Origin; To: World; TranslateLocal: [site.X,site.Y,site.Z]; }+ </Part>+}+Pattern TunerPosts Over TunerPostsSites {+ site => <Part TunerPost = Drum<R:4mm,H:8mm>>+ Placement { From: Origin; To: World; TranslateLocal: [site.X,site.Y,site.Z]; }+ </Part>+}+Pattern TunerWashers Over TunerWashersSites {+ site => <Part TunerWasher = Drum<R:7mm,H:1.5mm>>+ Placement { From: Origin; To: World; TranslateLocal: [site.X,site.Y,site.Z]; }+ </Part>+}+Pattern TunerButtons Over TunerButtonsSites {+ site => <Part TunerButton = Panel<L:15mm,W:19mm,H:6mm,R:5mm>>+ Placement { From: Origin; To: World; TranslateLocal: [site.X,site.Y,site.Z]; }+ </Part>+}</Assembly>+ FrameTransform NutWorld { From: GuitarX0.Neck.NutMount.Frame; Normal: [0,1,0]; Up: [0,0,1]; TranslateLocal: [0mm,-7mm,0mm]; }+ FrameTransform HeadTilt { From: NutWorld.Frame; RotateLocal: { Axis: X; Angle: -13deg } }+ Interface<Fixed> VeneerSeat { A: GuitarX0.Headstock.Front.Frame; B: GuitarX0.HeadVeneer.Base.Frame; Gap: 0mm; Clocking: 0deg; }Anchor: GuitarX0;}diff --git a/scripts/create-guitar-x0.py b/scripts/create-guitar-x0.pyindex b2334a16..828411c6 100644--- a/scripts/create-guitar-x0.py+++ b/scripts/create-guitar-x0.py@@ -6,6 +6,7 @@ exports and renders belong under artifacts/local/guitar-x0.from pathlib import Pathimport mathimport json+import reROOT = Path('fixtures/Canonical/AssemblyInterfaces/GuitarX0')ROOT.mkdir(parents=True, exist_ok=True)@@ -88,7 +89,9 @@ for i,(y,depth) in enumerate(neck_stations):rows.append(' SectionChain Neck { Continuity: G1')for i in range(len(neck_stations)):rows.append(f' Section S{i} {{ Frame: F{i}\n Profile: P{i}\n Seam: Edge0 }}')-rows.extend([' Start: Cap',' End: Cap',' }','}'])+rows.extend([' Start: Cap',' End: Cap',' }',+ ' Expose { Semantic NutMount { DatumFrame Frame = Neck.Section.S5.Frame; }',+ ' Semantic HeelMount { DatumFrame Frame = Neck.Section.S0.Frame; } }','}'])(ROOT/'Neck.firmament').write_text('\n'.join(rows)+'\n')templates='''// GUITAR-SURFACING-X0. Original design inspired by the single-cut family.@@ -132,6 +135,8 @@ Template<H: Length> Struct Board {Extrude Body { Profile: P From: 0mm To: H }}Template<H: Length> Struct Head {+ Expose { Semantic Base { DatumFrame Frame = [0,0,0] x [1,0,0] y [0,1,0] z [0,0,1]; }+ Semantic Front { DatumFrame Frame = [0mm,0mm,H] x [1,0,0] y [0,1,0] z [0,0,1]; } }Point2 RFlare { Position: [34mm,40mm] }Point2 RSide { Position: [39mm,154mm] }Point2 RCrown { Position: [12mm,160mm] }@@ -154,10 +159,9 @@ Template<H: Length> Struct Head {'''parts=[]def part(name,definition,x=0,y=0,z=0,angle=0,axis='z'):- c,s=math.cos(math.radians(angle)),math.sin(math.radians(angle))- rot=[c,s,0,0,-s,c,0,0,0,0,1,0] if axis=='z' else [1,0,0,0,0,c,s,0,0,-s,c,0]- matrix=','.join(f'{v:.15g}' for v in rot+[x,y,z,1])- parts.append(f' <Part {name} = {definition}>\n Placement LegacyExplicit = [{matrix}];\n </Part>')+ rotate=f' RotateLocal: {{ Axis: {axis.upper()}; Angle: {number(angle)}deg }}' if angle else ''+ translation=','.join(number(v)+'mm' for v in (x,y,z))+ parts.append(f' <Part {name} = {definition}>\n Placement {{ From: Origin; To: World; TranslateLocal: [{translation}];{rotate} }}\n </Part>')def formed_string(name, start, nut, end, diameter):def subtract(a,b):return [x-y for x,y in zip(a,b)]@@ -170,9 +174,9 @@ def formed_string(name, start, nut, end, diameter):yaxis=[zaxis[1]*xaxis[2]-zaxis[2]*xaxis[1],zaxis[2]*xaxis[0]-zaxis[0]*xaxis[2],zaxis[0]*xaxis[1]-zaxis[1]*xaxis[0]]angle=math.acos(sum(a*b for a,b in zip(zaxis,target)))setback=3*math.tan(angle/2)- matrix=','.join(f'{v:.15g}' for v in xaxis+[0]+yaxis+[0]+zaxis+[0]+list(start)+[1])definition=f'GuitarString<D:{number(diameter)}mm,Lead:{number(lead_length-setback)}mm,Tail:{number(tail_length-setback)}mm,Deflection:{number(math.degrees(angle))}deg>'- parts.append(f' <Part {name} = {definition}>\n Placement LegacyExplicit = [{matrix}];\n </Part>')+ vector=lambda vs:','.join(f'{v:.15g}' for v in vs)+ parts.append(f' <Part {name} = {definition}>\n Placement {{ From: Origin; To: World; TranslateLocal: [{",".join(number(v)+"mm" for v in start)}]; Normal: [{vector(zaxis)}]; Up: [{vector(yaxis)}]; }}\n </Part>')if name=='String5':# The same formed route as a standalone CLI inspection/STEP witness.vector=lambda vs:','.join(f'{v:.15g}' for v in vs)@@ -194,8 +198,11 @@ for name in ['MahoganyBack','IvoryBinding','CarvedMaple','Neck']:part(name,f'SectionChainFile<"{name}.firmament">')part('BoardBinding','Board<H:5mm>',z=55)part('Rosewood','Board<H:2mm>',z=60)-part('Headstock','Head<H:14mm>',y=660,z=48,angle=-13,axis='x')-part('HeadVeneer','Head<H:1mm>',y=660+14*math.sin(math.radians(13)),z=48+14*math.cos(math.radians(13)),angle=-13,axis='x')+parts.append('''<Part Headstock = Head<H:14mm>>+ Placement { From: Base.Frame; To: HeadTilt.Frame; }+</Part>+<Part HeadVeneer = Head<H:1mm>>+</Part>''')part('Nut','Panel<L:44mm,W:4mm,H:3mm,R:1mm>',y=658,z=62)for name,y in [('NeckPickup',98),('BridgePickup',0)]:part(name+'Cream','Surround<L:88mm,W:46mm,H:4mm>',y=y,z=53)@@ -234,7 +241,41 @@ for side in [-1,1]:part(f'TunerButton{side+1}{i}','Panel<L:15mm,W:19mm,H:6mm,R:5mm>',x=side*49,y=y,z=z-7)string_index=i if side==-1 else 5-iformed_string(f'String{string_index}',((string_index-2.5)*10.2,-75,65),((string_index-2.5)*7.2,658,65),(side*27,y,z+5),.28+string_index*.08)-assembly=templates+'Assembly GuitarX0 {\n <Assembly GuitarX0>\n'+'\n'.join(parts)+'\n </Assembly>\n Anchor: GuitarX0;\n}\n'+# Finite keyed occurrence families. Values remain ordinary checked Firmament+# Records; the compiler owns expansion, identities, and definition sharing.+catalog=['Record HardwareSite { X: Length; Y: Length; Z: Length }']+for family,matcher in [+ ('PickupSeats',r'(?:Neck|Bridge)PickupCream'),+ ('PickupCoils',r'(?:Neck|Bridge)PickupCoil[01]'),+ ('PickupPoles',r'(?:Neck|Bridge)PickupPole[0-5]'),+ ('Saddles',r'Saddle[0-5]'),+ ('TunerPosts',r'TunerPost[02][0-2]'),+ ('TunerWashers',r'TunerWasher[02][0-2]'),+ ('TunerButtons',r'TunerButton[02][0-2]')]:+ selected=[]+ for declaration in parts:+ match=re.fullmatch(r'\s*<Part (\w+) = (.+)>\n\s*Placement \{ From: Origin; To: World; TranslateLocal: \[([^,]+),([^,]+),([^]]+)\]; \}\n\s*</Part>',declaration)+ if match and re.fullmatch(matcher,match[1]):+ selected.append((declaration,match))+ assert selected, family+ definitions={m[2] for _,m in selected}+ assert len(definitions)==1, family+ catalog.append(f'Static {family}Sites: Set<HardwareSite> {{\n'+ '\n'.join(+ f' {m[1]} => HardwareSite {{ X: {m[3]}; Y: {m[4]}; Z: {m[5]} }}' for _,m in selected)+'\n}')+ for declaration,_ in selected: parts.remove(declaration)+ leaf='PickupCream' if family=='PickupSeats' else family.removesuffix('s')+ parts.append(f'''Pattern {family} Over {family}Sites {{+ site => <Part {leaf} = {next(iter(definitions))}>+ Placement {{ From: Origin; To: World; TranslateLocal: [site.X,site.Y,site.Z]; }}+ </Part>+}}''')+assembly=templates+'\n'.join(catalog)+'\nAssembly GuitarX0 {\n <Assembly GuitarX0>\n'+'\n'.join(parts)+'''\n </Assembly>+ FrameTransform NutWorld { From: GuitarX0.Neck.NutMount.Frame; Normal: [0,1,0]; Up: [0,0,1]; TranslateLocal: [0mm,-7mm,0mm]; }+ FrameTransform HeadTilt { From: NutWorld.Frame; RotateLocal: { Axis: X; Angle: -13deg } }+ Interface<Fixed> VeneerSeat { A: GuitarX0.Headstock.Front.Frame; B: GuitarX0.HeadVeneer.Base.Frame; Gap: 0mm; Clocking: 0deg; }+ Anchor: GuitarX0;+}+'''(ROOT/'guitar-x0.firmament').write_text(assembly)looks={'SectionChainFile<"CarvedMaple.firmament">':(.65,.28,.035,0,.35),@@ -251,4 +292,4 @@ looks={'Panel<L:25mm,W:12mm,H:0.3mm,R:1mm>':(.74,.73,.62,.1,.3),}(ROOT/'preview-materials.json').write_text(json.dumps({k:dict(zip(['red','green','blue','metallic','roughness'],v)) for k,v in looks.items()},indent=2)+'\n')-print(f'Authored {len(parts)} part occurrences in {ROOT}')+print(f'Authored guitar with seven keyed hardware patterns in {ROOT}; inspect via Aetheris.CLI for expanded occurrence counts.')