Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Add 3DM inspection commands and bound slow corpus tests

Yuechen Li60936dc7a70b
diff --git a/.gitignore b/.gitignore
index ddf7fece..d386e09a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,6 +36,8 @@ bld/
# Repository-local generated output (source fixtures and checked-in docs evidence live elsewhere).
.tmp/
artifacts/local/
+# Local Cartesian qualification inputs have unverified redistribution rights.
+/testdata/3DM/*.3dm
demo-output/
docs/preview2/
diff --git a/Aetheris.CLI.Tests/ThreeDmLampBaseIntentLocalTests.cs b/Aetheris.CLI.Tests/ThreeDmLampBaseIntentLocalTests.cs
new file mode 100644
index 00000000..0ab7e45c
--- /dev/null
+++ b/Aetheris.CLI.Tests/ThreeDmLampBaseIntentLocalTests.cs
@@ -0,0 +1,57 @@
+using Rhino.FileIO;
+using Rhino.Geometry;
+using Xunit.Sdk;
+
+namespace Aetheris.CLI.Tests;
+
+public sealed class ThreeDmLampBaseIntentLocalTests
+{
+ [Fact]
+ public void SelectedBaseAndPrimaryIntentMeasurementsMatchLocalSource()
+ {
+ var directory = new DirectoryInfo(AppContext.BaseDirectory);
+ while (directory is not null && !File.Exists(Path.Combine(directory.FullName, "Aetheris.slnx")))
+ directory = directory.Parent;
+ if (directory is null) throw new DirectoryNotFoundException("Aetheris repository root was not found.");
+ var path = Path.Combine(directory.FullName, "testdata", "3DM", "cartesian-product-metres.3dm");
+ if (!File.Exists(path)) throw SkipException.ForSkip("Local Cartesian 3DM fixture is absent.");
+
+ using var file = File3dm.Read(path);
+ Assert.NotNull(file);
+ Brep? brep = null;
+ Guid sourceId = Guid.Empty;
+ var objectIndex = 0;
+ foreach (var item in file.Objects)
+ {
+ if (objectIndex++ != 5) continue;
+ sourceId = item.Attributes.ObjectId;
+ brep = Assert.IsType<Brep>(item.Geometry);
+ break;
+ }
+ Assert.Equal(Guid.Parse("764c1644-10c1-44ec-a51b-3335716bda0b"), sourceId);
+ Assert.NotNull(brep);
+ Assert.True(brep.IsSolid);
+ Assert.Equal((54, 133, 314), (brep.Faces.Count, brep.Edges.Count, brep.Trims.Count));
+
+ var points = brep.Edges.SelectMany(edge => Enumerable.Range(0, 129).Select(i =>
+ edge.PointAt(edge.Domain.T0 + (edge.Domain.T1 - edge.Domain.T0) * i / 128d))).ToArray();
+ Assert.InRange(points.Min(point => point.X * 1000), -107.50001, -107.49999);
+ Assert.InRange(points.Max(point => point.X * 1000), 107.49999, 107.50001);
+ Assert.InRange(points.Min(point => point.Y * 1000), -75.00001, -74.99999);
+ Assert.InRange(points.Max(point => point.Y * 1000), 74.99999, 75.00001);
+ Assert.InRange(points.Min(point => point.Z * 1000), -0.00001, 0.00001);
+ Assert.InRange(points.Max(point => point.Z * 1000), 11.99999, 12.00001);
+
+ AssertCircle(brep.Edges[130], 38, 0, 61.6);
+ AssertCircle(brep.Edges[105], -78, 0, 7);
+ AssertCircle(brep.Edges[107], -44, -25, 3.5);
+ }
+
+ private static void AssertCircle(BrepEdge edge, double x, double y, double radius)
+ {
+ Assert.True(edge.EdgeCurve.TryGetCircle(out var circle));
+ Assert.InRange(circle.Center.X * 1000, x - 0.00001, x + 0.00001);
+ Assert.InRange(circle.Center.Y * 1000, y - 0.00001, y + 0.00001);
+ Assert.InRange(circle.Radius * 1000, radius - 0.00001, radius + 0.00001);
+ }
+}
diff --git a/Aetheris.CLI.Tests/ThreeDmLocalQualificationTests.cs b/Aetheris.CLI.Tests/ThreeDmLocalQualificationTests.cs
new file mode 100644
index 00000000..eb9682c9
--- /dev/null
+++ b/Aetheris.CLI.Tests/ThreeDmLocalQualificationTests.cs
@@ -0,0 +1,39 @@
+using Aetheris.ThreeDm;
+using Xunit.Sdk;
+
+namespace Aetheris.CLI.Tests;
+
+public sealed class ThreeDmLocalQualificationTests
+{
+ [Fact]
+ public void CartesianProductInventoryUsesFileUnitsAndNeverClaimsConversion()
+ {
+ var directory = new DirectoryInfo(AppContext.BaseDirectory);
+ while (directory is not null && !File.Exists(Path.Combine(directory.FullName, "Aetheris.slnx")))
+ directory = directory.Parent;
+ if (directory is null) throw new DirectoryNotFoundException("Aetheris repository root was not found.");
+ var path = Path.Combine(directory.FullName, "testdata", "3DM", "cartesian-product-metres.3dm");
+ if (!File.Exists(path)) throw SkipException.ForSkip("Local Cartesian 3DM qualification fixture is absent.");
+
+ var inventory = ThreeDmInspector.Inspect(path);
+ Assert.Equal("Meters", inventory.SourceUnit);
+ Assert.Equal(1000, inventory.MillimetresPerSourceUnit);
+ Assert.Equal(inventory.SourceAbsoluteTolerance * 1000, inventory.AbsoluteToleranceMillimetres);
+ Assert.Equal(inventory.ObjectCount, inventory.Objects.Count);
+ Assert.Equal(inventory.BrepCount, inventory.Objects.Count(obj => obj.GeometryType == "Brep"));
+ Assert.Equal(27, inventory.BrepCount);
+ Assert.Equal(0, inventory.MeshCount);
+ Assert.Equal((185, 232, 742, 346, 219),
+ (inventory.FaceCount, inventory.LoopCount, inventory.TrimCount, inventory.EdgeCount, inventory.VertexCount));
+ Assert.Equal((114, 50), (inventory.SeamTrimCount, inventory.SingularTrimCount));
+ Assert.Equal((196, 56, 0, 53),
+ (inventory.RationalEdgeCount, inventory.RationalArcEdgeCount,
+ inventory.RationalEllipticEdgeCount, inventory.RationalGenericEdgeCount));
+ Assert.Equal(0.001, inventory.AbsoluteToleranceMillimetres);
+ var repeated = ThreeDmInspector.Inspect(path);
+ Assert.Equal(inventory.Objects, repeated.Objects);
+ Assert.Equal(inventory.BoundsMillimetres, repeated.BoundsMillimetres);
+ Assert.All(inventory.Objects.Where(obj => obj.GeometryType == "Brep"),
+ obj => Assert.Equal("exact-but-not-yet-mapped", obj.Classification));
+ }
+}
diff --git a/Aetheris.CLI.Tests/ThreeDmRecoveryLocalTests.cs b/Aetheris.CLI.Tests/ThreeDmRecoveryLocalTests.cs
new file mode 100644
index 00000000..c89df14b
--- /dev/null
+++ b/Aetheris.CLI.Tests/ThreeDmRecoveryLocalTests.cs
@@ -0,0 +1,46 @@
+using System.Text.Json;
+using Aetheris.ThreeDm;
+using Xunit.Sdk;
+
+namespace Aetheris.CLI.Tests;
+
+public sealed class ThreeDmRecoveryLocalTests
+{
+ [Fact]
+ public void ProductRecoveryStudyIsDeterministicAndLeavesTopologyProvisional()
+ {
+ var directory = new DirectoryInfo(AppContext.BaseDirectory);
+ while (directory is not null && !File.Exists(Path.Combine(directory.FullName, "Aetheris.slnx")))
+ directory = directory.Parent;
+ if (directory is null) throw new DirectoryNotFoundException("Aetheris repository root was not found.");
+ var path = Path.Combine(directory.FullName, "testdata", "3DM", "cartesian-product-metres.3dm");
+ if (!File.Exists(path)) throw SkipException.ForSkip("Local Cartesian 3DM recovery fixture is absent.");
+
+ var first = ThreeDmRecovery.Analyze(path);
+ var second = ThreeDmRecovery.Analyze(path);
+ Assert.Equal(JsonSerializer.Serialize(first), JsonSerializer.Serialize(second));
+ Assert.Equal(27, first.Bodies.Count);
+ Assert.Equal(0.001, first.SourceToleranceMillimetres);
+ Assert.Equal((196, 53, 53, 0),
+ (first.SourceRationalEdgeCount, first.StudiedRationalEdgeCount,
+ first.QualifiedRecoveredRationalEdgeCount, first.UnresolvedRationalEdgeCount));
+ Assert.Equal((104, 21, 83),
+ (first.SourceRationalSurfaceCount, first.QualifiedAnalyticRationalSurfaceCount,
+ first.UnresolvedRationalSurfaceCount));
+ var studied = first.Bodies.SelectMany(body => body.Edges)
+ .Where(edge => edge.SourceIsRational && edge.NativeClassification == "Unclassified").ToArray();
+ Assert.Equal(16, studied.Count(edge => edge.PreferredCandidate == "CircleSupport"));
+ Assert.Equal(37, studied.Count(edge => edge.PreferredCandidate == "NonRationalSameNet"));
+ Assert.Contains(studied, edge => edge.PreferredCandidate == "NonRationalSameNet" &&
+ edge.Candidates.Any(candidate => candidate.Kind == "CircleSupport" &&
+ candidate.Qualification == RecoveryQualification.Approximate));
+ Assert.All(studied, edge =>
+ {
+ Assert.Contains(edge.Candidates, candidate => candidate.Kind == "NonRationalSameNet"
+ && candidate.Qualification == RecoveryQualification.WithinSourceTolerance);
+ Assert.Contains("topology pending", edge.Status);
+ Assert.True(edge.RelativeWeightSpread < 1e-12);
+ });
+ Assert.StartsWith("No canonical BRep or production STEP is emitted", first.ProductionStatus);
+ }
+}
diff --git a/Aetheris.CLI/Aetheris.CLI.csproj b/Aetheris.CLI/Aetheris.CLI.csproj
index 550cfe08..17621f47 100644
--- a/Aetheris.CLI/Aetheris.CLI.csproj
+++ b/Aetheris.CLI/Aetheris.CLI.csproj
@@ -23,6 +23,7 @@
<ItemGroup>
<ProjectReference Include="..\Aetheris.Kernel.Firmament\Aetheris.Kernel.Firmament.csproj" />
<ProjectReference Include="..\Aetheris.Kernel.Core\Aetheris.Kernel.Core.csproj" />
+ <ProjectReference Include="..\Aetheris.ThreeDm\Aetheris.ThreeDm.csproj" />
<ProjectReference Include="..\Aetheris.Firmament.FrictionLab\Aetheris.Firmament.FrictionLab.csproj" />
<ProjectReference Include="..\Aetheris.FEA\Aetheris.FEA.csproj" />
<ProjectReference Include="..\Aetheris.Modules.BuiltIn\Aetheris.Modules.BuiltIn.csproj" />
diff --git a/Aetheris.CLI/CliRunner.cs b/Aetheris.CLI/CliRunner.cs
index 916a1f3a..7f6878b8 100644
--- a/Aetheris.CLI/CliRunner.cs
+++ b/Aetheris.CLI/CliRunner.cs
@@ -218,6 +218,8 @@ public static class CliRunner
"mesh" => RunMesh(args.Skip(1).ToArray(), stdout, stderr),
"validate" => RunValidate(args.Skip(1).ToArray(), stdout, stderr),
"inspect" => RunInspect(args.Skip(1).ToArray(), stdout, stderr),
+ "inspect-3dm" => ThreeDmCli.Run(args.Skip(1).ToArray(), stdout, stderr, JsonOptions),
+ "recover-3dm" => ThreeDmCli.Recover(args.Skip(1).ToArray(), stdout, stderr, JsonOptions),
"inspect-profile" => RunInspectProfile(args.Skip(1).ToArray(), stdout, stderr),
"inspect-spans" => RunInspectSpans(args.Skip(1).ToArray(), stdout, stderr),
"inspect-compose" => RunInspectCompose(args.Skip(1).ToArray(), stdout, stderr),
@@ -4813,6 +4815,8 @@ Model CanonicalPanel {
stdout.WriteLine(" mesh Export a supported exact B-rep as STL or topology-preserving OBJ.");
stdout.WriteLine(" view Build/open a model in Cadmata.");
stdout.WriteLine(" inspect Inspect Firmament semantics or STEP topology.");
+ stdout.WriteLine(" inspect-3dm Inventory local Rhino 3DM geometry and import blockers.");
+ stdout.WriteLine(" recover-3dm Measure analytic recovery candidates from Rhino 3DM geometry.");
stdout.WriteLine(" analyze Analyze STEP topology and analytic surfaces.");
stdout.WriteLine(" fea Compile and solve a Firmament linear-elastic analysis and export Abaqus verification input.");
stdout.WriteLine(" drawing Compile production drawings or inspect/highlight PDFs with source-linked Drawing Notes.");
diff --git a/Aetheris.CLI/ThreeDmCli.cs b/Aetheris.CLI/ThreeDmCli.cs
new file mode 100644
index 00000000..80c7748e
--- /dev/null
+++ b/Aetheris.CLI/ThreeDmCli.cs
@@ -0,0 +1,97 @@
+using System.Text.Json;
+using Aetheris.ThreeDm;
+
+namespace Aetheris.CLI;
+
+internal static class ThreeDmCli
+{
+ public static int Recover(string[] args, TextWriter stdout, TextWriter stderr, JsonSerializerOptions jsonOptions)
+ {
+ if (args.Length == 1 && args[0] is "--help" or "-h")
+ {
+ stdout.WriteLine("Usage: aetheris recover-3dm <file.3dm> [--body <index> [--edge <index>|--face <index>]] [--json]");
+ return 0;
+ }
+ if (args.Length < 1)
+ {
+ stderr.WriteLine("Usage: aetheris recover-3dm <file.3dm> [--body <index> [--edge <index>|--face <index>]] [--json]");
+ return 1;
+ }
+ var json = false;
+ int? bodyIndex = null, edgeIndex = null, faceIndex = null;
+ for (var i = 1; i < args.Length; i++)
+ {
+ if (args[i] == "--json") { json = true; continue; }
+ if (args[i] is "--body" or "--edge" or "--face" && i + 1 < args.Length &&
+ int.TryParse(args[i + 1], out var index) && index >= 0)
+ {
+ switch (args[i])
+ {
+ case "--body": bodyIndex = index; break;
+ case "--edge": edgeIndex = index; break;
+ case "--face": faceIndex = index; break;
+ }
+ i++;
+ continue;
+ }
+ stderr.WriteLine($"Invalid recover-3dm option: {args[i]}");
+ return 1;
+ }
+ if ((edgeIndex.HasValue || faceIndex.HasValue) && (!bodyIndex.HasValue || edgeIndex.HasValue && faceIndex.HasValue))
+ {
+ stderr.WriteLine("--edge or --face requires --body; choose only one focused entity.");
+ return 1;
+ }
+ var report = ThreeDmRecovery.Analyze(args[0]);
+ if (bodyIndex is int selectedBody)
+ {
+ var body = report.Bodies.FirstOrDefault(b => b.ObjectIndex == selectedBody);
+ if (body is null) { stderr.WriteLine($"3DM BRep object {selectedBody} was not found."); return 1; }
+ object focus = body;
+ if (edgeIndex is int selectedEdge)
+ focus = new { body.ObjectIndex, body.SourceId, Edge = body.Edges.FirstOrDefault(e => e.EdgeIndex == selectedEdge)
+ ?? throw new ArgumentOutOfRangeException(nameof(edgeIndex), $"Edge {selectedEdge} was not found in object {selectedBody}.") };
+ if (faceIndex is int selectedFace)
+ focus = new { body.ObjectIndex, body.SourceId, Face = body.Faces.FirstOrDefault(f => f.FaceIndex == selectedFace)
+ ?? throw new ArgumentOutOfRangeException(nameof(faceIndex), $"Face {selectedFace} was not found in object {selectedBody}.") };
+ if (json) stdout.WriteLine(JsonSerializer.Serialize(focus, jsonOptions));
+ else stdout.WriteLine($"Object {selectedBody}: {JsonSerializer.Serialize(focus, jsonOptions)}");
+ }
+ else if (json)
+ stdout.WriteLine(JsonSerializer.Serialize(report, jsonOptions));
+ else
+ {
+ stdout.WriteLine($"Source: {report.Bodies.Count} BReps, {report.SourceRationalEdgeCount} rational edges, {report.SourceRationalSurfaceCount} rational surfaces");
+ stdout.WriteLine($"Rational edges: {report.NativeAnalyticRationalEdgeCount} native analytic supports; {report.StudiedRationalEdgeCount} previously unclassified; {report.QualifiedRecoveredRationalEdgeCount} of those have support candidates within source tolerance; {report.UnresolvedRationalEdgeCount} unresolved supports");
+ stdout.WriteLine($"Rational surface study: {report.QualifiedAnalyticRationalSurfaceCount} analytic support candidates within source tolerance; {report.UnresolvedRationalSurfaceCount} unresolved");
+ stdout.WriteLine(report.ProductionStatus);
+ }
+ return 0;
+ }
+
+ public static int Run(string[] args, TextWriter stdout, TextWriter stderr, JsonSerializerOptions jsonOptions)
+ {
+ if (args.Length == 1 && args[0] is "--help" or "-h")
+ {
+ stdout.WriteLine("Usage: aetheris inspect-3dm <file.3dm> [--json]");
+ return 0;
+ }
+ if (args.Length is < 1 or > 2 || (args.Length == 2 && args[1] != "--json"))
+ {
+ stderr.WriteLine("Usage: aetheris inspect-3dm <file.3dm> [--json]");
+ return 1;
+ }
+ var inventory = ThreeDmInspector.Inspect(args[0]);
+ if (args.Length == 2)
+ stdout.WriteLine(JsonSerializer.Serialize(inventory, jsonOptions));
+ else
+ {
+ stdout.WriteLine($"3DM v{inventory.ArchiveVersion}: {inventory.ObjectCount} objects, {inventory.LayerCount} layers");
+ stdout.WriteLine($"Units: {inventory.SourceUnit} ({inventory.MillimetresPerSourceUnit} mm/unit); absolute tolerance: {inventory.AbsoluteToleranceMillimetres} mm");
+ stdout.WriteLine($"BReps: {inventory.BrepCount}; faces/loops/trims/edges/vertices: {inventory.FaceCount}/{inventory.LoopCount}/{inventory.TrimCount}/{inventory.EdgeCount}/{inventory.VertexCount}");
+ stdout.WriteLine($"Seam/singular trims: {inventory.SeamTrimCount}/{inventory.SingularTrimCount}; rational generic edges: {inventory.RationalGenericEdgeCount}");
+ stdout.WriteLine($"Import qualification: not yet mapped to Aetheris BRep; STEP conversion unavailable.");
+ }
+ return 0;
+ }
+}
diff --git a/Aetheris.Kernel.Core.Tests/Brep/Recipes/RecognizedConstructionRecipeTests.cs b/Aetheris.Kernel.Core.Tests/Brep/Recipes/RecognizedConstructionRecipeTests.cs
index 643d1e09..33cf79f0 100644
--- a/Aetheris.Kernel.Core.Tests/Brep/Recipes/RecognizedConstructionRecipeTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Brep/Recipes/RecognizedConstructionRecipeTests.cs
@@ -1,6 +1,5 @@
using System.Security.Cryptography;
using System.Text;
-using System.Diagnostics;
using Aetheris.Kernel.Core.Brep;
using Aetheris.Kernel.Core.Brep.Boolean;
using Aetheris.Kernel.Core.Brep.Recipes;
@@ -14,16 +13,11 @@ using Aetheris.Kernel.Core.Numerics;
using Aetheris.Kernel.Core.Step242;
using Aetheris.Kernel.Core.Topology;
using Aetheris.Kernel.StandardLibrary;
-using Xunit.Abstractions;
namespace Aetheris.Kernel.Core.Tests.Brep.Recipes;
public sealed class RecognizedConstructionRecipeTests
{
- private readonly ITestOutputHelper _output;
-
- public RecognizedConstructionRecipeTests(ITestOutputHelper output) => _output = output;
-
[Fact]
public void ThroughHole_DirectRecipe_LegacyAndFacadeAreTopologyAndStepIdentical()
{
@@ -96,41 +90,6 @@ public sealed class RecognizedConstructionRecipeTests
Assert.Equal("semantic-hole", Assert.Single(direct.Value.SafeBooleanComposition!.Holes).FeatureId);
}
- [Fact]
- public void ThroughHole_RecipeLayerHasNoMeaningfulRuntimeRegression()
- {
- var root = BrepPrimitives.CreateBox(40d, 30d, 12d).Value;
- var tool = BrepPrimitives.CreateCylinder(4d, 20d).Value;
- var facade = BrepBoolean.Subtract(root, tool).Value;
- var history = facade.SafeBooleanComposition!;
- var request = new ThroughHoleRecipeRequest(
- history.RootDescriptor,
- Assert.Single(history.Holes),
- history,
- ToleranceContext.Default);
-
- const int iterations = 100;
- _ = ThroughHoleConstructionRecipe.Execute(request);
- _ = BrepBooleanBoxCylinderHoleBuilder.BuildRecognizedThroughHoleLegacy(history, ToleranceContext.Default);
-
- var legacy = Stopwatch.StartNew();
- for (var index = 0; index < iterations; index++)
- {
- Assert.True(BrepBooleanBoxCylinderHoleBuilder.BuildRecognizedThroughHoleLegacy(history, ToleranceContext.Default).IsSuccess);
- }
- legacy.Stop();
-
- var recipe = Stopwatch.StartNew();
- for (var index = 0; index < iterations; index++)
- {
- Assert.True(ThroughHoleConstructionRecipe.Execute(request).IsSuccess);
- }
- recipe.Stop();
-
- _output.WriteLine($"legacy={legacy.Elapsed.TotalMilliseconds:F3}ms recipe={recipe.Elapsed.TotalMilliseconds:F3}ms iterations={iterations}");
- Assert.True(recipe.Elapsed <= legacy.Elapsed * 3 + TimeSpan.FromMilliseconds(10));
- }
-
[Fact]
public void StandardLibrary_ThroughHole_DirectRecipeMatchesCompatibilityFacade()
{
@@ -147,45 +106,6 @@ public sealed class RecognizedConstructionRecipeTests
AssertRoundTrips(direct.Value);
}
- [Theory]
- [InlineData("firmament", 80d, 50d, 25d, 4d, 25d)]
- [InlineData("cir", 20d, 20d, 10d, 3d, 20d)]
- [InlineData("standard-library", 20d, 20d, 20d, 3d, 24d)]
- public void KnownCaller_DirectRecipeAvoidsFacadeRecognitionOverhead(
- string caller,
- double width,
- double depth,
- double height,
- double radius,
- double toolHeight)
- {
- const int iterations = 30;
- var request = ThroughHoleRecipeRequestBuilder.FromBoxAndZCylinder(
- width, depth, height, Vector3D.Zero, radius, toolHeight, Vector3D.Zero, caller).Value;
-
- _ = ThroughHoleConstructionRecipe.Execute(request);
- _ = BrepBoolean.Subtract(BrepPrimitives.CreateBox(width, depth, height).Value, BrepPrimitives.CreateCylinder(radius, toolHeight).Value);
-
- var facade = Stopwatch.StartNew();
- for (var index = 0; index < iterations; index++)
- {
- Assert.True(BrepBoolean.Subtract(
- BrepPrimitives.CreateBox(width, depth, height).Value,
- BrepPrimitives.CreateCylinder(radius, toolHeight).Value).IsSuccess);
- }
- facade.Stop();
-
- var direct = Stopwatch.StartNew();
- for (var index = 0; index < iterations; index++)
- {
- Assert.True(ThroughHoleConstructionRecipe.Execute(request).IsSuccess);
- }
- direct.Stop();
-
- _output.WriteLine($"caller={caller} facade={facade.Elapsed.TotalMilliseconds:F3}ms direct-recipe={direct.Elapsed.TotalMilliseconds:F3}ms iterations={iterations}");
- Assert.True(direct.Elapsed <= facade.Elapsed * 3 + TimeSpan.FromMilliseconds(10));
- }
-
[Fact]
public void PolygonalThroughCut_DirectRecipe_LegacyAndFacadeAreTopologyAndStepIdentical()
{
diff --git a/Aetheris.Kernel.Core.Tests/Brep/Tessellation/DisplayMeshOrientationCorpusTests.cs b/Aetheris.Kernel.Core.Tests/Brep/Tessellation/DisplayMeshOrientationCorpusTests.cs
index fbf70e54..9ab5253d 100644
--- a/Aetheris.Kernel.Core.Tests/Brep/Tessellation/DisplayMeshOrientationCorpusTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Brep/Tessellation/DisplayMeshOrientationCorpusTests.cs
@@ -41,6 +41,7 @@ public sealed class DisplayMeshOrientationCorpusTests
[Theory]
[MemberData(nameof(ClosedBrepFiles))]
+ [Trait("Category", "SlowCorpus")]
public void DisplayMesh_OfAClosedBody_IsOutwardOriented(string relativePath)
{
var import = Step242Importer.ImportBody(ReadFixture(relativePath));
@@ -68,7 +69,7 @@ public sealed class DisplayMeshOrientationCorpusTests
private static (double WindingVolume, double NormalVolume) MeasureVolumes(BrepBody body)
{
- var display = DisplayPreparationFallbackBuilder.Build(body, null);
+ var display = DisplayPreparationFallbackBuilder.Build(body, null, null, TimeSpan.FromSeconds(30));
Assert.True(display.IsSuccess);
var windingVolume = 0d;
diff --git a/Aetheris.Kernel.Core.Tests/Brep/Tessellation/DisplayPreparationFallbackBuilderTests.cs b/Aetheris.Kernel.Core.Tests/Brep/Tessellation/DisplayPreparationFallbackBuilderTests.cs
index cf7a9146..24e108ee 100644
--- a/Aetheris.Kernel.Core.Tests/Brep/Tessellation/DisplayPreparationFallbackBuilderTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Brep/Tessellation/DisplayPreparationFallbackBuilderTests.cs
@@ -17,7 +17,7 @@ public sealed class DisplayPreparationFallbackBuilderTests
{
var body = UvTrimMaskExtractorTests.ImportSingleLoopBsplineBody();
- var result = DisplayPreparationFallbackBuilder.Build(body);
+ var result = BuildWithTestBudget(body);
Assert.True(result.IsSuccess);
var patch = Assert.Single(result.Value.FacePatches);
@@ -51,8 +51,8 @@ public sealed class DisplayPreparationFallbackBuilderTests
{
var body = UvTrimMaskExtractorTests.ImportBsplineBodyWithHole();
- var first = DisplayPreparationFallbackBuilder.Build(body);
- var second = DisplayPreparationFallbackBuilder.Build(body);
+ var first = BuildWithTestBudget(body);
+ var second = BuildWithTestBudget(body);
Assert.True(first.IsSuccess);
Assert.True(second.IsSuccess);
@@ -70,7 +70,7 @@ public sealed class DisplayPreparationFallbackBuilderTests
{
var body = BrepPrimitives.CreateBox(2d, 2d, 2d).Value;
- var result = DisplayPreparationFallbackBuilder.Build(body);
+ var result = BuildWithTestBudget(body);
Assert.True(result.IsSuccess);
Assert.All(result.Value.FacePatches, patch =>
@@ -85,8 +85,8 @@ public sealed class DisplayPreparationFallbackBuilderTests
{
var body = UvTrimMaskExtractorTests.CreateBodyWithMissingVertexPoint(UvTrimMaskExtractorTests.ImportSingleLoopBsplineBody());
- var first = DisplayPreparationFallbackBuilder.Build(body);
- var second = DisplayPreparationFallbackBuilder.Build(body);
+ var first = BuildWithTestBudget(body);
+ var second = BuildWithTestBudget(body);
Assert.True(first.IsSuccess);
Assert.True(second.IsSuccess);
@@ -106,8 +106,8 @@ public sealed class DisplayPreparationFallbackBuilderTests
{
var body = UvTrimMaskExtractorTests.ImportSingleLoopBsplineBody();
- var first = DisplayPreparationFallbackBuilder.Build(body);
- var second = DisplayPreparationFallbackBuilder.Build(body);
+ var first = BuildWithTestBudget(body);
+ var second = BuildWithTestBudget(body);
Assert.True(first.IsSuccess);
Assert.True(second.IsSuccess);
@@ -139,7 +139,7 @@ public sealed class DisplayPreparationFallbackBuilderTests
foreach (var sweepCase in BoundedRealCaseSweepCases)
{
var body = sweepCase.CreateBody();
- var result = DisplayPreparationFallbackBuilder.Build(body);
+ var result = BuildWithTestBudget(body);
Assert.True(result.IsSuccess);
var patch = Assert.Single(result.Value.FacePatches);
caseResults.Add(new BoundedRealCaseSweepCaseResult(
@@ -180,6 +180,9 @@ public sealed class DisplayPreparationFallbackBuilderTests
"|",
result.FacePatches.Select(patch =>
$"{patch.FaceId.Value}:{patch.Source}:{patch.ScaffoldRejectionReason}:{patch.Positions.Count}:{patch.TriangleIndices.Count}:{string.Join(',', patch.TriangleIndices.Take(24))}"));
+
+ private static Aetheris.Kernel.Core.Results.KernelResult<DisplayTessellationResult> BuildWithTestBudget(BrepBody body)
+ => DisplayPreparationFallbackBuilder.Build(body, null, null, TimeSpan.FromSeconds(30));
}
internal sealed record DisplayPreparationSweepCase(
diff --git a/Aetheris.Kernel.Core.Tests/Brep/Tessellation/NistDisplayCorpusRegressionTests.cs b/Aetheris.Kernel.Core.Tests/Brep/Tessellation/NistDisplayCorpusRegressionTests.cs
index 0b2bbf26..b2b8f7d9 100644
--- a/Aetheris.Kernel.Core.Tests/Brep/Tessellation/NistDisplayCorpusRegressionTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Brep/Tessellation/NistDisplayCorpusRegressionTests.cs
@@ -33,12 +33,13 @@ public sealed class NistDisplayCorpusRegressionTests
[Theory]
[MemberData(nameof(Files))]
+ [Trait("Category", "SlowCorpus")]
public void NistModel_DisplaysEveryFace_WithoutTessellationWarnings(string relativePath)
{
var import = Step242Importer.ImportBody(File.ReadAllText(Path.Combine(FindRepoRoot(), "testdata", "step242", "nist", relativePath)));
Assert.True(import.IsSuccess, string.Join(" | ", import.Diagnostics.Select(d => d.Message)));
- var display = DisplayPreparationFallbackBuilder.Build(import.Value, null);
+ var display = DisplayPreparationFallbackBuilder.Build(import.Value, null, null, TimeSpan.FromSeconds(30));
Assert.True(display.IsSuccess, string.Join(" | ", display.Diagnostics.Select(d => d.Message)));
var warnings = display.Diagnostics.Where(d => d.Severity != KernelDiagnosticSeverity.Info).Select(d => d.Message).ToArray();
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242BSplineSurfaceWithKnotsTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242BSplineSurfaceWithKnotsTests.cs
index 1df3e341..4323085a 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242BSplineSurfaceWithKnotsTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242BSplineSurfaceWithKnotsTests.cs
@@ -21,6 +21,7 @@ public sealed class Step242BSplineSurfaceWithKnotsTests
}
[Fact]
+ [Trait("Category", "SlowCorpus")]
public void Step242_NistCtc02_BSplineSurfaces_ObservedAsNonRationalWithExpectedDegreeFamilies()
{
var path = Path.Combine(Step242CorpusManifestRunner.RepoRoot(), "testdata", "step242", "nist", "CTC", "nist_ctc_02_asme1_ap242-e2.stp");
@@ -60,6 +61,7 @@ public sealed class Step242BSplineSurfaceWithKnotsTests
[InlineData("testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp")]
[InlineData("testdata/step242/nist/FTC/nist_ftc_07_asme1_ap242-e2.stp")]
[InlineData("testdata/step242/nist/FTC/nist_ftc_10_asme1_ap242-e2.stp")]
+ [Trait("Category", "SlowCorpus")]
public void Step242_NistTargets_DoNotFirstFailOnUnsupportedBSplineSurfaceWithKnots(string relativePath)
{
var entry = new Step242CorpusManifestEntry(
@@ -85,6 +87,7 @@ public sealed class Step242BSplineSurfaceWithKnotsTests
[InlineData("testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp")]
[InlineData("testdata/step242/nist/FTC/nist_ftc_07_asme1_ap242-e2.stp")]
[InlineData("testdata/step242/nist/FTC/nist_ftc_10_asme1_ap242-e2.stp")]
+ [Trait("Category", "SlowCorpus")]
public void Step242_NistTargets_FirstBlockerIsExplicitAfterBSplineSurfaceProgression(string relativePath)
{
var entry = new Step242CorpusManifestEntry(
@@ -110,6 +113,7 @@ public sealed class Step242BSplineSurfaceWithKnotsTests
[InlineData("testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp", "", "Audit.None", "No diagnostics.")]
[InlineData("testdata/step242/nist/FTC/nist_ftc_07_asme1_ap242-e2.stp", "", "Audit.None", "No diagnostics.")]
[InlineData("testdata/step242/nist/STC/nist_stc_08_asme1_ap242-e3.stp", "", "Audit.None", "No diagnostics.")]
+ [Trait("Category", "SlowCorpus")]
public void Step242_TrimmedSphereTargets_AdvancePastOldUntrimmedSphereBlocker_AndRemainDeterministic(
string relativePath,
string expectedLayer,
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242BsplineSurfaceRecoveryTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242BsplineSurfaceRecoveryTests.cs
index 0372ee55..359d7bfb 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242BsplineSurfaceRecoveryTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242BsplineSurfaceRecoveryTests.cs
@@ -78,6 +78,7 @@ public sealed class Step242BsplineSurfaceRecoveryTests
/// tolerance-based test would swap them for one. They are spline faces and must stay spline faces.
/// </summary>
[Fact]
+ [Trait("Category", "SlowCorpus")]
public void NistCtc02FreeFormBlends_AreNotRecovered()
{
var import = Step242Importer.ImportBody(ReadFixture("testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp"));
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242ConicalSurfaceRegressionTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242ConicalSurfaceRegressionTests.cs
index 874f8594..21de28eb 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242ConicalSurfaceRegressionTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242ConicalSurfaceRegressionTests.cs
@@ -86,6 +86,7 @@ public sealed class Step242ConicalSurfaceRegressionTests
[InlineData("testdata/step242/nist/FTC/nist_ftc_09_asme1_ap242-e1.stp", "", "Audit.None", "No diagnostics.")]
[InlineData("testdata/step242/nist/FTC/nist_ftc_10_asme1_ap242-e2.stp", "", "Audit.None", "No diagnostics.")]
[InlineData("testdata/step242/nist/STC/nist_stc_09_asme1_ap242-e3.stp", "", "", "")]
+ [Trait("Category", "SlowCorpus")]
public void Step242_NistCurvedRevolvedTargets_AdvancePastOldTopologyFamily_AndReportDeterministicNextBlocker(
string relativePath,
string expectedLayer,
@@ -153,6 +154,7 @@ public sealed class Step242ConicalSurfaceRegressionTests
"",
"Audit.None",
"No diagnostics.")]
+ [Trait("Category", "SlowCorpus")]
public void Step242_NistTargets_AdvancePastCircleTrim_AndKeepDeterministicNextBlocker(
string relativePath,
string expectedLayer,
@@ -222,6 +224,7 @@ public sealed class Step242ConicalSurfaceRegressionTests
}
[Fact]
+ [Trait("Category", "SlowCorpus")]
public void Step242_ConicalSurfaceImport_RadianContextFromGlobalUnits_RemainsRadians()
{
var fixturePath = Path.Combine(Step242CorpusManifestRunner.RepoRoot(), "testdata", "step242", "nist", "STC", "nist_stc_09_asme1_ap242-e3.stp");
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242EdgeCurveSenseRegressionTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242EdgeCurveSenseRegressionTests.cs
index 63d9ab00..959169da 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242EdgeCurveSenseRegressionTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242EdgeCurveSenseRegressionTests.cs
@@ -8,6 +8,7 @@ public sealed class Step242EdgeCurveSenseRegressionTests
[InlineData("testdata/step242/nist/FTC/nist_ftc_08_asme1_ap242-e2.stp")]
[InlineData("testdata/step242/nist/FTC/nist_ftc_11_asme1_ap242-e2.stp")]
[InlineData("testdata/step242/nist/STC/nist_stc_06_asme1_ap242-e3.stp")]
+ [Trait("Category", "SlowCorpus")]
public void Step242_NistEdgeCurveSenseTargets_AdvanceToNextBlocker_Deterministically(
string relativePath)
{
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242EllipseEdgeRegressionTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242EllipseEdgeRegressionTests.cs
index 334052f1..948bd23d 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242EllipseEdgeRegressionTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242EllipseEdgeRegressionTests.cs
@@ -6,6 +6,7 @@ public sealed class Step242EllipseEdgeRegressionTests
{
[Theory]
[InlineData("testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp", "", "Audit.None", "No diagnostics.")]
+ [Trait("Category", "SlowCorpus")]
public void Step242_NistEllipseTargets_AdvancePastUnsupportedEllipse_AndRemainDeterministic(string relativePath, string expectedLayer, string expectedSource, string expectedMessagePrefix)
{
var entry = new Step242CorpusManifestEntry(
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242ExporterTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242ExporterTests.cs
index 9e7f93fb..33905a83 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242ExporterTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242ExporterTests.cs
@@ -265,6 +265,7 @@ END-ISO-10303-21;";
}
[Fact]
+ [Trait("Category", "SlowCorpus")]
public void ExportBody_Ctc02RoundTrip_ShallowCones_PreserveApexCoordinates()
{
var fixturePath = Path.Combine(Step242CorpusManifestRunner.RepoRoot(), "testdata", "step242", "nist", "CTC", "nist_ctc_02_asme1_ap242-e2.stp");
@@ -313,6 +314,7 @@ END-ISO-10303-21;";
}
[Fact]
+ [Trait("Category", "SlowCorpus")]
public void ExportBody_Ctc02RoundTrip_PreservesPlanarFaceWithCircularBoundaryNearExpectedCenter()
{
var fixturePath = Path.Combine(Step242CorpusManifestRunner.RepoRoot(), "testdata", "step242", "nist", "CTC", "nist_ctc_02_asme1_ap242-e2.stp");
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242LoopRoleNormalizationRegressionTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242LoopRoleNormalizationRegressionTests.cs
index 89c79f5d..0df46bfe 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242LoopRoleNormalizationRegressionTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242LoopRoleNormalizationRegressionTests.cs
@@ -13,6 +13,7 @@ public sealed class Step242LoopRoleNormalizationRegressionTests
[InlineData("testdata/step242/nist/FTC/nist_ftc_11_asme1_ap242-e2.stp", null, null)]
[InlineData("testdata/step242/nist/STC/nist_stc_06_asme1_ap242-e3.stp", null, null)]
[InlineData("testdata/step242/nist/STC/nist_stc_09_asme1_ap242-e3.stp", null, null)]
+ [Trait("Category", "SlowCorpus")]
public void Step242_NistLoopRoleTargets_ProgressDeterministically_WithExplicitNormalizedBoundaries(
string relativePath,
string? expectedSource,
@@ -140,6 +141,7 @@ public sealed class Step242LoopRoleNormalizationRegressionTests
[InlineData("testdata/step242/nist/CTC/nist_ctc_04_asme1_ap242-e1.stp")]
[InlineData("testdata/step242/nist/FTC/nist_ftc_07_asme1_ap242-e2.stp")]
[InlineData("testdata/step242/nist/FTC/nist_ftc_10_asme1_ap242-e2.stp")]
+ [Trait("Category", "SlowCorpus")]
public void Step242_PlanarLoopRole_CoedgeGapDiagnostics_AreDeterministic(string relativePath)
{
var first = CaptureCoedgeGaps(relativePath);
@@ -154,6 +156,7 @@ public sealed class Step242LoopRoleNormalizationRegressionTests
[InlineData("testdata/step242/nist/CTC/nist_ctc_04_asme1_ap242-e1.stp", 259, 977)]
[InlineData("testdata/step242/nist/FTC/nist_ftc_07_asme1_ap242-e2.stp", 11, 35)]
[InlineData("testdata/step242/nist/FTC/nist_ftc_10_asme1_ap242-e2.stp", 3, 20)]
+ [Trait("Category", "SlowCorpus")]
public void Step242_PlanarLoopRole_KnownWorstLoopJoinGaps_CollapseToNearZero(
string relativePath,
int loopId,
@@ -175,6 +178,7 @@ public sealed class Step242LoopRoleNormalizationRegressionTests
[InlineData("testdata/step242/nist/FTC/nist_ftc_07_asme1_ap242-e2.stp")]
[InlineData("testdata/step242/nist/FTC/nist_ftc_10_asme1_ap242-e2.stp")]
[InlineData("testdata/step242/nist/FTC/nist_ftc_11_asme1_ap242-e2.stp")]
+ [Trait("Category", "SlowCorpus")]
public void Step242_PlanarLoopRole_CircularSampling_IsAdaptiveAndDeterministic(string relativePath)
{
var first = CaptureCircularSampling(relativePath);
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242PeriodicBoundaryOrientationTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242PeriodicBoundaryOrientationTests.cs
index 3bd0831d..1f58b7be 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242PeriodicBoundaryOrientationTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242PeriodicBoundaryOrientationTests.cs
@@ -17,6 +17,7 @@ public sealed class Step242PeriodicBoundaryOrientationTests
[Theory]
[MemberData(nameof(FormerRedCases))]
+ [Trait("Category", "SlowCorpus")]
public void PeriodicBoundaryOrientation_SurvivesExportImport(string relativePath)
{
var imported = Step242Importer.ImportBody(ReadNist(relativePath));
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242ProductionRationalGuardTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242ProductionRationalGuardTests.cs
new file mode 100644
index 00000000..1172cc6d
--- /dev/null
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242ProductionRationalGuardTests.cs
@@ -0,0 +1,68 @@
+using Aetheris.Kernel.Core.Brep;
+using Aetheris.Kernel.Core.Geometry;
+using Aetheris.Kernel.Core.Geometry.Surfaces;
+using Aetheris.Kernel.Core.Geometry.Curves;
+using Aetheris.Kernel.Core.Math;
+using Aetheris.Kernel.Core.Step242;
+
+namespace Aetheris.Kernel.Core.Tests.Step242;
+
+public sealed class Step242ProductionRationalGuardTests
+{
+ [Fact]
+ public void TrustedProductionRouteRejectsRationalSurfaceBeforeSerialization()
+ {
+ var box = BrepPrimitives.CreateBox(10, 10, 10).Value;
+ var firstSurfaceId = box.Bindings.FaceBindings.First().SurfaceGeometryId;
+ var geometry = new BrepGeometryStore();
+ foreach (var curve in box.Geometry.Curves) geometry.AddCurve(curve.Key, curve.Value);
+ foreach (var surface in box.Geometry.Surfaces)
+ geometry.AddSurface(surface.Key, surface.Key == firstSurfaceId
+ ? SurfaceGeometry.FromBSplineSurfaceWithKnots(new BSplineSurfaceWithKnots(
+ 1, 1,
+ new IReadOnlyList<Point3D>[]
+ {
+ [new(0, 0, 0), new(0, 1, 0)],
+ [new(1, 0, 0), new(1, 1, 0)]
+ },
+ "UNSPECIFIED", false, false, false,
+ [2, 2], [2, 2], [0d, 1d], [0d, 1d], "UNSPECIFIED",
+ new IReadOnlyList<double>[] { [1d, 2d], [1d, 1d] }))
+ : surface.Value);
+ var body = new BrepBody(box.Topology, geometry, box.Bindings);
+
+ var production = Step242Exporter.ExportBody(body, new Step242ExportOptions
+ {
+ BrepExportPreflightPolicy = BrepExportPreflightPolicy.TrustedProductionRoute
+ });
+ Assert.False(production.IsSuccess);
+ Assert.Contains(production.Diagnostics, d => d.Message.Contains("RationalGeometryNotCanonical", StringComparison.Ordinal));
+
+ var ordinary = Step242Exporter.ExportBody(box, new Step242ExportOptions
+ {
+ BrepExportPreflightPolicy = BrepExportPreflightPolicy.TrustedProductionRoute
+ });
+ Assert.True(ordinary.IsSuccess, string.Join(" | ", ordinary.Diagnostics.Select(d => d.Message)));
+ Assert.DoesNotContain("RATIONAL_B_SPLINE", ordinary.Value, StringComparison.Ordinal);
+ }
+
+ [Fact]
+ public void TrustedProductionRouteRejectsRationalPcurveBeforeSerialization()
+ {
+ var box = BrepPrimitives.CreateBox(10, 10, 10).Value;
+ var face = box.Topology.Faces.First();
+ var coedge = box.Topology.GetLoop(face.LoopIds[0]).CoedgeIds[0];
+ var surfaceId = box.Bindings.GetFaceBinding(face.Id).SurfaceGeometryId;
+ var curve = new BSpline3Curve(1, [new Point3D(0, 0, 0), new Point3D(1, 0, 0)],
+ [2, 2], [0d, 1d], "UNSPECIFIED", false, false, "UNSPECIFIED");
+ box.Bindings.AddPcurveBinding(new CoedgePcurveBinding(coedge, face.Id, surfaceId,
+ PcurveGeometry.RationalPolynomial(new ParameterInterval(0, 1), curve, [1d, 2d])));
+
+ var production = Step242Exporter.ExportBody(box, new Step242ExportOptions
+ {
+ BrepExportPreflightPolicy = BrepExportPreflightPolicy.TrustedProductionRoute
+ });
+ Assert.False(production.IsSuccess);
+ Assert.Contains(production.Diagnostics, d => d.Message.Contains("RationalGeometryNotCanonical", StringComparison.Ordinal));
+ }
+}
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242RationalSurfaceReductionTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242RationalSurfaceReductionTests.cs
index 2f8fff15..de1771cb 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242RationalSurfaceReductionTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242RationalSurfaceReductionTests.cs
@@ -27,6 +27,7 @@ public sealed class Step242RationalSurfaceReductionTests
/// <summary>The invariant the whole lane exists to hold: an imported body carries no rational surface.</summary>
[Theory]
[MemberData(nameof(CorpusFiles))]
+ [Trait("Category", "SlowCorpus")]
public void ImportedBody_CarriesNoRationalSurface(string relativePath)
{
var import = Step242Importer.ImportBody(ReadFixture(relativePath));
@@ -37,6 +38,7 @@ public sealed class Step242RationalSurfaceReductionTests
[Theory]
[MemberData(nameof(CorpusFiles))]
+ [Trait("Category", "SlowCorpus")]
public void ExportedFile_ContainsNoRationalSurface(string relativePath)
{
var import = Step242Importer.ImportBody(ReadFixture(relativePath));
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242RevolvedTopologyFamilyRegressionTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242RevolvedTopologyFamilyRegressionTests.cs
index 28bdc528..5c37330e 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242RevolvedTopologyFamilyRegressionTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242RevolvedTopologyFamilyRegressionTests.cs
@@ -8,6 +8,7 @@ public sealed class Step242RevolvedTopologyFamilyRegressionTests
[InlineData("testdata/step242/nist/CTC/nist_ctc_04_asme1_ap242-e1.stp", "No diagnostics.")]
[InlineData("testdata/step242/nist/FTC/nist_ftc_07_asme1_ap242-e2.stp", "No diagnostics.")]
[InlineData("testdata/step242/nist/FTC/nist_ftc_10_asme1_ap242-e2.stp", "No diagnostics.")]
+ [Trait("Category", "SlowCorpus")]
public void Step242_RepeatedCurvedRevolvedTargets_AdvanceWithExplicitDeterministicNextBlocker(
string relativePath,
string expectedMessagePrefix)
@@ -92,6 +93,7 @@ public sealed class Step242RevolvedTopologyFamilyRegressionTests
[Theory]
[InlineData("testdata/step242/nist/FTC/nist_ftc_06_asme1_ap242-e2.stp", "No diagnostics.")]
[InlineData("testdata/step242/nist/STC/nist_stc_08_asme1_ap242-e3.stp", "No diagnostics.")]
+ [Trait("Category", "SlowCorpus")]
public void Step242_RevolvedTopologyFamilyBlockers_StayDeterministic_AndRemainExplicit(string relativePath, string expectedMessagePrefix)
{
var entry = new Step242CorpusManifestEntry(
@@ -120,6 +122,7 @@ public sealed class Step242RevolvedTopologyFamilyRegressionTests
}
[Fact]
+ [Trait("Category", "SlowCorpus")]
public void Step242_RepeatedCurvedRevolvedTargets_AdvanceToSuccess_Deterministically()
{
const string relativePath = "testdata/step242/nist/FTC/nist_ftc_09_asme1_ap242-e1.stp";
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242RoundTripCorpusTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242RoundTripCorpusTests.cs
index 8805e224..e28030ff 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242RoundTripCorpusTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242RoundTripCorpusTests.cs
@@ -11,8 +11,9 @@ namespace Aetheris.Kernel.Core.Tests.Step242;
/// then wrote the stored EDGE_CURVE.same_sense anyway. On the edges where that flag said otherwise, a reader walked
/// the edge backwards and the loop's consecutive coedges landed an edge-length apart.
/// <para>
-/// Face and edge counts alone would not have caught it - the topology survives - so the volume of the display mesh
-/// is compared too: a loop walked backwards changes the shape, not the counts.
+/// Face and edge counts alone would not have caught it - the topology survives - so a representative
+/// round trip also compares display-mesh volume. The separate NIST display and orientation corpus tests
+/// exercise mesh preparation across the wider corpus without repeating it twice per exported model here.
/// </para>
/// </summary>
public sealed class Step242RoundTripCorpusTests
@@ -35,7 +36,8 @@ public sealed class Step242RoundTripCorpusTests
[Theory]
[MemberData(nameof(CorpusFiles))]
- public void ExportedBody_IsReadableByAetheris_AndKeepsItsShape(string fileName)
+ [Trait("Category", "SlowCorpus")]
+ public void ExportedBody_IsReadableByAetheris_AndKeepsItsTopology(string fileName)
{
var source = Step242Importer.ImportBody(ReadCorpusFile(fileName));
Assert.True(source.IsSuccess, string.Join(" | ", source.Diagnostics.Select(diagnostic => diagnostic.Message)));
@@ -49,6 +51,19 @@ public sealed class Step242RoundTripCorpusTests
Assert.Equal(source.Value.Topology.Faces.Count(), reimported.Value.Topology.Faces.Count());
Assert.Equal(source.Value.Topology.Edges.Count(), reimported.Value.Topology.Edges.Count());
+ }
+
+ [Fact]
+ [Trait("Category", "SlowCorpus")]
+ public void ExportedBody_KeepsRepresentativeDisplayVolume()
+ {
+ const string fileName = "nist_ctc_01_asme1_ap242-e1.stp";
+ var source = Step242Importer.ImportBody(ReadCorpusFile(fileName));
+ Assert.True(source.IsSuccess);
+ var exported = Step242Exporter.ExportBody(source.Value);
+ Assert.True(exported.IsSuccess);
+ var reimported = Step242Importer.ImportBody(exported.Value);
+ Assert.True(reimported.IsSuccess);
var before = EnclosedVolume(source.Value);
var after = EnclosedVolume(reimported.Value);
Assert.True(
@@ -59,7 +74,7 @@ public sealed class Step242RoundTripCorpusTests
/// <summary>Signed volume of the display mesh, which changes if any loop is walked in the wrong direction.</summary>
private static double EnclosedVolume(BrepBody body)
{
- var display = DisplayPreparationFallbackBuilder.Build(body, null);
+ var display = DisplayPreparationFallbackBuilder.Build(body, null, null, TimeSpan.FromSeconds(30));
Assert.True(display.IsSuccess);
var volume = 0d;
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242UnsupportedSurfaceForHolesRegressionTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242UnsupportedSurfaceForHolesRegressionTests.cs
index 09ec9a28..6fc0145b 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242UnsupportedSurfaceForHolesRegressionTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242UnsupportedSurfaceForHolesRegressionTests.cs
@@ -18,6 +18,7 @@ public sealed class Step242UnsupportedSurfaceForHolesRegressionTests
null,
null)]
+ [Trait("Category", "SlowCorpus")]
public void Step242_NistTargets_AdvancePastGenericUnsupportedSurfaceForHoles_Deterministically(
string relativePath,
string? expectedLayer,
diff --git a/Aetheris.Kernel.Core/Step242/Step242ExportOptions.cs b/Aetheris.Kernel.Core/Step242/Step242ExportOptions.cs
index fdcf3569..fa7714e4 100644
--- a/Aetheris.Kernel.Core/Step242/Step242ExportOptions.cs
+++ b/Aetheris.Kernel.Core/Step242/Step242ExportOptions.cs
@@ -35,7 +35,10 @@ public sealed class Step242ExportOptions
/// </summary>
public BrepExportPreflightMode BrepExportPreflightMode { get; init; } = BrepExportPreflightMode.Audit;
- /// <summary>Records why this route selected its preflight mode.</summary>
+ /// <summary>
+ /// TrustedProductionRoute rejects rational B-spline supports and pcurves.
+ /// LegacyRoute retains interchange/debug compatibility, including rational evidence.
+ /// </summary>
public BrepExportPreflightPolicy BrepExportPreflightPolicy { get; init; } = BrepExportPreflightPolicy.LegacyRoute;
/// <summary>Preserve a full circular edge's declared parameter interval as TRIMMED_CURVE.</summary>
diff --git a/Aetheris.Kernel.Core/Step242/Step242Exporter.cs b/Aetheris.Kernel.Core/Step242/Step242Exporter.cs
index 1bf365b4..5d4ec413 100644
--- a/Aetheris.Kernel.Core/Step242/Step242Exporter.cs
+++ b/Aetheris.Kernel.Core/Step242/Step242Exporter.cs
@@ -21,6 +21,24 @@ public static class Step242Exporter
{
options ??= new Step242ExportOptions();
+ // The legacy interchange route still supports rational evidence for
+ // compatibility and debugging. Trusted production routes must first
+ // recover a canonical analytic or non-rational representation.
+ if (options.BrepExportPreflightPolicy == BrepExportPreflightPolicy.TrustedProductionRoute)
+ {
+ foreach (var face in body.Bindings.FaceBindings)
+ {
+ if (body.Geometry.TryGetSurface(face.SurfaceGeometryId, out var support)
+ && support?.BSplineSurfaceWithKnots?.IsRational == true)
+ return RationalGeometryNotCanonical($"Face:{face.FaceId.Value}", "rational B-spline surface");
+ }
+ foreach (var pcurve in body.Bindings.PcurveBindings)
+ {
+ if (pcurve.Pcurve.RationalWeights is not null)
+ return RationalGeometryNotCanonical($"Coedge:{pcurve.CoedgeId.Value}", "rational B-spline pcurve");
+ }
+ }
+
var preflight = options.BrepExportPreflightMode == BrepExportPreflightMode.Disabled
? null
: BrepExportPreflight.Validate(body);
@@ -1448,6 +1466,15 @@ public static class Step242Exporter
source)
]);
+ private static KernelResult<string> RationalGeometryNotCanonical(string source, string kind) =>
+ KernelResult<string>.Failure([
+ new KernelDiagnostic(
+ KernelDiagnosticCode.ValidationFailed,
+ KernelDiagnosticSeverity.Error,
+ $"RationalGeometryNotCanonical: trusted production STEP cannot emit {kind}; recover a qualified canonical carrier first.",
+ source)
+ ]);
+
private static IEnumerable<KernelDiagnostic> ToKernelDiagnostics(BrepExportPreflightResult result, bool errorsAsWarnings) =>
result.Diagnostics.Select(diagnostic => new KernelDiagnostic(
KernelDiagnosticCode.ValidationFailed,
diff --git a/Aetheris.Kernel.Firmament.Tests/Assembly/AssemblyGearBridgeX1Tests.cs b/Aetheris.Kernel.Firmament.Tests/Assembly/AssemblyGearBridgeX1Tests.cs
index 5a67e1ca..f2447d70 100644
--- a/Aetheris.Kernel.Firmament.Tests/Assembly/AssemblyGearBridgeX1Tests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/Assembly/AssemblyGearBridgeX1Tests.cs
@@ -170,6 +170,7 @@ public sealed class AssemblyGearBridgeX1Tests
}
[Fact]
+ [Trait("Category", "SlowCorpus")]
public void GearGeometryUsesOrdinaryWholeTreeAp242LoweringDeterministically()
{
var path = FirmamentCorpusHarness.ResolveFixtureFullPath("fixtures/Canonical/AssemblyInterfaces/exposed-gear-port.firmament");
diff --git a/Aetheris.Kernel.Firmament.Tests/Assembly/AssemblyM1Tests.cs b/Aetheris.Kernel.Firmament.Tests/Assembly/AssemblyM1Tests.cs
index 1f7ccb2d..4fa769f9 100644
--- a/Aetheris.Kernel.Firmament.Tests/Assembly/AssemblyM1Tests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/Assembly/AssemblyM1Tests.cs
@@ -7,6 +7,26 @@ namespace Aetheris.Kernel.Firmament.Tests.Assembly;
public sealed class AssemblyM1Tests
{
+ [Fact]
+ public void AuthoredSectionChainFile_MaterializesRuledPartInProductStep()
+ {
+ var path = FirmamentCorpusHarness.ResolveFixtureFullPath("fixtures/Canonical/ThreeDm/lamp-visible-intent.firmament");
+ var compilation = new AssemblyM1Pipeline().CompileFile(path);
+ Assert.True(compilation.IsSuccess, string.Join(Environment.NewLine, compilation.Diagnostics.Select(item => item.Message)));
+
+ Assert.Equal(7, compilation.Geometry!.InstanceBodies.Count);
+ Assert.DoesNotContain(compilation.Geometry.InstanceBodies.Keys, name =>
+ name.Contains("Cable", StringComparison.OrdinalIgnoreCase) || name.Contains("Bulb", StringComparison.OrdinalIgnoreCase));
+ var shade = compilation.Geometry.InstanceBodies.Single(item => item.Key.EndsWith(".Shade", StringComparison.Ordinal)).Value;
+ Assert.Contains(shade.Geometry.Surfaces, item => item.Value.Kind == SurfaceGeometryKind.BSplineSurfaceWithKnots);
+
+ var step = AssemblyIrAp242Exporter.Export(compilation);
+ Assert.True(step.IsSuccess, string.Join(Environment.NewLine, step.Diagnostics.Select(item => item.Message)));
+ var imported = Step242AssemblyImporter.Import(step.Value);
+ Assert.True(imported.IsSuccess, string.Join(Environment.NewLine, imported.Diagnostics.Select(item => item.Message)));
+ Assert.Equal(7, imported.Value.Occurrences.Count);
+ }
+
[Fact]
public void ModelTargetTemplates_MaterializeAnalyticPrimitiveDefinitionsAndExportProductOccurrences()
{
diff --git a/Aetheris.Kernel.Firmament.Tests/Assembly/WindingAxisMateTests.cs b/Aetheris.Kernel.Firmament.Tests/Assembly/WindingAxisMateTests.cs
index 3f9b0f6e..23761734 100644
--- a/Aetheris.Kernel.Firmament.Tests/Assembly/WindingAxisMateTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/Assembly/WindingAxisMateTests.cs
@@ -8,6 +8,7 @@ public sealed class WindingAxisMateTests
[Theory]
[InlineData(6)]
[InlineData(4.5)]
+ [Trait("Category", "SlowCorpus")]
public void WindingDatumMatesActualPitchedCoilAxisToStem(double pitch)
{
var fixture = FirmamentCorpusHarness.ResolveFixtureFullPath("fixtures/Canonical/Assembly/coil-on-stem.firmament");
@@ -26,6 +27,14 @@ public sealed class WindingAxisMateTests
Assert.Equal(2, result.Geometry!.Artifact.MateResiduals.Count);
Assert.All(result.Geometry.Artifact.MateResiduals, r => Assert.True(r.Passed));
Assert.Single(result.Ir.FitResults);
+ }
+
+ [Fact]
+ [Trait("Category", "SlowCorpus")]
+ public void WindingDatumRejectsOversizeFitAndWrongMateAxis()
+ {
+ var fixture = FirmamentCorpusHarness.ResolveFixtureFullPath("fixtures/Canonical/Assembly/coil-on-stem.firmament");
+ var source = File.ReadAllText(fixture);
// Fit classification uses the compiler-derived clear diameter, not the part origin.
var invalid = new AssemblyM1Pipeline().Compile(source.Replace("Diameter = 8mm", "Diameter = 17mm", StringComparison.Ordinal), fixture);
Assert.False(Assert.Single(invalid.Ir!.FitResults).Compatible);
diff --git a/Aetheris.Kernel.Firmament.Tests/CubicBezier2ProfileTests.cs b/Aetheris.Kernel.Firmament.Tests/CubicBezier2ProfileTests.cs
new file mode 100644
index 00000000..0d508a42
--- /dev/null
+++ b/Aetheris.Kernel.Firmament.Tests/CubicBezier2ProfileTests.cs
@@ -0,0 +1,46 @@
+using Aetheris.Kernel.Firmament.FirmamentV2;
+using Aetheris.Kernel.Firmament.Materializer;
+
+namespace Aetheris.Kernel.Firmament.Tests;
+
+public sealed class CubicBezier2ProfileTests
+{
+ [Fact]
+ public void LampBaseUsesTwoDirectPolynomialFlanksAndExportsWithoutRationalGeometry()
+ {
+ var path = FirmamentCorpusHarness.ResolveFixtureFullPath("fixtures/Canonical/ThreeDm/lamp-base-intent.firmament");
+ var source = File.ReadAllText(path);
+ var profile = ProfileAuthoringParser.ResolveNamedProfile(source, "PlateSection", out var diagnostics);
+ Assert.Empty(diagnostics);
+ Assert.NotNull(profile);
+ Assert.Equal(2, profile.Loops.Single(loop => loop.IsOuter).Segments.Count(segment => segment.Geometry is LineArcCubicBezier2D));
+
+ var build = FirmamentBuildAndExport.CompileSource(source);
+ Assert.True(build.IsSuccess, string.Join("\n", build.Diagnostics.Select(d => d.Message)));
+ Assert.Empty(build.Diagnostics);
+ Assert.Contains("B_SPLINE_CURVE_WITH_KNOTS", build.Value.StepText);
+ Assert.DoesNotContain("RATIONAL_B_SPLINE_CURVE", build.Value.StepText);
+ Assert.DoesNotContain("RATIONAL_B_SPLINE_SURFACE", build.Value.StepText);
+ }
+
+ [Fact]
+ public void CubicGuideRequiresNamedControlsAndItsAuthoredEndpoints()
+ {
+ const string source = """
+ Model InvalidCubic {
+ Units: mm
+ Concept Struct Sketch On XY {
+ Point2 A { Position: [0mm,0mm] }
+ Point2 B { Position: [10mm,0mm] }
+ Point2 C { Position: [10mm,10mm] }
+ CubicBezier2 Flank { From: A; Control1: B; Control2: Missing; To: C }
+ }
+ Profile Outline Using Sketch { Loop Outer {
+ Segment Curve { Trace: Flank; From: A; To: C }
+ } }
+ }
+ """;
+ _ = ProfileAuthoringParser.ResolveNamedProfile(source, "Outline", out var diagnostics);
+ Assert.Contains(diagnostics, d => d.Contains("profile-layout-unresolved-cubic-bezier:Flank", StringComparison.Ordinal));
+ }
+}
diff --git a/Aetheris.Kernel.Firmament.Tests/GearLibraryX0Tests.cs b/Aetheris.Kernel.Firmament.Tests/GearLibraryX0Tests.cs
index aa5a171f..acf31fa3 100644
--- a/Aetheris.Kernel.Firmament.Tests/GearLibraryX0Tests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/GearLibraryX0Tests.cs
@@ -29,6 +29,7 @@ public sealed class GearLibraryX0Tests
[InlineData("miter-basic.firmament", "MiterGear", 20)]
[InlineData("ratchet-basic.firmament", "RatchetGear", 60)]
[InlineData("pawl-basic.firmament", "Pawl", null)]
+ [Trait("Category", "SlowCorpus")]
public void CanonicalFamiliesMaterializeAndReimport(string file, string family, int? teeth)
{
var source = File.ReadAllText(Fixture("Canonical", "Gears", file));
diff --git a/Aetheris.Kernel.Firmament.Tests/KnotPathTests.cs b/Aetheris.Kernel.Firmament.Tests/KnotPathTests.cs
index d2b5cd60..3c06d7f0 100644
--- a/Aetheris.Kernel.Firmament.Tests/KnotPathTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/KnotPathTests.cs
@@ -27,6 +27,7 @@ public sealed class KnotPathTests
[InlineData("trefoil.firmament")]
[InlineData("figure-eight.firmament")]
[InlineData("torus-knot-3-5.firmament")]
+ [Trait("Category", "SlowCorpus")]
public void ClosedTubeHasNoCapsAndExportsPcurveCompletePolynomialStep(string fixture)
{
var built = WireFormBRepMaterializer.Build(Parse(fixture)); Assert.True(built.IsSuccess, Messages(built.Diagnostics));
@@ -78,6 +79,7 @@ public sealed class KnotPathTests
}
[Fact]
+ [Trait("Category", "SlowCorpus")]
public void RepeatExportAndStockAccountingAreDeterministic()
{
var source = File.ReadAllText(Fixture("trefoil.firmament")); var first = FirmamentBuildAndExport.CompileSource(source); var second = FirmamentBuildAndExport.CompileSource(source);
diff --git a/Aetheris.Kernel.Firmament.Tests/ProfilePipelineX1Tests.cs b/Aetheris.Kernel.Firmament.Tests/ProfilePipelineX1Tests.cs
index 5951fb96..0d229e8e 100644
--- a/Aetheris.Kernel.Firmament.Tests/ProfilePipelineX1Tests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/ProfilePipelineX1Tests.cs
@@ -430,6 +430,20 @@ public sealed class ProfilePipelineX1Tests
Assert.False(profile.Loops.Single().Segments[1].Provenance.Reversed);
}
+ [Fact]
+ public void TracedCircleLoopsInheritDistinctGuideIdentities()
+ {
+ var parsed = ProfileAuthoringParser.Parse("""
+ Circle2 Outside { Center: [0mm, 0mm] Radius: 10mm }
+ Circle2 Inside { Center: [0mm, 0mm] Radius: 5mm }
+ Profile Ring { Loop Outer { Outside |> TraceLoop } Loop Inner { Inside |> TraceLoop } }
+ Extrude Solid { Profile: Ring; From: 0mm; To: 1mm }
+ """);
+ Assert.Empty(parsed.Diagnostics);
+ var profile = Assert.IsType<ResolvedProfile2D>(parsed.Profile);
+ Assert.Equal(["Outside_Curve", "Inside_Curve"], profile.Loops.SelectMany(loop => loop.Segments).Select(segment => segment.Name));
+ }
+
[Fact]
public void CrossLoopLeafCollision_IsExplicitAndAliasesResolveIt()
{
diff --git a/Aetheris.Kernel.Firmament.Tests/SectionChainAuthoringTests.cs b/Aetheris.Kernel.Firmament.Tests/SectionChainAuthoringTests.cs
index b76a4142..6ee1fc43 100644
--- a/Aetheris.Kernel.Firmament.Tests/SectionChainAuthoringTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/SectionChainAuthoringTests.cs
@@ -5,6 +5,92 @@ namespace Aetheris.Kernel.Firmament.Tests;
public sealed class SectionChainAuthoringTests
{
+ [Fact]
+ public void SolidLoftBuildsCappedRuledCircleToEllipse()
+ {
+ var source = FirmamentCorpusHarness.ReadFixtureText("fixtures/Canonical/SectionChain/solid-loft-common-ray.firmament");
+ var result = SectionChainAuthoringParser.Compile(source);
+ Assert.True(result.IsSuccess, string.Join(Environment.NewLine, result.Diagnostics));
+ Assert.Equal(4, result.Chain!.Sections[0].Profile.Spans.Count);
+ Assert.Equal(4, result.Chain.Sections[1].Profile.Spans.Count);
+ Assert.Equal(SectionTransitionPolicy.Ruled, result.Chain.TransitionPolicy);
+ Assert.NotNull(result.Materialization?.Body);
+ Assert.True(result.Materialization!.Pcurves!.LoopClosureValid);
+ }
+
+ [Fact]
+ public void HollowLoftCommonRayRemovesLampShadePhaseTwist()
+ {
+ var source = FirmamentCorpusHarness.ReadFixtureText("fixtures/Canonical/ThreeDm/lamp-shade-loft.firmament");
+ var result = SectionChainAuthoringParser.Compile(source);
+ Assert.True(result.IsSuccess, string.Join(Environment.NewLine, result.Diagnostics));
+ Assert.Equal(SectionTransitionPolicy.Ruled, result.Chain!.TransitionPolicy);
+ Assert.NotNull(result.Materialization?.Body);
+ Assert.True(result.Materialization!.Pcurves!.LoopClosureValid);
+
+ var rear = result.Chain.Sections[0];
+ var front = result.Chain.Sections[1];
+ var rearStart = Assert.IsType<SectionProfileCurve.PolynomialBSpline>(rear.Profile.Spans[0].Curve).ControlPoints[0];
+ var frontStart = Assert.IsType<SectionProfileCurve.PolynomialBSpline>(front.Profile.Spans[0].Curve).ControlPoints[0];
+ var rearRay = rear.Frame.Transform(rearStart) - rear.Frame.Transform(new(0, 0));
+ var frontRay = front.Frame.Transform(frontStart) - front.Frame.Transform(new(-0.374, 0));
+ Assert.True(rearRay.Y / rearRay.Length > 0.999999);
+ Assert.True(frontRay.Y / frontRay.Length > 0.999999);
+ }
+
+ [Fact]
+ public void HollowLoftTwistBuildsRuledHyperboloidWithMeasuredWaist()
+ {
+ var source = FirmamentCorpusHarness.ReadFixtureText("fixtures/Canonical/SectionChain/hollow-loft-twist.firmament");
+ var result = SectionChainAuthoringParser.Compile(source);
+ Assert.True(result.IsSuccess, string.Join(Environment.NewLine, result.Diagnostics));
+ var rear = result.Chain!.Sections[0];
+ var front = result.Chain.Sections[1];
+ var rearStart = Assert.IsType<SectionProfileCurve.PolynomialBSpline>(rear.Profile.Spans[0].Curve).ControlPoints[0];
+ var frontStart = Assert.IsType<SectionProfileCurve.PolynomialBSpline>(front.Profile.Spans[0].Curve).ControlPoints[0];
+ var rearPoint = rear.Frame.Transform(rearStart);
+ var frontPoint = front.Frame.Transform(frontStart);
+ var angle = Math.Atan2(frontPoint.Y, frontPoint.X) - Math.Atan2(rearPoint.Y, rearPoint.X);
+ Assert.InRange(angle * 180 / Math.PI, 62.999999, 63.000001);
+ var waistX = (rearPoint.X + frontPoint.X) / 2;
+ var waistY = (rearPoint.Y + frontPoint.Y) / 2;
+ Assert.InRange(Math.Sqrt(waistX*waistX + waistY*waistY), 25*Math.Cos(63*Math.PI/360)-1e-8, 25*Math.Cos(63*Math.PI/360)+1e-8);
+ Assert.True(result.Materialization!.Pcurves!.LoopClosureValid);
+ }
+
+ [Fact]
+ public void HollowLoftRejectsTwistBeyondBound()
+ {
+ var source = FirmamentCorpusHarness.ReadFixtureText("fixtures/Canonical/SectionChain/hollow-loft-twist.firmament")
+ .Replace("Twist: 63deg", "Twist: 181deg", StringComparison.Ordinal);
+ var result = SectionChainAuthoringParser.Compile(source);
+ Assert.False(result.IsSuccess);
+ Assert.Contains("loft-twist-invalid:range=-180..180deg", result.Diagnostics);
+ }
+
+ [Fact]
+ public void HollowLoftRejectsMalformedTwistInsteadOfUsingZero()
+ {
+ var source = FirmamentCorpusHarness.ReadFixtureText("fixtures/Canonical/SectionChain/hollow-loft-twist.firmament")
+ .Replace("Twist: 63deg", "Twist: accidental", StringComparison.Ordinal);
+ var result = SectionChainAuthoringParser.Compile(source);
+ Assert.False(result.IsSuccess);
+ Assert.Contains("loft-twist-invalid:range=-180..180deg", result.Diagnostics);
+ }
+
+ [Fact]
+ public void ExplicitSketchProfilesSupportTiltedRuledTransitions()
+ {
+ var source = FirmamentCorpusHarness.ReadFixtureText("fixtures/Canonical/SectionChain/explicit-sketch-ruled.firmament");
+ var result = SectionChainAuthoringParser.Compile(source);
+
+ Assert.True(result.IsSuccess, string.Join(Environment.NewLine, result.Diagnostics));
+ Assert.Equal(2, result.Chain!.Sections.Count);
+ Assert.Equal(SectionTransitionPolicy.Ruled, result.Chain.TransitionPolicy);
+ Assert.NotNull(result.Materialization?.Body);
+ Assert.True(result.Materialization!.Pcurves!.DomainValid);
+ }
+
[Theory]
[InlineData(60, 40, 8, 0)]
[InlineData(77.98, 163.43, 19.43, 0)]
diff --git a/Aetheris.Kernel.Firmament.Tests/WireFormTests.cs b/Aetheris.Kernel.Firmament.Tests/WireFormTests.cs
index 5f09d899..c56067a8 100644
--- a/Aetheris.Kernel.Firmament.Tests/WireFormTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/WireFormTests.cs
@@ -8,6 +8,7 @@ namespace Aetheris.Kernel.Firmament.Tests;
public sealed class WireFormTests
{
[Fact]
+ [Trait("Category", "SlowCorpus")]
public void AxisCoil_LowersSemanticHelixToNonRationalSplineTube()
{
var source = File.ReadAllText(Fixture("Canonical", "WireForm", "axis-coil.firmament"));
diff --git a/Aetheris.Kernel.Firmament/Assembly/AssemblyDisplayMeshExporter.cs b/Aetheris.Kernel.Firmament/Assembly/AssemblyDisplayMeshExporter.cs
index 69f6c609..73e9120d 100644
--- a/Aetheris.Kernel.Firmament/Assembly/AssemblyDisplayMeshExporter.cs
+++ b/Aetheris.Kernel.Firmament/Assembly/AssemblyDisplayMeshExporter.cs
@@ -31,12 +31,6 @@ public static class AssemblyDisplayMeshExporter
var useSurfaceMeshIr = body.Topology.Faces.All(face =>
body.TryGetFaceSurfaceGeometry(face.Id, out var surface)
&& surface?.Kind is SurfaceGeometryKind.Plane or SurfaceGeometryKind.Cylinder);
- if (body.Geometry.Surfaces.Any(s => s.Value.Kind == SurfaceGeometryKind.BSplineSurfaceWithKnots))
- {
- var trims = Aetheris.Surfacing.BoundedPcurveBuilder.Populate(body.Topology, body.Geometry, body.Bindings);
- if (!trims.IsSuccess)
- throw new InvalidOperationException($"assembly-mesh-pcurve-failed:{identity}:" + string.Join(";", trims.Diagnostics));
- }
var tessellation = useSurfaceMeshIr
? BrepDisplayTessellator.TessellateSurfaceMeshIr(body, effectiveOptions)
: BrepDisplayTessellator.TessellateBounded(body, effectiveOptions);
diff --git a/Aetheris.Kernel.Firmament/Assembly/AssemblyM1Execution.cs b/Aetheris.Kernel.Firmament/Assembly/AssemblyM1Execution.cs
index d30375a4..e793998b 100644
--- a/Aetheris.Kernel.Firmament/Assembly/AssemblyM1Execution.cs
+++ b/Aetheris.Kernel.Firmament/Assembly/AssemblyM1Execution.cs
@@ -8,6 +8,7 @@ using Aetheris.Kernel.Core.Geometry;
using Aetheris.Kernel.Core.Math;
using Aetheris.Kernel.Core.Step242;
using Aetheris.Kernel.Firmament.FirmamentV2;
+using Aetheris.Surfacing;
using Aetheris.Semantics;
namespace Aetheris.Kernel.Firmament.Assembly;
@@ -61,6 +62,49 @@ internal static class AssemblyDefinitionMaterializer
{
if (!string.IsNullOrWhiteSpace(definitionSource))
{
+ // Keep the authored SectionChain in its own source document so sibling
+ // assembly templates cannot leak unrelated profiles into its binder.
+ var sectionFile = System.Text.RegularExpressions.Regex.Match(definitionIdentity,
+ "^(?:SectionChainFile|LoftFile)<\\\"(?<path>[^\\\"]+)\\\">$", System.Text.RegularExpressions.RegexOptions.CultureInvariant);
+ if (sectionFile.Success)
+ {
+ var baseDirectory = Path.GetDirectoryName(Path.GetFullPath(sourceIdentity)) ?? Directory.GetCurrentDirectory();
+ var sectionPath = Path.GetFullPath(Path.Combine(baseDirectory, sectionFile.Groups["path"].Value.Replace('/', Path.DirectorySeparatorChar)));
+ if (!File.Exists(sectionPath))
+ {
+ diagnostics.Add(new("assembly-profile-unresolved-resource", $"SectionChain source '{sectionFile.Groups["path"].Value}' was not found at '{sectionPath}'."));
+ return null;
+ }
+ var section = SectionChainAuthoringParser.Compile(File.ReadAllText(sectionPath));
+ if (!section.IsSuccess || section.Materialization?.Body is not { } sectionBody ||
+ section.Materialization.StructureKind != SectionChainStructureKind.ClosedSolid)
+ {
+ foreach (var diagnostic in section.Diagnostics)
+ diagnostics.Add(new("assembly-definition-materialization-failed", $"SectionChain source '{sectionPath}': {diagnostic}"));
+ if (section.IsSuccess)
+ diagnostics.Add(new("assembly-definition-materialization-failed", $"SectionChain source '{sectionPath}' must materialize one capped closed solid."));
+ return null;
+ }
+ var sectionStep = Step242Exporter.ExportBody(sectionBody);
+ if (!sectionStep.IsSuccess || sectionStep.Value is null)
+ {
+ foreach (var diagnostic in sectionStep.Diagnostics)
+ diagnostics.Add(new("assembly-definition-materialization-failed", $"SectionChain source '{sectionPath}' STEP export failed: {diagnostic.Message}"));
+ return null;
+ }
+ var sectionImport = Step242Importer.ImportBody(sectionStep.Value);
+ if (!sectionImport.IsSuccess || sectionImport.Value is null)
+ {
+ foreach (var diagnostic in sectionImport.Diagnostics)
+ diagnostics.Add(new("assembly-definition-reimport-failed", $"SectionChain source '{sectionPath}' STEP reimport failed: {diagnostic.Message}"));
+ return null;
+ }
+ var 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, [],
+ new(sectionStableId, definitionIdentity, "section-chain:" + sectionHash[..16], sectionHash, Metrics(sectionImport.Value), sectionProvenance));
+ }
var gearDocument = GearAuthoring.ParseDefinitions(definitionSource);
var gear = gearDocument.Gears.SingleOrDefault(candidate => string.Equals(candidate.Name, definitionIdentity, StringComparison.Ordinal));
if (gear is not null)
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/LoftAuthoringParser.cs b/Aetheris.Kernel.Firmament/FirmamentV2/LoftAuthoringParser.cs
new file mode 100644
index 00000000..3cb829d1
--- /dev/null
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/LoftAuthoringParser.cs
@@ -0,0 +1,252 @@
+using System.Globalization;
+using System.Text.RegularExpressions;
+using Aetheris.Kernel.Core.Math;
+using Aetheris.Kernel.Firmament.Materializer;
+using Aetheris.Surfacing;
+
+namespace Aetheris.Kernel.Firmament.FirmamentV2;
+
+/// <summary>
+/// Bounded two-section solid or hollow loft. The two named closed 2D outlines and their
+/// construction planes are authoring inputs; SectionChain remains the sole
+/// ruled BRep materializer. CommonRay pairs equal polar directions in the two
+/// section frames, independently of each ellipse's parameter origin.
+/// </summary>
+public static class LoftAuthoringParser
+{
+ private static readonly Regex Header = new(@"\bLoft(?:\s*<\s*(?<kind>Hollow)\s*>)?\s+(?<name>[A-Za-z_]\w*)\s*\{", RegexOptions.CultureInvariant);
+
+ public static bool IsLoftSource(string source) => Header.IsMatch(source);
+
+ public static SectionChainAuthoringResult Compile(string source, bool materialize = true)
+ {
+ ArgumentNullException.ThrowIfNull(source);
+ var diagnostics = new List<string>();
+ if (!Regex.IsMatch(source, @"\bUnits\s*:\s*mm\b", RegexOptions.CultureInvariant))
+ diagnostics.Add("loft-units-invalid:millimetres-required");
+ var declarations = Header.Matches(source).Cast<Match>().ToArray();
+ if (declarations.Length != 1)
+ return Fail($"loft-count-invalid:expected=1:actual={declarations.Length}");
+ if (Regex.IsMatch(source, @"\bSectionChain\s+[A-Za-z_]\w*\s*\{", RegexOptions.CultureInvariant))
+ return Fail("loft-section-chain-ambiguous:one-surfacing-root-required");
+
+ var declaration = declarations[0];
+ var open = source.IndexOf('{', declaration.Index + declaration.Length - 1);
+ var close = MatchingBrace(source, open);
+ if (close < 0) return Fail("loft-block-unclosed");
+ var body = source[(open + 1)..close];
+ var name = declaration.Groups["name"].Value;
+ var hollow = declaration.Groups["kind"].Success;
+ var allowed = new HashSet<string>(StringComparer.Ordinal)
+ {
+ "RearProfile", "RearFrame", "FrontProfile", "FrontFrame", "Rule",
+ "Correspondence", "Reference", "Twist"
+ };
+ if (hollow) { allowed.Add("Thickness"); allowed.Add("SeamGap"); }
+ var fields = Regex.Matches(body, @"(?m)^\s*(?<key>[A-Za-z_]\w*)\s*:", RegexOptions.CultureInvariant)
+ .Cast<Match>().Select(match => match.Groups["key"].Value).ToArray();
+ foreach (var field in fields.Where(field => !allowed.Contains(field)))
+ diagnostics.Add($"loft-field-unknown:{field}");
+ foreach (var field in fields.GroupBy(field => field, StringComparer.Ordinal).Where(group => group.Count() > 1))
+ diagnostics.Add($"loft-field-duplicate:{field.Key}");
+ var rearProfileName = Field(body, "RearProfile");
+ var frontProfileName = Field(body, "FrontProfile");
+ var rearFrameName = Field(body, "RearFrame");
+ var frontFrameName = Field(body, "FrontFrame");
+ var rule = Field(body, "Rule");
+ var correspondence = Field(body, "Correspondence");
+ if (rule != "Ruled") diagnostics.Add($"loft-rule-unsupported:{rule ?? "<missing>"}:expected=Ruled");
+ if (correspondence != "CommonRay") diagnostics.Add($"loft-correspondence-unsupported:{correspondence ?? "<missing>"}:expected=CommonRay");
+ if (rearProfileName is null || frontProfileName is null || rearFrameName is null || frontFrameName is null)
+ diagnostics.Add("loft-section-input-missing:RearProfile,FrontProfile,RearFrame,FrontFrame-required");
+
+ var thickness = 0d;
+ var thicknessText = Scalar(body, "Thickness");
+ if (hollow && (thicknessText is null || !ProfileAuthoringParser.TryMeasure(thicknessText, "mm", out thickness) || thickness <= 0))
+ diagnostics.Add("loft-thickness-invalid:positive-length-required");
+ var seamDegrees = 0.1d;
+ var seamText = RawField(body, "SeamGap");
+ if (seamText is not null && (!TryDegrees(seamText, out seamDegrees) || seamDegrees < 0.01 || seamDegrees > 5))
+ diagnostics.Add("loft-seam-gap-invalid:range=0.01..5deg");
+ var twistDegrees = 0d;
+ var twistText = RawField(body, "Twist");
+ if (twistText is not null && (!TryDegrees(twistText, out twistDegrees) || Math.Abs(twistDegrees) > 180))
+ diagnostics.Add("loft-twist-invalid:range=-180..180deg");
+ var referenceText = Regex.Match(body, @"(?m)^\s*Reference\s*:\s*\[\s*(?<x>[-+.\deE]+)\s*,\s*(?<y>[-+.\deE]+)\s*,\s*(?<z>[-+.\deE]+)\s*\]\s*;?\s*$", RegexOptions.CultureInvariant);
+ Vector3D reference = default;
+ if (!referenceText.Success || !TryVector(referenceText, out reference) || reference.Length < 1e-8)
+ diagnostics.Add("loft-reference-invalid:nonzero-world-direction-required");
+ if (diagnostics.Count > 0) return Fail(diagnostics.ToArray());
+
+ var rear = ProfileAuthoringParser.ResolveNamedProfile(source, rearProfileName!, out var rearDiagnostics);
+ var front = ProfileAuthoringParser.ResolveNamedProfile(source, frontProfileName!, out var frontDiagnostics);
+ if (rear is null) diagnostics.AddRange(rearDiagnostics);
+ if (front is null) diagnostics.AddRange(frontDiagnostics);
+ var rearFrame = ProfileAuthoringParser.ResolveNamedConstructionPlane(source, rearFrameName!, diagnostics);
+ var frontFrame = ProfileAuthoringParser.ResolveNamedConstructionPlane(source, frontFrameName!, diagnostics);
+ if (rearFrame is null) diagnostics.Add($"loft-frame-unresolved:Rear:{rearFrameName}");
+ if (frontFrame is null) diagnostics.Add($"loft-frame-unresolved:Front:{frontFrameName}");
+ var rearOutline = rear is null ? null : Outline(rear, "Rear", thickness, diagnostics);
+ var frontOutline = front is null ? null : Outline(front, "Front", thickness, diagnostics);
+ if (diagnostics.Count > 0 || rearOutline is null || frontOutline is null || rearFrame is null || frontFrame is null)
+ return Fail(diagnostics.ToArray());
+
+ var rearSectionFrame = new SectionFrame(rearFrame.Origin, rearFrame.AxisX, rearFrame.AxisY, rearFrame.AxisZ);
+ var frontSectionFrame = new SectionFrame(frontFrame.Origin, frontFrame.AxisX, frontFrame.AxisY, frontFrame.AxisZ);
+ var rearProfile = MakeProfile("Rear", rearOutline, rearSectionFrame, reference, hollow, seamDegrees, thickness, diagnostics);
+ var frontProfile = MakeProfile("Front", frontOutline, frontSectionFrame, reference, hollow, seamDegrees, thickness, diagnostics,
+ twistDegrees * Math.PI / 180d);
+ if (diagnostics.Count > 0 || rearProfile is null || frontProfile is null) return Fail(diagnostics.ToArray());
+
+ var chain = new SectionChain(name,
+ [new Section("Rear", rearSectionFrame, rearProfile), new Section("Front", frontSectionFrame, frontProfile)],
+ [], SectionTransitionPolicy.Ruled, SectionTermination.Cap, SectionTermination.Cap, SectionChainContinuity.G0);
+ if (!materialize) return new(true, chain, null, []);
+ var result = SectionChainMaterializer.Materialize(chain);
+ if (!result.IsSuccess) diagnostics.AddRange(result.Diagnostics.Select(item => $"{item.Code}:{item.Message}"));
+ return new(result.IsSuccess, chain, result, diagnostics);
+
+ SectionChainAuthoringResult Fail(params string[] messages) => new(false, null, null,
+ diagnostics.Concat(messages).Distinct(StringComparer.Ordinal).ToArray());
+ }
+
+ private sealed record Outline2((double X, double Y) Center, double Major, double Minor, double Rotation);
+
+ private static Outline2? Outline(ResolvedProfile2D profile, string section, double thickness, List<string> diagnostics)
+ {
+ if (profile.Loops.Count != 1 || !profile.Loops[0].IsOuter || profile.Loops[0].Segments.Count != 1)
+ {
+ diagnostics.Add($"loft-profile-unsupported:{section}:one-closed-circle-or-ellipse-required");
+ return null;
+ }
+ var outline = profile.Loops[0].Segments[0].Geometry switch
+ {
+ LineArcFullCircle2D circle => new Outline2(circle.Center, circle.Radius, circle.Radius, 0),
+ LineArcFullEllipse2D ellipse => new Outline2(ellipse.Center, ellipse.MajorRadius, ellipse.MinorRadius, ellipse.RotationRadians),
+ _ => null
+ };
+ if (outline is null) diagnostics.Add($"loft-profile-unsupported:{section}:one-closed-circle-or-ellipse-required");
+ else if (outline.Minor <= thickness + 1e-6)
+ diagnostics.Add($"loft-thickness-exceeds-section:{section}");
+ return outline;
+ }
+
+ private static SectionProfile? MakeProfile(string name, Outline2 outline, SectionFrame frame,
+ Vector3D worldReference, bool hollow, double gapDegrees, double thickness, List<string> diagnostics, double twistRadians = 0)
+ {
+ var rx = worldReference.Dot(frame.XAxis.ToVector());
+ var ry = worldReference.Dot(frame.YAxis.ToVector());
+ var length = Math.Sqrt(rx * rx + ry * ry);
+ if (length < 1e-8)
+ {
+ diagnostics.Add($"loft-reference-parallel-to-frame:{name}");
+ return null;
+ }
+ var referenceAngle = Math.Atan2(ry, rx) + twistRadians;
+ var gap = gapDegrees * Math.PI / 180d;
+ var outerAngles = new[] { 0d, Math.PI/2, Math.PI, 3*Math.PI/2, hollow ? 2*Math.PI-gap : 2*Math.PI };
+ var innerAngles = outerAngles.Reverse().ToArray();
+ var spans = new List<SectionProfileSpan>(hollow ? 10 : 4);
+ for (var i = 0; i < 4; i++)
+ spans.Add(new($"O{i}", Cubic(outline, 0, referenceAngle + outerAngles[i], referenceAngle + outerAngles[i+1])));
+ if (!hollow) return new(name + "Outline", spans, "O0");
+ spans.Add(new("BridgeEnd", new SectionProfileCurve.Line(
+ PointAt(outline, 0, referenceAngle + outerAngles[^1]),
+ PointAt(outline, thickness, referenceAngle + innerAngles[0]))));
+ for (var i = 0; i < 4; i++)
+ spans.Add(new($"I{i}", Cubic(outline, thickness, referenceAngle + innerAngles[i], referenceAngle + innerAngles[i+1])));
+ spans.Add(new("BridgeStart", new SectionProfileCurve.Line(
+ PointAt(outline, thickness, referenceAngle), PointAt(outline, 0, referenceAngle))));
+ return new(name + "Wall", spans, "O0");
+ }
+
+ private static SectionProfileCurve.PolynomialBSpline Cubic(Outline2 outline, double inset, double startRay, double endRay)
+ {
+ var start = EllipseParameter(outline, startRay, inset);
+ var end = EllipseParameter(outline, endRay, inset);
+ var clockwise = endRay < startRay;
+ while (clockwise && end >= start) end -= 2*Math.PI;
+ while (!clockwise && end <= start) end += 2*Math.PI;
+ var k = 4d/3d * Math.Tan((end-start)/4d);
+ var p0 = AtParameter(outline, inset, start);
+ var p3 = AtParameter(outline, inset, end);
+ var t0 = Tangent(outline, inset, start);
+ var t3 = Tangent(outline, inset, end);
+ var p1 = new SectionPoint2D(p0.X+k*t0.X, p0.Y+k*t0.Y);
+ var p2 = new SectionPoint2D(p3.X-k*t3.X, p3.Y-k*t3.Y);
+ return new(3, [p0,p1,p2,p3], [4,4], [0,1]);
+ }
+
+ private static SectionPoint2D PointAt(Outline2 outline, double inset, double ray)
+ => AtParameter(outline, inset, EllipseParameter(outline, ray, inset));
+
+ private static double EllipseParameter(Outline2 outline, double ray, double inset)
+ {
+ var relative = ray-outline.Rotation;
+ return Math.Atan2(Math.Sin(relative)/(outline.Minor-inset), Math.Cos(relative)/(outline.Major-inset));
+ }
+
+ private static SectionPoint2D AtParameter(Outline2 outline, double inset, double parameter)
+ {
+ var x = (outline.Major-inset)*Math.Cos(parameter);
+ var y = (outline.Minor-inset)*Math.Sin(parameter);
+ var c = Math.Cos(outline.Rotation); var s = Math.Sin(outline.Rotation);
+ return new(outline.Center.X+c*x-s*y, outline.Center.Y+s*x+c*y);
+ }
+
+ private static SectionPoint2D Tangent(Outline2 outline, double inset, double parameter)
+ {
+ var x = -(outline.Major-inset)*Math.Sin(parameter);
+ var y = (outline.Minor-inset)*Math.Cos(parameter);
+ var c = Math.Cos(outline.Rotation); var s = Math.Sin(outline.Rotation);
+ return new(c*x-s*y, s*x+c*y);
+ }
+
+ private static string? Field(string body, string key)
+ {
+ var match = Regex.Match(body, $@"(?m)^\s*{Regex.Escape(key)}\s*:\s*(?<value>[A-Za-z_]\w*)\s*;?\s*$", RegexOptions.CultureInvariant);
+ return match.Success ? match.Groups["value"].Value : null;
+ }
+
+ private static string? Scalar(string body, string key)
+ {
+ var match = Regex.Match(body, $@"(?m)^\s*{Regex.Escape(key)}\s*:\s*(?<value>[-+.\deE]+(?:mm|deg))\s*;?\s*$", RegexOptions.CultureInvariant);
+ return match.Success ? match.Groups["value"].Value : null;
+ }
+
+ private static string? RawField(string body, string key)
+ {
+ var match = Regex.Match(body, $@"(?m)^\s*{Regex.Escape(key)}\s*:\s*(?<value>[^\r\n;]+)\s*;?\s*$", RegexOptions.CultureInvariant);
+ return match.Success ? match.Groups["value"].Value.Trim() : null;
+ }
+
+ private static bool TryDegrees(string text, out double degrees)
+ {
+ degrees = 0;
+ return text.EndsWith("deg", StringComparison.Ordinal)
+ && double.TryParse(text[..^3], NumberStyles.Float, CultureInfo.InvariantCulture, out degrees)
+ && double.IsFinite(degrees);
+ }
+
+ private static bool TryVector(Match match, out Vector3D vector)
+ {
+ vector = default;
+ if (!double.TryParse(match.Groups["x"].Value, NumberStyles.Float, CultureInfo.InvariantCulture, out var x) ||
+ !double.TryParse(match.Groups["y"].Value, NumberStyles.Float, CultureInfo.InvariantCulture, out var y) ||
+ !double.TryParse(match.Groups["z"].Value, NumberStyles.Float, CultureInfo.InvariantCulture, out var z) ||
+ !double.IsFinite(x) || !double.IsFinite(y) || !double.IsFinite(z)) return false;
+ vector = new(x,y,z);
+ return true;
+ }
+
+ private static int MatchingBrace(string source, int open)
+ {
+ var depth = 0;
+ for (var i = open; i < source.Length; i++)
+ {
+ if (source[i] == '{') depth++;
+ else if (source[i] == '}' && --depth == 0) return i;
+ }
+ return -1;
+ }
+}
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringParser.cs b/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringParser.cs
index 25141720..c89b2d66 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringParser.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringParser.cs
@@ -15,6 +15,7 @@ public static class ProfileAuthoringParser
private const double Tolerance = 1e-9;
private static readonly Regex Point = new(@"\bPoint2\s+(?<n>[A-Za-z_]\w*)\s*\{\s*Position\s*:\s*(?:\[|Point2\s*\()\s*(?<x>[-+.\deE]+)mm\s*,\s*(?<y>[-+.\deE]+)mm\s*(?:\]|\))", RegexOptions.Singleline | RegexOptions.CultureInvariant);
private static readonly Regex Line = new(@"\bLine2\s+(?<n>[A-Za-z_]\w*)\s*\{\s*From\s*:\s*(?<a>[\w.]+)\s*;?\s*To\s*:\s*(?<b>[\w.]+)", RegexOptions.Singleline | RegexOptions.CultureInvariant);
+ private static readonly Regex CubicBezier = new(@"\bCubicBezier2\s+(?<n>[A-Za-z_]\w*)\s*\{\s*From\s*:\s*(?<a>[\w.]+)\s*;?\s*Control1\s*:\s*(?<c1>[\w.]+)\s*;?\s*Control2\s*:\s*(?<c2>[\w.]+)\s*;?\s*To\s*:\s*(?<b>[\w.]+)", RegexOptions.Singleline | RegexOptions.CultureInvariant);
private static readonly Regex Circle = new(@"(?:\bConcept\s+)?\bCircle2\s+(?<n>[A-Za-z_]\w*)\s*\{\s*Center\s*:\s*(?<c>[\w.]+)\s*;?\s*Radius\s*:\s*(?<r>[-+.\deE]+)mm", RegexOptions.Singleline | RegexOptions.CultureInvariant);
private static readonly Regex EllipseGuide = new(@"\bEllipse2Guide\s+(?<n>[A-Za-z_]\w*)\s*\{\s*Center\s*:\s*(?<c>[\w.]+)\s*;?\s*SemiAxes\s*:\s*\[\s*(?<a>[-+.\deE]+)mm\s*,\s*(?<b>[-+.\deE]+)mm\s*\]\s*;?\s*Rotation\s*:\s*(?<r>[-+.\deE]+)deg", RegexOptions.Singleline | RegexOptions.CultureInvariant);
private static readonly Regex Rect = new(@"\bRect2\s+(?<n>[A-Za-z_]\w*)\s*\{\s*Center\s*:\s*(?:\[|Point2\s*\()\s*(?<x>[-+.\deE]+)mm\s*,\s*(?<y>[-+.\deE]+)mm\s*(?:\]|\))\s*;?\s*Size\s*:\s*\[(?<w>[-+.\deE]+)mm\s*,\s*(?<h>[-+.\deE]+)mm\]", RegexOptions.Singleline | RegexOptions.CultureInvariant);
@@ -235,6 +236,16 @@ public static class ProfileAuthoringParser
if (!points.TryGetValue(match.Groups["a"].Value, out var from) || !points.TryGetValue(match.Groups["b"].Value, out var to)) diagnostics.Add($"profile-layout-unresolved-line:{name}");
else guides[name] = new LineArcLineSegment2D(from, to);
}
+ foreach (Match match in CubicBezier.Matches(source))
+ {
+ var name = match.Groups["n"].Value;
+ if (!points.TryGetValue(match.Groups["a"].Value, out var from) ||
+ !points.TryGetValue(match.Groups["c1"].Value, out var control1) ||
+ !points.TryGetValue(match.Groups["c2"].Value, out var control2) ||
+ !points.TryGetValue(match.Groups["b"].Value, out var to))
+ diagnostics.Add($"profile-layout-unresolved-cubic-bezier:{name}");
+ else guides[name] = new LineArcCubicBezier2D(from, control1, control2, to);
+ }
foreach (Match match in Rect.Matches(source))
{
var name = match.Groups["n"].Value;
@@ -715,7 +726,7 @@ public static class ProfileAuthoringParser
return [];
}
if (guides.TryGetValue(stages[0].Reference!, out var closedGuide) && closedGuide is LineArcFullCircle2D or LineArcFullEllipse2D)
- return [PipelineSegment(profile, loopName, stages[0].Alias ?? "Boundary", closedGuide, $"concept:{profile.Frame ?? "XY"}.{stages[0].Reference}", stages[0].Reference!, false, 0, match.Index)];
+ return [PipelineSegment(profile, loopName, stages[0].Alias ?? stages[0].Reference!.Split('.').Last(), closedGuide, $"concept:{profile.Frame ?? "XY"}.{stages[0].Reference}", stages[0].Reference!, false, 0, match.Index)];
if (!paths.TryGetValue(stages[0].Reference!, out var path))
{
diagnostics.Add($"firmament-profile-traceloop-not-loop:{stages[0].Reference}");
@@ -1021,6 +1032,12 @@ public static class ProfileAuthoringParser
private static LineArcProfileCurve2D? SelectGuide(LineArcProfileCurve2D guide, (double X, double Y) from, (double X, double Y) to, string sweep, string segment, string trace, List<string> diagnostics)
{
if (guide is LineArcLineSegment2D line) { if (!OnLine(from, line) || !OnLine(to, line)) diagnostics.Add($"profile-endpoint-not-on-guide:{segment}:{trace}"); return new LineArcLineSegment2D(from, to); }
+ if (guide is LineArcCubicBezier2D cubic)
+ {
+ if (!string.IsNullOrWhiteSpace(sweep) || Distance(from, cubic.Start) > Tolerance || Distance(to, cubic.End) > Tolerance)
+ { diagnostics.Add($"profile-cubic-bezier-invalid:{segment}:{trace}"); return null; }
+ return cubic;
+ }
if (guide is LineArcFullCircle2D circle)
{
if (!OnCircle(from, circle.Center, circle.Radius) || !OnCircle(to, circle.Center, circle.Radius) || string.IsNullOrWhiteSpace(sweep)) { diagnostics.Add($"profile-arc-invalid:{segment}:{trace}"); return null; }
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/SectionChainAuthoringParser.cs b/Aetheris.Kernel.Firmament/FirmamentV2/SectionChainAuthoringParser.cs
index 6f54543d..c99bc8a6 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/SectionChainAuthoringParser.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/SectionChainAuthoringParser.cs
@@ -12,17 +12,20 @@ public sealed record SectionChainAuthoringResult(
/// <summary>
/// Domain binder for Firmament SectionChain declarations. Profiles remain ordinary
-/// Concept Path-derived Profiles; this layer only associates them with ordered frames,
+/// named Profiles; this layer only associates them with ordered frames,
/// seams, correspondence, transition law, and termination intent.
/// </summary>
public static class SectionChainAuthoringParser
{
public static bool IsSectionChainSource(string source) =>
- Regex.IsMatch(source, @"\bSectionChain\s+[A-Za-z_]\w*\s*\{", RegexOptions.CultureInvariant);
+ Regex.IsMatch(source, @"\bSectionChain\s+[A-Za-z_]\w*\s*\{", RegexOptions.CultureInvariant)
+ || LoftAuthoringParser.IsLoftSource(source);
public static SectionChainAuthoringResult Compile(string source, bool materialize = true)
{
ArgumentNullException.ThrowIfNull(source);
+ if (LoftAuthoringParser.IsLoftSource(source))
+ return LoftAuthoringParser.Compile(source, materialize);
var diagnostics = new List<string>();
if (!Regex.IsMatch(source, @"\bUnits\s*:\s*mm\b", RegexOptions.CultureInvariant))
diagnostics.Add("section-chain-units-invalid:millimetres-required");
@@ -55,7 +58,12 @@ public static class SectionChainAuthoringParser
var seam = Field(authored.Body, "Seam");
if (frameName is null) diagnostics.Add($"section-chain-frame-missing:{authored.Name}");
ResolvedProfile2D? profile = null;
- if (profileName is null || !profiles.TryGetValue(profileName ?? string.Empty, out profile))
+ if (profileName is not null && !profiles.TryGetValue(profileName, out profile))
+ {
+ profile = ProfileAuthoringParser.ResolveNamedProfile(source, profileName, out var profileDiagnostics);
+ if (profile is null) diagnostics.AddRange(profileDiagnostics);
+ }
+ if (profile is null)
diagnostics.Add($"section-chain-profile-unresolved:{authored.Name}:{profileName ?? "<missing>"}");
var plane = frameName is null ? null : ProfileAuthoringParser.ResolveNamedConstructionPlane(source, frameName, diagnostics);
if (frameName is not null && plane is null) diagnostics.Add($"section-chain-frame-unresolved:{authored.Name}:{frameName}");
diff --git a/Aetheris.Modules.Tests/SurfacingM1Tests.cs b/Aetheris.Modules.Tests/SurfacingM1Tests.cs
index d5d83bd9..78a1bcc6 100644
--- a/Aetheris.Modules.Tests/SurfacingM1Tests.cs
+++ b/Aetheris.Modules.Tests/SurfacingM1Tests.cs
@@ -110,9 +110,11 @@ public sealed class SurfacingM1Tests
Assert.Contains(BoundaryPatchLowering.Lower(new("g1",s,n,w,new RuledBoundary.Line("e2",new(5,0,0),new(5,5,0)),p,BoundaryContinuity.TangentG1)).Diagnostics,d=>d.Code=="surfacing-tangent-constraint-unsupported");
}
- [Fact] public void NonRationalBSplineContractRejectsInvalidDataAndHasNoWeights()
+ [Fact] public void PolynomialBSplineContractRejectsInvalidDataAndHasNoWeights()
{
- Assert.DoesNotContain(typeof(BSplineSurfaceWithKnots).GetProperties(),property=>property.Name.Contains("Weight",StringComparison.OrdinalIgnoreCase));
+ var polynomial = new BSplineSurfaceWithKnots(1,1,[[Point3D.Origin,new(1,0,0)],[new(0,1,0),new(1,1,0)]],"x",false,false,false,[2,2],[2,2],[0,1],[0,1],"x");
+ Assert.False(polynomial.IsRational);
+ Assert.Null(polynomial.Weights);
Assert.Throws<ArgumentException>(()=>new BSplineSurfaceWithKnots(1,1,[[new(double.NaN,0,0),Point3D.Origin],[Point3D.Origin,Point3D.Origin]],"x",false,false,false,[2,2],[2,2],[0,1],[0,1],"x"));
}
diff --git a/Aetheris.ThreeDm/Aetheris.ThreeDm.csproj b/Aetheris.ThreeDm/Aetheris.ThreeDm.csproj
new file mode 100644
index 00000000..03d7fbdd
--- /dev/null
+++ b/Aetheris.ThreeDm/Aetheris.ThreeDm.csproj
@@ -0,0 +1,11 @@
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <TargetFramework>net10.0</TargetFramework>
+ <ImplicitUsings>enable</ImplicitUsings>
+ <Nullable>enable</Nullable>
+ </PropertyGroup>
+ <ItemGroup>
+ <PackageReference Include="Rhino3dm" Version="8.32.0" />
+ <ProjectReference Include="..\Aetheris.Kernel.Core\Aetheris.Kernel.Core.csproj" />
+ </ItemGroup>
+</Project>
diff --git a/Aetheris.ThreeDm/ThreeDmBoundsSampler.cs b/Aetheris.ThreeDm/ThreeDmBoundsSampler.cs
new file mode 100644
index 00000000..6a160d7f
--- /dev/null
+++ b/Aetheris.ThreeDm/ThreeDmBoundsSampler.cs
@@ -0,0 +1,32 @@
+using Rhino.Geometry;
+
+namespace Aetheris.ThreeDm;
+
+/// <summary>
+/// A bounded envelope of trimmed edge samples. Rhino's BRep bounding box can
+/// include much larger, untrimmed support surfaces; this sample is useful for
+/// component navigation but is not a certified surface extrema search.
+/// </summary>
+internal static class ThreeDmBoundsSampler
+{
+ public static BoundingBox Sample(Brep brep)
+ {
+ var minX = double.PositiveInfinity; var minY = double.PositiveInfinity; var minZ = double.PositiveInfinity;
+ var maxX = double.NegativeInfinity; var maxY = double.NegativeInfinity; var maxZ = double.NegativeInfinity;
+ foreach (var edge in brep.Edges)
+ {
+ var domain = edge.Domain;
+ const int count = 129;
+ for (var i = 0; i < count; i++)
+ {
+ var point = edge.PointAt(domain.T0 + (domain.T1 - domain.T0) * i / (count - 1d));
+ if (!point.IsValid) continue;
+ minX = double.Min(minX, point.X); minY = double.Min(minY, point.Y); minZ = double.Min(minZ, point.Z);
+ maxX = double.Max(maxX, point.X); maxY = double.Max(maxY, point.Y); maxZ = double.Max(maxZ, point.Z);
+ }
+ }
+ return double.IsFinite(minX)
+ ? new BoundingBox(new Point3d(minX, minY, minZ), new Point3d(maxX, maxY, maxZ))
+ : brep.GetBoundingBox(true);
+ }
+}
diff --git a/Aetheris.ThreeDm/ThreeDmInspector.cs b/Aetheris.ThreeDm/ThreeDmInspector.cs
new file mode 100644
index 00000000..e38b0e98
--- /dev/null
+++ b/Aetheris.ThreeDm/ThreeDmInspector.cs
@@ -0,0 +1,135 @@
+using System.Diagnostics;
+using Rhino;
+using Rhino.FileIO;
+using Rhino.Geometry;
+
+namespace Aetheris.ThreeDm;
+
+public sealed record ThreeDmPoint(double X, double Y, double Z);
+public sealed record ThreeDmBounds(ThreeDmPoint Min, ThreeDmPoint Max);
+public sealed record ThreeDmObjectInventory(
+ int Index, Guid SourceId, int LayerIndex, string GeometryType, string Classification,
+ bool IsSolid, bool IsManifold, int Faces, int Loops, int Trims, int Edges, int Vertices,
+ ThreeDmBounds? BoundsMillimetres);
+public sealed record ThreeDmInventory(
+ int ArchiveVersion, long FileSizeBytes, string SourceUnit, double? MillimetresPerSourceUnit,
+ double SourceAbsoluteTolerance, double? AbsoluteToleranceMillimetres, double SourceAngleToleranceDegrees,
+ int LayerCount, int InstanceDefinitionCount, int ObjectCount,
+ IReadOnlyDictionary<string, int> ObjectTypes, int BrepCount, int ExtrusionCount, int MeshCount,
+ int SubDCount, int CurveCount, int SurfaceCount, int UnsupportedObjectCount,
+ int FaceCount, int LoopCount, int TrimCount, int EdgeCount, int VertexCount,
+ int SeamTrimCount, int SingularTrimCount, int RationalEdgeCount, int RationalNoncircularEdgeCount,
+ int RationalArcEdgeCount, int RationalEllipticEdgeCount, int RationalGenericEdgeCount,
+ int RationalSurfaceCount, int RationalTrimCount, ThreeDmBounds? BoundsMillimetres,
+ IReadOnlyList<ThreeDmObjectInventory> Objects, IReadOnlyList<string> Diagnostics,
+ double ParseMilliseconds, double InventoryMilliseconds);
+
+/// <summary>Read-only OpenNURBS inventory. Does not claim a BRep translation.</summary>
+public static class ThreeDmInspector
+{
+ public static ThreeDmInventory Inspect(string path)
+ {
+ ArgumentException.ThrowIfNullOrWhiteSpace(path);
+ var fullPath = Path.GetFullPath(path);
+ var fileSize = new FileInfo(fullPath).Length;
+ var timer = Stopwatch.StartNew();
+ using var file = File3dm.Read(fullPath) ?? throw new InvalidDataException("OpenNURBS could not read the 3DM file.");
+ var parseMilliseconds = timer.Elapsed.TotalMilliseconds;
+ var settings = file.Settings;
+ var factor = MillimetresPerSourceUnit(settings.ModelUnitSystem);
+ var diagnostics = new List<string>();
+ if (factor is null)
+ diagnostics.Add($"UnitConversionIssue: model unit {settings.ModelUnitSystem} has no qualified mm conversion.");
+ var objects = new List<ThreeDmObjectInventory>();
+ var types = new SortedDictionary<string, int>(StringComparer.Ordinal);
+ var faceCount = 0; var loopCount = 0; var trimCount = 0; var edgeCount = 0; var vertexCount = 0;
+ var seamCount = 0; var singularCount = 0; var rationalEdgeCount = 0; var rationalNoncircularEdgeCount = 0;
+ var rationalArcEdgeCount = 0; var rationalEllipticEdgeCount = 0; var rationalGenericEdgeCount = 0;
+ var rationalSurfaceCount = 0; var rationalTrimCount = 0;
+ var brepCount = 0; var extrusionCount = 0; var meshCount = 0; var subDCount = 0;
+ var curveCount = 0; var surfaceCount = 0; var unsupportedCount = 0;
+ BoundingBox? overall = null;
+ var index = 0;
+ foreach (var item in file.Objects)
+ {
+ var geometry = item.Geometry;
+ var type = geometry.GetType().Name;
+ types[type] = types.GetValueOrDefault(type) + 1;
+ if (geometry is not Brep brep)
+ {
+ switch (geometry)
+ {
+ case Extrusion: extrusionCount++; break;
+ case Mesh: meshCount++; break;
+ case SubD: subDCount++; break;
+ case Curve: curveCount++; break;
+ case Surface: surfaceCount++; break;
+ default: unsupportedCount++; break;
+ }
+ diagnostics.Add($"Unsupported3dmObjectType: object {index} ({type}) is outside the X0 BRep bridge.");
+ objects.Add(new ThreeDmObjectInventory(index++, item.Attributes.ObjectId, item.Attributes.LayerIndex,
+ type, "non-BRep", false, false, 0, 0, 0, 0, 0, null));
+ continue;
+ }
+ brepCount++;
+ faceCount += brep.Faces.Count; loopCount += brep.Loops.Count; trimCount += brep.Trims.Count;
+ edgeCount += brep.Edges.Count; vertexCount += brep.Vertices.Count;
+ foreach (var edge in brep.Edges)
+ {
+ if (!edge.EdgeCurve.ToNurbsCurve().IsRational) continue;
+ rationalEdgeCount++;
+ if (!edge.EdgeCurve.TryGetCircle(out _))
+ {
+ rationalNoncircularEdgeCount++;
+ if (edge.EdgeCurve.TryGetArc(out _)) rationalArcEdgeCount++;
+ else if (edge.EdgeCurve.TryGetEllipse(out _)) rationalEllipticEdgeCount++;
+ else
+ {
+ rationalGenericEdgeCount++;
+ diagnostics.Add($"Unsupported3dmCurveType: object {index}, edge {edge.EdgeIndex} is a generic rational curve; Aetheris has no generic rational 3D curve carrier.");
+ }
+ }
+ }
+ foreach (var surface in brep.Surfaces)
+ if (surface.ToNurbsSurface().IsRational) rationalSurfaceCount++;
+ foreach (var trim in brep.Trims)
+ {
+ if (trim.TrimType == BrepTrimType.Seam) seamCount++;
+ if (trim.TrimType == BrepTrimType.Singular) singularCount++;
+ if (trim.TrimCurve.ToNurbsCurve().IsRational) rationalTrimCount++;
+ }
+ var box = ThreeDmBoundsSampler.Sample(brep);
+ if (overall is null) overall = box;
+ else { var merged = overall.Value; merged.Union(box); overall = merged; }
+ objects.Add(new ThreeDmObjectInventory(index++, item.Attributes.ObjectId, item.Attributes.LayerIndex,
+ type, "exact-but-not-yet-mapped", brep.IsSolid, brep.IsManifold,
+ brep.Faces.Count, brep.Loops.Count, brep.Trims.Count, brep.Edges.Count, brep.Vertices.Count,
+ factor is double scale ? ConvertBounds(box, scale) : null));
+ }
+ return new ThreeDmInventory(file.ArchiveVersion, fileSize, settings.ModelUnitSystem.ToString(), factor,
+ settings.ModelAbsoluteTolerance, factor * settings.ModelAbsoluteTolerance,
+ settings.ModelAngleToleranceDegrees, file.AllLayers.Count, file.AllInstanceDefinitions.Count,
+ index, types, brepCount, extrusionCount, meshCount, subDCount, curveCount, surfaceCount,
+ unsupportedCount, faceCount, loopCount, trimCount, edgeCount, vertexCount, seamCount, singularCount,
+ rationalEdgeCount, rationalNoncircularEdgeCount, rationalArcEdgeCount,
+ rationalEllipticEdgeCount, rationalGenericEdgeCount,
+ rationalSurfaceCount, rationalTrimCount,
+ overall is BoundingBox bounds && factor is double f ? ConvertBounds(bounds, f) : null,
+ objects, diagnostics, parseMilliseconds, timer.Elapsed.TotalMilliseconds - parseMilliseconds);
+ }
+
+ private static ThreeDmBounds ConvertBounds(BoundingBox bounds, double factor) => new(
+ new(bounds.Min.X * factor, bounds.Min.Y * factor, bounds.Min.Z * factor),
+ new(bounds.Max.X * factor, bounds.Max.Y * factor, bounds.Max.Z * factor));
+
+ private static double? MillimetresPerSourceUnit(UnitSystem unit) => unit switch
+ {
+ UnitSystem.Millimeters => 1,
+ UnitSystem.Centimeters => 10,
+ UnitSystem.Meters => 1000,
+ UnitSystem.Microns => 0.001,
+ UnitSystem.Inches => 25.4,
+ UnitSystem.Feet => 304.8,
+ _ => null
+ };
+}
diff --git a/Aetheris.ThreeDm/ThreeDmRecovery.cs b/Aetheris.ThreeDm/ThreeDmRecovery.cs
new file mode 100644
index 00000000..c2d7d6b3
--- /dev/null
+++ b/Aetheris.ThreeDm/ThreeDmRecovery.cs
@@ -0,0 +1,521 @@
+using Aetheris.Kernel.Core.Judgment;
+using Aetheris.Kernel.Core.Geometry.Curves;
+using Rhino.FileIO;
+using Rhino.Geometry;
+using KernelPoint = Aetheris.Kernel.Core.Math.Point3D;
+
+namespace Aetheris.ThreeDm;
+
+public enum RecoveryQualification { WithinSourceTolerance, Approximate, Unresolved }
+
+public sealed record RecoveryResidual(
+ double RmsMillimetres, double P95Millimetres, double MaxMillimetres,
+ double EndpointMaxMillimetres, double? MaxTangentDegrees, int SampleCount);
+
+public sealed record RecoveryCandidate(
+ string Kind, string Method, RecoveryResidual Residual, RecoveryQualification Qualification,
+ IReadOnlyDictionary<string, double> Parameters, string Limitation);
+
+public sealed record RecoveryEdge(
+ int EdgeIndex, bool SourceIsRational, int Degree, int ControlPointCount, int KnotCount,
+ double MinimumWeight, double MaximumWeight, double RelativeWeightSpread,
+ string NativeClassification, IReadOnlyList<RecoveryCandidate> Candidates,
+ string? PreferredCandidate, string Status, string TopologyStatus);
+
+public sealed record RecoveryFace(
+ int FaceIndex, int SurfaceIndex, bool SourceIsRational, int DegreeU, int DegreeV,
+ int ControlPointCountU, int ControlPointCountV, int KnotCountU, int KnotCountV,
+ int LoopCount, int TrimCount, string NativeClassification, RecoveryCandidate? Candidate,
+ string Status, string TopologyStatus);
+
+public sealed record RecoveryBody(
+ int ObjectIndex, Guid SourceId, int LayerIndex, bool SourceIsSolid, bool SourceIsManifold,
+ int FaceCount, int LoopCount, int TrimCount, int EdgeCount, int VertexCount,
+ int NativeAnalyticEdgeCount, int QualifiedRecoveredEdgeCount, int UnresolvedRationalEdgeCount,
+ int QualifiedAnalyticFaceCount, int UnresolvedRationalFaceCount,
+ ThreeDmBounds BoundsMillimetres, IReadOnlyList<RecoveryEdge> Edges, IReadOnlyList<RecoveryFace> Faces);
+
+public sealed record RecoveryDimensionHypothesis(
+ string Kind, double ValueMillimetres, double SpreadMillimetres,
+ IReadOnlyList<string> SourceEntities, string Qualification);
+
+public sealed record ThreeDmRecoveryReport(
+ string SourceUnit, double MillimetresPerSourceUnit, double SourceToleranceMillimetres,
+ string ManufacturingToleranceStatus, IReadOnlyList<RecoveryBody> Bodies,
+ int SourceRationalEdgeCount, int NativeAnalyticRationalEdgeCount, int StudiedRationalEdgeCount,
+ int QualifiedRecoveredRationalEdgeCount, int UnresolvedRationalEdgeCount,
+ int SourceRationalSurfaceCount, int QualifiedAnalyticRationalSurfaceCount,
+ int UnresolvedRationalSurfaceCount,
+ IReadOnlyList<RecoveryDimensionHypothesis> RepeatedDimensions,
+ string ProductionStatus, IReadOnlyList<string> Diagnostics);
+
+/// <summary>
+/// Deterministic, read-only geometry recovery evidence. Candidates are support-geometry
+/// hypotheses; no face/trim topology is changed and no candidate is canonicalized here.
+/// </summary>
+public static class ThreeDmRecovery
+{
+ public static ThreeDmRecoveryReport Analyze(string path)
+ {
+ ArgumentException.ThrowIfNullOrWhiteSpace(path);
+ using var file = File3dm.Read(Path.GetFullPath(path)) ?? throw new InvalidDataException("OpenNURBS could not read the 3DM file.");
+ var unit = file.Settings.ModelUnitSystem.ToString();
+ var factor = unit switch
+ {
+ "Millimeters" => 1d, "Centimeters" => 10d, "Meters" => 1000d,
+ "Microns" => 0.001d, "Inches" => 25.4d, "Feet" => 304.8d,
+ _ => throw new NotSupportedException($"UnitConversionIssue: unsupported 3DM model unit {unit}.")
+ };
+ var tolerance = file.Settings.ModelAbsoluteTolerance * factor;
+ var angleToleranceDegrees = file.Settings.ModelAngleToleranceDegrees;
+ if (!double.IsFinite(tolerance) || tolerance <= 0)
+ throw new InvalidDataException("UnitConversionIssue: source tolerance is not positive and finite.");
+
+ var bodies = new List<RecoveryBody>();
+ var diagnostics = new List<string>();
+ var objectIndex = 0;
+ foreach (var item in file.Objects)
+ {
+ if (item.Geometry is not Brep brep)
+ {
+ diagnostics.Add($"Unsupported3dmObjectType: object {objectIndex} is {item.Geometry.GetType().Name}; recovery is BRep-only.");
+ objectIndex++;
+ continue;
+ }
+ var edges = new List<RecoveryEdge>(brep.Edges.Count);
+ foreach (var edge in brep.Edges)
+ edges.Add(RecoverEdge(edge, factor, tolerance, angleToleranceDegrees));
+ var faces = new List<RecoveryFace>(brep.Faces.Count);
+ foreach (var face in brep.Faces)
+ faces.Add(RecoverFace(face, brep.Surfaces[face.SurfaceIndex], factor, tolerance, angleToleranceDegrees));
+ var box = ThreeDmBoundsSampler.Sample(brep);
+ bodies.Add(new RecoveryBody(objectIndex, item.Attributes.ObjectId, item.Attributes.LayerIndex,
+ brep.IsSolid, brep.IsManifold, brep.Faces.Count, brep.Loops.Count, brep.Trims.Count,
+ brep.Edges.Count, brep.Vertices.Count,
+ edges.Count(e => e.SourceIsRational && e.NativeClassification != "Unclassified"),
+ edges.Count(e => e.Status == "Qualified support candidate; topology pending"),
+ edges.Count(e => e.SourceIsRational && e.Status == "Unresolved"),
+ faces.Count(f => f.SourceIsRational && f.Status == "Qualified support candidate; topology pending"),
+ faces.Count(f => f.SourceIsRational && f.Status == "Unresolved"),
+ new ThreeDmBounds(
+ new(box.Min.X * factor, box.Min.Y * factor, box.Min.Z * factor),
+ new(box.Max.X * factor, box.Max.Y * factor, box.Max.Z * factor)),
+ edges, faces));
+ objectIndex++;
+ }
+ var allEdges = bodies.SelectMany(b => b.Edges).ToArray();
+ var allFaces = bodies.SelectMany(b => b.Faces).ToArray();
+ return new ThreeDmRecoveryReport(unit, factor, tolerance,
+ "No manufacturing tolerance was supplied; source tolerance is geometric evidence only.",
+ bodies, allEdges.Count(e => e.SourceIsRational),
+ allEdges.Count(e => e.SourceIsRational && e.NativeClassification != "Unclassified"),
+ allEdges.Count(e => e.SourceIsRational && e.NativeClassification == "Unclassified"),
+ allEdges.Count(e => e.SourceIsRational && e.NativeClassification == "Unclassified" && e.Status == "Qualified support candidate; topology pending"),
+ allEdges.Count(e => e.SourceIsRational && e.Status == "Unresolved"),
+ allFaces.Count(f => f.SourceIsRational),
+ allFaces.Count(f => f.SourceIsRational && f.Status == "Qualified support candidate; topology pending"),
+ allFaces.Count(f => f.SourceIsRational && f.Status == "Unresolved"),
+ RepeatedDimensions(bodies, tolerance),
+ "No canonical BRep or production STEP is emitted. All candidates require trim/topology qualification.", diagnostics);
+ }
+
+ private static RecoveryEdge RecoverEdge(BrepEdge edge, double factor, double toleranceMm, double angleToleranceDegrees)
+ {
+ var source = edge.EdgeCurve;
+ var nurbs = source.ToNurbsCurve();
+ var weights = Enumerable.Range(0, nurbs.Points.Count).Select(i => nurbs.Points[i].Weight).ToArray();
+ var minimumWeight = weights.Min(); var maximumWeight = weights.Max();
+ var relativeWeightSpread = (maximumWeight - minimumWeight) / double.Abs(weights.Average());
+ var native = source.IsLinear() ? "Line"
+ : source.TryGetCircle(out _) ? "Circle"
+ : source.TryGetArc(out _) ? "Arc"
+ : source.TryGetEllipse(out _) ? "Ellipse"
+ : "Unclassified";
+ if (!nurbs.IsRational || native != "Unclassified")
+ {
+ var nativeCandidate = nurbs.IsRational
+ ? MeasureNativeEdge(edge, native, factor, toleranceMm, angleToleranceDegrees)
+ : null;
+ return new RecoveryEdge(edge.EdgeIndex, nurbs.IsRational, nurbs.Degree, nurbs.Points.Count,
+ nurbs.Knots.Count, minimumWeight, maximumWeight, relativeWeightSpread, native,
+ nativeCandidate is null ? [] : [nativeCandidate],
+ nativeCandidate?.Qualification == RecoveryQualification.WithinSourceTolerance ? nativeCandidate.Kind : null,
+ native == "Unclassified" ? "Non-rational source; outside rational edge study"
+ : nativeCandidate?.Qualification == RecoveryQualification.WithinSourceTolerance
+ ? "Qualified support candidate; topology pending" : "Native recognition requires further measurement",
+ "Original edge and trims retained as source evidence; no canonical edge built.");
+ }
+
+ var samples = SampleEdge(edge, int.Clamp(16 * nurbs.Degree + 1, 65, 257));
+ var candidates = new List<RecoveryCandidate>();
+ var p0 = samples[0]; var pm = samples[samples.Count / 2]; var p1 = samples[^1];
+ if (p0.DistanceTo(p1) > 1e-12)
+ {
+ var direction = p1 - p0;
+ direction.Unitize();
+ var distances = samples.Select(p => ((p - p0) - direction * ((p - p0) * direction)).Length * factor).ToArray();
+ var residual = Residual(distances, samples, edge, p => direction, factor);
+ candidates.Add(new RecoveryCandidate("Line", "endpoint line fit; full edge sampled", residual,
+ Qualify(residual, toleranceMm, angleToleranceDegrees), new Dictionary<string, double> { ["lengthMillimetres"] = p0.DistanceTo(p1) * factor },
+ "Infinite support only; trim orientation and adjacent faces unqualified."));
+ }
+ try
+ {
+ var circle = new Circle(p0, pm, p1);
+ if (circle.IsValid && circle.Radius > 1e-12)
+ {
+ var normal = circle.Normal;
+ var distances = samples.Select(p =>
+ {
+ var offset = p - circle.Center;
+ var axial = offset * normal;
+ var radial = (offset - axial * normal).Length;
+ return double.Sqrt(double.Pow(radial - circle.Radius, 2) + axial * axial) * factor;
+ }).ToArray();
+ var residual = Residual(distances, samples, edge, p =>
+ {
+ var radial = p - circle.Center;
+ radial -= (radial * normal) * normal;
+ var tangent = Vector3d.CrossProduct(normal, radial);
+ tangent.Unitize();
+ return tangent;
+ }, factor);
+ candidates.Add(new RecoveryCandidate("CircleSupport", "three-point circle fit; full edge sampled", residual,
+ Qualify(residual, toleranceMm, angleToleranceDegrees), new Dictionary<string, double> { ["radiusMillimetres"] = circle.Radius * factor },
+ "Circle support only; arc sweep, trim orientation and adjacent faces unqualified."));
+ }
+ }
+ catch (ArgumentException) { /* Degenerate three-point circle has no candidate. */ }
+
+ var polynomial = TrySameNetPolynomial(edge, nurbs, samples, factor, toleranceMm, angleToleranceDegrees);
+ if (polynomial is not null) candidates.Add(polynomial);
+
+ var admissible = candidates.Where(c => c.Qualification == RecoveryQualification.WithinSourceTolerance).ToArray();
+ string? preferred = null;
+ if (admissible.Length > 0)
+ {
+ var engine = new JudgmentEngine<IReadOnlyList<RecoveryCandidate>>();
+ var selection = engine.Evaluate(admissible,
+ admissible.Select((candidate, index) => new JudgmentCandidate<IReadOnlyList<RecoveryCandidate>>(
+ candidate.Kind, _ => true,
+ _ => (candidate.Kind switch { "Line" => 3d, "CircleSupport" => 2d, _ => 1d })
+ - candidate.Residual.MaxMillimetres / toleranceMm,
+ TieBreakerPriority: index)).ToArray());
+ preferred = selection.Selection?.Candidate.Name;
+ }
+ return new RecoveryEdge(edge.EdgeIndex, true, nurbs.Degree, nurbs.Points.Count, nurbs.Knots.Count,
+ minimumWeight, maximumWeight, relativeWeightSpread, "Unclassified", candidates, preferred,
+ preferred is null ? "Unresolved" : "Qualified support candidate; topology pending",
+ "Original edge and trims retained as source evidence; no canonical edge built.");
+ }
+
+ private static RecoveryFace RecoverFace(BrepFace face, Surface surface, double factor, double toleranceMm, double angleToleranceDegrees)
+ {
+ var nurbs = surface.ToNurbsSurface();
+ var kind = "Unclassified";
+ Func<Point3d, (double Distance, Vector3d Normal)>? evaluate = null;
+ IReadOnlyDictionary<string, double> parameters = new Dictionary<string, double>();
+ if (surface.TryGetPlane(out var plane))
+ {
+ kind = "Plane";
+ evaluate = p => (double.Abs((p - plane.Origin) * plane.Normal), plane.Normal);
+ }
+ else if (surface.TryGetCylinder(out var cylinder))
+ {
+ kind = "Cylinder";
+ parameters = new Dictionary<string, double> { ["radiusMillimetres"] = cylinder.Radius * factor };
+ evaluate = p =>
+ {
+ var offset = p - cylinder.Center;
+ var axial = offset * cylinder.Axis;
+ var radial = offset - axial * cylinder.Axis;
+ var normal = radial; normal.Unitize();
+ return (double.Abs(radial.Length - cylinder.Radius), normal);
+ };
+ }
+ else if (surface.TryGetCone(out var cone) && double.Abs(cone.Height) > 1e-12)
+ {
+ kind = "Cone";
+ parameters = new Dictionary<string, double> { ["baseRadiusMillimetres"] = cone.Radius * factor };
+ evaluate = p =>
+ {
+ var offset = p - cone.ApexPoint;
+ var axial = offset * cone.Axis;
+ var radial = offset - axial * cone.Axis;
+ var normal = radial; normal.Unitize();
+ return (double.Abs(radial.Length - double.Abs(axial * cone.Radius / cone.Height)), normal);
+ };
+ }
+ else if (surface.TryGetSphere(out var sphere))
+ {
+ kind = "Sphere";
+ parameters = new Dictionary<string, double> { ["radiusMillimetres"] = sphere.Radius * factor };
+ evaluate = p =>
+ {
+ var radial = p - sphere.Center;
+ var normal = radial; normal.Unitize();
+ return (double.Abs(radial.Length - sphere.Radius), normal);
+ };
+ }
+ else if (surface.TryGetTorus(out var torus))
+ {
+ kind = "Torus";
+ parameters = new Dictionary<string, double>
+ {
+ ["majorRadiusMillimetres"] = torus.MajorRadius * factor,
+ ["minorRadiusMillimetres"] = torus.MinorRadius * factor
+ };
+ evaluate = p =>
+ {
+ var offset = p - torus.Plane.Origin;
+ var axial = offset * torus.Plane.Normal;
+ var radial = offset - axial * torus.Plane.Normal;
+ var r = radial.Length;
+ var tube = double.Sqrt(double.Pow(r - torus.MajorRadius, 2) + axial * axial);
+ var normal = r > 1e-12 ? radial * ((r - torus.MajorRadius) / r) + torus.Plane.Normal * axial : Vector3d.Zero;
+ normal.Unitize();
+ return (double.Abs(tube - torus.MinorRadius), normal);
+ };
+ }
+
+ RecoveryCandidate? candidate = null;
+ if (evaluate is not null)
+ {
+ const int countPerAxis = 17;
+ var domainU = surface.Domain(0); var domainV = surface.Domain(1);
+ var distances = new List<double>(countPerAxis * countPerAxis);
+ var normalAngles = new List<double>();
+ for (var i = 0; i < countPerAxis; i++)
+ for (var j = 0; j < countPerAxis; j++)
+ {
+ var u = domainU.T0 + (domainU.T1 - domainU.T0) * i / (countPerAxis - 1d);
+ var v = domainV.T0 + (domainV.T1 - domainV.T0) * j / (countPerAxis - 1d);
+ var point = surface.PointAt(u, v);
+ var result = evaluate(point);
+ distances.Add(result.Distance * factor);
+ var sourceNormal = surface.NormalAt(u, v);
+ if (sourceNormal.IsValid && result.Normal.IsValid && sourceNormal.Length > 1e-12 && result.Normal.Length > 1e-12)
+ normalAngles.Add(double.Acos(double.Clamp(double.Abs(sourceNormal * result.Normal / (sourceNormal.Length * result.Normal.Length)), 0, 1)) * 180 / double.Pi);
+ }
+ var measured = Distances(distances);
+ candidate = new RecoveryCandidate(kind, "Rhino analytic probe plus independent 17x17 support-domain residual",
+ new RecoveryResidual(measured.Rms, measured.P95, measured.Max, 0,
+ normalAngles.Count == 0 ? null : normalAngles.Max(), distances.Count),
+ measured.Max <= toleranceMm &&
+ (normalAngles.Count == 0 || normalAngles.Max() <= angleToleranceDegrees)
+ ? RecoveryQualification.WithinSourceTolerance : RecoveryQualification.Approximate,
+ parameters, "Full support domain sampled; trims, loops and orientation are not qualified.");
+ }
+ var qualified = candidate?.Qualification == RecoveryQualification.WithinSourceTolerance;
+ return new RecoveryFace(face.FaceIndex, face.SurfaceIndex, nurbs.IsRational,
+ nurbs.OrderU - 1, nurbs.OrderV - 1, nurbs.Points.CountU, nurbs.Points.CountV,
+ nurbs.KnotsU.Count, nurbs.KnotsV.Count, face.Loops.Count,
+ face.Loops.Sum(loop => loop.Trims.Count), kind, candidate,
+ qualified ? "Qualified support candidate; topology pending" : "Unresolved",
+ "Source loops/trims are inventory only; no canonical face or pcurve built.");
+ }
+
+ private static IReadOnlyList<Point3d> SampleEdge(BrepEdge edge, int count)
+ {
+ var domain = edge.Domain;
+ return Enumerable.Range(0, count)
+ .Select(i => edge.PointAt(domain.T0 + (domain.T1 - domain.T0) * i / (count - 1d))).ToArray();
+ }
+
+ private static RecoveryQualification Qualify(RecoveryResidual residual, double toleranceMm, double angleToleranceDegrees) =>
+ residual.MaxMillimetres <= toleranceMm &&
+ (residual.MaxTangentDegrees is null || residual.MaxTangentDegrees <= angleToleranceDegrees)
+ ? RecoveryQualification.WithinSourceTolerance : RecoveryQualification.Approximate;
+
+ private static RecoveryCandidate? TrySameNetPolynomial(
+ BrepEdge edge, NurbsCurve nurbs, IReadOnlyList<Point3d> samples,
+ double factor, double toleranceMm, double angleToleranceDegrees)
+ {
+ // OpenNURBS omits one end knot at each end relative to the full vector
+ // carried by Aetheris/STEP. This is a candidate calculation, never a
+ // rewrite of the source curve or its edge uses.
+ try
+ {
+ var controls = Enumerable.Range(0, nurbs.Points.Count)
+ .Select(i => nurbs.Points[i].Location)
+ .Select(p => new KernelPoint(p.X * factor, p.Y * factor, p.Z * factor)).ToArray();
+ var knots = new double[nurbs.Knots.Count + 2];
+ knots[0] = nurbs.Knots[0];
+ for (var i = 0; i < nurbs.Knots.Count; i++) knots[i + 1] = nurbs.Knots[i];
+ knots[^1] = nurbs.Knots[^1];
+ var values = new List<double>(); var multiplicities = new List<int>();
+ foreach (var knot in knots)
+ {
+ if (values.Count > 0 && knot == values[^1]) multiplicities[^1]++;
+ else { values.Add(knot); multiplicities.Add(1); }
+ }
+ var curve = new BSpline3Curve(nurbs.Degree, controls, multiplicities, values,
+ "UNSPECIFIED", nurbs.IsClosed, false, "UNSPECIFIED");
+ var domain = edge.Domain;
+ if (domain.T0 < curve.DomainStart - 1e-10 || domain.T1 > curve.DomainEnd + 1e-10)
+ return null;
+ var distances = new double[samples.Count];
+ for (var i = 0; i < samples.Count; i++)
+ {
+ var parameter = domain.T0 + (domain.T1 - domain.T0) * i / (samples.Count - 1d);
+ var point = curve.Evaluate(parameter);
+ distances[i] = double.Sqrt(double.Pow(point.X - samples[i].X * factor, 2) +
+ double.Pow(point.Y - samples[i].Y * factor, 2) +
+ double.Pow(point.Z - samples[i].Z * factor, 2));
+ }
+ var measured = Distances(distances);
+ var maxTangent = 0d;
+ for (var i = 0; i < samples.Count; i++)
+ {
+ var parameter = domain.T0 + (domain.T1 - domain.T0) * i / (samples.Count - 1d);
+ var sourceTangent = edge.TangentAt(parameter);
+ var target = curve.EvaluateTangent(parameter);
+ var targetLength = double.Sqrt(target.X * target.X + target.Y * target.Y + target.Z * target.Z);
+ if (!sourceTangent.IsValid || sourceTangent.Length < 1e-12 || targetLength < 1e-12) continue;
+ var cosine = double.Clamp(double.Abs((sourceTangent.X * target.X + sourceTangent.Y * target.Y + sourceTangent.Z * target.Z) /
+ (sourceTangent.Length * targetLength)), 0, 1);
+ maxTangent = double.Max(maxTangent, double.Acos(cosine) * 180 / double.Pi);
+ }
+ var residual = new RecoveryResidual(measured.Rms, measured.P95, measured.Max,
+ double.Max(distances[0], distances[^1]), maxTangent, distances.Length);
+ return new RecoveryCandidate("NonRationalSameNet", "source controls and knots; weights set to one; full edge sampled",
+ residual, Qualify(residual, toleranceMm, angleToleranceDegrees),
+ new Dictionary<string, double> { ["degree"] = nurbs.Degree, ["controlPointCount"] = controls.Length },
+ "Candidate only. Trims, face support, and topology are unqualified; no curve is promoted to canonical geometry.");
+ }
+ catch (ArgumentException) { return null; }
+ }
+
+ private static RecoveryCandidate? MeasureNativeEdge(
+ BrepEdge edge, string native, double factor, double toleranceMm, double angleToleranceDegrees)
+ {
+ var samples = SampleEdge(edge, 129);
+ Circle circle;
+ var hasCircularSupport = edge.EdgeCurve.TryGetCircle(out circle);
+ if (!hasCircularSupport && native == "Arc" && edge.EdgeCurve.TryGetArc(out var arc))
+ {
+ circle = new Circle(arc.Plane, arc.Radius);
+ hasCircularSupport = true;
+ }
+ if (native is "Circle" or "Arc" && hasCircularSupport)
+ {
+ var normal = circle.Normal;
+ var distances = samples.Select(p =>
+ {
+ var offset = p - circle.Center;
+ var axial = offset * normal;
+ var radial = (offset - axial * normal).Length;
+ return double.Sqrt(double.Pow(radial - circle.Radius, 2) + axial * axial) * factor;
+ }).ToArray();
+ var residual = Residual(distances, samples, edge, p =>
+ {
+ var radial = p - circle.Center;
+ radial -= (radial * normal) * normal;
+ var tangent = Vector3d.CrossProduct(normal, radial);
+ tangent.Unitize();
+ return tangent;
+ }, factor);
+ return new RecoveryCandidate(native, "Rhino analytic probe plus independent support residual", residual,
+ Qualify(residual, toleranceMm, angleToleranceDegrees),
+ new Dictionary<string, double> { ["radiusMillimetres"] = circle.Radius * factor },
+ "Analytic support only; arc sweep, trims and topology remain unqualified.");
+ }
+ if (native == "Ellipse" && edge.EdgeCurve.TryGetEllipse(out var ellipse))
+ {
+ var plane = ellipse.Plane;
+ var distances = samples.Select(p =>
+ {
+ var offset = p - ellipse.Center;
+ var x = offset * plane.XAxis;
+ var y = offset * plane.YAxis;
+ var z = offset * plane.Normal;
+ var rho = double.Sqrt(double.Pow(x / ellipse.Radius1, 2) + double.Pow(y / ellipse.Radius2, 2));
+ if (rho < 1e-12) return double.PositiveInfinity;
+ // Radial projection is a point on the ellipse. Its distance is
+ // a conservative upper bound on nearest-point deviation.
+ return double.Sqrt(double.Pow(x - x / rho, 2) + double.Pow(y - y / rho, 2) + z * z) * factor;
+ }).ToArray();
+ var residual = Residual(distances, samples, edge, p =>
+ {
+ var offset = p - ellipse.Center;
+ var theta = double.Atan2((offset * plane.YAxis) / ellipse.Radius2,
+ (offset * plane.XAxis) / ellipse.Radius1);
+ var tangent = -ellipse.Radius1 * double.Sin(theta) * plane.XAxis +
+ ellipse.Radius2 * double.Cos(theta) * plane.YAxis;
+ tangent.Unitize();
+ return tangent;
+ }, factor);
+ return new RecoveryCandidate("Ellipse", "Rhino analytic probe plus radial-distance upper bound", residual,
+ Qualify(residual, toleranceMm, angleToleranceDegrees),
+ new Dictionary<string, double>
+ {
+ ["radius1Millimetres"] = ellipse.Radius1 * factor,
+ ["radius2Millimetres"] = ellipse.Radius2 * factor
+ },
+ "Radial-distance residual is an upper bound; arc sweep, trims and topology remain unqualified.");
+ }
+ return null;
+ }
+
+ private static RecoveryResidual Residual(IReadOnlyList<double> distances, IReadOnlyList<Point3d> points,
+ BrepEdge source, Func<Point3d, Vector3d> candidateTangent, double factor)
+ {
+ var measured = Distances(distances);
+ var domain = source.Domain;
+ var maxAngle = 0d;
+ for (var i = 0; i < points.Count; i++)
+ {
+ var parameter = domain.T0 + (domain.T1 - domain.T0) * i / (points.Count - 1d);
+ var tangent = source.TangentAt(parameter);
+ var target = candidateTangent(points[i]);
+ if (!tangent.IsValid || !target.IsValid || tangent.Length < 1e-12 || target.Length < 1e-12) continue;
+ var cosine = double.Clamp(double.Abs(tangent * target / (tangent.Length * target.Length)), 0, 1);
+ maxAngle = double.Max(maxAngle, double.Acos(cosine) * 180 / double.Pi);
+ }
+ _ = factor;
+ return new RecoveryResidual(measured.Rms, measured.P95, measured.Max,
+ double.Max(distances[0], distances[^1]), maxAngle, distances.Count);
+ }
+
+ private static (double Rms, double P95, double Max) Distances(IReadOnlyList<double> distances)
+ {
+ var ordered = distances.OrderBy(x => x).ToArray();
+ return (double.Sqrt(distances.Sum(x => x * x) / distances.Count),
+ ordered[(int)double.Ceiling(0.95 * ordered.Length) - 1], ordered[^1]);
+ }
+
+ private static IReadOnlyList<RecoveryDimensionHypothesis> RepeatedDimensions(
+ IReadOnlyList<RecoveryBody> bodies, double toleranceMm)
+ {
+ var observations = new List<(double Radius, string Source)>();
+ foreach (var body in bodies)
+ {
+ foreach (var face in body.Faces)
+ if (face.Candidate?.Qualification == RecoveryQualification.WithinSourceTolerance &&
+ face.Candidate.Parameters.TryGetValue("radiusMillimetres", out var radius))
+ observations.Add((radius, $"object:{body.ObjectIndex}/face:{face.FaceIndex}"));
+ foreach (var edge in body.Edges)
+ {
+ var preferred = edge.Candidates.FirstOrDefault(c => c.Kind == edge.PreferredCandidate);
+ if (preferred is not null && preferred.Parameters.TryGetValue("radiusMillimetres", out var radius))
+ observations.Add((radius, $"object:{body.ObjectIndex}/edge:{edge.EdgeIndex}"));
+ }
+ }
+ var ordered = observations.OrderBy(o => o.Radius).ThenBy(o => o.Source, StringComparer.Ordinal).ToArray();
+ var families = new List<RecoveryDimensionHypothesis>();
+ for (var i = 0; i < ordered.Length;)
+ {
+ var end = i + 1;
+ while (end < ordered.Length && ordered[end].Radius - ordered[i].Radius <= toleranceMm) end++;
+ if (end - i > 1)
+ {
+ var group = ordered[i..end];
+ families.Add(new RecoveryDimensionHypothesis("RepeatedRadius", group.Average(o => o.Radius),
+ group[^1].Radius - group[0].Radius, group.Select(o => o.Source).ToArray(),
+ "Geometric dimension hypothesis only; not an authored constraint."));
+ }
+ i = end;
+ }
+ return families;
+ }
+}
diff --git a/Aetheris.slnx b/Aetheris.slnx
index 64eb4a62..3d9b4bb3 100644
--- a/Aetheris.slnx
+++ b/Aetheris.slnx
@@ -79,6 +79,7 @@
<Project Path="Aetheris.Kernel.Core.Tests/Aetheris.Kernel.Core.Tests.csproj" />
<Project Path="test-support/Aetheris.TestForgePack/Aetheris.TestForgePack.csproj" />
<Project Path="test-support/Aetheris.TestForgePack.Duplicate/Aetheris.TestForgePack.Duplicate.csproj" />
+ <Project Path="Aetheris.ThreeDm/Aetheris.ThreeDm.csproj" />
<Project Path="Aetheris.Web.Runtime/Aetheris.Web.Runtime.csproj" />
<Project Path="demos/Aetheris.PmiInjectionDemo/Aetheris.PmiInjectionDemo.csproj" />
</Solution>
diff --git a/docs/development/audits/test-iteration-speed-x0.md b/docs/development/audits/test-iteration-speed-x0.md
new file mode 100644
index 00000000..05e1dd50
--- /dev/null
+++ b/docs/development/audits/test-iteration-speed-x0.md
@@ -0,0 +1,9 @@
+# Kernel test iteration speed, 2026-09-22
+
+Run `scripts/Test-KernelIteration.ps1` for Core, Firmament, and Modules tests during geometry/language iteration. It excludes `Category=SlowCorpus` whole-model corpus qualification; `scripts/Test-KernelIteration.ps1 -IncludeSlowCorpus` includes those cases. A full solution qualification remains `dotnet test Aetheris.slnx --no-build --no-restore -m:1` after a solution build. The script fails on the first failing project and does not write tracked output.
+
+The measured preclassification Core run (`Category!=SlowCorpus` with only the older category labels) passed 1,032 tests in 4m57s. Its TRX profile, retained in ignored `artifacts/local/test-profiles/core-iteration-profile.trx`, showed 20–58-second NIST import/export cases repeated across regression classes. After tagging the measured whole-file cases, the same Core filter passed 958 tests in 51 seconds. Small STEP unit tests remain in that filter. The full Firmament project passed 1,576 tests in 2m08s when run alone; after moving measured whole-model coil, gear, knot, and wire-form cases to `SlowCorpus`, its iteration filter passed 1,563 tests in 47 seconds. The test profile is `artifacts/local/test-profiles/firmament-profile.trx`.
+
+Two wall-clock ratio tests in `RecognizedConstructionRecipeTests` rebuilt identical through-holes 380 times and could fail on scheduling alone; nearby tests already compare direct, legacy, and facade topology and STEP artifacts. The V8 annular-profile failure came from assigning the synthetic segment name `Boundary` to both traced circles; full-circle guides now inherit their authored names, while real cross-loop name collisions still fail. An assembly display exporter preflight repeated pcurve work with a builder that did not support mixed cylinder/B-spline bodies; the actual tessellator and its face-count checks remain authoritative. Display fallback tests now pass an explicit 30-second *test* budget instead of relying on the 5-second production default under parallel test load.
+
+The actual iteration script passed 958 Core, 1,563 Firmament, and 103 Modules tests in 119 seconds including project checks. Focused validation also passed: 7 display fallback tests, 3 FTC07 view tests, 38 profile-pipeline tests, the V8 physical engine test, the plateau mesh test, and the updated module B-spline contract test. `dotnet build Aetheris.slnx --no-restore -m:1` passed with seven pre-existing WebAssembly warnings; a subsequent serial full-solution test run passed 3,836 tests in 20 test projects with zero failures (Core 1,099/1,099 in 8m39s and Firmament 1,578/1,578 in 1m37s). Its ignored log is `artifacts/local/test-profiles/full-serial.log`. The faster filter is an iteration gate, not a substitute for full corpus qualification.
diff --git a/docs/public/firmament/assemblies.md b/docs/public/firmament/assemblies.md
index a22d781c..70ef5512 100644
--- a/docs/public/firmament/assemblies.md
+++ b/docs/public/firmament/assemblies.md
@@ -81,4 +81,6 @@ The hierarchical Gear flagship is [`fixtures/Canonical/AssemblyInterfaces/expose
Subassembly composition never exports a child STEP and imports it into its parent. Included definitions form one semantic source graph, the existing Assembly compiler solves the whole tree, and the existing AP242 exporter lowers the resulting hierarchy once when every leaf has executable geometry.
+A capped, closed `SectionChain` or bounded `Loft<Hollow>` can serve as a ruled assembly part from a separate authored `.firmament` file. Write `<Part Shade = LoftFile<"lamp-shade-loft.firmament">>` (or `SectionChainFile` for a directly authored chain); the path is relative to the assembly source. Both use the SectionChain materializer, and assembly imports its AP242 body into the ordinary product tree. Open shells are rejected as part definitions. The [Cartesian lamp fixture](../../../fixtures/Canonical/ThreeDm/lamp-visible-intent.firmament) exercises this path with a tilted ruled shade.
+
Legacy JSON `.firmasm` remains a compatibility/import lane. Canonical reusable semantic authoring uses `.firmament`; the compatibility format does not gain runtime inclusion or become the design authority.
diff --git a/docs/public/firmament/cubic-bezier-profiles.md b/docs/public/firmament/cubic-bezier-profiles.md
new file mode 100644
index 00000000..58b990ed
--- /dev/null
+++ b/docs/public/firmament/cubic-bezier-profiles.md
@@ -0,0 +1,15 @@
+# Direct cubic profile guides
+
+`CubicBezier2` supplies one bounded, non-rational polynomial span to an ordinary `Profile`. Four named `Point2` guides define its start, two controls, and end:
+
+```firmament
+Point2 Start { Position: [0mm,0mm] }
+Point2 StartHandle { Position: [0mm,10mm] }
+Point2 EndHandle { Position: [20mm,20mm] }
+Point2 End { Position: [30mm,20mm] }
+CubicBezier2 Flank { From: Start; Control1: StartHandle; Control2: EndHandle; To: End }
+```
+
+Inside a `Profile`, consume the complete span with `Segment FlankEdge { Trace: Flank; From: Start; To: End }`. Its endpoints must be the authored endpoints; no subspan, automatic fit, or rational weights are accepted. Other named spans must close the profile. Ordinary Profile validation checks winding, closure, and self-intersection before extrusion.
+
+The [lamp base intent fixture](../../../fixtures/Canonical/ThreeDm/lamp-base-intent.firmament) uses two mirrored cubic flanks and a circular end. The source 3DM is measurement evidence; the polynomial controls in that fixture are intentionally new design parameters.
diff --git a/docs/public/firmament/loft.md b/docs/public/firmament/loft.md
new file mode 100644
index 00000000..437ea0f6
--- /dev/null
+++ b/docs/public/firmament/loft.md
@@ -0,0 +1,42 @@
+# Two-section loft
+
+`Loft` makes a capped solid between two named 2D outlines on independently framed construction planes. `Loft<Hollow>` derives inner outlines from a positive nominal thickness to make a thin-wall solid. The admitted outlines are a `Circle2` or `Ellipse2` used as the sole outer loop of a named `Profile`. Both forms lower to the existing G0 `SectionChain` ruled materializer, pcurve validator, BRep, and AP242 exporter; there is no second loft kernel.
+
+```firmament
+schema SectionChain
+Model TwistedShell {
+ Units: mm
+ Concept Struct Stations {
+ Lower: Plane { Origin: [0mm, 0mm, 0mm]; Normal: [0, 0, 1]; Up: [0, 1, 0] }
+ Upper: Plane { Origin: [0mm, 0mm, 50mm]; Normal: [0, 0, 1]; Up: [0, 1, 0] }
+ }
+ Construction Plane LowerFrame { Trace: Stations.Lower }
+ Construction Plane UpperFrame { Trace: Stations.Upper }
+ Circle2 LowerCircle { Center: [0mm, 0mm] Radius: 25mm }
+ Circle2 UpperCircle { Center: [0mm, 0mm] Radius: 25mm }
+ Profile LowerOutline { Loop Outer { LowerCircle |> TraceLoop } }
+ Profile UpperOutline { Loop Outer { UpperCircle |> TraceLoop } }
+
+ Loft<Hollow> Shell {
+ RearProfile: LowerOutline
+ RearFrame: LowerFrame
+ FrontProfile: UpperOutline
+ FrontFrame: UpperFrame
+ Thickness: 1mm
+ Rule: Ruled
+ Correspondence: CommonRay
+ Reference: [1, 0, 0]
+ Twist: 63deg
+ }
+}
+```
+
+For a filled solid, replace `Loft<Hollow> Shell` with `Loft Shell` and omit `Thickness` and `SeamGap`. The [solid witness](../../../fixtures/Canonical/SectionChain/solid-loft-common-ray.firmament) lofts a circle to a rotated ellipse and exports six closed faces.
+
+`Rule: Ruled` makes each generator a straight segment between the sections. `Correspondence: CommonRay` pairs outline points by polar ray from each outline's center, projected from the world-space `Reference` direction into each section plane. This makes the pairing independent of how an ellipse's axes happen to be rotated or where its native parameter starts. `Twist` rotates the **front correspondence** relative to that reference; it does not rotate or move the front outline. It is available in both forms, defaults to `0deg`, and admits `-180deg..180deg`. Equal coaxial circular sections with `Twist: 63deg` form a ruled hyperboloid-like shell: for two radius-25 mm circles, the mid-height generator radius is `25 cos(31.5°) ≈ 21.316 mm`.
+
+The materializer currently admits one outer loop per section, so the generated wall uses a narrow topological seam. `SeamGap` defaults to `0.1deg` and accepts `0.01deg..5deg`. The slit is explicit; it is not silently sewn shut. The major/minor axes are each reduced by `Thickness` at the inner ellipse, so thickness is nominal around an ellipse rather than an exact normal offset.
+
+The [lamp shade](../../../fixtures/Canonical/ThreeDm/lamp-shade-loft.firmament) is the `Twist: 0deg` circle-to-tilted-ellipse case. The [63° witness](../../../fixtures/Canonical/SectionChain/hollow-loft-twist.firmament) exercises the optional twist. Both use `aetheris build <file> --out artifacts/local/<name>.step --json`; `aetheris section-chain build` also reports the underlying correspondence, pcurves, topology, and STEP reimport. A loft source may be an assembly part via `LoftFile<"relative-source.firmament">`.
+
+These are bounded two-section lofts. Arbitrary profile topology, open loft sheets, rails, multi-section global fairing, exact normal ellipse offset, and arbitrary twist laws remain unsupported.
diff --git a/docs/public/firmament/section-chains.md b/docs/public/firmament/section-chains.md
index f8222f06..767aa68b 100644
--- a/docs/public/firmament/section-chains.md
+++ b/docs/public/firmament/section-chains.md
@@ -2,6 +2,8 @@
A SectionChain builds a surface or closed body from an ordered sequence of framed profiles. G1 is the normal freeform authoring default; explicit G0/Ruled remains available when straight generators are intentional.
+For two framed circle or ellipse profiles, [`Loft` and `Loft<Hollow>`](loft.md) provide concise ruled authoring with explicit point correspondence and optional twist. They lower into the same SectionChain path.
+
```text
Section0 -> Section1 -> Section2 -> Section3
```
@@ -28,7 +30,7 @@ A Sweep transports one profile through a trajectory. A SectionChain allows the p
## Firmament authoring
-SectionChain authoring reuses ordinary `Concept Path` and `Profile` declarations. A `Section` associates that reusable 2D profile with a named right-handed `Construction Plane`; it does not expose vertices, faces, or raw BRep surfaces.
+SectionChain authoring reuses ordinary `Concept Path` and `Profile` declarations, including `Profile ... Using` an explicit `Concept Struct ... On XY` sketch. A `Section` associates that reusable 2D profile with a named right-handed `Construction Plane`; it does not expose vertices, faces, or raw BRep surfaces. The [explicit sketch fixture](../../../fixtures/Canonical/SectionChain/explicit-sketch-ruled.firmament) shows two differently sized sections on tilted frames.
```firmament
Concept Path NoseOutline {
diff --git a/docs/public/firmament/syntax.md b/docs/public/firmament/syntax.md
index 6d14e3be..74fcb4e1 100644
--- a/docs/public/firmament/syntax.md
+++ b/docs/public/firmament/syntax.md
@@ -281,7 +281,7 @@ Profile SideProfile Using PositiveXWorkplane {
}
```
-Segment names are Profile-wide identities. Manual `Segment` and pipeline stages both preserve their authored or inherited leaf names; loops do not silently qualify them. If two loops would introduce the same name, binding reports `firmament-profile-segment-identity-collision`. Resolve the collision explicitly with `As` on the pipeline stages (for example, `Cutout.Bottom As CutoutBottom`) or by renaming a manual Segment.
+Segment names are Profile-wide identities. Manual `Segment` and pipeline stages both preserve their authored or inherited leaf names; loops do not silently qualify them. A traced full `Circle2` or `Ellipse2` derives its segment identity from the guide name, so `Outside |> TraceLoop` and `Inside |> TraceLoop` have distinct identities. If two loops would introduce the same name, binding reports `firmament-profile-segment-identity-collision`. Resolve the collision explicitly with `As` on the pipeline stages (for example, `Cutout.Bottom As CutoutBottom`) or by renaming a manual Segment.
A `Concept Path` may also compose existing named spans and remain open:
diff --git a/docs/public/reference/3dm-recovery.md b/docs/public/reference/3dm-recovery.md
new file mode 100644
index 00000000..a1cf7bca
--- /dev/null
+++ b/docs/public/reference/3dm-recovery.md
@@ -0,0 +1,11 @@
+# 3DM geometry recovery evidence
+
+`aetheris inspect-3dm model.3dm --json` reads Rhino/OpenNURBS file metadata and BRep inventory. `aetheris recover-3dm model.3dm --json` measures bounded analytic and non-rational recovery candidates. Use `--body N --edge N` or `--body N --face N` with `recover-3dm` to inspect one source entity. The file's unit metadata determines conversion to Aetheris millimetres.
+
+The recovery report is a **review aid**. It lists source object UUIDs, body/face/edge indices, degree and control-net sizes, candidate dimensions, RMS/p95/max deviations, angular deviations, rejected alternatives, and topology status. It also groups repeated radii as hypotheses. The command does not rebuild trims, create a canonical Aetheris BRep, infer Firmament authoring history, or export STEP.
+
+Reported BRep bounds use 129 deterministic samples on each trimmed edge. Rhino's BRep bounding box can include the untrimmed support surfaces and substantially overstate a part's envelope. Edge-sampled bounds are useful for navigating this file but are not certified face-interior extrema.
+
+Rational NURBS are source evidence. A simpler analytic carrier or non-rational spline may be proposed only with measured residuals and a stated qualification. A source geometric tolerance is not a manufacturing tolerance. Numerical agreement on sampled support geometry does not qualify face boundaries, edge uses, orientation, or shell enclosure. Production promotion needs those checks and an explicit caller policy. `TrustedProductionRoute` STEP export rejects rational B-spline surfaces and pcurves; legacy interchange output can retain them for compatibility and debugging.
+
+The private Cartesian Product Design `.3dm` used in the [X1 qualification report](../../release/3DM-RECOVERY-X1.md) is local-only and excluded from Git. Automation should keep detailed JSON under ignored `artifacts/local/`.
diff --git a/docs/public/reference/cli.md b/docs/public/reference/cli.md
index f0f2a317..1bda65ca 100644
--- a/docs/public/reference/cli.md
+++ b/docs/public/reference/cli.md
@@ -7,6 +7,8 @@ Primary public commands:
| `validate <file> [--json]` | Parse, bind, check units/targets/static semantics without geometry |
| `build <file> [--output path] [--json]` | Materialize and export exact STEP AP242 |
| `inspect <firmament-or-step> [--json]` | Inspect source semantics or route STEP to analysis |
+| `inspect-3dm <file.3dm> [--json]` | Inventory Rhino/OpenNURBS metadata, units, BRep topology, and unsupported objects |
+| `recover-3dm <file.3dm> [--body N [--edge N\|--face N]] [--json]` | Measure provisional analytic/non-rational recovery candidates; see [3DM recovery evidence](3dm-recovery.md) |
| `analyze <step> [--json]` | Reinspect topology, surfaces, bounds, manifold state, and PMI |
| `analyze section <step> ((--xy\|--xz\|--yz) --offset value\|--origin x,y,z --normal x,y,z) [--out section.svg] [--json]` | Extract trim-aware analytic section loops in a principal or arbitrary plane and optionally render deterministic SVG evidence |
| `analyze compound <step> [--json]` | Inspect every disconnected rigid root without silently selecting or merging one |
@@ -14,7 +16,7 @@ Primary public commands:
| `fea <file> --out-dir dir [--json]` | Compile and solve the bounded linear-elastic analysis |
| `sheetmetal ...` | Inspect, recognize, recover, compare, or flatten Sheet Metal |
| `sculpture build <source> ...` | Build the bounded non-manufacturing Sol 1 AP242 artwork, evidence, and SVG preview |
-| `section-chain <build\|inspect\|validate> <file.firmament\|flagship\|twist\|two-profile> ...` | Lower authored profiles into SectionChain IR and report frames, spans, correspondence, pcurves, conservative intersection qualification, STEP, and reimport evidence |
+| `section-chain <build\|inspect\|validate> <file.firmament\|flagship\|twist\|two-profile> ...` | Lower authored SectionChain, `Loft`, or `Loft<Hollow>` into SectionChain IR and report frames, spans, correspondence, pcurves, conservative intersection qualification, STEP, and reimport evidence |
| `wireframe <model.step> [--out preview.svg] [--view iso\|front\|top\|right] [--density N] [--json]` | Render deterministic exact-edge and trim-clipped surface-isoline SVG evidence |
| `asm ...` | Inspect/execute/import/export assemblies |
diff --git a/docs/public/reference/supported-features.md b/docs/public/reference/supported-features.md
index ebba1ea4..31c1c598 100644
--- a/docs/public/reference/supported-features.md
+++ b/docs/public/reference/supported-features.md
@@ -17,6 +17,7 @@
| Wire coils | Bounded (WIRE-X1) | Semantic AxisCoil plus Cylinder/Frustum/Sphere SurfaceCoil, explicit handedness/clearance, constant circular wire, evaluable winding authority, deterministic cubic non-rational STEP tube; no variable pitch/section, arbitrary support, intentional contact, dynamics, or knots |
| Formed Wire | Bounded (WIRE-X0) | One open, continuous, unbranched constant circular wire; explicit 3D StartFrame; ordered Straight and signed planar Bend operations through ±180° in current local Up/Right planes; exact line/arc centerline, ideal cut length/volume/mass, analytic cylinders/tori/caps, terminals, and fail-closed no-contact validation. No coils, knots, branches, variable section, springback, or intentional contact. See [guide](../firmament/wire-form.md). |
| SectionChain loft substrate | Bounded (SURF-X4 subset) | Firmament authoring lowers into ordered framed, same-topology semantic SectionChain IR; explicit G0 ruled or default G1 local polynomial transitions; shared edges and tangent fields; Cap/Open; strict pcurves; deterministic intersection checks; persistent typed BodyState Add/Remove through documented planar housing lanes; no generic CSG authoring, rational product surface, or faceted fallback. See [Section chains](../firmament/section-chains.md). |
+| `Loft` and `Loft<Hollow>` | Bounded two-section circle/ellipse profiles | Two framed outlines, straight ruled generators, `CommonRay` correspondence, and optional `Twist` (-180° to 180°). `Loft` makes a capped solid; `Loft<Hollow>` adds nominal wall thickness and a narrow explicit seam. Both lower through SectionChain to closed AP242 solids. See [Loft](../firmament/loft.md). |
| Structural / weldment | Bounded (X2) | Explicit 3D nodes and straight paths; identifiable members; square/rectangular/round tube, angle, flat/round bar; orientation; catalog material; two-member butt and polygonal miter joints; semantic fillet welds; AP242 member assembly and deterministic JSON Cut List. No coping, curved routing, multi-member miter, connection design, weld analysis, or structural FEA. See [guide](../firmament/structural.md). |
| Semantic piping / routing | Bounded (X3a) | Logical connections; equipment-owned port Interfaces and hollow nozzle stubs; target-port-scoped owner KeepOut exemptions; coincident endpoint mates; explicit orthogonal 3D routes; deterministic A* proposals; editable accepted routes; 90-degree elbows; bounded local rerouting; AP242 assembly, BOM, and pipe Cut List. No freeform, stress-, flow-, slope-, or plant-scale routing. See [guide](../firmament/piping.md). |
| Boss | Bounded | First-class connected finite profile addition; relative `On: Top` resolves the highest current semantic support under the footprint, named `<feature>.Top`/`Base.Top` is explicit, ambiguity fails typed; positive height; lowers through existing `Add`; no arbitrary solid union |
@@ -39,7 +40,7 @@
| Platform qualification | Supported | Windows x64 bundle; NativeAOT Forge Host on `win-x64` |
| Linux/macOS release binaries | Not in Preview 3 | Framework logic tests do not constitute binary qualification |
| Post-Preview-3 feature families | X0 exception | Circular Sweep, WIRE-X0 Formed Wire, and Standard Products Paperclip are bounded X0 additions; other new geometry/PMI/FEA/Forge families remain frozen |
-| General smooth/rail/topology-changing loft, helix, and freeform surface features | Not in Preview 3 | Bounded G1 SectionChains do not qualify arbitrary smooth loft, guide rails, topology-changing correspondence, arbitrary dumb-solid editing, G2 continuity, or surface networks. |
+| General smooth/rail/topology-changing loft, helix, and freeform surface features | Not in Preview 3 | The bounded two-section lofts and G1 SectionChains do not qualify arbitrary smooth loft, guide rails, topology-changing correspondence, arbitrary dumb-solid editing, G2 continuity, or surface networks. |
| Through profile removal | Bounded semantic operations | Use qualified `Hole`, `Slot`, or another documented opening feature; Pocket never means through-all |
| Arbitrary solid Boolean subtraction / hemispherical cavity | Not in Preview 3 | No public `Union`, `Subtract`, `Intersect`, CSG tree, Sphere-from-Block subtraction, or hemisphere special case |
diff --git a/docs/release/3DM-IMPORT-X0.md b/docs/release/3DM-IMPORT-X0.md
new file mode 100644
index 00000000..473a1ab6
--- /dev/null
+++ b/docs/release/3DM-IMPORT-X0.md
@@ -0,0 +1,53 @@
+# 3DM-IMPORT-X0 — Cartesian Product geometry bridge
+
+## Verdict: Meaningful progression
+
+The local Product Design file parses through McNeel OpenNURBS and is now inspectable with `aetheris inspect-3dm`. It is **not** imported into Aetheris BRep, exported as STEP, or round-trip qualified. No exactness or fidelity claim is made. The inspection path removes uncertainty about the source and identifies a concrete blocker: 53 of its 196 rational 3D edges do not classify as circles, arcs, or ellipses, while Aetheris currently has no generic rational 3D curve carrier. Another 56 classify as circular arcs when `TryGetArc` is tested before `TryGetEllipse`; circles/arcs can also satisfy Rhino's ellipse probe. The STEP importer explicitly rejects rational B-spline curves that cannot recover as analytic circles (`Step242Importer.cs`, rational curve branch). Conversion must also map 742 trims, including 114 seams and 50 singular trims, through the established pcurve and vertex-loop architecture before export can be claimed. X1 recovery evidence is reported separately in `3DM-RECOVERY-X1.md`.
+
+## Reproduce the local inventory
+
+```powershell
+dotnet run --project Aetheris.CLI -- inspect-3dm testdata/3DM/cartesian-product-metres.3dm --json
+dotnet test Aetheris.CLI.Tests/Aetheris.CLI.Tests.csproj --filter FullyQualifiedName~ThreeDmLocalQualificationTests
+```
+
+The second command skips explicitly if the private fixture is absent. The JSON inventory is local output; if saved, it belongs under `artifacts/local/`. This inspector reads BRep data directly and does not use meshes. It classifies each Product object as `exact-but-not-yet-mapped`; classification is not a conversion result.
+
+## Source inventory (local run, 2026-09-22)
+
+| Measure | Result |
+| --- | ---: |
+| File size | 736,583 bytes |
+| 3DM archive version | 70 |
+| Model units | metres |
+| Conversion to Aetheris units | 1,000 mm/metre |
+| Model absolute tolerance | 0.000001 m = 0.001 mm |
+| Model angle tolerance | 1 degree |
+| Layers / instance definitions | 3 / 0 |
+| Objects | 27 BReps; 0 extrusions, meshes, SubD, standalone curves or surfaces |
+| Classification | 0 exact-supported; 27 exact-but-not-yet-mapped; 0 non-BRep/unsupported/irrelevant |
+| Source BRep faces / loops / trims / edges / vertices | 185 / 232 / 742 / 346 / 219 |
+| Seam / singular trims | 114 / 50 |
+| Rational edge / surface / trim NURBS | 196 / 104 / 142 |
+| Rational edges not recognized as circles | 109 |
+| Of these, recognized as circular arcs / unresolved by native analytic probes | 56 / 53 |
+| Sampled trimmed-edge bounds in mm | min (-430.583432381, -77.334934891, 0); max (139.199739336, 77.328068101, 559.759999981) |
+| Parse / inventory wall time | about 572 / 19 ms on this local run |
+
+All 27 BReps report `IsSolid=true`. The inventory is source metadata, not an Aetheris enclosure, manifold, orientation, mass-property, or STEP qualification. The source stores every support surface as `NurbsSurface`, every edge as `NurbsCurve`, and every trim as `NurbsCurve`; no analytic surface carrier is yet assigned. Source UUID, layer index, per-object topology counts, source-space extents converted into mm, and curve blockers are in CLI JSON output.
+
+## Dependency and deployment audit
+
+`Aetheris.ThreeDm` isolates [McNeel Rhino3dm 8.32.0](https://www.nuget.org/packages/Rhino3dm/8.32.0) from kernel geometry types. McNeel publishes it under MIT and describes it as a .NET OpenNURBS reader/writer independent of Rhino ([source repository](https://github.com/mcneel/rhino3dm)). The NuGet package includes managed .NET assemblies and native runtimes for Windows x86/x64/arm64, Linux x64/arm64, and macOS x64/arm64. Redistribution requires retaining its MIT notice; no Cartesian source asset is redistributed. The native library and P/Invoke make NativeAOT compatibility unqualified here. Browser WASM support is not part of X0. This is a desktop/server inspection adapter, with no Rhino type in its public records.
+
+## Legal and repository hygiene
+
+`/testdata/3DM/*.3dm` is ignored by Git. `git ls-files 'testdata/3DM/*.3dm'` returns no tracked files. No Cartesian source, extracted payload, converted copy, image, or screenshot was added. The local fixture is qualification input only. Later local corpus candidates are Furniture, Interior, Structure, and Manufacturing; none was opened for this milestone.
+
+## Remaining qualification boundary
+
+There is no 3DM importer or `convert-3dm` command yet. The X1 recovery toolkit now qualifies non-rational support candidates for the 53 unclassified rational edges; its evidence is in `3DM-RECOVERY-X1.md`. A canonical conversion still needs edge-use/trim and singular-boundary mapping, face/edge coherence, orientation and shell validation, then source-to-imported and STEP-reimport quantitative comparisons. Rational curves remain source evidence, not a required production representation. Accordingly, imported bbox, vertex/edge/surface/trim deviations, topology deltas, STEP entity counts, area, volume, centroid, allocation, and round-trip timings are **not available**; reporting zero for them would be false.
+
+## Validation
+
+The full solution build completed with zero errors (seven existing Web.Runtime analyzer/WASM warnings). The local 3DM qualification test passed. The full solution test run did not pass: 14 failures appeared in existing Core, Modules, Firmament, Server, and EditableV8 tests, while all 446 CLI tests passed. A representative unrelated failure, `SurfacingM1Tests.NonRationalBSplineContractRejectsInvalidDataAndHasNoWeights`, reproduced alone: it asserts that `BSplineSurfaceWithKnots` has no `Weights` property, though that property already exists in unchanged kernel code. The complete test output is local at `artifacts/local/3dm-full-test.log`.
diff --git a/docs/release/3DM-INTENT-X0.md b/docs/release/3DM-INTENT-X0.md
new file mode 100644
index 00000000..de00535e
--- /dev/null
+++ b/docs/release/3DM-INTENT-X0.md
@@ -0,0 +1,49 @@
+# 3DM-INTENT-X0 — lamp base intent port
+
+## Reconstruction plan (before Firmament authoring)
+
+The selected manufactured base is source BRep object **5**, UUID `764c1644-10c1-44ec-a51b-3335716bda0b`: one closed solid with 54 faces, 133 edges, and 314 trims. Its sampled edge envelope is `x=-107.5..107.5`, `y=-75..75`, `z=0..12 mm`. The Rhino BRep bounding box includes untrimmed surface extents as far as `x=169.52` and is **not** the plate envelope. Objects 0–4 are the long post and upper fittings; objects 6–12 are nearby mounting/switch parts; object 13 is a cable connector and object 14 the cable. These are separate BReps and are excluded. The user-provided Blender and CAD Assistant views agree with this connected-body selection. In particular, the hex nut is separate object **8**, approximately `x=-88..-68`, `y=-8.66..8.66`, `z=2..5 mm`; the coaxial cylindrical fitting is object **6**, approximately `x=-87..-69`, `y=-9..9`, `z=2..23 mm`; object **7** is a separate annular fitting at `z=5..7 mm`. Their shared axis is `(x,y)=(-78,0)` mm. The base plate has the mating opening, but those hardware solids are not fused into object 5.
+
+Use the source XY orientation, translate the large opening center `(38,0)` to the replacement origin, and keep +Z upward. The first construction is an extruded plate from `z=0` to `12`: one right semicircle and two mirrored, tangent-aligned polynomial cubic flanks form the outer loop. Three circular inner loops describe the large opening and the two mount penetrations visible in the top face. The source's bottom recess and 0.6 mm rim treatment will be assessed after the primary plate compiles. This is a new editable interpretation; it does not claim the original authoring history.
+
+| Source evidence (object 5) | Inferred feature | Planned Firmament | Chosen value / uncertainty |
+| --- | --- | --- | --- |
+| Face 35 top plane and edges 55–63, 121–129 | Asymmetric plate outline | Cubic flank pair plus circular end | Three segments; fit of each flank against top boundary has sampled max about 0.294 mm. |
+| Face 35 inner edge 130, circular; face 27 interior | Large through opening | Circular inner loop | Center `(38,0)` source = replacement `(0,0)`; top radius 61.6 mm, side radius 61 mm because of 0.6 mm rim. |
+| Faces 30/31 and top edges 105/107 | Post and auxiliary mounting penetrations | Circular inner loops | Centers `(-78,0)` and `(-44,-25)` source, radii 7 and 3.5 mm. Bottom correspondence remains to be checked. |
+| Top plane `z=12`, bottom plane `z=0`, recessed plane `z=7` | Plate with an offset rounded-rectangle underside subtraction | Extrusion, then underside cut if viable | Nominal outer plate thickness 12 mm; underside cut reaches about 7 mm. Its contact with the outside and large opening appears rough in the source Boolean. |
+
+Source geometric tolerance is `0.001 mm`. It is not a manufacturing tolerance. For this roughly 215 mm plate, a **1 mm maximum surface deviation** is the practical reconstruction threshold for the intent port. The top outline's 0.292 mm maximum sampled fit and the omitted 0.6 mm rim treatment are within that scale. The underside relief is not: it creates a 7 mm local mismatch.
+
+## Implemented Firmament and geometric evidence
+
+The canonical first-pass source is [`fixtures/Canonical/ThreeDm/lamp-base-intent.firmament`](../../fixtures/Canonical/ThreeDm/lamp-base-intent.firmament), 34 nonblank lines. It contains one named XY sketch, a three-segment outer profile (two mirrored degree-three non-rational cubic flanks and a circular semicircle), three circular inner loops, and one 0–12 mm plate extrusion. The post interface is an aperture in this selected body; the shaft and collars belong to separate BReps. A small generic `CubicBezier2` profile guide lowers into the existing polynomial profile/BRep/STEP path; there is no rational production geometry and no new executor. All controls are ordinary named, editable points. The direct guide is documented in [public Firmament documentation](../public/firmament/cubic-bezier-profiles.md).
+
+| Measurement | Source evidence | Chosen construction | Delta and reason |
+| --- | ---: | ---: | --- |
+| Plate Z envelope | 0–12 mm, faces 32/35 | 0–12 mm | 0; source plane offsets. |
+| Large opening center | (38,0) mm source | (0,0) mm local | Datum translation `(-38,0)`; no shape change. |
+| Large opening radius | 61.6 mm top; 61 mm side | 61.6 mm through | 0 at top; up to 0.6 mm at the omitted rim. |
+| Post mount aperture | center (-78,0), R7 mm | local (-116,0), R7 mm | 0 at top; underside connection awaits relief. |
+| Auxiliary aperture | center (-44,-25), R3.5 mm | local (-82,-25), R3.5 mm | 0 at top; underside connection awaits relief. |
+| Outer right semicircle | R74.4 mm top; R75 mm side | R74.4 mm | 0 at top; up to 0.6 mm at the omitted rim. |
+| Left nose | x=-106.9 mm top; x=-107.5 mm side | x=-106.9 mm source frame | 0 at top; 0.6 mm at the omitted rim. |
+| Cubic upper nose handle | fitted y=53.9567 mm | y=53.96 mm | +0.0033 mm; rounded editable control. |
+| Cubic upper shoulder handle | fitted x=-9.3235 mm source | x=-9.32 mm source | +0.0035 mm; rounded editable control. Lower flank is mirrored. |
+| Underside relief | roof at z=7 mm, from outer left side to large opening | absent | **7 mm local mismatch**; blocks qualification. |
+
+Using 1,040 deterministic points on the source top outer edges, nearest-point distance to the three-segment redraw is **RMS 0.1473, p95 0.2852, max 0.2921 mm**. The two cubic-to-circle joins and the nose join are tangent-aligned by their control vectors; the source's own many-span perimeter is not copied. The right semicircle and three top opening circles use measured centers/radii. The source's sampled edge envelope is `[-107.5,-75,0]..[107.5,75,12] mm`. After the documented datum translation, the STEP envelope is `[-106.9,-74.4,0]..[106.9,74.4,12] mm`: 0.6 mm inside the source side envelope in XY and equal in Z.
+
+The supplied millimetre STL provided an independent local display and comparison reference; the source BRep object 5 occupies its contiguous facet range 6,080–17,551. Its approximate tessellated volume is 120,370 mm³. The current STEP reimport gives a bounded triangulation volume estimate of 152,677 mm³ with a conservative 15,058 mm³ bound, corroborating substantial missing underside removal. A replacement underside point at source coordinate `(-70,10,0)` is 7.0 mm from the selected source STL surface. Full two-way surface RMS/p95/max for the **cubic STEP** are not reported: Aetheris' mesh command currently rejects its `LinearExtrusion` side supports. An analytic arc-outline trial could be meshed, but it is a different candidate and cannot substitute for the canonical model's score.
+
+## Production STEP and topology
+
+`aetheris build` completed with no diagnostics. The local STEP is 10,289 bytes and 261 entities. `aetheris inspect` reports one body, one shell, eight faces, 18 edges, and an enclosed-manifold structural assessment. Its surfaces are two planes, four cylinders, and two non-rational linear extrusions; its curves include four polynomial B-spline edge uses. `RATIONAL_B_SPLINE_CURVE` and `RATIONAL_B_SPLINE_SURFACE` counts are both **zero**. `aetheris verify` reimported the STEP, found one enclosed and consistently oriented shell, and produced the volume estimate above. The inspection/verification is of the replacement STEP, not of a translated Rhino body. Local generated artifacts are under ignored `artifacts/local/`: `lamp-base-intent.step`, `lamp-base-intent-top.png`, and `lamp-base-intent-iso.png`.
+
+## Remaining blocker and next bounded capability
+
+**Verdict: Meaningful progression.** The correct body is identified, measured, and redrawn as a small editable Firmament model with a real enclosed production STEP. It does **not** yet match the source base within the documented 1 mm threshold because the source underside has a 7 mm offset rounded-rectangle subtraction. The source's rough Boolean makes that subtraction meet the outer side and large opening. This is an ordinary pocket construction, not a need to reproduce the source's complex NURBS control nets. Below `z=7` it splits the remaining plate material into two XY regions, which the top plate reconnects in 3D. The hex nut and hollow cylindrical pole interface visible in the bottom view are separate source bodies 6–8, so they are recorded as local interface context rather than merged into this plate STEP.
+
+An attempted `Compose Body` with the cubic profile is rejected with `Profile arrangements require bounded line or circular-arc source curves.` A seven-arc outline trial admits composition, but a source-sized underside cut is rejected as `arrangement-rejected:disconnected-or-invalid-material:outer-loops=2:context=slab=(0,7)`. A smaller contained pocket compiles but leaves the source-like connection and much of the 7 mm mismatch unresolved. A `Modify Body Pocket` trial after the cubic extrusion emitted the same eight-face STEP, so it did not provide a valid relief either. The minimal capability gap is a profile/pocket materialization route that accepts the existing polynomial flank and a connected 3D solid whose intermediate slab has two material loops. It should preserve one canonical BRep/STEP authority and diagnose unsupported cuts explicitly. Until that is available, adding cosmetic rim fillets or more small details would not converge on base qualification.
+
+Mechanical work suitable for automation includes source object/trim inventory, sampled trimmed-edge envelope, analytic opening measurements, bounded outline fitting, source-to-profile residuals, STEP entity counts, and deterministic reimport checks. The decisions to select object 5, use the opening as datum, treat separate collars as separate parts, choose a three-segment perimeter, and admit a 1 mm redraw threshold remain explicit engineering judgments. An independent fresh agent given this measurement plan and public Firmament docs proposed profile extrusion, circular openings, and later underside validation; it correctly rejected original-history recovery and accepted a small non-rational spline only with measured qualification.
diff --git a/docs/release/3DM-INTENT-X1.md b/docs/release/3DM-INTENT-X1.md
new file mode 100644
index 00000000..a97de2b2
--- /dev/null
+++ b/docs/release/3DM-INTENT-X1.md
@@ -0,0 +1,40 @@
+# 3DM-INTENT-X1 — visible Cartesian lamp reconstruction
+
+## Verdict
+
+**Meaningful progression.** The visible lamp compiles from authored Firmament into a seven-solid AP242 assembly, and the emitted STEP reimports as seven occurrences. The oblique shade now uses `Loft<Hollow>` with two named circle/ellipse profiles, straight ruled generators, common-ray correspondence, and `Twist: 0deg`; it lowers through the existing G0 SectionChain BRep/STEP path. A separate `Twist: 63deg` witness builds a ruled hyperboloid-like shell. Three edited lamp variants rebuild. The remaining qualification issue is the 0.1° construction seam: SectionChain does not currently accept an annular profile with an inner loop. Full component surface residuals and manufacturing qualification are not claimed.
+
+The source `testdata/3DM/cartesian-product-metres.3dm` remains local-only. No original Rhino BRep, control net, wire, or source-derived render is checked in. This is a new semantic redraw, not recovered authoring history.
+
+## Canonical product
+
+The assembly is [`fixtures/Canonical/ThreeDm/lamp-visible-intent.firmament`](../../fixtures/Canonical/ThreeDm/lamp-visible-intent.firmament). The shade is a separate editable [`Loft<Hollow>`](../../fixtures/Canonical/ThreeDm/lamp-shade-loft.firmament) source referenced by `LoftFile`. Authors specify two framed circle/ellipse profiles, nominal thickness, ruling, reference direction, and optional twist. The binder generates four polynomial cubic outer spans, four inner spans, and two short radial bridges per section for the existing SectionChain materializer. The bridges leave the documented 0.1° slit. All other bodies are ordinary profile extrusions. Local output is `artifacts/local/lamp-visible-intent.step`; local front/isometric comparison images are `artifacts/local/lamp-visible-overlay-front.png` and `artifacts/local/lamp-visible-overlay-iso.png`.
+
+| Part | Source evidence in millimetres | Chosen geometry and difference |
+| --- | --- | --- |
+| Base, object 5 | Edge envelope x=±107.5, y=±75, z=0–12; opening top R61.6 | Existing three-segment top outline, R61.6 opening, 12 thick. Outer side envelope is 0.6 inside source because its small edge round is omitted. Existing top-outline fit: RMS 0.1473, p95 0.2852, max 0.2921. The rough offset underside pocket is excluded by mission. |
+| Pole, object 0 | Shared vertical axis (-78,0), R5.5, z=2–437 | R5.5 shaft from z=2–431; upper six millimetres give way to the pivot solid. |
+| Lower collar and nut, objects 6–8 | R9 coaxial boss reaches z=23; hex nut x=-88..-68, y=±8.66, z=2–5 | R9/R5.5 annular collar z=12–23. R17.32 across-flats hex nut with R5.5 bore is placed z=-3–0 below the flat replacement plate; its 5 mm displacement follows omission of the underside pocket. |
+| Pivot, object 22 | Y axis through (-78,0,441), R10, y=±10 | R10, 20-long pin at the measured axis and center. |
+| Head, objects 16–17 | Axis (0.8,0,-0.6), outer R27, inner R26; rear (-153.8,0,537.5), front (-39,0,451.4) | Annular tube with the same radii and 143.5 axial length. Small rear cap/internal details are omitted. |
+| Shade, objects 19–20 | Rear circular section centered (-39,0,451.4), outer R27; front plane center about (56.665,0,339.933), normal about (0.138648,0,-0.990342) | Ruled 1 mm nominal wall with common-ray alignment and zero added twist. Front outer ellipse fit has local semiaxes about 78.918 and 81.142; inner axes are each 1 mm smaller. Source front contour to replacement front contour: RMS 1.137, p95 1.932, max 2.069, based on 65 source edge samples. |
+
+The front source contour is planar but not a circle: the best circle fit has radial RMS 1.984 mm and max 3.228 mm; the fitted ellipse improves radial RMS to 1.218 mm and max 1.815 mm. The final cubic approximation is non-rational. Its 0.1° seam is roughly 0.14 mm wide at the front section and 0.047 mm at the rear section. The cut planes differ substantially; a coaxial revolve would put the front rim in the wrong plane. The previous hand-authored chain paired a rear span starting at local +X with a front span starting near world +Y, producing the visible twist. `CommonRay` now pairs both starts along world +Y. A trial using exact clockwise circular arcs failed SectionChain's pcurve inverse check by about 0.0004–0.0015 mm against its 0.00001 mm limit. The bounded loft's cubic spans materialize with 60 pcurves and maximum reconstruction deviation about 5.5×10⁻¹⁰ mm.
+
+## Rebuild and production proof
+
+`aetheris asm inspect` reports no diagnostics. `aetheris asm export-ap242` produced `artifacts/local/lamp-visible-intent.step` (81,118 bytes, SHA-256 `1388CA985A1002E80A356F086B238A63FC9CD03FD7ED4C1755398BD7E9FCDCEF`). A repeat export produced the same hash. `aetheris asm import-step` succeeded. The product has one assembly product plus seven part products, seven `MANIFOLD_SOLID_BREP`/`CLOSED_SHELL` pairs, 43 advanced faces, 21 planes, 11 cylinders, and 9 non-rational B-spline surfaces. `RATIONAL_B_SPLINE_CURVE` and `RATIONAL_B_SPLINE_SURFACE` entity counts are both zero; no rational pcurve entity is present. The SectionChain's self-intersection and pcurve checks pass. The 63° twist witness also STEP-reimports, with 60 valid pcurves and measured mid-height radius `25 cos(31.5°)` mm. The added plain `Loft` circle-to-ellipse witness STEP-reimports as a closed six-face solid with 24 valid pcurves.
+
+Three local variants under ignored `artifacts/local/lamp-edit-checks/` passed `aetheris asm inspect` with zero diagnostics: opening radius 61.6→60 mm, pole height 429→439 mm with dependent pivot/head/shade stations raised 10 mm, and front ellipse axis lengths increased by 5%. The pole edit currently requires coordinated station edits; the assembly does not yet own a mate that drives those placements. The shade width is now one editable `Ellipse2` declaration.
+
+The front and isometric overlays compare selected source BRep edges (gray) with replacement STEP-backed assembly edges (cyan). They are visual review aids, not a full surface-distance proof. Source objects 13–14 (connector/cable), 25–26 (internal electrical details), bulb internals, and the underside base pocket are the explicit exclusion mask. The simple nut is retained but moved below the flat base; this displacement is **not** excluded from the component comparison. A whole-object nearest sampled-edge comparison is not a valid surface score here because source objects contain many interior/pocket edges with no intended counterpart. Full per-component surface RMS/p95/max therefore remain unqualified rather than replaced with misleading edge-cloud numbers.
+
+## Automation and judgment
+
+The local 3DM inspection/recovery tooling mechanically identified BRep objects, units, cylindrical axes, radii, section planes, edge samples, and envelopes. The bounded fit and overlay scripts measured the shade contour and regenerated source-to-model edge views. The production CLI supplies materialization, STEP export/reimport, topology, and edit diagnostics. The agent judgment was the component decomposition, the omission mask, choosing a tilted ruled shade instead of a revolve, selecting nominal wall/shaft sizes, and retaining the underside nut as separate hardware. An independent fresh agent given the source inventory and public Firmament docs proposed the same primitive/ruled component decomposition and excluded wire and the underside pocket.
+
+The next bounded capability is an annular SectionChain section or another exact thin-wall construction that closes the shade without a slit while retaining oblique front and rear frames. Qualify that change with exact STEP reimport and component surface residuals; avoid reconstructing the Rhino NURBS control net.
+
+## Validation gate
+
+`dotnet build Aetheris.slnx --no-restore` passed with seven WebAssembly analyzer/SQLite varargs warnings and no errors. Six focused loft/assembly tests passed after the final source changes. The full solution test run reached multiple failures outside the lamp path (NIST STEP/display preparation, a generic plateau mesh, a module spline contract, a server view case, and an EditableV8 physical engine case); the CLI suite passed 448/448 and the Firmament suite reported 1570/1571, with the one failure in `PlanarPlateauTests.FreshAuthoredPhoneUsesGenericPlateauAndMeshesEveryFace`. The Core/NIST test host continued without new log output for over five minutes after its last reported failure, so the full run was interrupted. Its output is retained locally in `artifacts/local/lamp-full-tests.log`. This run is not a green full-suite claim.
diff --git a/docs/release/3DM-RECOVERY-X1.md b/docs/release/3DM-RECOVERY-X1.md
new file mode 100644
index 00000000..84ba0380
--- /dev/null
+++ b/docs/release/3DM-RECOVERY-X1.md
@@ -0,0 +1,111 @@
+# 3DM-RECOVERY-X1 — rational geometry recovery toolkit
+
+## Verdict: Meaningful progression
+
+The local Product Design lamp now has deterministic, inspectable recovery evidence at body, face, and edge level. `recover-3dm` does not emit an Aetheris BRep, authoritative Firmament, or STEP from the lamp. The result is useful for a later human/LLM recovery plan, but trim/topology qualification and a real Firmament witness remain open.
+
+The central result is that the 53 edges left unclassified by X0's native analytic probes are **not evidence that Aetheris should adopt rational NURBS as production geometry**. All 53 have nearly constant control-point weights (relative spread at most `1.21e-13`). A non-rational B-spline with the same controls, knots, and parameter values matches each source edge within the file's `0.001 mm` tolerance; the largest sampled deviation is `2.28e-13 mm`. Sixteen of these edges also fit circular support within source tolerance. The other 37 retain the non-rational candidate. These are support-geometry findings, not rebuilt edge uses or bodies.
+
+## Reproduce and navigate
+
+```powershell
+dotnet run --project Aetheris.CLI -- recover-3dm testdata/3DM/cartesian-product-metres.3dm --json > artifacts/local/3dm-recovery.json
+dotnet run --project Aetheris.CLI -- recover-3dm testdata/3DM/cartesian-product-metres.3dm --body 5 --edge 0 --json
+dotnet run --project Aetheris.CLI -- recover-3dm testdata/3DM/cartesian-product-metres.3dm --body 5 --face 0 --json
+dotnet test Aetheris.CLI.Tests/Aetheris.CLI.Tests.csproj --filter FullyQualifiedName~ThreeDm
+```
+
+`--body`, `--edge`, and `--face` narrow the report to one source entity and include its source object UUID. The complete local JSON lists every BRep, face, and edge, with candidate parameters, RMS/p95/max positional residual, endpoint residual, tangent deviation for edges, normal deviation for analytic faces, qualification class, and topology status. It also groups repeated radius hypotheses for review. No source control net, raw geometry payload, or converted lamp asset is committed. The private file remains ignored at `/testdata/3DM/*.3dm`; if absent, local tests skip explicitly.
+
+## Source authority and qualification
+
+The file declares **metres**, so measurements are converted once to **mm**. Its absolute model tolerance is `1e-6 m = 0.001 mm`; sampled trimmed edges span roughly `570 × 155 × 560 mm`. Rhino's native BRep box includes untrimmed support extents and had overstated the object envelope. Edge-sampled bounds are navigation evidence, not certified face-interior extrema. Source tolerance is a geometric assertion from the file, not a manufacturing tolerance. No manufacturing tolerance was supplied. Numerical candidates are called `WithinSourceTolerance` only when bounded deterministic samples pass positional and source angle tolerances. This is numerical evidence, not a symbolic proof or a claim that all unsampled extrema pass. A candidate remains provisional until trims, edge uses, face support, orientation, and shell topology are qualified.
+
+The edge study samples up to 257 parameter locations for each unclassified rational edge. Its line candidate uses the endpoint line; its circle candidate uses three source points and tests the entire edge. Its non-rational candidate keeps the same control net and knot parameterization while setting weights to one. OpenNURBS' two omitted end knots are restored for the Aetheris B-spline evaluator. The near-constant weights make this replacement exceptionally close for the Product edges, but X1 does not generalize that result to arbitrary rational curves. The bounded candidate chooser uses JudgmentEngine only after candidates pass residual and angular admissibility, then prefers the simpler representation with explicit residuals retained.
+
+## Edge recovery summary
+
+| Rational source edges | Native circular supports | Native circular arcs | Previously unclassified | Circular candidates from those 53 | Non-rational same-net candidates from those 53 | Unresolved support |
+| ---: | ---: | ---: | ---: | ---: | ---: | ---: |
+| 196 | 87 | 56 | 53 | 16 | 37 | 0 |
+
+All 143 native circular/arc supports were independently sampled and remained within source tolerance. Of the 53 studied edges, the 16 selected circle supports have sampled max deviations from `9.77e-5` to `9.30e-4 mm`. The 37 selected non-rational same-net curves have sampled max deviations from `7.42e-14` to `2.28e-13 mm`. Some rejected circle candidates fit visually but exceed the source tolerance; the report retains their residuals instead of silently choosing them. All 53 require edge/trim and face coherence checks before promotion.
+
+### All 53 previously unclassified rational edges
+
+The source edge identifier is `(object index, Brep edge index)`. The table records the selected **support** candidate; every row remains topology pending. Full candidate sets, including rejected circles and line fits, are available in local JSON.
+
+| Object | Edge | Preferred support | Sampled max deviation (mm) | Status |
+| ---: | ---: | --- | ---: | --- |
+| 5 | 0 | CircleSupport | 9.77144E-05 | Within source tolerance; topology pending |
+| 5 | 5 | CircleSupport | 9.77144E-05 | Within source tolerance; topology pending |
+| 5 | 6 | NonRationalSameNet | 1.5641E-13 | Within source tolerance; topology pending |
+| 5 | 7 | NonRationalSameNet | 1.01796E-13 | Within source tolerance; topology pending |
+| 5 | 8 | NonRationalSameNet | 8.8176E-14 | Within source tolerance; topology pending |
+| 5 | 10 | NonRationalSameNet | 1.00061E-13 | Within source tolerance; topology pending |
+| 5 | 11 | NonRationalSameNet | 1.07759E-13 | Within source tolerance; topology pending |
+| 5 | 13 | NonRationalSameNet | 1.0563E-13 | Within source tolerance; topology pending |
+| 5 | 14 | NonRationalSameNet | 9.95761E-14 | Within source tolerance; topology pending |
+| 5 | 16 | NonRationalSameNet | 7.41882E-14 | Within source tolerance; topology pending |
+| 5 | 20 | NonRationalSameNet | 1.28009E-13 | Within source tolerance; topology pending |
+| 5 | 22 | CircleSupport | 0.000101631 | Within source tolerance; topology pending |
+| 5 | 23 | NonRationalSameNet | 1.42244E-13 | Within source tolerance; topology pending |
+| 5 | 47 | NonRationalSameNet | 9.23706E-14 | Within source tolerance; topology pending |
+| 5 | 49 | NonRationalSameNet | 9.96186E-14 | Within source tolerance; topology pending |
+| 5 | 50 | NonRationalSameNet | 1.17186E-13 | Within source tolerance; topology pending |
+| 5 | 55 | NonRationalSameNet | 1.36028E-13 | Within source tolerance; topology pending |
+| 5 | 57 | NonRationalSameNet | 1.1375E-13 | Within source tolerance; topology pending |
+| 5 | 59 | NonRationalSameNet | 7.70415E-14 | Within source tolerance; topology pending |
+| 5 | 60 | NonRationalSameNet | 1.16429E-13 | Within source tolerance; topology pending |
+| 5 | 61 | NonRationalSameNet | 1.2958E-13 | Within source tolerance; topology pending |
+| 5 | 63 | CircleSupport | 0.000101631 | Within source tolerance; topology pending |
+| 5 | 64 | CircleSupport | 0.000268969 | Within source tolerance; topology pending |
+| 5 | 65 | CircleSupport | 0.000268969 | Within source tolerance; topology pending |
+| 5 | 66 | NonRationalSameNet | 9.23706E-14 | Within source tolerance; topology pending |
+| 5 | 67 | CircleSupport | 0.000930239 | Within source tolerance; topology pending |
+| 5 | 68 | NonRationalSameNet | 9.11498E-14 | Within source tolerance; topology pending |
+| 5 | 70 | NonRationalSameNet | 9.10112E-14 | Within source tolerance; topology pending |
+| 5 | 71 | NonRationalSameNet | 1.16022E-13 | Within source tolerance; topology pending |
+| 5 | 72 | CircleSupport | 9.77144E-05 | Within source tolerance; topology pending |
+| 5 | 74 | CircleSupport | 9.77144E-05 | Within source tolerance; topology pending |
+| 5 | 75 | NonRationalSameNet | 1.39961E-13 | Within source tolerance; topology pending |
+| 5 | 76 | NonRationalSameNet | 9.8718E-14 | Within source tolerance; topology pending |
+| 5 | 78 | NonRationalSameNet | 8.78893E-14 | Within source tolerance; topology pending |
+| 5 | 79 | CircleSupport | 0.000930239 | Within source tolerance; topology pending |
+| 5 | 80 | NonRationalSameNet | 8.53392E-14 | Within source tolerance; topology pending |
+| 5 | 83 | CircleSupport | 0.000101631 | Within source tolerance; topology pending |
+| 5 | 85 | NonRationalSameNet | 1.14106E-13 | Within source tolerance; topology pending |
+| 5 | 110 | CircleSupport | 0.00026858 | Within source tolerance; topology pending |
+| 5 | 111 | NonRationalSameNet | 8.53391E-14 | Within source tolerance; topology pending |
+| 5 | 112 | CircleSupport | 0.000928503 | Within source tolerance; topology pending |
+| 5 | 113 | NonRationalSameNet | 8.98773E-14 | Within source tolerance; topology pending |
+| 5 | 115 | NonRationalSameNet | 1.14572E-13 | Within source tolerance; topology pending |
+| 5 | 122 | CircleSupport | 0.00026858 | Within source tolerance; topology pending |
+| 5 | 123 | NonRationalSameNet | 8.55607E-14 | Within source tolerance; topology pending |
+| 5 | 124 | CircleSupport | 0.000928503 | Within source tolerance; topology pending |
+| 5 | 125 | NonRationalSameNet | 8.6751E-14 | Within source tolerance; topology pending |
+| 5 | 127 | NonRationalSameNet | 1.0569E-13 | Within source tolerance; topology pending |
+| 5 | 128 | NonRationalSameNet | 1.14915E-13 | Within source tolerance; topology pending |
+| 5 | 129 | CircleSupport | 0.000101631 | Within source tolerance; topology pending |
+| 14 | 0 | NonRationalSameNet | 8.52663E-14 | Within source tolerance; topology pending |
+| 14 | 3 | NonRationalSameNet | 1.42818E-13 | Within source tolerance; topology pending |
+| 14 | 5 | NonRationalSameNet | 2.27486E-13 | Within source tolerance; topology pending |
+
+## Surface recovery and component evidence
+
+Of 185 source NURBS supports, native analytic probes plus independent 17×17 support-domain checks identify 74 planes, 20 cylinders, and one torus within source tolerance. Among the 104 rational surfaces, 20 cylinders and one torus have analytic support candidates; **83 rational surfaces remain unresolved**. The support-domain grid is not trim-aware and cannot establish valid faces. The local report gives each face's degree, control net size, knots, loop/trim counts, and candidate residuals. No sampled refitting of surfaces was performed.
+
+Each source BRep is a neutral component group; the tool does not label base, stem, shade, or cable from geometry alone. It records source solid/manifold flags, bounds, adjacency counts, and provisional recoveries per body. Repeated radius hypotheses include 2.1, 3.5, 4, 4.3, 5.5, 7, 10, 41.45, and 42.02 mm groups. Those are measurements, not authored dimensions or constraints. The three remaining non-unit-weight edges in the 53-edge study occur in object 14 and have nearly constant weights around 1.669; they pass the same-net check numerically, without being called structurally exact.
+
+## Production STEP boundary
+
+`Step242Exporter` now rejects rational B-spline support surfaces and rational pcurves on `TrustedProductionRoute` with `RationalGeometryNotCanonical`. Tests prove rejection and prove an ordinary box still exports without rational entities. The legacy interchange route retains rational serialization for existing compatibility/debug workflows; it is not a certificate of recovered production geometry. The lamp has no production STEP yet, so there are no lamp STEP entity counts or round-trip metrics to report. No raw rational debug STEP was created.
+
+## What remains unresolved
+
+The 742 source trims, including 114 seams and 50 singular trims, have not been mapped to Aetheris pcurves/vertex loops. The 83 rational surfaces without analytic recognition need a bounded non-rational recovery study or explicit unresolved designation at body reconstruction time. No source subset has yet been rebuilt as a canonical Aetheris BRep, compiled through provisional Firmament, or compared after STEP reimport. Geometry alone cannot establish whether a body was originally authored with Revolve, Boss, or another feature. The report therefore contains candidate geometry and repeated dimensions, with no authoritative feature history.
+
+## Validation
+
+`dotnet build Aetheris.slnx --verbosity quiet` completed with zero errors and two existing Web.Runtime WASM warnings. The focused 3DM tests passed (2/2). The production rational guard tests passed (2/2), and a broader STEP regression filter covering exporter, pcurve/vertex-loop, rational surface reduction, and the guard passed (50/50). The X0 full-suite run had 14 failures in existing Core, Modules, Firmament, Server, and EditableV8 tests; the representative Modules failure reproduced alone in unchanged code, as recorded in `3DM-IMPORT-X0.md`. X1 did not rerun the full suite.
+
diff --git a/docs/release/Aetheris.CLI.README.md b/docs/release/Aetheris.CLI.README.md
index b914c8cf..a1d81f53 100644
--- a/docs/release/Aetheris.CLI.README.md
+++ b/docs/release/Aetheris.CLI.README.md
@@ -14,6 +14,12 @@ under the GNU Affero General Public License v3.0 (`AGPL-3.0`); third-party
assets retain their respective licenses and provenance. Alternative licensing
is available on request.
+`aetheris inspect-3dm <file.3dm> [--json]` inventories Rhino/OpenNURBS geometry,
+units, topology, and current import blockers. It does not convert 3DM to STEP.
+`aetheris recover-3dm <file.3dm> [--json]` measures provisional analytic and
+non-rational recovery candidates. See `3DM-IMPORT-X0.md` and `3DM-RECOVERY-X1.md`
+for the local qualification boundaries.
+
`aetheris view` needs Cadmata. The NuGet global tool does not bundle the viewer;
download the Windows bundle from the GitHub release for package-relative Cadmata
discovery and the complete desktop experience.
diff --git a/fixtures/Canonical/README.md b/fixtures/Canonical/README.md
index bcd99770..dad35cb0 100644
--- a/fixtures/Canonical/README.md
+++ b/fixtures/Canonical/README.md
@@ -36,7 +36,7 @@ Everything in this directory is current authoring guidance. Examples progress fr
| route a piping system | `Piping/pump-skid.firmament` | logical Connection, equipment-owned nozzle Interfaces/mates, scoped owner exemption, explicit/accepted Routes, strict foreign KeepOut clearance, fittings, BOM/Cut List |
| combine machining operations | `Integration/machined-mounting-block.firmament` | Boss, Pocket, holes, counterbores, chamfer, PMI |
-`Pocket` never means through-all; use a supported `Hole` or `Slot` for through removal. General loft, helix, arbitrary Boolean authoring, and freeform surface features are not in Preview 3; see [`docs/public/reference/supported-features.md`](../../docs/public/reference/supported-features.md).
+`Pocket` never means through-all; use a supported `Hole` or `Slot` for through removal. Bounded two-section [`Loft` and `Loft<Hollow>`](../../docs/public/firmament/loft.md) are admitted; general smooth/rail loft, helix, arbitrary Boolean authoring, and freeform surface features are not in Preview 3; see [`docs/public/reference/supported-features.md`](../../docs/public/reference/supported-features.md).
## Ownership
diff --git a/fixtures/Canonical/SectionChain/explicit-sketch-ruled.firmament b/fixtures/Canonical/SectionChain/explicit-sketch-ruled.firmament
new file mode 100644
index 00000000..d24da76a
--- /dev/null
+++ b/fixtures/Canonical/SectionChain/explicit-sketch-ruled.firmament
@@ -0,0 +1,65 @@
+Model ExplicitSketchRuled {
+ Units: mm
+
+ Concept Struct Frames {
+ Near: Plane { Origin: [0mm, 0mm, 0mm]; Normal: [0, 0, 1]; Up: [0, 1, 0] }
+ Far: Plane { Origin: [4mm, 0mm, 12mm]; Normal: [0.2, 0, 0.9797958971132712]; Up: [0, 1, 0] }
+ }
+ Construction Plane NearFrame { Trace: Frames.Near }
+ Construction Plane FarFrame { Trace: Frames.Far }
+
+ Concept Struct NearSketch On XY {
+ Point2 A { Position: [-2mm, -2mm] }
+ Point2 B { Position: [2mm, -2mm] }
+ Point2 C { Position: [2mm, 2mm] }
+ Point2 D { Position: [-2mm, 2mm] }
+ Line2 South { From: A; To: B }
+ Line2 East { From: B; To: C }
+ Line2 North { From: C; To: D }
+ Line2 West { From: D; To: A }
+ }
+ Profile NearProfile Using NearSketch {
+ Loop Outer {
+ Segment South { Trace: South; From: A; To: B }
+ Segment East { Trace: East; From: B; To: C }
+ Segment North { Trace: North; From: C; To: D }
+ Segment West { Trace: West; From: D; To: A }
+ }
+ }
+
+ Concept Struct FarSketch On XY {
+ Point2 A { Position: [-5mm, -5mm] }
+ Point2 B { Position: [5mm, -5mm] }
+ Point2 C { Position: [5mm, 5mm] }
+ Point2 D { Position: [-5mm, 5mm] }
+ Line2 South { From: A; To: B }
+ Line2 East { From: B; To: C }
+ Line2 North { From: C; To: D }
+ Line2 West { From: D; To: A }
+ }
+ Profile FarProfile Using FarSketch {
+ Loop Outer {
+ Segment South { Trace: South; From: A; To: B }
+ Segment East { Trace: East; From: B; To: C }
+ Segment North { Trace: North; From: C; To: D }
+ Segment West { Trace: West; From: D; To: A }
+ }
+ }
+
+ SectionChain Transition {
+ Continuity: G0
+ Transition: Ruled
+ Section Near {
+ Frame: NearFrame
+ Profile: NearProfile
+ Seam: South
+ }
+ Section Far {
+ Frame: FarFrame
+ Profile: FarProfile
+ Seam: South
+ }
+ Start: Cap
+ End: Cap
+ }
+}
diff --git a/fixtures/Canonical/SectionChain/hollow-loft-twist.firmament b/fixtures/Canonical/SectionChain/hollow-loft-twist.firmament
new file mode 100644
index 00000000..e5e590e7
--- /dev/null
+++ b/fixtures/Canonical/SectionChain/hollow-loft-twist.firmament
@@ -0,0 +1,27 @@
+schema SectionChain
+Model TwistedRuledShell {
+ Units: mm
+ Concept Struct Stations {
+ Lower: Plane { Origin: [0mm, 0mm, 0mm]; Normal: [0, 0, 1]; Up: [0, 1, 0] }
+ Upper: Plane { Origin: [0mm, 0mm, 50mm]; Normal: [0, 0, 1]; Up: [0, 1, 0] }
+ }
+ Construction Plane LowerFrame { Trace: Stations.Lower }
+ Construction Plane UpperFrame { Trace: Stations.Upper }
+ Circle2 LowerCircle { Center: [0mm, 0mm] Radius: 25mm }
+ Circle2 UpperCircle { Center: [0mm, 0mm] Radius: 25mm }
+ Profile LowerOutline { Loop Outer { LowerCircle |> TraceLoop } }
+ Profile UpperOutline { Loop Outer { UpperCircle |> TraceLoop } }
+
+ Loft<Hollow> Hyperboloid {
+ RearProfile: LowerOutline
+ RearFrame: LowerFrame
+ FrontProfile: UpperOutline
+ FrontFrame: UpperFrame
+ Thickness: 1mm
+ Rule: Ruled
+ Correspondence: CommonRay
+ Reference: [1, 0, 0]
+ Twist: 63deg
+ SeamGap: 0.1deg
+ }
+}
diff --git a/fixtures/Canonical/SectionChain/solid-loft-common-ray.firmament b/fixtures/Canonical/SectionChain/solid-loft-common-ray.firmament
new file mode 100644
index 00000000..56106d80
--- /dev/null
+++ b/fixtures/Canonical/SectionChain/solid-loft-common-ray.firmament
@@ -0,0 +1,24 @@
+schema SectionChain
+Model RuledSolidLoft {
+ Units: mm
+ Concept Struct Stations {
+ Lower: Plane { Origin: [0mm, 0mm, 0mm]; Normal: [0, 0, 1]; Up: [0, 1, 0] }
+ Upper: Plane { Origin: [0mm, 0mm, 50mm]; Normal: [0, 0, 1]; Up: [0, 1, 0] }
+ }
+ Construction Plane LowerFrame { Trace: Stations.Lower }
+ Construction Plane UpperFrame { Trace: Stations.Upper }
+ Circle2 LowerCircle { Center: [0mm, 0mm] Radius: 25mm }
+ Ellipse2 UpperEllipse { Center: [0mm, 0mm] AxisLengths: [60mm, 40mm] Rotation: 25deg }
+ Profile LowerOutline { Loop Outer { LowerCircle |> TraceLoop } }
+ Profile UpperOutline { Loop Outer { UpperEllipse |> TraceLoop } }
+
+ Loft Body {
+ RearProfile: LowerOutline
+ RearFrame: LowerFrame
+ FrontProfile: UpperOutline
+ FrontFrame: UpperFrame
+ Rule: Ruled
+ Correspondence: CommonRay
+ Reference: [1, 0, 0]
+ }
+}
diff --git a/fixtures/Canonical/ThreeDm/lamp-base-intent.firmament b/fixtures/Canonical/ThreeDm/lamp-base-intent.firmament
new file mode 100644
index 00000000..a10469ed
--- /dev/null
+++ b/fixtures/Canonical/ThreeDm/lamp-base-intent.firmament
@@ -0,0 +1,38 @@
+Model LampBaseIntent {
+ Units: mm
+
+ // The large opening is the XY datum. Source XY is translated by (-38, 0) mm.
+ Concept Struct BaseSketch On XY {
+ Point2 Nose { Position: [-144.9mm, 0mm] }
+ Point2 UpperNoseHandle { Position: [-144.9mm, 53.96mm] }
+ Point2 UpperShoulderHandle { Position: [-47.32mm, 74.4mm] }
+ Point2 UpperShoulder { Position: [-5.5mm, 74.4mm] }
+ Point2 LowerShoulder { Position: [-5.5mm, -74.4mm] }
+ Point2 LowerShoulderHandle { Position: [-47.32mm, -74.4mm] }
+ Point2 LowerNoseHandle { Position: [-144.9mm, -53.96mm] }
+ Point2 RoundCenter { Position: [-5.5mm, 0mm] }
+ Point2 OpeningCenter { Position: [0mm, 0mm] }
+ Point2 PostMountCenter { Position: [-116mm, 0mm] }
+ Point2 AuxiliaryMountCenter { Position: [-82mm, -25mm] }
+
+ CubicBezier2 UpperFlank { From: UpperShoulder; Control1: UpperShoulderHandle; Control2: UpperNoseHandle; To: Nose }
+ Circle2 RoundEnd { Center: RoundCenter; Radius: 74.4mm }
+ CubicBezier2 LowerFlank { From: Nose; Control1: LowerNoseHandle; Control2: LowerShoulderHandle; To: LowerShoulder }
+ Circle2 LargeOpening { Center: OpeningCenter; Radius: 61.6mm }
+ Circle2 PostMount { Center: PostMountCenter; Radius: 7mm }
+ Circle2 AuxiliaryMount { Center: AuxiliaryMountCenter; Radius: 3.5mm }
+ }
+
+ Profile PlateSection Using BaseSketch {
+ Loop Outer {
+ Segment Lower { Trace: LowerFlank; From: Nose; To: LowerShoulder }
+ Segment Round { Trace: RoundEnd; From: LowerShoulder; To: UpperShoulder; Sweep: CounterClockwise }
+ Segment Upper { Trace: UpperFlank; From: UpperShoulder; To: Nose }
+ }
+ Loop Inner { LargeOpening As OpeningBoundary |> TraceLoop }
+ Loop Inner { PostMount As PostBoundary |> TraceLoop }
+ Loop Inner { AuxiliaryMount As AuxiliaryBoundary |> TraceLoop }
+ }
+
+ Struct Base { Extrude PrimaryPlate { Profile: PlateSection; From: 0mm; To: 12mm } }
+}
diff --git a/fixtures/Canonical/ThreeDm/lamp-shade-loft.firmament b/fixtures/Canonical/ThreeDm/lamp-shade-loft.firmament
new file mode 100644
index 00000000..486bd4c8
--- /dev/null
+++ b/fixtures/Canonical/ThreeDm/lamp-shade-loft.firmament
@@ -0,0 +1,29 @@
+schema SectionChain
+Model CartesianLampShade {
+ Units: mm
+
+ Concept Struct Stations {
+ RearDatum: Plane { Origin: [-39mm, 0mm, 451.4mm]; Normal: [0.8, 0, -0.6]; Up: [0, 1, 0] }
+ FrontDatum: Plane { Origin: [56.665mm, 0mm, 339.933mm]; Normal: [0.138648, 0, -0.990342]; Up: [0, 1, 0] }
+ }
+ Construction Plane RearFrame { Trace: Stations.RearDatum }
+ Construction Plane FrontFrame { Trace: Stations.FrontDatum }
+
+ Circle2 RearContour { Center: [0mm, 0mm] Radius: 27mm }
+ Ellipse2 FrontContour { Center: [-0.374mm, 0mm] AxisLengths: [162.284mm, 157.836mm] Rotation: 174.97169564455444deg }
+ Profile RearOutline { Loop Outer { RearContour |> TraceLoop } }
+ Profile FrontOutline { Loop Outer { FrontContour |> TraceLoop } }
+
+ Loft<Hollow> Shade {
+ RearProfile: RearOutline
+ RearFrame: RearFrame
+ FrontProfile: FrontOutline
+ FrontFrame: FrontFrame
+ Thickness: 1mm
+ Rule: Ruled
+ Correspondence: CommonRay
+ Reference: [0, 1, 0]
+ Twist: 0deg
+ SeamGap: 0.1deg
+ }
+}
diff --git a/fixtures/Canonical/ThreeDm/lamp-visible-intent.firmament b/fixtures/Canonical/ThreeDm/lamp-visible-intent.firmament
new file mode 100644
index 00000000..3d41d85e
--- /dev/null
+++ b/fixtures/Canonical/ThreeDm/lamp-visible-intent.firmament
@@ -0,0 +1,109 @@
+Units: mm
+
+Template<OpeningRadius: Length>
+Struct LampBase {
+
+ // The large opening is the XY datum. Source XY is translated by (-38, 0) mm.
+ Concept Struct BaseSketch On XY {
+ Point2 Nose { Position: [-144.9mm, 0mm] }
+ Point2 UpperNoseHandle { Position: [-144.9mm, 53.96mm] }
+ Point2 UpperShoulderHandle { Position: [-47.32mm, 74.4mm] }
+ Point2 UpperShoulder { Position: [-5.5mm, 74.4mm] }
+ Point2 LowerShoulder { Position: [-5.5mm, -74.4mm] }
+ Point2 LowerShoulderHandle { Position: [-47.32mm, -74.4mm] }
+ Point2 LowerNoseHandle { Position: [-144.9mm, -53.96mm] }
+ Point2 RoundCenter { Position: [-5.5mm, 0mm] }
+ Point2 OpeningCenter { Position: [0mm, 0mm] }
+ Point2 PostMountCenter { Position: [-116mm, 0mm] }
+ Point2 AuxiliaryMountCenter { Position: [-82mm, -25mm] }
+
+ CubicBezier2 UpperFlank { From: UpperShoulder; Control1: UpperShoulderHandle; Control2: UpperNoseHandle; To: Nose }
+ Circle2 RoundEnd { Center: RoundCenter; Radius: 74.4mm }
+ CubicBezier2 LowerFlank { From: Nose; Control1: LowerNoseHandle; Control2: LowerShoulderHandle; To: LowerShoulder }
+ Circle2 LargeOpening { Center: OpeningCenter; Radius: OpeningRadius }
+ Circle2 PostMount { Center: PostMountCenter; Radius: 7mm }
+ Circle2 AuxiliaryMount { Center: AuxiliaryMountCenter; Radius: 3.5mm }
+ }
+
+ Profile PlateSection Using BaseSketch {
+ Loop Outer {
+ Segment Lower { Trace: LowerFlank; From: Nose; To: LowerShoulder }
+ Segment Round { Trace: RoundEnd; From: LowerShoulder; To: UpperShoulder; Sweep: CounterClockwise }
+ Segment Upper { Trace: UpperFlank; From: UpperShoulder; To: Nose }
+ }
+ Loop Inner { LargeOpening As OpeningBoundary |> TraceLoop }
+ Loop Inner { PostMount As PostBoundary |> TraceLoop }
+ Loop Inner { AuxiliaryMount As AuxiliaryBoundary |> TraceLoop }
+ }
+
+ Struct Base { Extrude PrimaryPlate { Profile: PlateSection; From: 0mm; To: 12mm } }
+}
+
+
+// Product frame follows the source millimetre XY/Z axes. The base profile has its own opening-centered datum.
+Template<PoleRadius: Length, PoleHeight: Length>
+Struct Upright {
+ Circle2 SectionCircle { Center: [0mm,0mm] Radius: PoleRadius }
+ Profile Section { Loop Outer { SectionCircle |> TraceLoop } }
+ Extrude Shaft { Profile: Section From: 0mm To: PoleHeight }
+}
+
+Template<OuterRadius: Length, InnerRadius: Length, CollarHeight: Length>
+Struct AnnularCollar {
+ Circle2 Outside { Center: [0mm,0mm] Radius: OuterRadius }
+ Circle2 Inside { Center: [0mm,0mm] Radius: InnerRadius }
+ Profile Section { Loop Outer { Outside |> TraceLoop } Loop Inner { Inside As BoreBoundary |> TraceLoop } }
+ Extrude Body { Profile: Section From: 0mm To: CollarHeight }
+}
+
+// The original underside nut sits within the omitted recessed pocket. This
+// canonical fitting is placed immediately below the flat replacement plate.
+Template<WidthAcrossFlats: Length, BoreRadius: Length, NutHeight: Length>
+Struct HexNut {
+ RegularPolygon2<6> Outside { Center: [0mm, 0mm] AcrossFlats: WidthAcrossFlats Rotation: 0deg }
+ Circle2 Bore { Center: [0mm, 0mm] Radius: BoreRadius }
+ Profile Section { Loop Outer { Outside |> TraceLoop } Loop Inner { Bore As BoreBoundary |> TraceLoop } }
+ Extrude Body { Profile: Section From: 0mm To: NutHeight }
+}
+
+Template<PivotRadius: Length, PivotLength: Length>
+Struct PivotPin {
+ Circle2 SectionCircle { Center: [0mm,0mm] Radius: PivotRadius }
+ Profile Section { Loop Outer { SectionCircle |> TraceLoop } }
+ Extrude Body { Profile: Section From: 0mm To: PivotLength }
+}
+
+Template<OutsideRadius: Length, InsideRadius: Length, TubeLength: Length>
+Struct HeadTube {
+ Circle2 Outside { Center: [0mm,0mm] Radius: OutsideRadius }
+ Circle2 Inside { Center: [0mm,0mm] Radius: InsideRadius }
+ Profile Section { Loop Outer { Outside |> TraceLoop } Loop Inner { Inside As InteriorBoundary |> TraceLoop } }
+ Extrude Body { Profile: Section From: 0mm To: TubeLength }
+}
+
+Assembly CartesianLamp {
+ <Assembly CartesianLamp>
+ <Part Base = LampBase<OpeningRadius: 61.6mm>>
+ Placement LegacyExplicit = [1,0,0,0,0,1,0,0,0,0,1,0,38,0,0,1];
+ </Part>
+ <Part Pole = Upright<PoleRadius: 5.5mm, PoleHeight: 429mm>>
+ Placement LegacyExplicit = [1,0,0,0,0,1,0,0,0,0,1,0,-78,0,2,1];
+ </Part>
+ <Part LowerCollar = AnnularCollar<OuterRadius: 9mm, InnerRadius: 5.5mm, CollarHeight: 11mm>>
+ Placement LegacyExplicit = [1,0,0,0,0,1,0,0,0,0,1,0,-78,0,12,1];
+ </Part>
+ <Part MountNut = HexNut<WidthAcrossFlats: 17.32mm, BoreRadius: 5.5mm, NutHeight: 3mm>>
+ Placement LegacyExplicit = [1,0,0,0,0,1,0,0,0,0,1,0,-78,0,-3,1];
+ </Part>
+ <Part Pivot = PivotPin<PivotRadius: 10mm, PivotLength: 20mm>>
+ Placement LegacyExplicit = [1,0,0,0,0,0,-1,0,0,1,0,0,-78,-10,441,1];
+ </Part>
+ <Part LampBody = HeadTube<OutsideRadius: 27mm, InsideRadius: 26mm, TubeLength: 143.5mm>>
+ Placement LegacyExplicit = [-0.6,0,-0.8,0,0,1,0,0,0.8,0,-0.6,0,-153.8,0,537.5,1];
+ </Part>
+ <Part Shade = LoftFile<"lamp-shade-loft.firmament">>
+ Placement LegacyExplicit = [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];
+ </Part>
+ </Assembly>
+ Anchor: CartesianLamp;
+}
diff --git a/scripts/Test-KernelIteration.ps1 b/scripts/Test-KernelIteration.ps1
new file mode 100644
index 00000000..da0c8c30
--- /dev/null
+++ b/scripts/Test-KernelIteration.ps1
@@ -0,0 +1,23 @@
+param([switch]$IncludeSlowCorpus)
+
+$ErrorActionPreference = 'Stop'
+$repoRoot = Split-Path -Parent $PSScriptRoot
+$filter = if ($IncludeSlowCorpus) { $null } else { 'Category!=SlowCorpus' }
+$projects = @(
+ 'Aetheris.Kernel.Core.Tests/Aetheris.Kernel.Core.Tests.csproj',
+ 'Aetheris.Kernel.Firmament.Tests/Aetheris.Kernel.Firmament.Tests.csproj',
+ 'Aetheris.Modules.Tests/Aetheris.Modules.Tests.csproj'
+)
+
+Push-Location $repoRoot
+try {
+ foreach ($project in $projects) {
+ $arguments = @('test', $project, '--no-restore', '-m:1', '--verbosity', 'quiet')
+ if ($filter) { $arguments += @('--filter', $filter) }
+ & dotnet @arguments
+ if ($LASTEXITCODE -ne 0) { throw "Kernel iteration test failed: $project (exit $LASTEXITCODE)" }
+ }
+}
+finally {
+ Pop-Location
+}