Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Integrate sheet-metal recognition and flattening workflows

Yuechen Lid0968f9748f4
diff --git a/Aetheris.CLI.Tests/SheetMetalCliTests.cs b/Aetheris.CLI.Tests/SheetMetalCliTests.cs
new file mode 100644
index 00000000..d4be4878
--- /dev/null
+++ b/Aetheris.CLI.Tests/SheetMetalCliTests.cs
@@ -0,0 +1,62 @@
+using System.Text.Json;
+using Aetheris.CLI;
+using Aetheris.Kernel.Core.Step242;
+using Aetheris.SheetMetal;
+using Xunit;
+
+namespace Aetheris.CLI.Tests;
+
+public sealed class SheetMetalCliTests
+{
+ private static readonly string RepoRoot=FindRepoRoot();
+
+ [Fact]
+ public void InspectCtc03_ReportsRecoveredManufacturingSemantics()
+ {
+ var output=new StringWriter();var error=new StringWriter();var input=Path.Combine(RepoRoot,"testdata/step242/nist/CTC/nist_ctc_03_asme1_ap242-e2.stp");
+ var exit=CliRunner.Run(["sheetmetal","inspect",input,"--json"],output,error);Assert.Equal(0,exit);Assert.Empty(error.ToString());
+ using var json=JsonDocument.Parse(output.ToString());var root=json.RootElement;Assert.True(root.GetProperty("success").GetBoolean());Assert.Equal("Partial",root.GetProperty("recognitionStatus").GetString());Assert.Equal(7,root.GetProperty("sheetMetal").GetProperty("bends").GetArrayLength());Assert.Equal("Partial",root.GetProperty("flatPattern").GetProperty("status").GetString());
+ }
+
+ [Fact]
+ public void FlattenAuthored_WritesDeterministicSvgWithBendAndCutLayers()
+ {
+ var temp=Path.Combine(Path.GetTempPath(),$"aetheris-sheetmetal-{Guid.NewGuid():N}.svg");
+ try
+ {
+ var output=new StringWriter();var error=new StringWriter();var input=Path.Combine(RepoRoot,"fixtures/FirmamentV2/SheetMetal/simple-u-channel.firmament");
+ var exit=CliRunner.Run(["sheetmetal","flatten",input,"--output",temp,"--k-factor","0.42","--json"],output,error);Assert.Equal(0,exit);Assert.Empty(error.ToString());
+ var svg=File.ReadAllText(temp);Assert.Contains("id=\"bend-lines\"",svg);Assert.Contains("id=\"bend-labels\" stroke=\"none\"",svg);Assert.Contains("id=\"cut-contours\"",svg);Assert.Contains("MountA",svg);Assert.Contains("Up 90°",svg);Assert.DoesNotContain("x1=\"35.66\" y1=\"42\" x2=\"35.66\" y2=\"42\"",svg);
+ }
+ finally{if(File.Exists(temp))File.Delete(temp);}
+ }
+
+ [Fact]
+ public void BuildAuthoredSheetMetal_UsesRealStepExportPath()
+ {
+ var temp=Path.Combine(Path.GetTempPath(),$"aetheris-sheetmetal-{Guid.NewGuid():N}.step");
+ try
+ {
+ var output=new StringWriter();var error=new StringWriter();var input=Path.Combine(RepoRoot,"fixtures/FirmamentV2/SheetMetal/simple-u-channel.firmament");
+ var exit=CliRunner.Run(["build",input,"--output",temp,"--json"],output,error);Assert.Equal(0,exit);Assert.Empty(error.ToString());var step=File.ReadAllText(temp);Assert.Contains("MANIFOLD_SOLID_BREP",step);Assert.Contains("ADVANCED_FACE",step);
+ }
+ finally{if(File.Exists(temp))File.Delete(temp);}
+ }
+
+ [Fact]
+ public void FlattenCtc03_WritesReimportableStepAndRecompilableRecoveredFirmament()
+ {
+ var dir=Path.Combine(Path.GetTempPath(),$"aetheris-sheetmetal-{Guid.NewGuid():N}");Directory.CreateDirectory(dir);
+ try
+ {
+ var step=Path.Combine(dir,"ctc03-flat.step");var firmament=Path.Combine(dir,"ctc03-recovered.firmament");var svg=Path.Combine(dir,"ctc03-flat.svg");
+ var output=new StringWriter();var error=new StringWriter();var input=Path.Combine(RepoRoot,"testdata/step242/nist/CTC/nist_ctc_03_asme1_ap242-e2.stp");
+ var exit=CliRunner.Run(["sheetmetal","flatten",input,"--step",step,"--firmament",firmament,"--svg",svg,"--json"],output,error);
+ Assert.Equal(0,exit);Assert.Empty(error.ToString());Assert.True(Step242Importer.ImportBody(File.ReadAllText(step)).IsSuccess);Assert.True(SheetMetalFirmament.CompileFile(firmament).IsSuccess);Assert.Contains("id=\"bend-labels\" stroke=\"none\"",File.ReadAllText(svg));
+ using var report=JsonDocument.Parse(output.ToString());Assert.Equal(Path.GetFullPath(step),report.RootElement.GetProperty("flatPattern").GetProperty("step").GetString());
+ }
+ finally{Directory.Delete(dir,true);}
+ }
+
+ private static string FindRepoRoot(){var dir=new DirectoryInfo(AppContext.BaseDirectory);while(dir is not null&&!File.Exists(Path.Combine(dir.FullName,"Aetheris.slnx")))dir=dir.Parent;return dir?.FullName??throw new InvalidOperationException("Repo root not found.");}
+}
diff --git a/Aetheris.CLI/Aetheris.CLI.csproj b/Aetheris.CLI/Aetheris.CLI.csproj
index e1b1bb8e..7e5aece3 100644
--- a/Aetheris.CLI/Aetheris.CLI.csproj
+++ b/Aetheris.CLI/Aetheris.CLI.csproj
@@ -27,6 +27,7 @@
<ProjectReference Include="..\Aetheris.FEA\Aetheris.FEA.csproj" />
<ProjectReference Include="..\Aetheris.Modules.BuiltIn\Aetheris.Modules.BuiltIn.csproj" />
<ProjectReference Include="..\Aetheris.Reconstruction\Aetheris.Reconstruction.csproj" />
+ <ProjectReference Include="..\Aetheris.SheetMetal\Aetheris.SheetMetal.csproj" />
</ItemGroup>
<ItemGroup>
diff --git a/Aetheris.CLI/CliRunner.cs b/Aetheris.CLI/CliRunner.cs
index 9f21f209..e84fe17c 100644
--- a/Aetheris.CLI/CliRunner.cs
+++ b/Aetheris.CLI/CliRunner.cs
@@ -23,6 +23,7 @@ using Aetheris.Modules.BuiltIn;
using Aetheris.Piping;
using Aetheris.Surfacing;
using Aetheris.Geometry;
+using Aetheris.SheetMetal;
namespace Aetheris.CLI;
@@ -157,6 +158,7 @@ public static class CliRunner
private const string ExperimentalPrismaticMapUsage = "Usage: aetheris experimental prismatic-map --case <case> --rows <N> --cols <N> --json";
private const string FeaUsage = "Usage: aetheris fea <analysis.firmament> [--rotate <x,y,z-degrees>] [--out-dir <directory>] [--json]";
private const string DrawingUsage = "Usage: aetheris drawing compile <drawing.firmament> --out-dir <directory> [--json]";
+ private const string SheetMetalUsage = "Usage: aetheris sheetmetal inspect <part.step|part.firmament> [--k-factor <0..1>] [--json] | aetheris sheetmetal flatten <part.step|part.firmament> [--step <flat.step>] [--firmament <recovered.firmament>] [--svg <flat.svg>] [--k-factor <0..1>] [--json]";
private const string ExperimentalLoopChamferCorpusUsage = "Usage: aetheris experimental loop-chamfer-corpus --out-dir <dir> [--json]";
internal static readonly JsonSerializerOptions JsonOptions = new()
@@ -217,6 +219,7 @@ public static class CliRunner
"asm" => RunAsm(args.Skip(1).ToArray(), stdout, stderr),
"experimental" => RunExperimental(args.Skip(1).ToArray(), stdout, stderr),
"modules" => RunModules(args.Skip(1).ToArray(), stdout, stderr),
+ "sheetmetal" => RunSheetMetal(args.Skip(1).ToArray(), stdout, stderr),
"reconstruct" => ReconstructionCli.Run(args.Skip(1).ToArray(), stdout, stderr, JsonOptions),
_ => UnknownCommand(args[0], stderr)
};
@@ -404,6 +407,9 @@ public static class CliRunner
}
}
+ if (File.Exists(sourcePath) && SheetMetalFirmament.LooksLikeSheetMetal(File.ReadAllText(sourcePath)))
+ return RunSheetMetalAuthoredBuild(sourcePath, outPath, json, stdout, stderr);
+
var build = FirmamentBuildAndExport.Run(sourcePath, outPath);
if (!build.IsSuccess)
{
@@ -472,6 +478,67 @@ public static class CliRunner
return 0;
}
+ private static int RunSheetMetalAuthoredBuild(string sourcePath, string? outPath, bool json, TextWriter stdout, TextWriter stderr)
+ {
+ var authored=SheetMetalFirmament.CompileFile(sourcePath);
+ if(!authored.IsSuccess||authored.Part?.FormedBody is null)
+ {
+ if(json)stdout.WriteLine(JsonSerializer.Serialize(new{command="build",success=false,input=Path.GetFullPath(sourcePath),domain="SheetMetal",diagnostics=authored.Diagnostics},JsonOptions));
+ else{stderr.WriteLine("Build failed:");foreach(var d in authored.Diagnostics)stderr.WriteLine($"- [{d.Severity}] {d.Code}: {d.Message}");}
+ return 1;
+ }
+ var export=Step242Exporter.ExportBody(authored.Part.FormedBody,new Step242ExportOptions{BrepExportPreflightMode=BrepExportPreflightMode.Enforce});
+ if(!export.IsSuccess){if(json)stdout.WriteLine(JsonSerializer.Serialize(new{command="build",success=false,input=Path.GetFullPath(sourcePath),domain="SheetMetal",diagnostics=export.Diagnostics.Select(d=>new{d.Message,d.Source})},JsonOptions));else foreach(var d in export.Diagnostics)stderr.WriteLine(d.Message);return 1;}
+ var output=Path.GetFullPath(outPath??Path.ChangeExtension(sourcePath,".step"));Directory.CreateDirectory(Path.GetDirectoryName(output)!);File.WriteAllText(output,export.Value);
+ if(json)stdout.WriteLine(JsonSerializer.Serialize(new{command="build",success=true,input=Path.GetFullPath(sourcePath),output,domain="SheetMetal",part=new{authored.Part.StableId,authored.Part.Thickness,regions=authored.Part.Regions.Count,bends=authored.Part.Bends.Count,features=authored.Part.Features.Count},flatPattern=new{authored.FlatPattern!.Status,authored.FlatPattern.Bounds,authored.FlatPattern.DeterministicHash}},JsonOptions));
+ else{stdout.WriteLine($"Built {Path.GetFileName(sourcePath)}");stdout.WriteLine($"STEP: {output}");stdout.WriteLine($"Model: {authored.Part.StableId} (SheetMetal, {authored.Part.Bends.Count} bends)");}
+ return 0;
+ }
+
+ private static int RunSheetMetal(string[] args, TextWriter stdout, TextWriter stderr)
+ {
+ if(args.Length==0||IsHelpFlag(args[0])){WriteSheetMetalHelp(stdout);return args.Length==0?1:0;}
+ var operation=args[0];if(operation is not ("inspect" or "flatten")||args.Length<2){stderr.WriteLine(SheetMetalUsage);return 1;}
+ var input=Path.GetFullPath(args[1]);string? output=null,flatStepOutput=null,firmamentOutput=null;var json=false;double? requestedK=null;
+ for(var i=2;i<args.Length;i++)
+ {
+ if(args[i]=="--json"){json=true;continue;}
+ if(args[i] is "--output" or "--out" or "--svg"&&i+1<args.Length){output=Path.GetFullPath(args[++i]);continue;}
+ if(args[i]=="--step"&&i+1<args.Length){flatStepOutput=Path.GetFullPath(args[++i]);continue;}
+ if(args[i]=="--firmament"&&i+1<args.Length){firmamentOutput=Path.GetFullPath(args[++i]);continue;}
+ if(args[i]=="--k-factor"&&i+1<args.Length&&double.TryParse(args[++i],System.Globalization.NumberStyles.Float,System.Globalization.CultureInfo.InvariantCulture,out var parsedK)&&parsedK>=0&&parsedK<=1){requestedK=parsedK;continue;}
+ stderr.WriteLine($"Unknown or invalid sheetmetal option '{args[i]}'.");stderr.WriteLine(SheetMetalUsage);return 1;
+ }
+ if(!File.Exists(input)){stderr.WriteLine($"Sheet Metal input was not found: {input}");return 1;}
+ SheetMetalPartIr? part;SheetThicknessRecognition? thickness=null;TimeSpan importTime=TimeSpan.Zero,recognitionTime=TimeSpan.Zero;IReadOnlyList<SheetMetalDiagnostic> recognitionDiagnostics;
+ var source=File.ReadAllText(input);if(SheetMetalFirmament.LooksLikeSheetMetal(source))
+ {
+ var authored=SheetMetalFirmament.Compile(source,input);part=authored.Part;recognitionDiagnostics=authored.Diagnostics;if(!authored.IsSuccess||part is null){WriteFailure(authored.Diagnostics);return 1;}
+ part=part with{FlatPatternPolicy=new(requestedK??part.FlatPatternPolicy.KFactor)};
+ }
+ else
+ {
+ var recognized=SheetMetalRecognizer.RecognizeStep(input,new(FlattenPolicy:new(requestedK??.5d)));part=recognized.Part;thickness=recognized.Thickness;importTime=recognized.ImportTime;recognitionTime=recognized.RecognitionTime;recognitionDiagnostics=recognized.Diagnostics;if(part is null){WriteFailure(recognitionDiagnostics);return 1;}
+ }
+ var k=requestedK??part.FlatPatternPolicy.KFactor;var flattenClock=Stopwatch.StartNew();var flat=SheetMetalFlattener.Flatten(part,new(k));flattenClock.Stop();var dfm=SheetMetalDfm.Evaluate(part,flat);
+ if(operation=="flatten")
+ {
+ if(string.IsNullOrWhiteSpace(output)&&string.IsNullOrWhiteSpace(flatStepOutput)&&string.IsNullOrWhiteSpace(firmamentOutput)){stderr.WriteLine("sheetmetal flatten requires at least one of --step, --firmament, or --svg/--output.");return 1;}
+ if(output is not null)SheetMetalSvgRenderer.Write(output,flat);
+ if(flatStepOutput is not null&&!SheetMetalManufacturingArtifacts.WriteFlatStep(flatStepOutput,part,flat,out var stepDiagnostics)){WriteFailure(stepDiagnostics);return 2;}
+ if(firmamentOutput is not null){var firmamentDirectory=Path.GetDirectoryName(firmamentOutput)!;Directory.CreateDirectory(firmamentDirectory);var recoverySource=Path.GetRelativePath(firmamentDirectory,input);File.WriteAllText(firmamentOutput,SheetMetalManufacturingArtifacts.WriteRecoveredFirmament(part,recoverySource));}
+ }
+ var body=part.FormedBody;var supportFamilies=body?.Topology.Faces.GroupBy(f=>body.TryGetFaceSurfaceGeometry(f.Id,out var s)?s?.Kind.ToString()??"Unknown":"Unknown").OrderBy(g=>g.Key).ToDictionary(g=>g.Key,g=>g.Count());
+ var pmiIndicators=Regex.Matches(source,"(DRAUGHTING_MODEL|GEOMETRIC_TOLERANCE|DATUM_FEATURE|ANNOTATION_OCCURRENCE|SHAPE_ASPECT)",RegexOptions.IgnoreCase).Count;
+ var report=new{command=$"sheetmetal {operation}",success=true,input,sourceAuthority=SheetMetalFirmament.LooksLikeSheetMetal(source)?(source.Contains("RecoveredRegion",StringComparison.Ordinal)?"Firmament recovered sheet-metal semantics":"Firmament authored semantics"):"STEP formed BRep (not mutated)",recognitionStatus=part.RecognitionStatus,thickness=new{nominal=part.Thickness,tolerance=thickness?.Tolerance,evidencePairs=thickness?.SourcePairs.Count(p=>p.Admitted)??0,outlierFaces=thickness?.OutlierFaceIds.Count??0},geometry=new{bodies=body?.Topology.Bodies.Count()??0,shells=body?.Topology.Shells.Count()??0,faces=body?.Topology.Faces.Count()??0,edges=body?.Topology.Edges.Count()??0,vertices=body?.Topology.Vertices.Count()??0,supportFamilies,pmiIndicators},sheetMetal=new{baseRegion=part.BaseRegionId,regions=part.Regions.Select(r=>new{r.StableId,r.Kind,r.ApproximateArea,sourceFaces=r.Source.FaceIds}),bends=part.Bends.Select(b=>new{b.StableId,b.AxisOrigin,b.AxisDirection,angleDegrees=b.BendAngleRadians*180/Math.PI,b.InsideRadius,b.Direction,b.AdjacentRegionA,b.AdjacentRegionB,sourceFaces=b.Source.FaceIds}),cuts=part.Features.Select(f=>new{f.StableId,f.Kind,f.OwningRegionId,f.Diameter,sourceFaces=f.Source.FaceIds})},flatPattern=new{flat.Status,flat.Bounds,bendLines=flat.BendLines.Count,cuts=flat.CutLoops.Count,kFactor=flat.Policy.KFactor,flat.DeterministicHash,svg=output,step=flatStepOutput,firmament=firmamentOutput},dfm=new{dfm.Overall,findings=dfm.Findings},diagnostics=recognitionDiagnostics.Concat(flat.Diagnostics),timingsMilliseconds=new{import=importTime.TotalMilliseconds,recognition=recognitionTime.TotalMilliseconds,flatten=flattenClock.Elapsed.TotalMilliseconds}};
+ if(json)stdout.WriteLine(JsonSerializer.Serialize(report,JsonOptions));else
+ {
+ stdout.WriteLine($"Sheet Metal: {part.RecognitionStatus} ({report.sourceAuthority})");stdout.WriteLine($"Thickness: {part.Thickness:G8} mm{(thickness is null?" authored/recovered":$" ± {thickness.Tolerance:G4} mm, {thickness.SourcePairs.Count(p=>p.Admitted)} paired supports")}");stdout.WriteLine($"Regions: {part.Regions.Count} ({part.Regions.Count(r=>r.Kind==SheetRegionKind.Planar)} planar, {part.Regions.Count(r=>r.Kind==SheetRegionKind.CylindricalBend)} cylindrical)");stdout.WriteLine($"Bends: {part.Bends.Count}; cuts: {part.Features.Count}; base: {part.BaseRegionId}");foreach(var bend in part.Bends)stdout.WriteLine($" {bend.StableId}: {bend.BendAngleRadians*180/Math.PI:G5} deg, R{bend.InsideRadius:G6}, {bend.Direction}, {bend.AdjacentRegionA} -> {bend.AdjacentRegionB}");stdout.WriteLine($"Flat pattern: {flat.Status}; {(flat.Bounds is null?"no bounds":$"{flat.Bounds.Width:G8} x {flat.Bounds.Height:G8} mm")}; K={flat.Policy.KFactor:G4}; hash={flat.DeterministicHash}");if(flatStepOutput is not null)stdout.WriteLine($"STEP: {flatStepOutput}");if(firmamentOutput is not null)stdout.WriteLine($"Firmament: {firmamentOutput}");if(output is not null)stdout.WriteLine($"SVG: {output}");foreach(var d in recognitionDiagnostics.Concat(flat.Diagnostics))stdout.WriteLine($" [{d.Severity}] {d.Code}: {d.Message}");
+ }
+ return flat.Status is FlatPatternStatus.Unsupported or FlatPatternStatus.Overlapping?2:0;
+ void WriteFailure(IReadOnlyList<SheetMetalDiagnostic> ds){if(json)stdout.WriteLine(JsonSerializer.Serialize(new{command=$"sheetmetal {operation}",success=false,input,diagnostics=ds},JsonOptions));else foreach(var d in ds)stderr.WriteLine($"[{d.Severity}] {d.Code}: {d.Message}");}
+ }
+
private static int RunModules(string[] args, TextWriter stdout, TextWriter stderr)
{
if (args.Length > 0 && args[0] == "showcase") return RunModuleShowcase(args.Skip(1).ToArray(), stdout, stderr);
@@ -3475,6 +3542,7 @@ Model CanonicalPanel {
stdout.WriteLine(" drawing Compile a Firmament Drawing Template to DrawingIR, SVG, vector A4 PDF, and native editable PPTX.");
stdout.WriteLine(" asm Inspect, execute, import, and export Firmament V2 assemblies.");
stdout.WriteLine(" modules Inspect built-in engineering Modules and capabilities.");
+ stdout.WriteLine(" sheetmetal Inspect/recover sheet semantics and generate manufacturing flat-pattern SVG.");
stdout.WriteLine(" verify Build/reimport and verify a model.");
stdout.WriteLine(" reconstruct Experimentally reconstruct a structured mesh from triangle PLY input.");
stdout.WriteLine();
@@ -3490,6 +3558,7 @@ Model CanonicalPanel {
stdout.WriteLine(" aetheris fea plate-with-hole.firmament --out-dir artifacts --json");
stdout.WriteLine(" aetheris drawing compile bearing-block-drawing.firmament --out-dir artifacts/drawing --json");
stdout.WriteLine(" aetheris asm inspect bearing-module.firmament --json");
+ stdout.WriteLine(" aetheris sheetmetal flatten formed.step --output formed-flat.svg");
stdout.WriteLine(" aetheris reconstruct mesh scan.ply --mode fast --out scan-remesh.obj --report scan-report.json");
stdout.WriteLine();
stdout.WriteLine("Run 'aetheris <command> --help' for command-specific usage.");
@@ -3535,6 +3604,25 @@ Model CanonicalPanel {
stdout.WriteLine(" --forge-pack <path> Load a trusted local .NET assembly containing IForgeConceptPack implementations. This executes local code; Aetheris does not sandbox external packs. Do not load untrusted packs.");
}
+ private static void WriteSheetMetalHelp(TextWriter stdout)
+ {
+ stdout.WriteLine("Recover bounded constant-thickness sheet, planar regions, cylindrical bends, and cuts from ordinary STEP, or compile the SheetMetal Firmament V2 module construct.");
+ stdout.WriteLine();
+ stdout.WriteLine(SheetMetalUsage);
+ stdout.WriteLine();
+ stdout.WriteLine(" inspect Print a compact recognition, bend-evidence, flat-status, DFM, and timing summary.");
+ stdout.WriteLine(" flatten Run recovery once and emit manufacturing and review artifacts from the same flat-pattern IR.");
+ stdout.WriteLine(" --step <flat.step> Write the thickness-bearing flat solid through the real AP242 BRep exporter.");
+ stdout.WriteLine(" --firmament <file> Write explicit recovered regions, bends, cuts, evidence bindings, and policy.");
+ stdout.WriteLine(" --svg <flat.svg> Write the secondary review drawing (--output remains an alias).");
+ stdout.WriteLine(" --k-factor <0..1> Override the source neutral-axis policy (STEP default 0.5).");
+ stdout.WriteLine(" --json Emit compact deterministic JSON.");
+ stdout.WriteLine();
+ stdout.WriteLine("Examples:");
+ stdout.WriteLine(" aetheris sheetmetal inspect testdata/step242/nist/CTC/nist_ctc_03_asme1_ap242-e2.stp");
+ stdout.WriteLine(" aetheris sheetmetal flatten testdata/step242/nist/CTC/nist_ctc_03_asme1_ap242-e2.stp --step artifacts/ctc03-flat.step --firmament artifacts/ctc03-recovered.firmament --svg artifacts/ctc03-flat.svg");
+ }
+
private static void WriteInspectHelp(TextWriter stdout)
{
stdout.WriteLine("Inspect what Aetheris understands a model to mean.");
diff --git a/Aetheris.SheetMetal.Tests/Aetheris.SheetMetal.Tests.csproj b/Aetheris.SheetMetal.Tests/Aetheris.SheetMetal.Tests.csproj
new file mode 100644
index 00000000..87d2969c
--- /dev/null
+++ b/Aetheris.SheetMetal.Tests/Aetheris.SheetMetal.Tests.csproj
@@ -0,0 +1,5 @@
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup><TargetFramework>net10.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable><IsPackable>false</IsPackable></PropertyGroup>
+ <ItemGroup><PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" /><PackageReference Include="xunit" Version="2.9.3" /><PackageReference Include="xunit.runner.visualstudio" Version="3.1.4"><PrivateAssets>all</PrivateAssets></PackageReference></ItemGroup>
+ <ItemGroup><ProjectReference Include="..\Aetheris.SheetMetal\Aetheris.SheetMetal.csproj" /><ProjectReference Include="..\Aetheris.Kernel.Core\Aetheris.Kernel.Core.csproj" /></ItemGroup>
+</Project>
diff --git a/Aetheris.SheetMetal.Tests/SheetMetalM1Tests.cs b/Aetheris.SheetMetal.Tests/SheetMetalM1Tests.cs
new file mode 100644
index 00000000..a7100292
--- /dev/null
+++ b/Aetheris.SheetMetal.Tests/SheetMetalM1Tests.cs
@@ -0,0 +1,99 @@
+using Aetheris.Kernel.Core.Brep;
+using Aetheris.Kernel.Core.Step242;
+using Xunit;
+
+namespace Aetheris.SheetMetal.Tests;
+
+public sealed class SheetMetalM1Tests
+{
+ private static readonly string RepoRoot=FindRepoRoot();
+
+ [Fact]
+ public void KFactorAllowance_UsesNeutralAxisRadius()
+ {
+ var policy=new SheetMetalFlattenPolicy(.42);
+ Assert.Equal(2.63,policy.NeutralRadius(2,1.5),10);
+ Assert.Equal(Math.PI/2*2.63,policy.BendAllowance(Math.PI/2,2,1.5),10);
+ }
+
+ [Fact]
+ public void AuthoredChannel_ProducesExactFormedBrepAndManufacturingFlatPattern()
+ {
+ var path=Path.Combine(RepoRoot,"fixtures/FirmamentV2/SheetMetal/simple-u-channel.firmament");
+ var result=SheetMetalFirmament.CompileFile(path);
+ Assert.True(result.IsSuccess,string.Join("\n",result.Diagnostics.Select(d=>d.Message)));
+ var part=Assert.IsType<SheetMetalPartIr>(result.Part);var flat=Assert.IsType<SheetMetalFlatPatternIr>(result.FlatPattern);
+ Assert.Equal(1.5,part.Thickness);Assert.Equal(2,part.Bends.Count);Assert.Equal(2,part.Features.Count);Assert.Equal(FlatPatternStatus.Valid,flat.Status);
+ Assert.Equal(2,flat.BendLines.Count);Assert.Equal(2,flat.CutLoops.Count);Assert.NotNull(part.FormedBody);
+ var preflight=BrepExportPreflight.Validate(part.FormedBody!);Assert.True(preflight.IsValid,string.Join("\n",preflight.Diagnostics.Select(d=>d.Message)));
+ var step=Step242Exporter.ExportBody(part.FormedBody!);Assert.True(step.IsSuccess,string.Join("\n",step.Diagnostics.Select(d=>d.Message)));Assert.True(Step242Importer.ImportBody(step.Value).IsSuccess);
+ var first=SheetMetalFlattener.Flatten(part);Assert.Equal(flat.DeterministicHash,first.DeterministicHash);
+ var roundTrip=SheetMetalRoundTrip.ValidateReferenceSurface(part,flat);Assert.True(roundTrip.IsWithinTolerance,string.Join("\n",roundTrip.Diagnostics.Select(d=>d.Message)));
+ Assert.All(flat.BendLines,b=>Assert.Equal(Math.PI/2*(2+.42*1.5),b.BendAllowance,10));
+ }
+
+ [Fact]
+ public void Ctc03_RecoversToleranceBoundedThicknessAndBendEvidenceDeterministically()
+ {
+ var path=Path.Combine(RepoRoot,"testdata/step242/nist/CTC/nist_ctc_03_asme1_ap242-e2.stp");
+ var first=SheetMetalRecognizer.RecognizeStep(path);var second=SheetMetalRecognizer.RecognizeStep(path);
+ Assert.True(first.Thickness.IsPlausible,string.Join("\n",first.Diagnostics.Select(d=>d.Message)));Assert.True(first.Part is not null,$"t={first.Thickness.NominalThickness}; planar={first.Thickness.SourcePairs.Count(p=>p.Family=="Planar")}; closestPlanar={string.Join(",",first.Thickness.SourcePairs.Where(p=>p.Family=="Planar").OrderBy(p=>p.Residual).Take(10).Select(p=>$"{p.FaceA}-{p.FaceB}:{p.Separation}/r{p.Residual}"))}; admitted={string.Join(",",first.Thickness.SourcePairs.Where(p=>p.Admitted).Select(p=>$"{p.Family}:{p.FaceA}-{p.FaceB}:{p.Separation}"))}; diagnostics={string.Join(" | ",first.Diagnostics.Select(d=>d.Message))}");
+ Assert.Equal(15,first.Part!.Regions.Count);Assert.Equal(7,first.Part.Bends.Count);Assert.Equal(2,first.Part.Features.Count);Assert.Equal(first.Part.StableId,second.Part!.StableId);
+ var flat1=SheetMetalFlattener.Flatten(first.Part);var flat2=SheetMetalFlattener.Flatten(second.Part);Assert.Equal(flat1.DeterministicHash,flat2.DeterministicHash);Assert.NotEqual(FlatPatternStatus.Unsupported,flat1.Status);
+ var validation=SheetMetalFlatPatternValidation.Validate(flat1);Assert.True(validation.Finite);Assert.True(validation.LoopsClosed);Assert.Empty(validation.Overlaps);
+ var flatBody=SheetMetalManufacturingArtifacts.BuildFlatBody(first.Part,flat1);Assert.True(flatBody.IsSuccess,string.Join("\n",flatBody.Diagnostics.Select(d=>d.Message)));Assert.NotNull(flatBody.Body);
+ var flatStep=Step242Exporter.ExportBody(flatBody.Body!);Assert.True(flatStep.IsSuccess,string.Join("\n",flatStep.Diagnostics.Select(d=>d.Message)));Assert.True(Step242Importer.ImportBody(flatStep.Value).IsSuccess);
+ var recoveredSource=SheetMetalManufacturingArtifacts.WriteRecoveredFirmament(first.Part,path);var recovered=SheetMetalFirmament.Compile(recoveredSource,"recovered-ctc03.firmament");Assert.True(recovered.IsSuccess,string.Join("\n",recovered.Diagnostics.Select(d=>d.Message)));
+ Assert.Equal(first.Part.Bends.Count,recovered.Part!.Bends.Count);Assert.Equal(first.Part.Features.Count,recovered.Part.Features.Count);Assert.True(flat1.DeterministicHash==recovered.FlatPattern!.DeterministicHash,$"expected={flat1.DeterministicHash} bounds={flat1.Bounds}; actual={recovered.FlatPattern.DeterministicHash} bounds={recovered.FlatPattern.Bounds}; expected bends={string.Join('|',flat1.BendLines.Select(b=>$"{b.BendId}:{b.Start}:{b.End}:{b.BendAllowance:R}"))}; actual bends={string.Join('|',recovered.FlatPattern.BendLines.Select(b=>$"{b.BendId}:{b.Start}:{b.End}:{b.BendAllowance:R}"))}");
+ }
+
+ [Fact]
+ public void InvalidAuthoredRadius_IsTypedRejection()
+ {
+ var source="""
+ SheetMetal Bad { Thickness: 2mm; Base: Rectangle(20mm, 20mm);
+ Flange L { From: Base.Left; Length: 4mm; Angle: 90deg; InsideRadius: 3mm; }
+ Flange R { From: Base.Right; Length: 4mm; Angle: 90deg; InsideRadius: 3mm; }
+ }
+ """;
+ var result=SheetMetalFirmament.Compile(source);Assert.False(result.IsSuccess);Assert.Contains(result.Diagnostics,d=>d.Code=="sheetmetal-firmament-invalid");
+ }
+
+ [Fact]
+ public void FlatOverlapDetection_RejectsPositiveAreaIntersectionButAllowsTouching()
+ {
+ FlatRegion2D Rect(string id,double x0,double x1)=>new(id,id,SheetRegionKind.Planar,[new(x0,0),new(x1,0),new(x1,10),new(x0,10)],"test");
+ Assert.Single(SheetMetalFlatPatternValidation.FindOverlaps([Rect("a",0,10),Rect("b",5,15)]));
+ Assert.Empty(SheetMetalFlatPatternValidation.FindOverlaps([Rect("a",0,10),Rect("b",10,20)]));
+ }
+
+ [Fact]
+ public void AuthoredFormedBody_IsRecognizedByTheSameImportedBrepSystem()
+ {
+ var authored=SheetMetalFirmament.CompileFile(Path.Combine(RepoRoot,"fixtures/FirmamentV2/SheetMetal/simple-u-channel.firmament"));
+ var recognized=SheetMetalRecognizer.Recognize(authored.Part!.FormedBody!,"authored-roundtrip.step");
+ Assert.True(recognized.Thickness.IsPlausible);Assert.Equal(1.5,recognized.Thickness.NominalThickness!.Value,8);Assert.NotNull(recognized.Part);Assert.Equal(2,recognized.Part!.Bends.Count);
+ }
+
+ [Fact]
+ public void DoubleCurvatureSolid_IsTypedUnsupportedRatherThanFlattened()
+ {
+ var sphere=Aetheris.Kernel.Core.Brep.BrepPrimitives.CreateSphere(10);Assert.True(sphere.IsSuccess);
+ var result=SheetMetalRecognizer.Recognize(sphere.Value,"sphere.step");Assert.Null(result.Part);Assert.False(result.Thickness.IsPlausible);Assert.Contains(result.Diagnostics,d=>d.Code==SheetMetalDiagnosticCodes.NonConstantThickness);
+ }
+
+ [Fact]
+ public void DisconnectedSheetGraph_ProducesPartialFlatWithDiagnostic()
+ {
+ var authored=SheetMetalFirmament.CompileFile(Path.Combine(RepoRoot,"fixtures/FirmamentV2/SheetMetal/simple-u-channel.firmament"));var part=authored.Part!;
+ var orphan=part.Regions.First(r=>r.StableId=="region-left-flange") with { StableId="region-orphan" };
+ var disconnected=part with { Regions=[..part.Regions,orphan] };
+ var flat=SheetMetalFlattener.Flatten(disconnected);Assert.Equal(FlatPatternStatus.Partial,flat.Status);Assert.Contains(flat.Diagnostics,d=>d.Code==SheetMetalDiagnosticCodes.DisconnectedGraph);
+ }
+
+ [Fact]
+ public void InvalidFlattenPolicyRadius_IsRejected()
+ => Assert.Throws<ArgumentOutOfRangeException>(()=>new SheetMetalFlattenPolicy(.5).BendAllowance(Math.PI/2,-1,1));
+
+ private static string FindRepoRoot(){var dir=new DirectoryInfo(AppContext.BaseDirectory);while(dir is not null&&!File.Exists(Path.Combine(dir.FullName,"Aetheris.slnx")))dir=dir.Parent;return dir?.FullName??throw new InvalidOperationException("Repo root not found.");}
+}
diff --git a/Aetheris.SheetMetal/Aetheris.SheetMetal.csproj b/Aetheris.SheetMetal/Aetheris.SheetMetal.csproj
index 5caf458b..adb34bc3 100644
--- a/Aetheris.SheetMetal/Aetheris.SheetMetal.csproj
+++ b/Aetheris.SheetMetal/Aetheris.SheetMetal.csproj
@@ -1,4 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup><TargetFramework>net10.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable></PropertyGroup>
<ItemGroup><ProjectReference Include="..\Aetheris.Modules\Aetheris.Modules.csproj" /><ProjectReference Include="..\Aetheris.Surfacing\Aetheris.Surfacing.csproj" /></ItemGroup>
+ <ItemGroup><ProjectReference Include="..\Aetheris.Kernel.Core\Aetheris.Kernel.Core.csproj" /><ProjectReference Include="..\Aetheris.Kernel.Firmament\Aetheris.Kernel.Firmament.csproj" /></ItemGroup>
</Project>
diff --git a/Aetheris.SheetMetal/RecoveredSheetMetalFirmament.cs b/Aetheris.SheetMetal/RecoveredSheetMetalFirmament.cs
new file mode 100644
index 00000000..b1c710dc
--- /dev/null
+++ b/Aetheris.SheetMetal/RecoveredSheetMetalFirmament.cs
@@ -0,0 +1,103 @@
+using System.Globalization;
+using System.Text.RegularExpressions;
+using Aetheris.Kernel.Core.Math;
+using Aetheris.Surfacing;
+
+namespace Aetheris.SheetMetal;
+
+/// <summary>Reader for the explicit, loss-aware recovered Sheet Metal Firmament form.</summary>
+internal static class RecoveredSheetMetalFirmament
+{
+ private const RegexOptions Rx = RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Singleline;
+ private const string Number = @"[+-]?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?:[Ee][+-]?[0-9]+)?";
+
+ public static bool IsRecovered(string source) => Regex.IsMatch(source, "\\bRecoveredRegion\\s+\"", Rx);
+
+ public static SheetMetalAuthoringResult Compile(string source, string sourcePath)
+ {
+ var header = Regex.Match(source, @"\bSheetMetal\s+(?<name>[A-Za-z_][A-Za-z0-9_]*)\s*\{", Rx);
+ if (!header.Success || !Scalar(source, "Thickness", "mm", out var thickness) || thickness <= 0)
+ return Failure("Recovered Sheet Metal requires a valid header and positive Thickness.");
+ var k = Scalar(source, "KFactor", null, out var parsedK) ? parsedK : .5;
+ if (k is < 0 or > 1) return Failure("Recovered Sheet Metal KFactor must be between 0 and 1.");
+ var baseRegion = Quoted(source, "BaseRegion"); if (baseRegion is null) return Failure("Recovered Sheet Metal requires BaseRegion.");
+ var statusText = Token(source, "RecoveryStatus") ?? nameof(SheetMetalRecognitionStatus.Partial);
+ if (!Enum.TryParse<SheetMetalRecognitionStatus>(statusText, true, out var status)) return Failure($"Unknown RecoveryStatus '{statusText}'.");
+
+ var regions = new List<SheetRegionIr>();
+ foreach (Match block in Regex.Matches(source, "\\bRecoveredRegion\\s+\"(?<id>[^\"]+)\"\\s*\\{(?<body>.*?)\\}", Rx))
+ {
+ var id = block.Groups["id"].Value; var body = block.Groups["body"].Value; var kindText = Token(body, "Kind");
+ if (!Enum.TryParse<SheetRegionKind>(kindText, true, out var kind)) return Failure($"RecoveredRegion '{id}' has invalid Kind.");
+ Scalar(body, "Area", "mm2", out var area); var faces = IntList(body, "SourceFaces"); var boundary = Points(body, "Boundary");
+ SheetPlaneReference? plane = null; SheetCylinderReference? cylinder = null;
+ if (kind == SheetRegionKind.Planar)
+ {
+ if (!Point(body, "PlaneOrigin", true, out var origin) || !Vector(body, "PlaneNormal", out var normal) || !Vector(body, "PlaneU", out var u) || !Vector(body, "PlaneV", out var v))
+ return Failure($"Recovered planar region '{id}' is missing its analytic frame.");
+ plane = new(origin, normal, u, v, Bool(body, "MaterialPositiveSide", true));
+ }
+ else if (kind == SheetRegionKind.CylindricalBend)
+ {
+ if (!Point(body, "AxisOrigin", true, out var origin) || !Vector(body, "AxisDirection", out var axis) || !Scalar(body, "MidRadius", "mm", out var midRadius) || !Scalar(body, "InsideRadius", "mm", out var insideRadius) || !Scalar(body, "AngularSpan", "deg", out var angular) || !Scalar(body, "AxisLength", "mm", out var length))
+ return Failure($"Recovered cylindrical region '{id}' is missing its analytic cylinder values.");
+ cylinder = new(origin, axis, midRadius, insideRadius, angular * Math.PI / 180d, length, Bool(body, "MaterialOutside", true));
+ }
+ regions.Add(new(id, kind, new(DevelopabilityKind.Developable, "recovered analytic support", 0, 0, "Serialized recovered support."), plane, cylinder, boundary, area,
+ new("Firmament recovered declaration", "recovered STEP semantics", faces, [], sourcePath), [new(SheetEvidenceKind.Authored, "recovered-region", "Explicit loss-aware Firmament recovery declaration.", SourceFaceIds: faces)]));
+ }
+ if (regions.Count == 0 || regions.All(r => r.StableId != baseRegion)) return Failure("Recovered Sheet Metal BaseRegion does not name a declared region.");
+
+ var bends = new List<SheetBendIr>();
+ foreach (Match block in Regex.Matches(source, "\\bRecoveredBend\\s+\"(?<id>[^\"]+)\"\\s*\\{(?<body>.*?)\\}", Rx))
+ {
+ var id = block.Groups["id"].Value; var body = block.Groups["body"].Value;
+ if (!Point(body, "AxisOrigin", true, out var origin) || !Vector(body, "AxisDirection", out var axis) || !Scalar(body, "Angle", "deg", out var angle) || !Scalar(body, "InsideRadius", "mm", out var radius))
+ return Failure($"Recovered bend '{id}' is missing axis, angle, or radius.");
+ var between = StringList(body, "Between"); if (between.Count != 2 || between.Any(x => regions.All(r => r.StableId != x))) return Failure($"Recovered bend '{id}' must connect two declared regions.");
+ if (!Enum.TryParse<SheetBendDirection>(Token(body, "Direction"), true, out var direction)) direction = SheetBendDirection.Unknown;
+ var faces = IntList(body, "SourceFaces"); bends.Add(new(id, origin, axis, angle * Math.PI / 180d, radius, thickness, direction, between[0], between[1], SheetNeutralAxisPolicy.KFactorPolicy(k),
+ new("Firmament recovered declaration", "recovered STEP semantics", faces, [], sourcePath), [new(SheetEvidenceKind.Authored, "recovered-bend", "Axis, radius, direction, and region adjacency serialized explicitly.", SourceFaceIds: faces)]));
+ }
+
+ var cuts = new List<SheetFeatureIr>();
+ foreach (Match block in Regex.Matches(source, "\\bRecoveredCut\\s+\"(?<id>[^\"]+)\"\\s*\\{(?<body>.*?)\\}", Rx))
+ {
+ var id = block.Groups["id"].Value; var body = block.Groups["body"].Value;
+ if (!Enum.TryParse<SheetFeatureKind>(Token(body, "Kind"), true, out var kind)) return Failure($"Recovered cut '{id}' has invalid Kind.");
+ var owner = Quoted(body, "On"); if (owner is null || regions.All(r => r.StableId != owner) || !Point(body, "Center", true, out var center)) return Failure($"Recovered cut '{id}' has invalid owner or center.");
+ var diameter = Scalar(body, "Diameter", "mm", out var d) ? d : (double?)null; var faces = IntList(body, "SourceFaces");
+ cuts.Add(new(id, kind, owner, center, diameter, Points(body, "Boundary"), new("Firmament recovered declaration", "recovered STEP semantics", faces, [], sourcePath),
+ [new(SheetEvidenceKind.Authored, "recovered-cut", "Cut classification and reference boundary serialized explicitly.", diameter, SourceFaceIds: faces)]));
+ }
+ var part = new SheetMetalPartIr(header.Groups["name"].Value, thickness, null, baseRegion, regions, bends, cuts, new(k), status,
+ "Firmament recovered Sheet Metal semantics", [new(SheetEvidenceKind.Authored, "recovered-intent", "Loss-aware semantic recovery source; original STEP remains authoritative geometry.")], [], null);
+ var flat = SheetMetalFlattener.Flatten(part, new(k));
+ return new(flat.Status == FlatPatternStatus.Unsupported ? false : true, null, part, flat, flat.Diagnostics);
+ }
+
+ private static bool Scalar(string text, string name, string? unit, out double value)
+ {
+ var suffix = unit is null ? "" : @"\s*" + Regex.Escape(unit); var match = Regex.Match(text, @"\b" + Regex.Escape(name) + @"\s*:\s*(?<v>" + Number + ")" + suffix + @"\s*;", Rx);
+ value = match.Success ? double.Parse(match.Groups["v"].Value, NumberStyles.Float, CultureInfo.InvariantCulture) : 0; return match.Success;
+ }
+ private static bool Point(string text, string name, bool units, out Point3D value) { var tuple = Tuple(text, name, units); value = tuple is null ? default : new(tuple.Value.X, tuple.Value.Y, tuple.Value.Z); return tuple is not null; }
+ private static bool Vector(string text, string name, out Vector3D value) { var tuple = Tuple(text, name, false); value = tuple is null ? default : new(tuple.Value.X, tuple.Value.Y, tuple.Value.Z); return tuple is not null; }
+ private static (double X, double Y, double Z)? Tuple(string text, string name, bool units)
+ {
+ var u = units ? @"\s*mm" : ""; var m = Regex.Match(text, @"\b" + Regex.Escape(name) + @"\s*:\s*\(\s*(?<x>" + Number + ")" + u + @"\s*,\s*(?<y>" + Number + ")" + u + @"\s*,\s*(?<z>" + Number + ")" + u + @"\s*\)\s*;", Rx);
+ return m.Success ? (N(m, "x"), N(m, "y"), N(m, "z")) : null;
+ }
+ private static IReadOnlyList<Point3D> Points(string text, string name)
+ {
+ var list = Regex.Match(text, @"\b" + Regex.Escape(name) + @"\s*:\s*\[(?<v>.*?)\]\s*;", Rx); if (!list.Success) return [];
+ return Regex.Matches(list.Groups["v"].Value, @"\(\s*(?<x>" + Number + @")\s*mm\s*,\s*(?<y>" + Number + @")\s*mm\s*,\s*(?<z>" + Number + @")\s*mm\s*\)", Rx).Cast<Match>().Select(m => new Point3D(N(m, "x"), N(m, "y"), N(m, "z"))).ToArray();
+ }
+ private static IReadOnlyList<int> IntList(string text, string name) { var m = Regex.Match(text, @"\b" + Regex.Escape(name) + @"\s*:\s*\[(?<v>.*?)\]\s*;", Rx); return m.Success ? Regex.Matches(m.Groups["v"].Value, @"\d+").Select(x => int.Parse(x.Value, CultureInfo.InvariantCulture)).ToArray() : []; }
+ private static IReadOnlyList<string> StringList(string text, string name) { var m = Regex.Match(text, @"\b" + Regex.Escape(name) + @"\s*:\s*\[(?<v>.*?)\]\s*;", Rx); return m.Success ? Regex.Matches(m.Groups["v"].Value, "\"(?<v>[^\"]+)\"").Cast<Match>().Select(x => x.Groups["v"].Value).ToArray() : []; }
+ private static string? Quoted(string text, string name) { var m = Regex.Match(text, @"\b" + Regex.Escape(name) + "\\s*:\\s*\"(?<v>[^\"]+)\"\\s*;", Rx); return m.Success ? m.Groups["v"].Value : null; }
+ private static string? Token(string text, string name) { var m = Regex.Match(text, @"\b" + Regex.Escape(name) + @"\s*:\s*(?<v>[A-Za-z_][A-Za-z0-9_]*)\s*;", Rx); return m.Success ? m.Groups["v"].Value : null; }
+ private static bool Bool(string text, string name, bool fallback) => bool.TryParse(Token(text, name), out var value) ? value : fallback;
+ private static double N(Match m, string group) => double.Parse(m.Groups[group].Value, NumberStyles.Float, CultureInfo.InvariantCulture);
+ private static SheetMetalAuthoringResult Failure(string message) => new(false, null, null, null, [new("sheetmetal-firmament-recovery-invalid", SheetMetalDiagnosticSeverity.Error, message)]);
+}
diff --git a/Aetheris.SheetMetal/SheetMetalDfm.cs b/Aetheris.SheetMetal/SheetMetalDfm.cs
new file mode 100644
index 00000000..e0d585f0
--- /dev/null
+++ b/Aetheris.SheetMetal/SheetMetalDfm.cs
@@ -0,0 +1,47 @@
+namespace Aetheris.SheetMetal;
+
+public sealed record SheetMetalDfmPolicy(
+ double MinimumInsideRadiusRatio = 1d,
+ double MinimumHoleToBendDistanceFactor = 2d,
+ double MinimumEdgeDistanceFactor = 1.5d);
+
+public enum SheetMetalDfmStatus { Pass, Warning, Fail, NotEvaluated }
+
+public sealed record SheetMetalDfmFinding(
+ string RuleId,
+ SheetMetalDfmStatus Status,
+ string Message,
+ string? SubjectId,
+ double? Measured,
+ double? Required);
+
+public sealed record SheetMetalDfmReport(IReadOnlyList<SheetMetalDfmFinding> Findings)
+{
+ public SheetMetalDfmStatus Overall => Findings.Any(f=>f.Status==SheetMetalDfmStatus.Fail)?SheetMetalDfmStatus.Fail:
+ Findings.Any(f=>f.Status==SheetMetalDfmStatus.Warning)?SheetMetalDfmStatus.Warning:SheetMetalDfmStatus.Pass;
+}
+
+public static class SheetMetalDfm
+{
+ public static SheetMetalDfmReport Evaluate(SheetMetalPartIr part,SheetMetalFlatPatternIr? flat=null,SheetMetalDfmPolicy? policy=null)
+ {
+ ArgumentNullException.ThrowIfNull(part);policy??=new();var findings=new List<SheetMetalDfmFinding>();
+ findings.Add(new("sheetmetal-dfm-thickness-positive",part.Thickness>0?SheetMetalDfmStatus.Pass:SheetMetalDfmStatus.Fail,part.Thickness>0?"Thickness is positive.":"Thickness must be positive.",part.StableId,part.Thickness,0d));
+ foreach(var bend in part.Bends)
+ {
+ var ratio=bend.InsideRadius/part.Thickness;var pass=ratio>=policy.MinimumInsideRadiusRatio;
+ findings.Add(new("sheetmetal-dfm-inside-radius-ratio",pass?SheetMetalDfmStatus.Pass:SheetMetalDfmStatus.Warning,$"Inside-radius/thickness ratio {ratio:G4} {(pass?"meets":"is below")} the parameterized experimental policy {policy.MinimumInsideRadiusRatio:G4}.",bend.StableId,ratio,policy.MinimumInsideRadiusRatio));
+ }
+ if(flat is not null)
+ {
+ findings.Add(new("sheetmetal-dfm-flat-overlap",flat.Status==FlatPatternStatus.Overlapping?SheetMetalDfmStatus.Fail:SheetMetalDfmStatus.Pass,flat.Status==FlatPatternStatus.Overlapping?"Flat material regions overlap.":"No planar-region overlap was detected.",flat.StableId,null,null));
+ foreach(var cut in flat.CutLoops)
+ {
+ var c=new SheetPoint2(cut.Boundary.Average(p=>p.X),cut.Boundary.Average(p=>p.Y));var nearest=flat.BendLines.Count==0?double.PositiveInfinity:flat.BendLines.Min(b=>PointLineDistance(c,b.Start,b.End));var required=policy.MinimumHoleToBendDistanceFactor*part.Thickness;
+ findings.Add(new("sheetmetal-dfm-hole-to-bend-distance",double.IsPositiveInfinity(nearest)?SheetMetalDfmStatus.NotEvaluated:nearest>=required?SheetMetalDfmStatus.Pass:SheetMetalDfmStatus.Warning,double.IsPositiveInfinity(nearest)?"No bend line is available for this cut.":$"Cut-center to nearest bend line is {nearest:G4}; experimental policy requires {required:G4}.",cut.FeatureId,double.IsPositiveInfinity(nearest)?null:nearest,required));
+ }
+ }
+ return new(findings);
+ }
+ private static double PointLineDistance(SheetPoint2 p,SheetPoint2 a,SheetPoint2 b){var dx=b.X-a.X;var dy=b.Y-a.Y;var l2=dx*dx+dy*dy;if(l2<=1e-20)return Math.Sqrt((p.X-a.X)*(p.X-a.X)+(p.Y-a.Y)*(p.Y-a.Y));var t=Math.Clamp(((p.X-a.X)*dx+(p.Y-a.Y)*dy)/l2,0,1);var x=a.X+t*dx;var y=a.Y+t*dy;return Math.Sqrt((p.X-x)*(p.X-x)+(p.Y-y)*(p.Y-y));}
+}
diff --git a/Aetheris.SheetMetal/SheetMetalFirmament.cs b/Aetheris.SheetMetal/SheetMetalFirmament.cs
new file mode 100644
index 00000000..4a0eb941
--- /dev/null
+++ b/Aetheris.SheetMetal/SheetMetalFirmament.cs
@@ -0,0 +1,114 @@
+using System.Globalization;
+using System.Text.RegularExpressions;
+using Aetheris.Kernel.Core.Brep;
+using Aetheris.Kernel.Core.Geometry;
+using Aetheris.Kernel.Core.Geometry.Curves;
+using Aetheris.Kernel.Core.Geometry.Surfaces;
+using Aetheris.Kernel.Core.Math;
+using Aetheris.Kernel.Core.Results;
+using Aetheris.Kernel.Core.Topology;
+using Aetheris.Surfacing;
+
+namespace Aetheris.SheetMetal;
+
+public sealed record AuthoredFlangeSpec(string Name,string Side,double Length,double AngleRadians,double InsideRadius,SheetBendDirection Direction);
+public sealed record AuthoredHoleSpec(string Name,double X,double Y,double Diameter);
+public sealed record SheetMetalAuthoringSpec(string Name,double Thickness,double BaseWidth,double BaseDepth,string? Material,double KFactor,AuthoredFlangeSpec Left,AuthoredFlangeSpec Right,IReadOnlyList<AuthoredHoleSpec> Holes);
+public sealed record SheetMetalAuthoringResult(bool IsSuccess,SheetMetalAuthoringSpec? Spec,SheetMetalPartIr? Part,SheetMetalFlatPatternIr? FlatPattern,IReadOnlyList<SheetMetalDiagnostic> Diagnostics);
+
+/// <summary>Firmament V2 module-owned high-level syntax for the bounded two-flange M1 family.</summary>
+public static class SheetMetalFirmament
+{
+ private const RegexOptions Rx=RegexOptions.IgnoreCase|RegexOptions.CultureInvariant|RegexOptions.Singleline;
+ public static bool LooksLikeSheetMetal(string source)
+ {
+ if(source is null)return false;
+ var clean=Regex.Replace(source,@"//.*?$|#.*?$",string.Empty,RegexOptions.Multiline);
+ return Regex.IsMatch(clean,@"^\s*SheetMetal\s+",RegexOptions.IgnoreCase|RegexOptions.CultureInvariant);
+ }
+
+ public static SheetMetalAuthoringResult CompileFile(string path)
+ {
+ ArgumentException.ThrowIfNullOrWhiteSpace(path);var full=Path.GetFullPath(path);if(!File.Exists(full))return Failure($"Sheet Metal Firmament source was not found: {full}");
+ return Compile(File.ReadAllText(full),full);
+ }
+
+ public static SheetMetalAuthoringResult Compile(string source,string sourcePath="authored.firmament")
+ {
+ ArgumentNullException.ThrowIfNull(source);var clean=Regex.Replace(source,@"//.*?$|#.*?$",string.Empty,RegexOptions.Multiline);
+ if(RecoveredSheetMetalFirmament.IsRecovered(clean))return RecoveredSheetMetalFirmament.Compile(clean,sourcePath);
+ var header=Regex.Match(clean,@"\bSheetMetal\s+(?<name>[A-Za-z_][A-Za-z0-9_]*)\s*\{",Rx);if(!header.Success)return Failure("Expected `SheetMetal <Name> { ... }`.");
+ if(!TryScalar(clean,"Thickness","mm",out var thickness)||thickness<=0)return Failure("Thickness must be a positive millimetre value.");
+ var baseMatch=Regex.Match(clean,@"\bBase\s*:\s*Rectangle\s*\(\s*(?<w>[+-]?[0-9.]+)\s*mm\s*,\s*(?<d>[+-]?[0-9.]+)\s*mm\s*\)\s*;",Rx);
+ if(!baseMatch.Success)return Failure("Expected `Base: Rectangle(<width>mm, <depth>mm);`.");
+ var width=Num(baseMatch,"w");var depth=Num(baseMatch,"d");if(width<=0||depth<=0)return Failure("Base rectangle dimensions must be positive.");
+ var material=Regex.Match(clean,"\\bMaterial\\s*:\\s*\"(?<v>[^\"]+)\"\\s*;",Rx) is {Success:true} mm?mm.Groups["v"].Value:null;
+ var k=TryScalar(clean,"KFactor",null,out var parsedK)?parsedK:SheetMetalFlattenPolicy.Default.KFactor;if(k<0||k>1)return Failure("KFactor must be between 0 and 1.");
+ var flanges=Regex.Matches(clean,@"\bFlange\s+(?<name>[A-Za-z_][A-Za-z0-9_]*)\s*\{(?<body>.*?)\}",Rx).Cast<Match>().Select(ParseFlange).ToArray();
+ if(flanges.Any(f=>f is null))return Failure("Each flange requires From: Base.Left|Right, Length, Angle, and InsideRadius.");
+ var typed=flanges.Cast<AuthoredFlangeSpec>().ToArray();var left=typed.SingleOrDefault(f=>f.Side.Equals("Left",StringComparison.OrdinalIgnoreCase));var right=typed.SingleOrDefault(f=>f.Side.Equals("Right",StringComparison.OrdinalIgnoreCase));
+ if(left is null||right is null||typed.Length!=2)return Failure("M1 authored lowering requires exactly one Base.Left and one Base.Right flange.");
+ if(Math.Abs(left.AngleRadians-Math.PI/2)>1e-8||Math.Abs(right.AngleRadians-Math.PI/2)>1e-8)return Failure("M1 formed topology supports 90 degree two-flange channels only; other angles remain typed unsupported.");
+ if(left.InsideRadius<0||right.InsideRadius<0||Math.Abs(left.InsideRadius-right.InsideRadius)>1e-8)return Failure("M1 formed topology requires equal non-negative inside radii on both flanges.");
+ if(left.Length<=left.InsideRadius+thickness||right.Length<=right.InsideRadius+thickness)return Failure("Flange length must exceed inside radius plus thickness.");
+ var holes=Regex.Matches(clean,@"\bHole\s+(?<name>[A-Za-z_][A-Za-z0-9_]*)\s*\{(?<body>.*?)\}",Rx).Cast<Match>().Select(ParseHole).ToArray();
+ if(holes.Any(h=>h is null))return Failure("Each hole requires On: Base, Center: (xmm, ymm), and Diameter.");
+ var typedHoles=holes.Cast<AuthoredHoleSpec>().ToArray();if(typedHoles.Any(h=>h.Diameter<=0||h.X-h.Diameter/2<=0||h.X+h.Diameter/2>=width||h.Y-h.Diameter/2<=0||h.Y+h.Diameter/2>=depth))return Failure("Authored holes must have positive diameter and remain strictly inside the base boundary.");
+ var spec=new SheetMetalAuthoringSpec(header.Groups["name"].Value,thickness,width,depth,material,k,left,right,typedHoles);
+ var bodyResult=AuthoredUChannelBrepBuilder.Build(spec);if(!bodyResult.IsSuccess||bodyResult.Value is null)return new(false,spec,null,null,bodyResult.Diagnostics.Select(d=>new SheetMetalDiagnostic("sheetmetal-formed-brep-failed",SheetMetalDiagnosticSeverity.Error,d.Message)).ToArray());
+ var part=CreatePart(spec,bodyResult.Value,sourcePath);var flat=SheetMetalFlattener.Flatten(part);return new(true,spec,part,flat,part.Diagnostics.Concat(flat.Diagnostics).ToArray());
+ }
+
+ private static SheetMetalPartIr CreatePart(SheetMetalAuthoringSpec s,BrepBody body,string sourcePath)
+ {
+ var t=s.Thickness;var r=s.Left.InsideRadius;var zAxis=new Vector3D(0,0,1);var yAxis=new Vector3D(0,1,0);var xAxis=new Vector3D(1,0,0);var midZ=t/2;
+ var baseRegion=new SheetRegionIr("region-base",SheetRegionKind.Planar,new(DevelopabilityKind.Developable,"authored analytic plane",0,0,"Authored planar base."),new(new(0,0,midZ),zAxis,xAxis,yAxis,true),null,[new(0,0,midZ),new(s.BaseWidth,0,midZ),new(s.BaseWidth,s.BaseDepth,midZ),new(0,s.BaseDepth,midZ)],s.BaseWidth*s.BaseDepth,new("Firmament declaration","authored semantics",[],[],sourcePath),[new(SheetEvidenceKind.Authored,"base-region","High-level Rectangle base declaration.")]);
+ var leftX=-(r+t/2);var rightX=s.BaseWidth+r+t/2;var leftRegion=new SheetRegionIr("region-left-flange",SheetRegionKind.Planar,new(DevelopabilityKind.Developable,"authored analytic plane",0,0,"Authored planar flange."),new(new(leftX,0,r+t),new(-1,0,0),yAxis,zAxis,true),null,[new(leftX,0,r+t),new(leftX,s.BaseDepth,r+t),new(leftX,s.BaseDepth,s.Left.Length),new(leftX,0,s.Left.Length)],s.BaseDepth*(s.Left.Length-r-t),new("Firmament declaration","authored semantics",[],[],sourcePath),[new(SheetEvidenceKind.Authored,"flange","Base.Left flange declaration.")]);
+ var rightRegion=new SheetRegionIr("region-right-flange",SheetRegionKind.Planar,new(DevelopabilityKind.Developable,"authored analytic plane",0,0,"Authored planar flange."),new(new(rightX,0,r+t),new(1,0,0),yAxis,zAxis,true),null,[new(rightX,0,r+t),new(rightX,0,s.Right.Length),new(rightX,s.BaseDepth,s.Right.Length),new(rightX,s.BaseDepth,r+t)],s.BaseDepth*(s.Right.Length-r-t),new("Firmament declaration","authored semantics",[],[],sourcePath),[new(SheetEvidenceKind.Authored,"flange","Base.Right flange declaration.")]);
+ SheetRegionIr bendRegion(string id,double x)=>new(id,SheetRegionKind.CylindricalBend,new(DevelopabilityKind.Developable,"authored analytic cylinder",0,0,"Authored cylindrical bend."),null,new(new(x,s.BaseDepth/2d,r+t),yAxis,r+t/2,r,Math.PI/2,s.BaseDepth,true),[],Math.PI/2*(r+t/2)*s.BaseDepth,new("Firmament declaration","authored semantics",[],[],sourcePath),[new(SheetEvidenceKind.Authored,"bend-region","90 degree cylindrical bend declaration.")]);
+ var leftBendRegion=bendRegion("region-left-bend",0);var rightBendRegion=bendRegion("region-right-bend",s.BaseWidth);
+ SheetBendIr bend(string id,double x,string a,string b,AuthoredFlangeSpec flange)=>new(id,new(x,s.BaseDepth/2d,r+t),yAxis,flange.AngleRadians,r,t,flange.Direction,a,b,SheetNeutralAxisPolicy.KFactorPolicy(s.KFactor),new("Firmament declaration","authored semantics",[],[],sourcePath),[new(SheetEvidenceKind.Authored,"bend","Axis, angle, radius, direction, and adjacency authored explicitly.")]);
+ var bends=new[]{bend("bend-left",0,"region-base","region-left-flange",s.Left),bend("bend-right",s.BaseWidth,"region-base","region-right-flange",s.Right)};
+ var features=s.Holes.Select(h=>new SheetFeatureIr($"feature-{h.Name}",SheetFeatureKind.CircularHole,"region-base",new(h.X,h.Y,midZ),h.Diameter,[],new("Firmament declaration","authored semantics",[],[],sourcePath),[new(SheetEvidenceKind.Authored,"through-hole","Authored Base circular through-hole.",h.Diameter)])).ToArray();
+ var policy=new SheetMetalFlattenPolicy(s.KFactor);return new($"sheetmetal-{s.Name}",t,s.Material,"region-base",[baseRegion,leftRegion,rightRegion,leftBendRegion,rightBendRegion],bends,features,policy,SheetMetalRecognitionStatus.Complete,"Firmament V2 SheetMetal authored semantics",[new(SheetEvidenceKind.Authored,"constant-thickness","Thickness is an authored domain value.",t),new(SheetEvidenceKind.Authored,"stationary-region","Base region authored explicitly.")],[],body);
+ }
+
+ private static AuthoredFlangeSpec? ParseFlange(Match m){var b=m.Groups["body"].Value;var from=Regex.Match(b,@"\bFrom\s*:\s*Base\.(?<side>Left|Right)\s*;",Rx);if(!from.Success||!TryScalar(b,"Length","mm",out var len)||!TryScalar(b,"Angle","deg",out var deg)||!TryScalar(b,"InsideRadius","mm",out var r))return null;var direction=Regex.Match(b,@"\bDirection\s*:\s*(?<d>Up|Down)\s*;",Rx) is {Success:true} d&&d.Groups["d"].Value.Equals("Down",StringComparison.OrdinalIgnoreCase)?SheetBendDirection.Down:SheetBendDirection.Up;return new(m.Groups["name"].Value,from.Groups["side"].Value,len,deg*Math.PI/180d,r,direction);}
+ private static AuthoredHoleSpec? ParseHole(Match m){var b=m.Groups["body"].Value;if(!Regex.IsMatch(b,@"\bOn\s*:\s*Base\s*;",Rx)||!TryScalar(b,"Diameter","mm",out var d))return null;var c=Regex.Match(b,@"\bCenter\s*:\s*\(\s*(?<x>[+-]?[0-9.]+)\s*mm\s*,\s*(?<y>[+-]?[0-9.]+)\s*mm\s*\)\s*;",Rx);return c.Success?new(m.Groups["name"].Value,Num(c,"x"),Num(c,"y"),d):null;}
+ private static bool TryScalar(string text,string name,string? unit,out double value){var suffix=unit is null?string.Empty:@"\s*"+Regex.Escape(unit);var m=Regex.Match(text,@"\b"+Regex.Escape(name)+@"\s*:\s*(?<v>[+-]?[0-9]+(?:\.[0-9]+)?)"+suffix+@"\s*;",Rx);value=m.Success?Num(m,"v"):0;return m.Success;}
+ private static double Num(Match m,string group)=>double.Parse(m.Groups[group].Value,NumberStyles.Float,CultureInfo.InvariantCulture);
+ private static SheetMetalAuthoringResult Failure(string message)=>new(false,null,null,null,[new("sheetmetal-firmament-invalid",SheetMetalDiagnosticSeverity.Error,message)]);
+}
+
+internal static class AuthoredUChannelBrepBuilder
+{
+ private enum EdgeKind{Line,Arc}
+ private sealed record CrossEdge(Point3D Start,Point3D End,EdgeKind Kind,Point3D? Center,double Radius,Vector3D? Axis,bool Inner=false);
+ private readonly record struct Use(EdgeId Edge,bool Reverse);
+ private static readonly Direction3D PlusX=Direction3D.Create(new Vector3D(1,0,0));private static readonly Direction3D PlusY=Direction3D.Create(new Vector3D(0,1,0));private static readonly Direction3D MinusY=Direction3D.Create(new Vector3D(0,-1,0));private static readonly Direction3D PlusZ=Direction3D.Create(new Vector3D(0,0,1));
+
+ public static KernelResult<BrepBody> Build(SheetMetalAuthoringSpec s)
+ {
+ var t=s.Thickness;var r=s.Left.InsideRadius;var ro=r+t;var w=s.BaseWidth;var d=s.BaseDepth;var ll=s.Left.Length;var lr=s.Right.Length;
+ var p=new[]{new Point3D(-ro,0,ll),new(-ro,0,ro),new(0,0,0),new(w,0,0),new(w+ro,0,ro),new(w+ro,0,lr),new(w+r,0,lr),new(w+r,0,ro),new(w,0,t),new(0,0,t),new(-r,0,ro),new(-r,0,ll)};
+ var edgeSpec=new[]{Line(0,1),Arc(1,2,new(0,0,ro),ro,MinusY.ToVector()),Line(2,3),Arc(3,4,new(w,0,ro),ro,MinusY.ToVector()),Line(4,5),Line(5,6),Line(6,7),Arc(7,8,new(w,0,ro),r,PlusY.ToVector(),true),Line(8,9),Arc(9,10,new(0,0,ro),r,PlusY.ToVector(),true),Line(10,11),Line(11,0)};
+ var b=new TopologyBuilder();var g=new BrepGeometryStore();var bindings=new BrepBindingModel();var points=new Dictionary<VertexId,Point3D>();var v0=new VertexId[p.Length];var v1=new VertexId[p.Length];
+ for(var i=0;i<p.Length;i++){v0[i]=b.AddVertex();v1[i]=b.AddVertex();points[v0[i]]=p[i];points[v1[i]]=p[i]+new Vector3D(0,d,0);}
+ var e0=new EdgeId[p.Length];var e1=new EdgeId[p.Length];var ey=new EdgeId[p.Length];for(var i=0;i<p.Length;i++){var n=(i+1)%p.Length;e0[i]=b.AddEdge(v0[i],v0[n]);e1[i]=b.AddEdge(v1[i],v1[n]);ey[i]=b.AddEdge(v0[i],v1[i]);BindCross(e0[i],edgeSpec[i],0);BindCross(e1[i],edgeSpec[i],d);BindLine(ey[i],points[v0[i]],points[v1[i]]);}
+ var bottomHoles=new List<EdgeId>();var topHoles=new List<EdgeId>();foreach(var h in s.Holes){bottomHoles.Add(AddCircle(h.X,h.Y,0,h.Diameter/2));topHoles.Add(AddCircle(h.X,h.Y,t,h.Diameter/2));}
+ var faces=new List<FaceId>();var start=AddFace([[..e0.Select(x=>new Use(x,false))]]);BindPlane(start,new(0,0,0),MinusY,PlusX);faces.Add(start);var end=AddFace([[..e1.Reverse().Select(x=>new Use(x,true))]]);BindPlane(end,new(0,d,0),PlusY,PlusX);faces.Add(end);
+ for(var i=0;i<p.Length;i++){var n=(i+1)%p.Length;var loops=new List<IReadOnlyList<Use>> { new Use[] { new(e0[i],false),new(ey[n],false),new(e1[i],true),new(ey[i],true) } };if(i==2)loops.AddRange(bottomHoles.Select(e=>(IReadOnlyList<Use>)new Use[] { new(e,true) }));if(i==8)loops.AddRange(topHoles.Select(e=>(IReadOnlyList<Use>)new Use[] { new(e,false) }));var face=AddFace(loops);BindSide(face,edgeSpec[i]);faces.Add(face);}
+ for(var i=0;i<bottomHoles.Count;i++){var face=AddFace([[new(bottomHoles[i],false)],[new(topHoles[i],true)]]);var h=s.Holes[i];BindSurface(face,SurfaceGeometry.FromCylinder(new CylinderSurface(new(h.X,h.Y,0),PlusZ,h.Diameter/2,PlusX)),false);faces.Add(face);}
+ var shell=b.AddShell(faces);b.AddBody([shell]);var body=new BrepBody(b.Model,g,bindings,points);var preflight=BrepExportPreflight.Validate(body);if(!preflight.IsValid)return KernelResult<BrepBody>.Failure(preflight.Diagnostics.Where(x=>x.Severity==BrepExportPreflightSeverity.Error).Select(x=>new Aetheris.Kernel.Core.Diagnostics.KernelDiagnostic(Aetheris.Kernel.Core.Diagnostics.KernelDiagnosticCode.ValidationFailed,Aetheris.Kernel.Core.Diagnostics.KernelDiagnosticSeverity.Error,$"{x.Code}: {x.Message}",x.Context)).ToArray());return KernelResult<BrepBody>.Success(body);
+
+ CrossEdge Line(int a,int q)=>new(p[a],p[q],EdgeKind.Line,null,0,null);CrossEdge Arc(int a,int q,Point3D c,double radius,Vector3D axis,bool inner=false)=>new(p[a],p[q],EdgeKind.Arc,c,radius,axis,inner);
+ void BindCross(EdgeId edge,CrossEdge spec,double y){var a=spec.Start+new Vector3D(0,y,0);var q=spec.End+new Vector3D(0,y,0);if(spec.Kind==EdgeKind.Line){BindCurve(edge,CurveGeometry.FromLine(new Line3Curve(a,Direction3D.Create(q-a))),0,(q-a).Length);}else{var center=spec.Center!.Value+new Vector3D(0,y,0);BindCurve(edge,CurveGeometry.FromCircle(new Circle3Curve(center,Direction3D.Create(spec.Axis!.Value),spec.Radius,Direction3D.Create(a-center))),0,Math.PI/2);}}
+ void BindLine(EdgeId edge,Point3D a,Point3D q)=>BindCurve(edge,CurveGeometry.FromLine(new Line3Curve(a,Direction3D.Create(q-a))),0,(q-a).Length);
+ EdgeId AddCircle(double x,double y,double z,double radius){var vertex=b.AddVertex();points[vertex]=new Point3D(x+radius,y,z);var edge=b.AddEdge(vertex,vertex);BindCurve(edge,CurveGeometry.FromCircle(new Circle3Curve(new(x,y,z),PlusZ,radius,PlusX)),0,2*Math.PI);return edge;}
+ void BindCurve(EdgeId edge,CurveGeometry curve,double from,double to){var id=new CurveGeometryId(g.Curves.Count()+1);g.AddCurve(id,curve);bindings.AddEdgeBinding(new(edge,id,new(from,to)));}
+ FaceId AddFace(IReadOnlyList<IReadOnlyList<Use>> loops){var ids=new List<LoopId>();foreach(var uses in loops){var loop=b.AllocateLoopId();var co=uses.Select(_=>b.AllocateCoedgeId()).ToArray();for(var i=0;i<co.Length;i++)b.AddCoedge(new(co[i],uses[i].Edge,loop,co[(i+1)%co.Length],co[(i+co.Length-1)%co.Length],uses[i].Reverse));b.AddLoop(new Loop(loop,co));ids.Add(loop);}return b.AddFace(ids);}
+ void BindSide(FaceId face,CrossEdge spec){if(spec.Kind==EdgeKind.Arc){BindSurface(face,SurfaceGeometry.FromCylinder(new CylinderSurface(spec.Center!.Value,PlusY,spec.Radius,Direction3D.Create(spec.Start-spec.Center.Value))),!spec.Inner);}else{var direction=spec.End-spec.Start;var normal=Direction3D.Create(direction.Cross(PlusY.ToVector()));var u=Math.Abs(normal.ToVector().Dot(PlusY.ToVector()))>.99?PlusX:PlusY;BindSurface(face,SurfaceGeometry.FromPlane(new PlaneSurface(spec.Start,normal,u)));}}
+ void BindPlane(FaceId face,Point3D origin,Direction3D normal,Direction3D u)=>BindSurface(face,SurfaceGeometry.FromPlane(new PlaneSurface(origin,normal,u)));
+ void BindSurface(FaceId face,SurfaceGeometry surface,bool same=true){var id=new SurfaceGeometryId(g.Surfaces.Count()+1);g.AddSurface(id,surface);bindings.AddFaceBinding(new(face,id,same));}
+ }
+}
diff --git a/Aetheris.SheetMetal/SheetMetalFlatPatternValidation.cs b/Aetheris.SheetMetal/SheetMetalFlatPatternValidation.cs
new file mode 100644
index 00000000..9e7d37bb
--- /dev/null
+++ b/Aetheris.SheetMetal/SheetMetalFlatPatternValidation.cs
@@ -0,0 +1,58 @@
+using Aetheris.Kernel.Core.Math;
+
+namespace Aetheris.SheetMetal;
+
+public sealed record SheetMetalFlatPatternValidationReport(
+ bool Finite,
+ bool LoopsClosed,
+ bool FeaturesContained,
+ IReadOnlyList<(string A,string B)> Overlaps,
+ FlatPatternStatus Status,
+ IReadOnlyList<SheetMetalDiagnostic> Diagnostics);
+
+public static class SheetMetalFlatPatternValidation
+{
+ public static SheetMetalFlatPatternValidationReport Validate(SheetMetalFlatPatternIr flat)
+ {
+ ArgumentNullException.ThrowIfNull(flat);var diagnostics=new List<SheetMetalDiagnostic>();
+ var finite=flat.Regions2D.SelectMany(r=>r.Boundary).Concat(flat.CutLoops.SelectMany(c=>c.Boundary)).All(p=>double.IsFinite(p.X)&&double.IsFinite(p.Y));
+ if(!finite)diagnostics.Add(new(SheetMetalDiagnosticCodes.FeatureMappingFailure,SheetMetalDiagnosticSeverity.Error,"Flat pattern contains non-finite coordinates."));
+ var closed=flat.Regions2D.All(r=>r.Boundary.Count>=3)&&flat.CutLoops.All(c=>c.Boundary.Count>=3);
+ if(!closed)diagnostics.Add(new(SheetMetalDiagnosticCodes.FeatureMappingFailure,SheetMetalDiagnosticSeverity.Error,"A flat region or cut loop has fewer than three boundary points."));
+ var overlaps=FindOverlaps(flat.Regions2D.Where(r=>r.Kind==SheetRegionKind.Planar).ToArray());
+ if(overlaps.Count>0)diagnostics.Add(new(SheetMetalDiagnosticCodes.FlatOverlap,SheetMetalDiagnosticSeverity.Error,$"Flat planar regions overlap: {string.Join(", ",overlaps.Select(x=>$"{x.A}/{x.B}"))}."));
+ var contained=flat.CutLoops.All(c=>flat.Regions2D.Any(r=>r.SourceRegionId==c.SourceRegionId&&c.Boundary.All(p=>PointInConvex(p,r.Boundary))));
+ if(!contained)diagnostics.Add(new(SheetMetalDiagnosticCodes.FeatureMappingFailure,SheetMetalDiagnosticSeverity.Warning,"One or more cut loops are not contained by their owning flat region."));
+ var status=!finite||!closed?FlatPatternStatus.Unsupported:overlaps.Count>0?FlatPatternStatus.Overlapping:flat.Status;
+ return new(finite,closed,contained,overlaps,status,diagnostics);
+ }
+
+ public static IReadOnlyList<(string A,string B)> FindOverlaps(IReadOnlyList<FlatRegion2D> regions)
+ {
+ var result=new List<(string,string)>();for(var i=0;i<regions.Count;i++)for(var j=i+1;j<regions.Count;j++)if(Overlap(regions[i].Boundary,regions[j].Boundary))result.Add((regions[i].SourceRegionId,regions[j].SourceRegionId));return result;
+ }
+ private static bool Overlap(IReadOnlyList<SheetPoint2>a,IReadOnlyList<SheetPoint2>b){if(a.Count<3||b.Count<3)return false;foreach(var axis in Axes(a).Concat(Axes(b))){var aa=a.Select(p=>Dot(p,axis)).ToArray();var bb=b.Select(p=>Dot(p,axis)).ToArray();if(Math.Min(aa.Max(),bb.Max())-Math.Max(aa.Min(),bb.Min())<=1e-7)return false;}return true;}
+ private static IEnumerable<SheetPoint2> Axes(IReadOnlyList<SheetPoint2>p){for(var i=0;i<p.Count;i++){var e=Sub(p[(i+1)%p.Count],p[i]);var axis=new SheetPoint2(-e.Y,e.X);var len=Math.Sqrt(Dot(axis,axis));yield return len<=1e-12?new(1,0):new(axis.X/len,axis.Y/len);}}
+ private static bool PointInConvex(SheetPoint2 p,IReadOnlyList<SheetPoint2>poly){if(poly.Count<3)return false;double? sign=null;for(var i=0;i<poly.Count;i++){var a=poly[i];var b=poly[(i+1)%poly.Count];var c=(b.X-a.X)*(p.Y-a.Y)-(b.Y-a.Y)*(p.X-a.X);if(Math.Abs(c)<=1e-7)continue;var s=Math.Sign(c);if(sign is null)sign=s;else if(sign!=s)return false;}return true;}
+ private static SheetPoint2 Sub(SheetPoint2 a,SheetPoint2 b)=>new(a.X-b.X,a.Y-b.Y);private static double Dot(SheetPoint2 a,SheetPoint2 b)=>a.X*b.X+a.Y*b.Y;
+}
+
+public sealed record SheetMetalRoundTripReport(bool IsWithinTolerance,double MaximumPointResidual,double MaximumBendAngleResidual,IReadOnlyList<SheetMetalDiagnostic> Diagnostics);
+
+public static class SheetMetalRoundTrip
+{
+ /// <summary>Reconstructs authored planar reference points from flat mappings and verifies stored bend angles.</summary>
+ public static SheetMetalRoundTripReport ValidateReferenceSurface(SheetMetalPartIr part,SheetMetalFlatPatternIr flat,double tolerance=1e-8)
+ {
+ var maxPoint=0d;var diagnostics=new List<SheetMetalDiagnostic>();
+ foreach(var mapping in flat.SourceToFlatMappings)
+ {
+ var region=part.Regions.First(r=>r.StableId==mapping.SourceRegionId);if(region.Plane is null)continue;
+ foreach(var source in region.Boundary3D){var d=source-mapping.PlaneOrigin;var flatPoint=Add(mapping.FlatOrigin,Add(Scale(mapping.FlatU,d.Dot(mapping.SourceU)),Scale(mapping.FlatV,d.Dot(mapping.SourceV))));if(!TryInverse(mapping,flatPoint,out var u,out var v)){maxPoint=double.PositiveInfinity;continue;}var reconstructed=mapping.PlaneOrigin+mapping.SourceU*u+mapping.SourceV*v;var projected=source-region.Plane.Normal*((source-region.Plane.Origin).Dot(region.Plane.Normal));maxPoint=Math.Max(maxPoint,(reconstructed-projected).Length);}
+ }
+ var maxAngle=0d;foreach(var bend in part.Bends){var a=part.Regions.First(r=>r.StableId==bend.AdjacentRegionA).Plane;var b=part.Regions.First(r=>r.StableId==bend.AdjacentRegionB).Plane;if(a is null||b is null)continue;var angle=Math.Acos(Math.Clamp(Math.Abs(a.Normal.Dot(b.Normal)),-1,1));maxAngle=Math.Max(maxAngle,Math.Abs(angle-bend.BendAngleRadians));}
+ var pass=maxPoint<=tolerance&&maxAngle<=tolerance;if(!pass)diagnostics.Add(new(SheetMetalDiagnosticCodes.UnsupportedBendTopology,SheetMetalDiagnosticSeverity.Error,$"Reference re-fold residuals exceed tolerance {tolerance:G6}: point={maxPoint:G6}, angle={maxAngle:G6}."));return new(pass,maxPoint,maxAngle,diagnostics);
+ }
+ private static bool TryInverse(SourceToFlatMapping m,SheetPoint2 p,out double u,out double v){var q=Sub(p,m.FlatOrigin);var det=m.FlatU.X*m.FlatV.Y-m.FlatU.Y*m.FlatV.X;if(Math.Abs(det)<=1e-14){u=v=0;return false;}u=(q.X*m.FlatV.Y-q.Y*m.FlatV.X)/det;v=(m.FlatU.X*q.Y-m.FlatU.Y*q.X)/det;return true;}
+ private static SheetPoint2 Add(SheetPoint2 a,SheetPoint2 b)=>new(a.X+b.X,a.Y+b.Y);private static SheetPoint2 Sub(SheetPoint2 a,SheetPoint2 b)=>new(a.X-b.X,a.Y-b.Y);private static SheetPoint2 Scale(SheetPoint2 a,double s)=>new(a.X*s,a.Y*s);
+}
diff --git a/Aetheris.SheetMetal/SheetMetalFlattener.cs b/Aetheris.SheetMetal/SheetMetalFlattener.cs
new file mode 100644
index 00000000..dbd897b3
--- /dev/null
+++ b/Aetheris.SheetMetal/SheetMetalFlattener.cs
@@ -0,0 +1,130 @@
+using System.Globalization;
+using System.Text;
+using Aetheris.Kernel.Core.Math;
+
+namespace Aetheris.SheetMetal;
+
+/// <summary>Deterministic analytic unfolding for planar regions connected by cylindrical bends.</summary>
+public static class SheetMetalFlattener
+{
+ private sealed record Mapping(
+ SheetRegionIr Region,
+ SheetPoint2 FlatOrigin,
+ SheetPoint2 FlatU,
+ SheetPoint2 FlatV)
+ {
+ public SheetPoint2 Map(Point3D point)
+ {
+ var plane=Region.Plane!;var d=point-plane.Origin;
+ return Add(FlatOrigin,Add(Scale(FlatU,d.Dot(plane.UAxis)),Scale(FlatV,d.Dot(plane.VAxis))));
+ }
+ public SourceToFlatMapping Public()=>new(Region.StableId,Region.Plane!.Origin,Region.Plane.UAxis,Region.Plane.VAxis,FlatOrigin,FlatU,FlatV);
+ }
+
+ public static SheetMetalFlatPatternIr Flatten(SheetMetalPartIr part, SheetMetalFlattenPolicy? policy = null)
+ {
+ ArgumentNullException.ThrowIfNull(part);policy??=part.FlatPatternPolicy;
+ var diagnostics=new List<SheetMetalDiagnostic>();var evidence=new List<SheetEvidence>();
+ var planar=part.Regions.Where(r=>r.Kind==SheetRegionKind.Planar&&r.Plane is not null).ToDictionary(r=>r.StableId,StringComparer.Ordinal);
+ if(!planar.TryGetValue(part.BaseRegionId,out var baseRegion))return Unsupported("The selected base region is not a planar reference region.");
+
+ var mappings=new Dictionary<string,Mapping>(StringComparer.Ordinal);
+ var baseMap=BaseMapping(baseRegion);mappings[baseRegion.StableId]=baseMap;
+ var pending=new Queue<string>();pending.Enqueue(baseRegion.StableId);
+ var bendRegions=new List<FlatRegion2D>();var bendLines=new List<FlatBendLine>();
+ while(pending.Count>0)
+ {
+ var currentId=pending.Dequeue();var current=mappings[currentId];
+ foreach(var bend in part.Bends.Where(b=>b.AdjacentRegionA==currentId||b.AdjacentRegionB==currentId).OrderBy(b=>b.StableId,StringComparer.Ordinal))
+ {
+ var neighborId=bend.AdjacentRegionA==currentId?bend.AdjacentRegionB:bend.AdjacentRegionA;
+ if(mappings.ContainsKey(neighborId)||!planar.TryGetValue(neighborId,out var neighbor))continue;
+ var allowance=policy.BendAllowance(bend.BendAngleRadians,bend.InsideRadius,bend.Thickness);
+ var axis=Normalize(bend.AxisDirection);var half=Math.Max(FindBendAxisLength(part,bend),1e-6)/2d;
+ var sourceStart=bend.AxisOrigin-axis*half;var sourceEnd=bend.AxisOrigin+axis*half;
+ var seamStart=current.Map(ProjectToPlane(sourceStart,current.Region.Plane!));var seamEnd=current.Map(ProjectToPlane(sourceEnd,current.Region.Plane!));
+ var flatAxis=Normalize(Sub(seamEnd,seamStart));var perp=new SheetPoint2(-flatAxis.Y,flatAxis.X);
+ var seamMid=Scale(Add(seamStart,seamEnd),.5d);var currentCentroid=current.Map(Centroid(current.Region.Boundary3D));
+ var currentSide=Dot(Sub(currentCentroid,seamMid),perp)>=0?1d:-1d;var targetPerp=Scale(perp,-currentSide);
+ var neighborPlane=neighbor.Plane!;var neighborCentroid=Centroid(neighbor.Boundary3D);var neighborAxisPoint=ProjectToPlane(bend.AxisOrigin,neighborPlane);
+ var neighborPerp3=neighborPlane.Normal.Cross(axis);if(!neighborPerp3.TryNormalize(out neighborPerp3))neighborPerp3=neighborPlane.VAxis;
+ if((neighborCentroid-neighborAxisPoint).Dot(neighborPerp3)<0)neighborPerp3=-neighborPerp3;
+ var targetAxis=flatAxis;if(axis.Dot(neighborPlane.UAxis)*Dot(targetAxis,flatAxis)<0)targetAxis=Scale(flatAxis,-1);
+ var targetSeamMid=Add(seamMid,Scale(targetPerp,allowance));
+ var neighborMap=MappingFromAxis(neighbor,axis,neighborPerp3,targetAxis,targetPerp,neighborAxisPoint,targetSeamMid);
+ mappings[neighborId]=neighborMap;pending.Enqueue(neighborId);
+
+ var shiftedStart=Add(seamStart,Scale(targetPerp,allowance));var shiftedEnd=Add(seamEnd,Scale(targetPerp,allowance));
+ bendRegions.Add(new($"flat-{bend.StableId}",bend.StableId,SheetRegionKind.CylindricalBend,[seamStart,seamEnd,shiftedEnd,shiftedStart],"exact neutral-axis cylindrical unroll"));
+ var centerShift=Scale(targetPerp,allowance/2d);
+ bendLines.Add(new(bend.StableId,Add(seamStart,centerShift),Add(seamEnd,centerShift),bend.Direction,bend.BendAngleRadians,bend.InsideRadius,bend.Thickness,policy.KFactor,allowance));
+ evidence.Add(new(SheetEvidenceKind.Derived,"bend-allowance","angle * (inside radius + K * thickness)",allowance,null,bend.Source.FaceIds));
+ }
+ }
+
+ var flatRegions=mappings.Values.OrderBy(m=>m.Region.StableId,StringComparer.Ordinal).Select(m=>new FlatRegion2D(
+ $"flat-{m.Region.StableId}",m.Region.StableId,SheetRegionKind.Planar,NormalizePolygon(m.Region.Boundary3D.Select(m.Map)),"composed analytic plane-to-flat transform")).ToList();
+ flatRegions.AddRange(bendRegions.OrderBy(r=>r.StableId,StringComparer.Ordinal));
+ var cuts=new List<FlatCutLoop>();
+ foreach(var feature in part.Features.OrderBy(f=>f.StableId,StringComparer.Ordinal))
+ {
+ if(!mappings.TryGetValue(feature.OwningRegionId,out var mapping)){diagnostics.Add(new(SheetMetalDiagnosticCodes.FeatureMappingFailure,SheetMetalDiagnosticSeverity.Warning,$"Feature '{feature.StableId}' belongs to an unflattened region."));continue;}
+ IReadOnlyList<SheetPoint2> loop;
+ if(feature.Kind==SheetFeatureKind.CircularHole&&feature.Diameter is { } diameter)
+ {
+ var c=mapping.Map(feature.Center);loop=Enumerable.Range(0,48).Select(i=>{var a=2*Math.PI*i/48d;return new SheetPoint2(c.X+diameter/2d*Math.Cos(a),c.Y+diameter/2d*Math.Sin(a));}).ToArray();
+ }
+ else loop=NormalizePolygon(feature.Boundary3D.Select(mapping.Map));
+ if(loop.Count>=3)cuts.Add(new(feature.StableId,feature.Kind,loop,feature.OwningRegionId));
+ else diagnostics.Add(new(SheetMetalDiagnosticCodes.FeatureMappingFailure,SheetMetalDiagnosticSeverity.Warning,$"Feature '{feature.StableId}' did not yield a closed 2D loop."));
+ }
+
+ if(mappings.Count<planar.Count)diagnostics.Add(new(SheetMetalDiagnosticCodes.DisconnectedGraph,SheetMetalDiagnosticSeverity.Warning,$"Flattened {mappings.Count} of {planar.Count} planar regions in the base-region bend component."));
+ var planarFlat=flatRegions.Where(r=>r.Kind==SheetRegionKind.Planar).ToArray();var overlaps=FindOverlaps(planarFlat);
+ if(overlaps.Count>0)diagnostics.Add(new(SheetMetalDiagnosticCodes.FlatOverlap,SheetMetalDiagnosticSeverity.Error,$"Flattened planar regions overlap: {string.Join(", ",overlaps.Select(x=>$"{x.A}/{x.B}"))}."));
+ var allPoints=flatRegions.SelectMany(r=>r.Boundary).Concat(cuts.SelectMany(c=>c.Boundary)).ToArray();
+ if(allPoints.Any(p=>!double.IsFinite(p.X)||!double.IsFinite(p.Y)))return Unsupported("Flat lowering produced non-finite coordinates.");
+ var bounds=allPoints.Length==0?null:new FlatPatternBounds(allPoints.Min(p=>p.X),allPoints.Min(p=>p.Y),allPoints.Max(p=>p.X),allPoints.Max(p=>p.Y));
+ var boundary=ConvexHull(flatRegions.SelectMany(r=>r.Boundary));
+ var status=overlaps.Count>0?FlatPatternStatus.Overlapping:(mappings.Count<planar.Count||part.RecognitionStatus==SheetMetalRecognitionStatus.Partial?FlatPatternStatus.Partial:FlatPatternStatus.Valid);
+ var hash=Hash(flatRegions,bendLines,cuts,policy,status);
+ return new($"flat-{part.StableId}",status,flatRegions,bendLines.OrderBy(b=>b.BendId,StringComparer.Ordinal).ToArray(),cuts,mappings.Values.OrderBy(m=>m.Region.StableId,StringComparer.Ordinal).Select(m=>m.Public()).ToArray(),boundary,bounds,policy,evidence,diagnostics,hash);
+
+ SheetMetalFlatPatternIr Unsupported(string message)=>new($"flat-{part.StableId}",FlatPatternStatus.Unsupported,[],[],[],[],[],null,policy,[],[new(SheetMetalDiagnosticCodes.UnsupportedBendTopology,SheetMetalDiagnosticSeverity.Error,message)],SheetMetalRecognizer.StableHash(message));
+ }
+
+ private static Mapping BaseMapping(SheetRegionIr region)
+ {
+ var p=region.Plane!;var raw=region.Boundary3D.Select(x=>new SheetPoint2((x-p.Origin).Dot(p.UAxis),(x-p.Origin).Dot(p.VAxis))).ToArray();
+ var minX=raw.Length==0?0:raw.Min(x=>x.X);var minY=raw.Length==0?0:raw.Min(x=>x.Y);
+ return new(region,new(-minX,-minY),new(1,0),new(0,1));
+ }
+
+ private static Mapping MappingFromAxis(SheetRegionIr region,Vector3D sourceAxis,Vector3D sourcePerp,SheetPoint2 flatAxis,SheetPoint2 flatPerp,Point3D anchor,SheetPoint2 target)
+ {
+ var p=region.Plane!;var flatU=Add(Scale(flatAxis,p.UAxis.Dot(sourceAxis)),Scale(flatPerp,p.UAxis.Dot(sourcePerp)));
+ var flatV=Add(Scale(flatAxis,p.VAxis.Dot(sourceAxis)),Scale(flatPerp,p.VAxis.Dot(sourcePerp)));
+ var d=anchor-p.Origin;var contribution=Add(Scale(flatU,d.Dot(p.UAxis)),Scale(flatV,d.Dot(p.VAxis)));
+ return new(region,Sub(target,contribution),flatU,flatV);
+ }
+
+ private static double FindBendAxisLength(SheetMetalPartIr part,SheetBendIr bend)=>part.Regions
+ .Where(r=>r.Cylinder is not null)
+ .OrderBy(r=>(r.Cylinder!.AxisOrigin-bend.AxisOrigin).Length+Math.Abs(r.Cylinder.InsideRadius-bend.InsideRadius)+(1d-Math.Abs(r.Cylinder.AxisDirection.Dot(bend.AxisDirection)))*1000d)
+ .FirstOrDefault()?.Cylinder?.AxisLength??0d;
+ private static Point3D ProjectToPlane(Point3D point,SheetPlaneReference plane)=>point-plane.Normal*((point-plane.Origin).Dot(plane.Normal));
+ private static Point3D Centroid(IReadOnlyList<Point3D> points)=>points.Count==0?Point3D.Origin:new(points.Average(p=>p.X),points.Average(p=>p.Y),points.Average(p=>p.Z));
+ private static IReadOnlyList<SheetPoint2> NormalizePolygon(IEnumerable<SheetPoint2> points)=>ConvexHull(points.DistinctBy(p=>(Math.Round(p.X,9),Math.Round(p.Y,9))));
+
+ private static IReadOnlyList<SheetPoint2> ConvexHull(IEnumerable<SheetPoint2> input)
+ {
+ var p=input.DistinctBy(x=>(Math.Round(x.X,9),Math.Round(x.Y,9))).OrderBy(x=>x.X).ThenBy(x=>x.Y).ToArray();if(p.Length<=2)return p;
+ var lower=new List<SheetPoint2>();foreach(var x in p){while(lower.Count>=2&&Cross(lower[^2],lower[^1],x)<=1e-10)lower.RemoveAt(lower.Count-1);lower.Add(x);}var upper=new List<SheetPoint2>();foreach(var x in p.Reverse()){while(upper.Count>=2&&Cross(upper[^2],upper[^1],x)<=1e-10)upper.RemoveAt(upper.Count-1);upper.Add(x);}return lower.Take(lower.Count-1).Concat(upper.Take(upper.Count-1)).ToArray();
+ }
+ private static IReadOnlyList<(string A,string B)> FindOverlaps(IReadOnlyList<FlatRegion2D> regions){var result=new List<(string,string)>();for(var i=0;i<regions.Count;i++)for(var j=i+1;j<regions.Count;j++)if(PolygonsOverlap(regions[i].Boundary,regions[j].Boundary))result.Add((regions[i].SourceRegionId,regions[j].SourceRegionId));return result;}
+ private static bool PolygonsOverlap(IReadOnlyList<SheetPoint2> a,IReadOnlyList<SheetPoint2>b){if(a.Count<3||b.Count<3)return false;foreach(var axis in Axes(a).Concat(Axes(b))){var aa=a.Select(p=>Dot(p,axis)).ToArray();var bb=b.Select(p=>Dot(p,axis)).ToArray();if(Math.Min(aa.Max(),bb.Max())-Math.Max(aa.Min(),bb.Min())<=1e-7)return false;}return true;}
+ private static IEnumerable<SheetPoint2> Axes(IReadOnlyList<SheetPoint2> p){for(var i=0;i<p.Count;i++){var e=Sub(p[(i+1)%p.Count],p[i]);yield return Normalize(new SheetPoint2(-e.Y,e.X));}}
+ private static string Hash(IReadOnlyList<FlatRegion2D> regions,IReadOnlyList<FlatBendLine>bends,IReadOnlyList<FlatCutLoop>cuts,SheetMetalFlattenPolicy policy,FlatPatternStatus status){var sb=new StringBuilder().Append(status).Append('|').Append(Q(policy.KFactor));foreach(var r in regions.OrderBy(x=>x.StableId,StringComparer.Ordinal)){sb.Append('|').Append(r.StableId);foreach(var p in r.Boundary)sb.Append('|').Append(Q(p.X)).Append(',').Append(Q(p.Y));}foreach(var b in bends.OrderBy(x=>x.BendId,StringComparer.Ordinal))sb.Append('|').Append(b.BendId).Append(':').Append(Q(b.BendAngleRadians)).Append(':').Append(Q(b.BendAllowance));foreach(var c in cuts.OrderBy(x=>x.FeatureId,StringComparer.Ordinal))sb.Append('|').Append(c.FeatureId);return SheetMetalRecognizer.StableHash(sb.ToString());static string Q(double value)=>Math.Round(value,9,MidpointRounding.AwayFromZero).ToString("R",CultureInfo.InvariantCulture);}
+ private static double Cross(SheetPoint2 a,SheetPoint2 b,SheetPoint2 c)=>(b.X-a.X)*(c.Y-a.Y)-(b.Y-a.Y)*(c.X-a.X);
+ private static SheetPoint2 Add(SheetPoint2 a,SheetPoint2 b)=>new(a.X+b.X,a.Y+b.Y);private static SheetPoint2 Sub(SheetPoint2 a,SheetPoint2 b)=>new(a.X-b.X,a.Y-b.Y);private static SheetPoint2 Scale(SheetPoint2 a,double s)=>new(a.X*s,a.Y*s);private static double Dot(SheetPoint2 a,SheetPoint2 b)=>a.X*b.X+a.Y*b.Y;private static SheetPoint2 Normalize(SheetPoint2 a){var l=Math.Sqrt(Dot(a,a));return l<=1e-12?new(1,0):Scale(a,1/l);}private static Vector3D Normalize(Vector3D v)=>v.TryNormalize(out var n)?n:v;
+}
diff --git a/Aetheris.SheetMetal/SheetMetalIr.cs b/Aetheris.SheetMetal/SheetMetalIr.cs
new file mode 100644
index 00000000..2da0ff9c
--- /dev/null
+++ b/Aetheris.SheetMetal/SheetMetalIr.cs
@@ -0,0 +1,226 @@
+using Aetheris.Kernel.Core.Brep;
+using Aetheris.Kernel.Core.Math;
+using Aetheris.Surfacing;
+
+namespace Aetheris.SheetMetal;
+
+public enum SheetMetalRecognitionStatus { Complete, Partial, Unsupported }
+public enum SheetRegionKind { Planar, CylindricalBend, Developable, Unsupported }
+public enum SheetBendDirection { Up, Down, Unknown }
+public enum SheetFeatureKind { CircularHole, ProfileHole, Slot, Cutout, Unsupported }
+public enum SheetEvidenceKind { Authored, Exact, ToleranceBounded, DeterministicHeuristic, Derived, Unsupported }
+public enum FlatPatternStatus { Valid, Overlapping, Partial, Unsupported }
+public enum SheetMetalDiagnosticSeverity { Information, Warning, Error }
+
+public static class SheetMetalDiagnosticCodes
+{
+ public const string NonConstantThickness = "sheetmetal-non-constant-thickness";
+ public const string UnpairedFaces = "sheetmetal-unpaired-sheet-faces";
+ public const string NonDevelopable = "sheetmetal-non-developable-region";
+ public const string AmbiguousBendAxis = "sheetmetal-ambiguous-bend-axis";
+ public const string UnsupportedBendTopology = "sheetmetal-unsupported-bend-topology";
+ public const string InconsistentBendRadius = "sheetmetal-inconsistent-bend-radius";
+ public const string DisconnectedGraph = "sheetmetal-disconnected-sheet-graph";
+ public const string FlatOverlap = "sheetmetal-flat-overlap";
+ public const string FeatureMappingFailure = "sheetmetal-feature-mapping-failure";
+ public const string InvalidRadius = "sheetmetal-invalid-radius";
+ public static IReadOnlyList<string> All { get; } =
+ [NonConstantThickness, UnpairedFaces, NonDevelopable, AmbiguousBendAxis, UnsupportedBendTopology,
+ InconsistentBendRadius, DisconnectedGraph, FlatOverlap, FeatureMappingFailure, InvalidRadius];
+}
+
+public sealed record SheetMetalDiagnostic(
+ string Code,
+ SheetMetalDiagnosticSeverity Severity,
+ string Message,
+ IReadOnlyList<int>? SourceFaceIds = null);
+
+public sealed record SheetEvidence(
+ SheetEvidenceKind Kind,
+ string Predicate,
+ string Basis,
+ double? Measured = null,
+ double? Tolerance = null,
+ IReadOnlyList<int>? SourceFaceIds = null);
+
+public sealed record SheetSourceBinding(
+ string SourceKind,
+ string SourceAuthority,
+ IReadOnlyList<int> FaceIds,
+ IReadOnlyList<int> EdgeIds,
+ string? SourcePath = null);
+
+public sealed record SheetPlaneReference(
+ Point3D Origin,
+ Vector3D Normal,
+ Vector3D UAxis,
+ Vector3D VAxis,
+ bool MaterialPositiveSide);
+
+public sealed record SheetCylinderReference(
+ Point3D AxisOrigin,
+ Vector3D AxisDirection,
+ double GeometricMidRadius,
+ double InsideRadius,
+ double AngularSpanRadians,
+ double AxisLength,
+ bool MaterialOutside);
+
+public sealed record SheetRegionIr(
+ string StableId,
+ SheetRegionKind Kind,
+ DevelopabilityEvidence Developability,
+ SheetPlaneReference? Plane,
+ SheetCylinderReference? Cylinder,
+ IReadOnlyList<Point3D> Boundary3D,
+ double ApproximateArea,
+ SheetSourceBinding Source,
+ IReadOnlyList<SheetEvidence> Evidence);
+
+public sealed record SheetNeutralAxisPolicy(string Kind, double KFactor)
+{
+ public static SheetNeutralAxisPolicy KFactorPolicy(double kFactor) => new("KFactor", kFactor);
+}
+
+public sealed record SheetBendIr(
+ string StableId,
+ Point3D AxisOrigin,
+ Vector3D AxisDirection,
+ double BendAngleRadians,
+ double InsideRadius,
+ double Thickness,
+ SheetBendDirection Direction,
+ string AdjacentRegionA,
+ string AdjacentRegionB,
+ SheetNeutralAxisPolicy NeutralAxisPolicy,
+ SheetSourceBinding Source,
+ IReadOnlyList<SheetEvidence> Evidence);
+
+public sealed record SheetFeatureIr(
+ string StableId,
+ SheetFeatureKind Kind,
+ string OwningRegionId,
+ Point3D Center,
+ double? Diameter,
+ IReadOnlyList<Point3D> Boundary3D,
+ SheetSourceBinding Source,
+ IReadOnlyList<SheetEvidence> Evidence);
+
+public sealed record SheetMetalFlattenPolicy(double KFactor)
+{
+ public static SheetMetalFlattenPolicy Default { get; } = new(0.5d);
+
+ public double NeutralRadius(double insideRadius, double thickness)
+ {
+ Validate(insideRadius, thickness);
+ return insideRadius + KFactor * thickness;
+ }
+
+ public double BendAllowance(double bendAngleRadians, double insideRadius, double thickness)
+ {
+ if (!double.IsFinite(bendAngleRadians) || bendAngleRadians <= 0d)
+ throw new ArgumentOutOfRangeException(nameof(bendAngleRadians));
+ return bendAngleRadians * NeutralRadius(insideRadius, thickness);
+ }
+
+ private void Validate(double radius, double thickness)
+ {
+ if (!double.IsFinite(KFactor) || KFactor < 0d || KFactor > 1d) throw new ArgumentOutOfRangeException(nameof(KFactor));
+ if (!double.IsFinite(radius) || radius < 0d) throw new ArgumentOutOfRangeException(nameof(radius));
+ if (!double.IsFinite(thickness) || thickness <= 0d) throw new ArgumentOutOfRangeException(nameof(thickness));
+ }
+}
+
+public sealed record SheetThicknessPairEvidence(
+ string Family,
+ int FaceA,
+ int FaceB,
+ double Separation,
+ double Residual,
+ bool Admitted);
+
+public sealed record SheetThicknessRecognition(
+ bool IsPlausible,
+ double? NominalThickness,
+ double Tolerance,
+ IReadOnlyList<SheetThicknessPairEvidence> SourcePairs,
+ IReadOnlyList<int> OutlierFaceIds,
+ IReadOnlyList<int> UnsupportedFaceIds,
+ IReadOnlyList<SheetEvidence> Evidence);
+
+public sealed record SheetMetalPartIr(
+ string StableId,
+ double Thickness,
+ string? Material,
+ string BaseRegionId,
+ IReadOnlyList<SheetRegionIr> Regions,
+ IReadOnlyList<SheetBendIr> Bends,
+ IReadOnlyList<SheetFeatureIr> Features,
+ SheetMetalFlattenPolicy FlatPatternPolicy,
+ SheetMetalRecognitionStatus RecognitionStatus,
+ string Provenance,
+ IReadOnlyList<SheetEvidence> Evidence,
+ IReadOnlyList<SheetMetalDiagnostic> Diagnostics,
+ BrepBody? FormedBody = null);
+
+public readonly record struct SheetPoint2(double X, double Y);
+
+public sealed record FlatRegion2D(
+ string StableId,
+ string SourceRegionId,
+ SheetRegionKind Kind,
+ IReadOnlyList<SheetPoint2> Boundary,
+ string MappingKind);
+
+public sealed record FlatBendLine(
+ string BendId,
+ SheetPoint2 Start,
+ SheetPoint2 End,
+ SheetBendDirection Direction,
+ double BendAngleRadians,
+ double InsideRadius,
+ double Thickness,
+ double KFactor,
+ double BendAllowance);
+
+public sealed record FlatCutLoop(
+ string FeatureId,
+ SheetFeatureKind Kind,
+ IReadOnlyList<SheetPoint2> Boundary,
+ string SourceRegionId);
+
+public sealed record SourceToFlatMapping(
+ string SourceRegionId,
+ Point3D PlaneOrigin,
+ Vector3D SourceU,
+ Vector3D SourceV,
+ SheetPoint2 FlatOrigin,
+ SheetPoint2 FlatU,
+ SheetPoint2 FlatV);
+
+public sealed record FlatPatternBounds(double MinX, double MinY, double MaxX, double MaxY)
+{
+ public double Width => MaxX - MinX;
+ public double Height => MaxY - MinY;
+}
+
+public sealed record SheetMetalFlatPatternIr(
+ string StableId,
+ FlatPatternStatus Status,
+ IReadOnlyList<FlatRegion2D> Regions2D,
+ IReadOnlyList<FlatBendLine> BendLines,
+ IReadOnlyList<FlatCutLoop> CutLoops,
+ IReadOnlyList<SourceToFlatMapping> SourceToFlatMappings,
+ IReadOnlyList<SheetPoint2> Boundary,
+ FlatPatternBounds? Bounds,
+ SheetMetalFlattenPolicy Policy,
+ IReadOnlyList<SheetEvidence> Evidence,
+ IReadOnlyList<SheetMetalDiagnostic> Diagnostics,
+ string DeterministicHash);
+
+public sealed record SheetMetalRecognitionResult(
+ SheetMetalPartIr? Part,
+ SheetThicknessRecognition Thickness,
+ IReadOnlyList<SheetMetalDiagnostic> Diagnostics,
+ TimeSpan ImportTime,
+ TimeSpan RecognitionTime);
diff --git a/Aetheris.SheetMetal/SheetMetalManufacturingArtifacts.cs b/Aetheris.SheetMetal/SheetMetalManufacturingArtifacts.cs
new file mode 100644
index 00000000..67b9d512
--- /dev/null
+++ b/Aetheris.SheetMetal/SheetMetalManufacturingArtifacts.cs
@@ -0,0 +1,151 @@
+using System.Globalization;
+using System.Text;
+using Aetheris.Kernel.Core.Brep;
+using Aetheris.Kernel.Core.Math;
+using Aetheris.Kernel.Core.Step242;
+using Aetheris.Kernel.Firmament.Materializer;
+
+namespace Aetheris.SheetMetal;
+
+public sealed record SheetMetalFlatBodyResult(
+ bool IsSuccess,
+ BrepBody? Body,
+ IReadOnlyList<SheetMetalDiagnostic> Diagnostics);
+
+/// <summary>Manufacturing artifact lowering from one authoritative flat-pattern IR.</summary>
+public static class SheetMetalManufacturingArtifacts
+{
+ public static SheetMetalFlatBodyResult BuildFlatBody(SheetMetalPartIr part, SheetMetalFlatPatternIr flat)
+ {
+ ArgumentNullException.ThrowIfNull(part);
+ ArgumentNullException.ThrowIfNull(flat);
+ if (flat.Status is FlatPatternStatus.Unsupported or FlatPatternStatus.Overlapping)
+ return Failure("Flat STEP requires a non-overlapping, supported flat pattern.");
+
+ var profiles = new Dictionary<string, ResolvedProfile2D>(StringComparer.Ordinal);
+ var operations = new List<PrismaticProfileOperation>();
+ var shift = flat.Bounds is null ? new SheetPoint2(10, 10) : new SheetPoint2(10 - flat.Bounds.MinX, 10 - flat.Bounds.MinY);
+ var materialRegions = flat.Regions2D.Where(r => r.Boundary.Count >= 3).OrderBy(r => r.StableId, StringComparer.Ordinal).ToArray();
+ for (var index = 0; index < materialRegions.Length; index++)
+ {
+ var region = materialRegions[index];
+ var name = $"material_{index:D3}";
+ profiles[name] = Profile(name, region.Boundary, shift);
+ operations.Add(new(name, index == 0 ? PrismaticProfileIntent.Base : PrismaticProfileIntent.Add, name, 0, part.Thickness,
+ region.Kind == SheetRegionKind.CylindricalBend ? "NeutralAxisBendStrip" : "FlatSheetRegion", region.SourceRegionId));
+ }
+ for (var index = 0; index < flat.CutLoops.Count; index++)
+ {
+ var cut = flat.CutLoops[index];
+ if (cut.Boundary.Count < 3) continue;
+ var name = $"cut_{index:D3}";
+ profiles[name] = Profile(name, cut.Boundary, shift);
+ operations.Add(new(name, PrismaticProfileIntent.Remove, name, 0, part.Thickness, "ThroughCut", cut.FeatureId, cut.FeatureId, cut.Kind.ToString()));
+ }
+ if (materialRegions.Length == 0) return Failure("Flat pattern contains no bounded material regions.");
+
+ var placement = new PrismaticProfilePlacement("FlatPatternPlacement", 0, 0, 0, "XY", "+Z", "+X", true);
+ var feature = new PrismaticProfileCompositionFeature(
+ $"flat_{Safe(part.StableId)}", "XY", "+Z", placement, operations, [0, part.Thickness],
+ $"SheetMetalFlatPatternIr:{flat.DeterministicHash}");
+ var parsed = new PrismaticProfileCompositionParseResult(feature, profiles, []);
+ var stack = PrismaticSectionStackCompiler.Normalize(parsed, out var normalizeDiagnostics);
+ if (stack is null)
+ return Failure("Flat profile union could not be normalized: " + string.Join("; ", normalizeDiagnostics));
+ var emission = PrismaticSectionStackEmitter.Emit(stack);
+ if (emission.Body is null)
+ return Failure("Flat profile BRep materialization failed: " + string.Join("; ", emission.Diagnostics));
+ var preflight = BrepExportPreflight.Validate(emission.Body);
+ if (!preflight.IsValid)
+ return Failure("Flat profile BRep failed STEP preflight: " + string.Join("; ", preflight.Diagnostics.Select(d => $"{d.Code}: {d.Message}")));
+ return new(true, emission.Body, emission.Diagnostics.Select(d => new SheetMetalDiagnostic("sheetmetal-flat-step-note", SheetMetalDiagnosticSeverity.Information, d)).ToArray());
+ }
+
+ public static bool WriteFlatStep(string path, SheetMetalPartIr part, SheetMetalFlatPatternIr flat, out IReadOnlyList<SheetMetalDiagnostic> diagnostics)
+ {
+ var body = BuildFlatBody(part, flat);
+ if (!body.IsSuccess || body.Body is null) { diagnostics = body.Diagnostics; return false; }
+ var exported = Step242Exporter.ExportBody(body.Body, new Step242ExportOptions
+ {
+ ProductId = Safe(part.StableId) + "_flat",
+ ProductName = part.StableId + " flat pattern",
+ BrepExportPreflightMode = BrepExportPreflightMode.Enforce
+ });
+ if (!exported.IsSuccess)
+ {
+ diagnostics = exported.Diagnostics.Select(d => new SheetMetalDiagnostic("sheetmetal-flat-step-export-failed", SheetMetalDiagnosticSeverity.Error, d.Message)).ToArray();
+ return false;
+ }
+ var full = Path.GetFullPath(path); Directory.CreateDirectory(Path.GetDirectoryName(full)!); File.WriteAllText(full, exported.Value);
+ diagnostics = body.Diagnostics;
+ return true;
+ }
+
+ public static string WriteRecoveredFirmament(SheetMetalPartIr part, string sourceStepPath)
+ {
+ ArgumentNullException.ThrowIfNull(part);
+ var c = CultureInfo.InvariantCulture;
+ var b = new StringBuilder();
+ b.AppendLine("// Generated recovered Sheet Metal intent. Source STEP geometry is referenced, not embedded or mutated.");
+ b.Append("SheetMetal ").Append(Safe(part.StableId)).AppendLine(" {");
+ b.Append(" Thickness: ").Append(part.Thickness.ToString("R", c)).AppendLine("mm;");
+ b.Append(" KFactor: ").Append(part.FlatPatternPolicy.KFactor.ToString("R", c)).AppendLine(";");
+ b.Append(" RecoveryStatus: ").Append(part.RecognitionStatus).AppendLine(";");
+ b.Append(" RecoverySource: \"").Append(Escape(sourceStepPath.Replace('\\', '/'))).AppendLine("\";");
+ b.Append(" BaseRegion: \"").Append(Escape(part.BaseRegionId)).AppendLine("\";");
+ foreach (var region in part.Regions.OrderBy(r => r.StableId, StringComparer.Ordinal))
+ {
+ b.Append(" RecoveredRegion \"").Append(Escape(region.StableId)).AppendLine("\" {");
+ b.Append(" Kind: ").Append(region.Kind).AppendLine(";");
+ b.Append(" Area: ").Append(region.ApproximateArea.ToString("R", c)).AppendLine("mm2;");
+ if (region.Plane is { } p)
+ {
+ Field("PlaneOrigin", p.Origin); VectorField("PlaneNormal", p.Normal); VectorField("PlaneU", p.UAxis); VectorField("PlaneV", p.VAxis);
+ b.Append(" MaterialPositiveSide: ").Append(p.MaterialPositiveSide.ToString().ToLowerInvariant()).AppendLine(";");
+ }
+ if (region.Cylinder is { } cylinder)
+ {
+ Field("AxisOrigin", cylinder.AxisOrigin); VectorField("AxisDirection", cylinder.AxisDirection);
+ Scalar("MidRadius", cylinder.GeometricMidRadius, "mm"); Scalar("InsideRadius", cylinder.InsideRadius, "mm");
+ Scalar("AngularSpan", cylinder.AngularSpanRadians * 180 / Math.PI, "deg"); Scalar("AxisLength", cylinder.AxisLength, "mm");
+ b.Append(" MaterialOutside: ").Append(cylinder.MaterialOutside.ToString().ToLowerInvariant()).AppendLine(";");
+ }
+ Points("Boundary", region.Boundary3D); Ints("SourceFaces", region.Source.FaceIds); b.AppendLine(" }");
+ }
+ foreach (var bend in part.Bends.OrderBy(x => x.StableId, StringComparer.Ordinal))
+ {
+ b.Append(" RecoveredBend \"").Append(Escape(bend.StableId)).AppendLine("\" {");
+ Field("AxisOrigin", bend.AxisOrigin); VectorField("AxisDirection", bend.AxisDirection); Scalar("Angle", bend.BendAngleRadians * 180 / Math.PI, "deg");
+ Scalar("InsideRadius", bend.InsideRadius, "mm"); b.Append(" Direction: ").Append(bend.Direction).AppendLine(";");
+ b.Append(" Between: [\"").Append(Escape(bend.AdjacentRegionA)).Append("\", \"").Append(Escape(bend.AdjacentRegionB)).AppendLine("\"];");
+ Ints("SourceFaces", bend.Source.FaceIds); b.AppendLine(" }");
+ }
+ foreach (var cut in part.Features.OrderBy(x => x.StableId, StringComparer.Ordinal))
+ {
+ b.Append(" RecoveredCut \"").Append(Escape(cut.StableId)).AppendLine("\" {");
+ b.Append(" Kind: ").Append(cut.Kind).AppendLine(";"); b.Append(" On: \"").Append(Escape(cut.OwningRegionId)).AppendLine("\";"); Field("Center", cut.Center);
+ if (cut.Diameter is { } diameter) Scalar("Diameter", diameter, "mm"); Points("Boundary", cut.Boundary3D); Ints("SourceFaces", cut.Source.FaceIds); b.AppendLine(" }");
+ }
+ b.AppendLine("}"); return b.ToString().Replace("\r\n", "\n", StringComparison.Ordinal);
+
+ void Scalar(string name, double value, string unit) => b.Append(" ").Append(name).Append(": ").Append(value.ToString("R", c)).Append(unit).AppendLine(";");
+ void Field(string name, Point3D p) => b.Append(" ").Append(name).Append(": (").Append(p.X.ToString("R", c)).Append("mm, ").Append(p.Y.ToString("R", c)).Append("mm, ").Append(p.Z.ToString("R", c)).AppendLine("mm);");
+ void VectorField(string name, Aetheris.Kernel.Core.Math.Vector3D v) => b.Append(" ").Append(name).Append(": (").Append(v.X.ToString("R", c)).Append(", ").Append(v.Y.ToString("R", c)).Append(", ").Append(v.Z.ToString("R", c)).AppendLine(");");
+ void Points(string name, IReadOnlyList<Aetheris.Kernel.Core.Math.Point3D> points) { b.Append(" ").Append(name).Append(": ["); b.Append(string.Join(", ", points.Select(p => $"({p.X.ToString("R", c)}mm, {p.Y.ToString("R", c)}mm, {p.Z.ToString("R", c)}mm)"))); b.AppendLine("];"); }
+ void Ints(string name, IReadOnlyList<int> values) => b.Append(" ").Append(name).Append(": [").Append(string.Join(", ", values)).AppendLine("];");
+ }
+
+ private static ResolvedProfile2D Profile(string name, IReadOnlyList<SheetPoint2> source, SheetPoint2 shift)
+ {
+ var cleaned = source.Select(p => new SheetPoint2(Clean(p.X + shift.X), Clean(p.Y + shift.Y))).ToArray();
+ var points = SignedArea(cleaned) >= 0 ? cleaned : cleaned.Reverse().ToArray();
+ var segments = points.Select((point, index) => new ResolvedProfileSegment2D($"s{index:D3}", new LineArcLineSegment2D((point.X, point.Y), (points[(index + 1) % points.Length].X, points[(index + 1) % points.Length].Y)), new($"{name}:s{index:D3}", name, name, "SheetMetalFlatPatternIr", "XY"))).ToArray();
+ return new(name, "XY", [new("Outer", true, segments)]);
+ }
+
+ private static double SignedArea(IReadOnlyList<SheetPoint2> points) { var sum = 0d; for (var i = 0; i < points.Count; i++) { var q = points[(i + 1) % points.Count]; sum += points[i].X * q.Y - q.X * points[i].Y; } return sum / 2d; }
+ private static double Clean(double value) => Math.Abs(value) < 1e-9 ? 0d : value;
+ private static string Safe(string value) { var chars = value.Select(ch => char.IsLetterOrDigit(ch) || ch == '_' ? ch : '_').ToArray(); var result = new string(chars); return result.Length > 0 && (char.IsLetter(result[0]) || result[0] == '_') ? result : "Recovered_" + result; }
+ private static string Escape(string value) => value.Replace("\\", "\\\\", StringComparison.Ordinal).Replace("\"", "\\\"", StringComparison.Ordinal);
+ private static SheetMetalFlatBodyResult Failure(string message) => new(false, null, [new("sheetmetal-flat-step-failed", SheetMetalDiagnosticSeverity.Error, message)]);
+}
diff --git a/Aetheris.SheetMetal/SheetMetalModule.cs b/Aetheris.SheetMetal/SheetMetalModule.cs
index 17306373..692f00c7 100644
--- a/Aetheris.SheetMetal/SheetMetalModule.cs
+++ b/Aetheris.SheetMetal/SheetMetalModule.cs
@@ -6,8 +6,19 @@ namespace Aetheris.SheetMetal;
public static class SheetMetalModule
{
public static readonly AetherisModuleId Id = new("Aetheris.SheetMetal");
- public static readonly ModuleVersion Version = new(0, 1, 0);
- public static AetherisModule Definition { get; } = new(Id,"Sheet Metal",Version,[],
- ["SheetMetal.NeutralSurface (reserved)","SheetMetal.FormedState (reserved)"],[],[],[],
+ public static readonly ModuleVersion Version = new(0, 2, 0);
+ public static AetherisModule Definition { get; } = new(Id,"Sheet Metal",Version,
+ [
+ Capability("SheetMetal.ConstantThickness", "Tolerance-bounded planar and coaxial cylindrical thickness recognition."),
+ Capability("SheetMetal.BendRecovery", "Bounded planar-cylinder-planar bend recovery with source-face evidence."),
+ Capability("SheetMetal.FlatPattern", "Deterministic K-factor lowering to flat IR, AP242 solid, recovered Firmament intent, bend lines, and mapped cuts."),
+ Capability("SheetMetal.AuthoredBracket", "Firmament V2 module syntax and exact formed topology for two-flange brackets.")
+ ],
+ ["SheetMetal","ConstantThickness","Flattenable","HasFlatPattern","BendCapable"],
+ ["TwoFlangeBracket<Spec>"],
+ ["Firmament SheetMetal -> SheetMetalPartIr -> explicit formed BRep + SheetMetalFlatPatternIr","STEP BRep -> recognized SheetMetalPartIr -> bounded flat pattern -> flat AP242 + recovered Firmament + SVG"],
+ SheetMetalDiagnosticCodes.All,
[new(CoreModule.Id,new(1,0,0)),new(SurfacingModule.Id,new(0,1,0))],new("docs/modules/sheet-metal.md"));
+
+ private static ModuleCapability Capability(string id, string description) => new(id, Id, Version, description);
}
diff --git a/Aetheris.SheetMetal/SheetMetalRecognizer.cs b/Aetheris.SheetMetal/SheetMetalRecognizer.cs
new file mode 100644
index 00000000..c02ab1ab
--- /dev/null
+++ b/Aetheris.SheetMetal/SheetMetalRecognizer.cs
@@ -0,0 +1,379 @@
+using System.Diagnostics;
+using System.Security.Cryptography;
+using System.Text;
+using Aetheris.Kernel.Core.Brep;
+using Aetheris.Kernel.Core.Geometry;
+using Aetheris.Kernel.Core.Geometry.Curves;
+using Aetheris.Kernel.Core.Geometry.Surfaces;
+using Aetheris.Kernel.Core.Judgment;
+using Aetheris.Kernel.Core.Math;
+using Aetheris.Kernel.Core.Step242;
+using Aetheris.Kernel.Core.Topology;
+using Aetheris.Surfacing;
+
+namespace Aetheris.SheetMetal;
+
+public sealed record SheetMetalRecognitionOptions(
+ double LinearTolerance = 0.01d,
+ double AngularToleranceRadians = 0.001d,
+ double MaximumThicknessFraction = 0.1d,
+ SheetMetalFlattenPolicy? FlattenPolicy = null)
+{
+ public SheetMetalFlattenPolicy EffectiveFlattenPolicy => FlattenPolicy ?? SheetMetalFlattenPolicy.Default;
+}
+
+/// <summary>
+/// Bounded recognizer for ordinary exact B-reps whose sheet skins are paired planes and
+/// coaxial cylinders. Source topology remains authoritative; this produces an interpretation.
+/// </summary>
+public static class SheetMetalRecognizer
+{
+ private sealed record FaceFacts(
+ FaceId Id,
+ SurfaceGeometry Surface,
+ bool SameSense,
+ IReadOnlyList<Point3D> OuterBoundary,
+ IReadOnlyList<IReadOnlyList<Point3D>> InnerBoundaries,
+ double Area,
+ Point3D Centroid,
+ IReadOnlyList<EdgeId> Edges);
+
+ private sealed record PairCandidate(string Family, FaceFacts A, FaceFacts B, double Separation, double Weight);
+ private sealed record ThicknessCluster(double Nominal, IReadOnlyList<PairCandidate> Pairs, double Score, double Spread);
+
+ public static SheetMetalRecognitionResult RecognizeStep(string path, SheetMetalRecognitionOptions? options = null)
+ {
+ ArgumentException.ThrowIfNullOrWhiteSpace(path);
+ var fullPath = Path.GetFullPath(path);
+ var importClock = Stopwatch.StartNew();
+ var text = File.ReadAllText(fullPath);
+ var import = Step242Importer.ImportBody(text);
+ importClock.Stop();
+ if (!import.IsSuccess || import.Value is null)
+ {
+ var diagnostics = import.Diagnostics.Select(d => new SheetMetalDiagnostic(
+ "sheetmetal-step-import-failed", SheetMetalDiagnosticSeverity.Error, d.Message)).ToArray();
+ return new(null, new(false, null, options?.LinearTolerance ?? 0.01d, [], [], [], []), diagnostics, importClock.Elapsed, TimeSpan.Zero);
+ }
+
+ var recognitionClock = Stopwatch.StartNew();
+ var result = Recognize(import.Value, fullPath, options);
+ recognitionClock.Stop();
+ return result with { ImportTime = importClock.Elapsed, RecognitionTime = recognitionClock.Elapsed };
+ }
+
+ public static SheetMetalRecognitionResult Recognize(BrepBody body, string sourcePath = "BRep", SheetMetalRecognitionOptions? options = null)
+ {
+ ArgumentNullException.ThrowIfNull(body);
+ options ??= new();
+ var facts = ExtractFacts(body);
+ var thickness = RecognizeThickness(facts, options);
+ var diagnostics = new List<SheetMetalDiagnostic>();
+ if (!thickness.IsPlausible || thickness.NominalThickness is null)
+ {
+ diagnostics.Add(new(SheetMetalDiagnosticCodes.NonConstantThickness, SheetMetalDiagnosticSeverity.Error,
+ "No tolerance-bounded nominal thickness was supported by opposing planar or coaxial cylindrical face pairs."));
+ return new(null, thickness, diagnostics, TimeSpan.Zero, TimeSpan.Zero);
+ }
+
+ var t = thickness.NominalThickness.Value;
+ var admitted = thickness.SourcePairs.Where(p => p.Admitted).ToArray();
+ var planarPairs = SelectDisjointPairs(
+ admitted.Where(p => p.Family == "Planar").Select(p => MakeCandidate(p, facts)).Where(p => p is not null).Cast<PairCandidate>(),
+ thickness.Tolerance);
+ var cylinderPairs = SelectDisjointPairs(
+ admitted.Where(p => p.Family == "Cylindrical").Select(p => MakeCandidate(p, facts)).Where(p => p is not null).Cast<PairCandidate>(),
+ thickness.Tolerance);
+
+ var regions = new List<SheetRegionIr>();
+ foreach (var pair in planarPairs.OrderBy(p => Math.Min(p.A.Id.Value, p.B.Id.Value)))
+ regions.Add(CreatePlanarRegion(pair, t, sourcePath));
+ foreach (var pair in cylinderPairs.OrderBy(p => Math.Min(p.A.Id.Value, p.B.Id.Value)))
+ regions.Add(CreateCylindricalRegion(pair, t, sourcePath));
+
+ var planarRegions = regions.Where(r => r.Kind == SheetRegionKind.Planar).ToArray();
+ var cylinderRegions = regions.Where(r => r.Kind == SheetRegionKind.CylindricalBend).ToArray();
+ var adjacency = FaceAdjacency(body);
+ var bends = new List<SheetBendIr>();
+ foreach (var bendRegion in cylinderRegions)
+ {
+ var adjacentRegions = planarRegions.Where(region =>
+ bendRegion.Source.FaceIds.Any(cylinderFace => adjacency.TryGetValue(cylinderFace, out var adjacent)
+ && region.Source.FaceIds.Any(adjacent.Contains)))
+ .OrderBy(region => region.StableId, StringComparer.Ordinal)
+ .ToArray();
+ if (adjacentRegions.Length != 2 || bendRegion.Cylinder is null)
+ {
+ diagnostics.Add(new(SheetMetalDiagnosticCodes.UnsupportedBendTopology, SheetMetalDiagnosticSeverity.Warning,
+ $"Cylindrical region '{bendRegion.StableId}' touches {adjacentRegions.Length} recovered planar regions; exactly two are required for a bend.", bendRegion.Source.FaceIds));
+ continue;
+ }
+
+ var c = bendRegion.Cylinder;
+ var direction = InferBendDirection(adjacentRegions[0], adjacentRegions[1], c.AxisDirection);
+ bends.Add(new(
+ bendRegion.StableId.Replace("region", "bend", StringComparison.Ordinal),
+ c.AxisOrigin, CanonicalDirection(c.AxisDirection), c.AngularSpanRadians, c.InsideRadius, t, direction,
+ adjacentRegions[0].StableId, adjacentRegions[1].StableId,
+ SheetNeutralAxisPolicy.KFactorPolicy(options.EffectiveFlattenPolicy.KFactor),
+ bendRegion.Source,
+ [new(SheetEvidenceKind.ToleranceBounded, "planar-cylinder-planar", "Paired coaxial cylinder touches exactly two recovered planar skin pairs.", c.AngularSpanRadians, options.AngularToleranceRadians, bendRegion.Source.FaceIds)]));
+ }
+
+ var baseRegion = planarRegions.OrderByDescending(r => r.ApproximateArea).ThenBy(r => r.StableId, StringComparer.Ordinal).FirstOrDefault();
+ if (baseRegion is null)
+ {
+ diagnostics.Add(new(SheetMetalDiagnosticCodes.UnsupportedBendTopology, SheetMetalDiagnosticSeverity.Error, "No planar base region could be recovered."));
+ return new(null, thickness, diagnostics, TimeSpan.Zero, TimeSpan.Zero);
+ }
+
+ var features = RecoverFeatures(body, planarPairs, planarRegions, sourcePath, options.LinearTolerance);
+ var connected = ConnectedRegionIds(baseRegion.StableId, bends);
+ var disconnected = planarRegions.Where(r => !connected.Contains(r.StableId)).Select(r => r.StableId).ToArray();
+ if (disconnected.Length > 0)
+ diagnostics.Add(new(SheetMetalDiagnosticCodes.DisconnectedGraph, SheetMetalDiagnosticSeverity.Warning,
+ $"{disconnected.Length} recovered planar regions are outside the base-region bend component and will not be flattened."));
+
+ var pairedFaceIds = regions.SelectMany(r => r.Source.FaceIds).ToHashSet();
+ var unsupported = facts.Where(f => !pairedFaceIds.Contains(f.Id.Value)).Select(f => f.Id.Value).Order().ToArray();
+ if (unsupported.Length > 0)
+ diagnostics.Add(new(SheetMetalDiagnosticCodes.UnpairedFaces, SheetMetalDiagnosticSeverity.Warning,
+ $"{unsupported.Length} source faces are boundary/cut/support faces rather than recovered sheet reference skins.", unsupported));
+
+ var status = bends.Count > 0 && disconnected.Length == 0
+ ? (unsupported.Length == 0 ? SheetMetalRecognitionStatus.Complete : SheetMetalRecognitionStatus.Partial)
+ : regions.Count > 0 ? SheetMetalRecognitionStatus.Partial : SheetMetalRecognitionStatus.Unsupported;
+ var stableId = $"sheetmetal-import-{StableHash(sourcePath + "|" + t.ToString("R", System.Globalization.CultureInfo.InvariantCulture))[..16]}";
+ var part = new SheetMetalPartIr(
+ stableId, t, null, baseRegion.StableId, regions.OrderBy(r => r.StableId, StringComparer.Ordinal).ToArray(),
+ bends.OrderBy(b => b.StableId, StringComparer.Ordinal).ToArray(), features, options.EffectiveFlattenPolicy, status,
+ "Recognized imported BRep interpretation; source STEP/BRep remains formed-geometry authority.",
+ [new(SheetEvidenceKind.DeterministicHeuristic, "base-region", "Largest recovered planar area, stable-ID tie break.", baseRegion.ApproximateArea, null, baseRegion.Source.FaceIds),
+ new(SheetEvidenceKind.ToleranceBounded, "constant-thickness", "Dominant opposing-support cluster selected by JudgmentEngine.", t, options.LinearTolerance, thickness.SourcePairs.Where(p => p.Admitted).SelectMany(p => new[]{p.FaceA,p.FaceB}).Distinct().Order().ToArray())],
+ diagnostics, body);
+ return new(part, thickness, diagnostics, TimeSpan.Zero, TimeSpan.Zero);
+
+ PairCandidate? MakeCandidate(SheetThicknessPairEvidence p, IReadOnlyList<FaceFacts> all)
+ {
+ var a = all.FirstOrDefault(f => f.Id.Value == p.FaceA);
+ var b = all.FirstOrDefault(f => f.Id.Value == p.FaceB);
+ return a is null || b is null ? null : new(p.Family, a, b, p.Separation, 1d);
+ }
+ }
+
+ private static SheetThicknessRecognition RecognizeThickness(IReadOnlyList<FaceFacts> facts, SheetMetalRecognitionOptions options)
+ {
+ var bounds = facts.SelectMany(f => f.OuterBoundary).ToArray();
+ var ranges = bounds.Length == 0 ? new[] { 100d } : new[]
+ {
+ bounds.Max(p => p.X)-bounds.Min(p => p.X), bounds.Max(p => p.Y)-bounds.Min(p => p.Y), bounds.Max(p => p.Z)-bounds.Min(p => p.Z)
+ }.Where(v => v > options.LinearTolerance).ToArray();
+ var maximumThickness = Math.Max(options.LinearTolerance * 2d, (ranges.Length == 0 ? 100d : ranges.Min()) * options.MaximumThicknessFraction);
+
+ var candidates = new List<PairCandidate>();
+ // Imported placements often carry harmless producer-specific direction noise. The
+ // fixture-scale bounded scan (62 planes in CTC-03) avoids brittle quantized buckets;
+ // the overlap predicate rejects unrelated parallel supports before clustering.
+ var planeFaces=facts.Where(f=>f.Surface.Plane is not null).OrderBy(f=>f.Id.Value).ToArray();
+ {
+ var faces = planeFaces;
+ for (var i = 0; i < faces.Length; i++) for (var j = i + 1; j < faces.Length; j++)
+ {
+ var a = faces[i]; var b = faces[j];
+ if (!OpposingSense(a, b)) continue;
+ var separation = Math.Abs((b.Surface.Plane!.Value.Origin-a.Surface.Plane!.Value.Origin).Dot(a.Surface.Plane.Value.Normal.ToVector()));
+ if (separation <= options.LinearTolerance || separation > maximumThickness || !PlanarOverlap(a,b)) continue;
+ candidates.Add(new("Planar", a, b, separation, 1d + Math.Log10(1d + Math.Min(a.Area,b.Area))));
+ }
+ }
+ foreach (var group in facts.Where(f => f.Surface.Cylinder is not null).GroupBy(f => CylinderAxisKey(f.Surface.Cylinder!.Value, options.LinearTolerance)))
+ {
+ var faces = group.OrderBy(f => f.Id.Value).ToArray();
+ for (var i = 0; i < faces.Length; i++) for (var j = i + 1; j < faces.Length; j++)
+ {
+ var a=faces[i]; var b=faces[j];
+ if (!OpposingSense(a,b)) continue;
+ var separation=Math.Abs(a.Surface.Cylinder!.Value.Radius-b.Surface.Cylinder!.Value.Radius);
+ if(separation<=options.LinearTolerance||separation>maximumThickness||!AxialOverlap(a,b,a.Surface.Cylinder.Value))continue;
+ candidates.Add(new("Cylindrical",a,b,separation,4d+Math.Log10(1d+Math.Min(a.Area,b.Area))));
+ }
+ }
+
+ var clusters = candidates.GroupBy(c => Math.Round(c.Separation / options.LinearTolerance, MidpointRounding.AwayFromZero))
+ .Select(group =>
+ {
+ var ordered=group.OrderBy(c=>c.Separation).ThenBy(c=>c.A.Id.Value).ThenBy(c=>c.B.Id.Value).ToArray();
+ var nominal=WeightedMedian(ordered);
+ var spread=ordered.Max(c=>Math.Abs(c.Separation-nominal));
+ var score=ordered.Sum(c=>c.Weight)-spread/Math.Max(options.LinearTolerance,1e-12);
+ return new ThicknessCluster(nominal,ordered,score,spread);
+ }).OrderBy(c=>c.Nominal).ToArray();
+ if(clusters.Length==0)return new(false,null,options.LinearTolerance,[],facts.Select(f=>f.Id.Value).Order().ToArray(),[],[]);
+
+ var engine=new JudgmentEngine<ThicknessCluster[]>();
+ var judgment=engine.Evaluate(clusters,clusters.Select((cluster,index)=>new JudgmentCandidate<ThicknessCluster[]>(
+ cluster.Nominal.ToString("R",System.Globalization.CultureInfo.InvariantCulture),
+ _=>cluster.Pairs.Count>0&&cluster.Spread<=options.LinearTolerance*1.5d,
+ _=>cluster.Score,
+ _=>$"Spread {cluster.Spread:G6} exceeds the bounded tolerance cluster.",index)).ToArray());
+ if(!judgment.IsSuccess)return new(false,null,options.LinearTolerance,[],facts.Select(f=>f.Id.Value).Order().ToArray(),[],[]);
+ var selected=clusters.Single(c=>c.Nominal.ToString("R",System.Globalization.CultureInfo.InvariantCulture)==judgment.Selection!.Value.Candidate.Name);
+ var allEvidence=candidates.OrderBy(c=>c.Family).ThenBy(c=>c.A.Id.Value).ThenBy(c=>c.B.Id.Value)
+ .Select(c=>new SheetThicknessPairEvidence(c.Family,c.A.Id.Value,c.B.Id.Value,c.Separation,Math.Abs(c.Separation-selected.Nominal),Math.Abs(c.Separation-selected.Nominal)<=options.LinearTolerance)).ToArray();
+ var supported=allEvidence.Where(e=>e.Admitted).SelectMany(e=>new[]{e.FaceA,e.FaceB}).ToHashSet();
+ return new(true,selected.Nominal,options.LinearTolerance,allEvidence,
+ facts.Where(f=>!supported.Contains(f.Id.Value)).Select(f=>f.Id.Value).Order().ToArray(),[],
+ [new(SheetEvidenceKind.ToleranceBounded,"nominal-thickness",$"JudgmentEngine selected dominant support cluster from {clusters.Length} bounded candidates.",selected.Nominal,options.LinearTolerance,supported.Order().ToArray())]);
+ }
+
+ private static IReadOnlyList<PairCandidate> SelectDisjointPairs(IEnumerable<PairCandidate> pairs, double tolerance)
+ {
+ var used=new HashSet<int>();var selected=new List<PairCandidate>();
+ foreach(var pair in pairs.OrderBy(p=>Math.Abs(p.Separation)).ThenByDescending(p=>Math.Min(p.A.Area,p.B.Area)).ThenBy(p=>p.A.Id.Value).ThenBy(p=>p.B.Id.Value))
+ if(used.Add(pair.A.Id.Value)){if(used.Add(pair.B.Id.Value))selected.Add(pair);else used.Remove(pair.A.Id.Value);}
+ return selected;
+ }
+
+ private static SheetRegionIr CreatePlanarRegion(PairCandidate pair,double thickness,string sourcePath)
+ {
+ var plane=pair.A.Surface.Plane!.Value;var n=plane.Normal.ToVector();
+ var toward=(pair.B.Centroid-pair.A.Centroid).Dot(n)>=0d?n:-n;
+ var origin=plane.Origin+toward*(pair.Separation/2d);
+ var u=CanonicalDirection(plane.UAxis.ToVector());var v=n.Cross(u);if(!v.TryNormalize(out v))v=plane.VAxis.ToVector();
+ var boundary=pair.A.OuterBoundary.Select(p=>p+toward*((pair.Separation/2d)-(p-origin).Dot(toward))).ToArray();
+ var ids=new[]{pair.A.Id.Value,pair.B.Id.Value}.Order().ToArray();
+ return new($"region-p-{ids[0]:D4}-{ids[1]:D4}",SheetRegionKind.Planar,
+ new(DevelopabilityKind.Developable,"analytic plane",0d,0,"Planes have zero Gaussian curvature."),
+ new(origin,n,u,v,pair.A.SameSense),null,boundary,Math.Max(pair.A.Area,pair.B.Area),
+ new("STEP/BRep faces","formed geometry evidence",ids,pair.A.Edges.Concat(pair.B.Edges).Select(e=>e.Value).Distinct().Order().ToArray(),sourcePath),
+ [new(SheetEvidenceKind.ToleranceBounded,"parallel-plane-pair","Parallel opposing supports with overlapping projected bounds.",pair.Separation,thickness==0?null:Math.Abs(pair.Separation-thickness),ids),
+ new(SheetEvidenceKind.Derived,"sheet-mid-surface","Midpoint plane; distinct from manufacturing neutral axis.",pair.Separation/2d,null,ids)]);
+ }
+
+ private static SheetRegionIr CreateCylindricalRegion(PairCandidate pair,double thickness,string sourcePath)
+ {
+ var ca=pair.A.Surface.Cylinder!.Value;var cb=pair.B.Surface.Cylinder!.Value;
+ var inner=ca.Radius<=cb.Radius?ca:cb;var span=Math.Min(AngularSpan(pair.A,ca),AngularSpan(pair.B,cb));
+ var axis=CanonicalDirection(inner.Axis.ToVector());var axial=pair.A.OuterBoundary.Concat(pair.B.OuterBoundary).Select(p=>(p-inner.Origin).Dot(axis)).ToArray();var axialMin=axial.Length==0?0:axial.Min();var axialMax=axial.Length==0?0:axial.Max();var length=axialMax-axialMin;var centeredAxisOrigin=inner.Origin+axis*((axialMin+axialMax)/2d);var ids=new[]{pair.A.Id.Value,pair.B.Id.Value}.Order().ToArray();
+ return new($"region-c-{ids[0]:D4}-{ids[1]:D4}",SheetRegionKind.CylindricalBend,
+ new(DevelopabilityKind.Developable,"analytic cylinder",0d,0,"Cylinders are analytically developable."),null,
+ new(centeredAxisOrigin,axis,(ca.Radius+cb.Radius)/2d,inner.Radius,span,length,inner.Radius==ca.Radius?pair.A.SameSense:pair.B.SameSense),
+ pair.A.OuterBoundary.Concat(pair.B.OuterBoundary).ToArray(),span*((ca.Radius+cb.Radius)/2d)*length,
+ new("STEP/BRep faces","formed geometry evidence",ids,pair.A.Edges.Concat(pair.B.Edges).Select(e=>e.Value).Distinct().Order().ToArray(),sourcePath),
+ [new(SheetEvidenceKind.ToleranceBounded,"coaxial-cylinder-pair","Coaxial opposing supports; radius difference agrees with nominal thickness.",Math.Abs(ca.Radius-cb.Radius),thickness==0?null:Math.Abs(Math.Abs(ca.Radius-cb.Radius)-thickness),ids),
+ new(SheetEvidenceKind.Derived,"geometric-mid-cylinder","Arithmetic mid-radius; manufacturing neutral radius is policy-derived separately.",(ca.Radius+cb.Radius)/2d,null,ids)]);
+ }
+
+ private static IReadOnlyList<SheetFeatureIr> RecoverFeatures(BrepBody body,IReadOnlyList<PairCandidate> pairs,IReadOnlyList<SheetRegionIr> regions,string sourcePath,double tolerance)
+ {
+ var result=new List<SheetFeatureIr>();
+ foreach(var pair in pairs)
+ {
+ var region=regions.FirstOrDefault(r=>r.Source.FaceIds.Contains(pair.A.Id.Value)&&r.Source.FaceIds.Contains(pair.B.Id.Value));
+ if(region?.Plane is null)continue;
+ foreach(var face in new[]{pair.A,pair.B})foreach(var loopId in body.GetLoopIds(face.Id).Skip(1))
+ {
+ var edges=body.GetCoedgeIds(loopId).Select(body.GetCoedgeEdgeId).ToArray();
+ if(edges.Length==1&&body.TryGetEdgeCurve(edges[0],out var curve)&&curve?.Circle3 is Circle3Curve circle)
+ {
+ var center=ProjectToPlane(circle.Center,region.Plane);
+ var id=$"feature-hole-f{face.Id.Value:D4}-e{edges[0].Value:D4}";
+ if(result.Any(f=>(f.Center-center).Length<=tolerance&&Math.Abs((f.Diameter??0)-2d*circle.Radius)<=tolerance))continue;
+ result.Add(new(id,SheetFeatureKind.CircularHole,region.StableId,center,2d*circle.Radius,[],
+ new("STEP/BRep loop","formed cut-boundary evidence",[face.Id.Value],edges.Select(e=>e.Value).ToArray(),sourcePath),
+ [new(SheetEvidenceKind.Exact,"circular-inner-loop","Single closed circular edge on a recovered planar sheet skin.",2d*circle.Radius,null,[face.Id.Value])]));
+ }
+ else
+ {
+ var boundary=edges.SelectMany(e=>body.GetVertices(e)).Distinct().Select(v=>body.TryGetVertexPoint(v,out var p)?(Point3D?)ProjectToPlane(p,region.Plane):null).Where(p=>p.HasValue).Select(p=>p!.Value).ToArray();
+ var center=Centroid(boundary);if(result.Any(f=>f.OwningRegionId==region.StableId&&(f.Center-center).Length<=tolerance))continue;
+ var kinds=edges.Select(e=>body.TryGetEdgeCurve(e,out var curve)?curve?.Kind:CurveGeometryKind.Unsupported).ToHashSet();var featureKind=kinds.Contains(CurveGeometryKind.Circle3)&&kinds.Contains(CurveGeometryKind.Line3)?SheetFeatureKind.Slot:SheetFeatureKind.ProfileHole;
+ if(boundary.Length>=3)result.Add(new($"feature-profile-f{face.Id.Value:D4}-l{loopId.Value:D4}",featureKind,region.StableId,center,null,boundary,
+ new("STEP/BRep loop","formed cut-boundary evidence",[face.Id.Value],edges.Select(e=>e.Value).ToArray(),sourcePath),
+ [new(SheetEvidenceKind.Exact,"planar-inner-loop","Closed inner boundary on a recovered planar sheet skin.",null,null,[face.Id.Value])]));
+ }
+ }
+ }
+ return result.OrderBy(f=>f.StableId,StringComparer.Ordinal).ToArray();
+ }
+
+ private static IReadOnlyList<FaceFacts> ExtractFacts(BrepBody body)
+ {
+ var result=new List<FaceFacts>();
+ foreach(var face in body.Topology.Faces.OrderBy(f=>f.Id.Value))
+ {
+ if(!body.TryGetFaceSurface(face.Id,out var surface)||surface is null)continue;
+ var loops=face.LoopIds.Select(id=>LoopPoints(body,id)).Where(p=>p.Count>0).ToArray();
+ if(loops.Length==0)continue;
+ var measured=loops.Select(points=>(Points:points,Area:LoopArea(points,surface))).OrderByDescending(x=>x.Area).ToArray();
+ var outer=measured[0].Points;var inner=measured.Skip(1).Select(x=>x.Points).ToArray();
+ var sameSense=!body.Bindings.TryGetFaceBinding(face.Id,out var binding)||binding.SameSense;
+ result.Add(new(face.Id,surface,sameSense,outer,inner,measured[0].Area,Centroid(outer),body.GetEdges(face.Id)));
+ }
+ return result;
+ }
+
+ private static IReadOnlyList<Point3D> LoopPoints(BrepBody body,LoopId loopId)
+ {
+ var points=new List<Point3D>();
+ foreach(var coedgeId in body.GetCoedgeIds(loopId))
+ {
+ var coedge=body.Topology.GetCoedge(coedgeId);var edge=body.Topology.GetEdge(coedge.EdgeId);
+ var vertex=coedge.IsReversed?edge.EndVertexId:edge.StartVertexId;
+ if(body.TryGetVertexPoint(vertex,out var p))points.Add(p);
+ }
+ return points;
+ }
+
+ private static double LoopArea(IReadOnlyList<Point3D> points,SurfaceGeometry surface)
+ {
+ if(points.Count<3)return surface.Cylinder is { } c?AxisSpan(points,c)*c.Radius*Math.Max(AngularSpan(points,c),1e-9):0d;
+ Vector3D u,v;
+ if(surface.Plane is { } p){u=p.UAxis.ToVector();v=p.VAxis.ToVector();}
+ else { var n=Newell(points);u=Perpendicular(n);v=n.Cross(u); }
+ double area=0;for(var i=0;i<points.Count;i++){var a=points[i];var b=points[(i+1)%points.Count];area+=a.XYZDot(u)*b.XYZDot(v)-b.XYZDot(u)*a.XYZDot(v);}return Math.Abs(area)*.5d;
+ }
+
+ private static Dictionary<int,HashSet<int>> FaceAdjacency(BrepBody body)
+ {
+ var edgeFaces=new Dictionary<int,List<int>>();
+ foreach(var face in body.Topology.Faces)foreach(var edge in body.GetEdges(face.Id)){if(!edgeFaces.TryGetValue(edge.Value,out var list))edgeFaces[edge.Value]=list=[];list.Add(face.Id.Value);}
+ var map=body.Topology.Faces.ToDictionary(f=>f.Id.Value,_=>new HashSet<int>());
+ foreach(var faces in edgeFaces.Values)foreach(var a in faces)foreach(var b in faces)if(a!=b)map[a].Add(b);
+ return map;
+ }
+
+ private static bool OpposingSense(FaceFacts a,FaceFacts b)
+ {
+ // STEP producers legitimately encode the same material-facing orientation either by
+ // reversing the plane placement or by ADVANCED_FACE.SAME_SENSE. Pairing therefore
+ // treats parallel support as geometric evidence and retains orientation separately.
+ if(a.Surface.Plane is { } pa&&b.Surface.Plane is { } pb)return Math.Abs(pa.Normal.ToVector().Dot(pb.Normal.ToVector()))>0.999d;
+ return a.SameSense!=b.SameSense;
+ }
+ private static bool PlanarOverlap(FaceFacts a,FaceFacts b)
+ {
+ var p=a.Surface.Plane!.Value;var u=p.UAxis.ToVector();var v=p.VAxis.ToVector();
+ var aa=Bounds2(a.OuterBoundary,u,v);var bb=Bounds2(b.OuterBoundary,u,v);var x=Math.Max(0,Math.Min(aa.maxX,bb.maxX)-Math.Max(aa.minX,bb.minX));var y=Math.Max(0,Math.Min(aa.maxY,bb.maxY)-Math.Max(aa.minY,bb.minY));
+ return x*y>=.05d*Math.Max(1e-12,Math.Min((aa.maxX-aa.minX)*(aa.maxY-aa.minY),(bb.maxX-bb.minX)*(bb.maxY-bb.minY)));
+ }
+ private static bool AxialOverlap(FaceFacts a,FaceFacts b,CylinderSurface c){var axis=c.Axis.ToVector();var aa=a.OuterBoundary.Select(p=>(p-c.Origin).Dot(axis)).ToArray();var bb=b.OuterBoundary.Select(p=>(p-c.Origin).Dot(axis)).ToArray();return aa.Length>0&&bb.Length>0&&Math.Min(aa.Max(),bb.Max())-Math.Max(aa.Min(),bb.Min())>1e-6;}
+ private static string PlaneOrientationKey(Vector3D n){n=CanonicalDirection(n);return $"{Math.Round(n.X,3)}|{Math.Round(n.Y,3)}|{Math.Round(n.Z,3)}";}
+ private static string CylinderAxisKey(CylinderSurface c,double tol){var axis=CanonicalDirection(c.Axis.ToVector());var closest=c.Origin-axis*(c.Origin-Point3D.Origin).Dot(axis);double q(double x)=>Math.Round(x/Math.Max(tol,1e-6));return $"{Math.Round(axis.X,3)}|{Math.Round(axis.Y,3)}|{Math.Round(axis.Z,3)}|{q(closest.X)}|{q(closest.Y)}|{q(closest.Z)}";}
+ private static double WeightedMedian(IReadOnlyList<PairCandidate> pairs){var ordered=pairs.OrderBy(p=>p.Separation).ToArray();var half=ordered.Sum(p=>p.Weight)/2d;double sum=0;foreach(var p in ordered){sum+=p.Weight;if(sum>=half)return p.Separation;}return ordered[^1].Separation;}
+ private static (double minX,double minY,double maxX,double maxY) Bounds2(IEnumerable<Point3D> points,Vector3D u,Vector3D v){var p=points.Select(x=>(x.XYZDot(u),x.XYZDot(v))).ToArray();return(p.Min(x=>x.Item1),p.Min(x=>x.Item2),p.Max(x=>x.Item1),p.Max(x=>x.Item2));}
+ private static double AngularSpan(FaceFacts face,CylinderSurface c)=>AngularSpan(face.OuterBoundary,c);
+ private static double AngularSpan(IReadOnlyList<Point3D> points,CylinderSurface c){if(points.Count<2)return 2d*Math.PI;var angles=points.Select(p=>{var d=p-c.Origin;var axial=c.Axis.ToVector()*d.Dot(c.Axis.ToVector());var r=d-axial;var a=Math.Atan2(r.Dot(c.YAxis.ToVector()),r.Dot(c.XAxis.ToVector()));return a<0?a+2*Math.PI:a;}).DistinctBy(a=>Math.Round(a,9)).Order().ToArray();if(angles.Length<2)return 2d*Math.PI;var gap=0d;for(var i=0;i<angles.Length;i++){var next=i==angles.Length-1?angles[0]+2*Math.PI:angles[i+1];gap=Math.Max(gap,next-angles[i]);}return 2*Math.PI-gap;}
+ private static double AxisSpan(FaceFacts f,CylinderSurface c)=>AxisSpan(f.OuterBoundary,c);
+ private static double AxisSpan(IReadOnlyList<Point3D> points,CylinderSurface c){var p=points.Select(x=>(x-c.Origin).Dot(c.Axis.ToVector())).ToArray();return p.Length==0?0:p.Max()-p.Min();}
+ private static SheetBendDirection InferBendDirection(SheetRegionIr a,SheetRegionIr b,Vector3D axis){if(a.Plane is null||b.Plane is null)return SheetBendDirection.Unknown;var sign=axis.Dot(a.Plane.Normal.Cross(b.Plane.Normal));return Math.Abs(sign)<1e-9?SheetBendDirection.Unknown:sign>0?SheetBendDirection.Up:SheetBendDirection.Down;}
+ private static HashSet<string> ConnectedRegionIds(string root,IReadOnlyList<SheetBendIr> bends){var result=new HashSet<string>(StringComparer.Ordinal){root};var changed=true;while(changed){changed=false;foreach(var b in bends)if(result.Contains(b.AdjacentRegionA)&&result.Add(b.AdjacentRegionB)||result.Contains(b.AdjacentRegionB)&&result.Add(b.AdjacentRegionA))changed=true;}return result;}
+ private static Point3D ProjectToPlane(Point3D p,SheetPlaneReference plane)=>p-plane.Normal*((p-plane.Origin).Dot(plane.Normal));
+ private static Point3D Centroid(IReadOnlyList<Point3D> p)=>p.Count==0?Point3D.Origin:new(p.Average(x=>x.X),p.Average(x=>x.Y),p.Average(x=>x.Z));
+ private static Vector3D Newell(IReadOnlyList<Point3D> p){var n=Vector3D.Zero;for(var i=0;i<p.Count;i++){var a=p[i];var b=p[(i+1)%p.Count];n+=new Vector3D((a.Y-b.Y)*(a.Z+b.Z),(a.Z-b.Z)*(a.X+b.X),(a.X-b.X)*(a.Y+b.Y));}return n.TryNormalize(out var q)?q:new(0,0,1);}
+ private static Vector3D Perpendicular(Vector3D n){var refv=Math.Abs(n.X)<.8?new Vector3D(1,0,0):new Vector3D(0,1,0);var p=n.Cross(refv);return p.TryNormalize(out p)?p:new(0,0,1);}
+ private static Vector3D CanonicalDirection(Vector3D v){if(!v.TryNormalize(out v))return v;return v.X< -1e-12||(Math.Abs(v.X)<=1e-12&&v.Y< -1e-12)||(Math.Abs(v.X)<=1e-12&&Math.Abs(v.Y)<=1e-12&&v.Z<0)?-v:v;}
+ internal static string StableHash(string value)=>Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(value))).ToLowerInvariant();
+
+ private static double XYZDot(this Point3D p,Vector3D v)=>p.X*v.X+p.Y*v.Y+p.Z*v.Z;
+}
diff --git a/Aetheris.SheetMetal/SheetMetalSvgRenderer.cs b/Aetheris.SheetMetal/SheetMetalSvgRenderer.cs
new file mode 100644
index 00000000..7a2066ec
--- /dev/null
+++ b/Aetheris.SheetMetal/SheetMetalSvgRenderer.cs
@@ -0,0 +1,25 @@
+using System.Globalization;
+using System.Text;
+
+namespace Aetheris.SheetMetal;
+
+public static class SheetMetalSvgRenderer
+{
+ public static string Render(SheetMetalFlatPatternIr flat)
+ {
+ ArgumentNullException.ThrowIfNull(flat);var b=flat.Bounds??new(0,0,100,100);const double margin=12;var width=Math.Max(1,b.Width)+2*margin;var height=Math.Max(1,b.Height)+2*margin;
+ double x(double value)=>value-b.MinX+margin;double y(double value)=>height-(value-b.MinY+margin);
+ string points(IEnumerable<SheetPoint2> p)=>string.Join(" ",p.Select(q=>$"{F(x(q.X))},{F(y(q.Y))}"));
+ var sb=new StringBuilder();sb.AppendLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");sb.AppendLine($"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"{F(width)}mm\" height=\"{F(height)}mm\" viewBox=\"0 0 {F(width)} {F(height)}\">");
+ sb.AppendLine("<rect width=\"100%\" height=\"100%\" fill=\"white\"/>");
+ sb.AppendLine("<g id=\"sheet-regions\" fill=\"#dbeafe\" fill-opacity=\"0.55\" stroke=\"#0f172a\" stroke-width=\"0.45\">");
+ foreach(var r in flat.Regions2D.OrderBy(r=>r.StableId,StringComparer.Ordinal))if(r.Boundary.Count>=3)sb.AppendLine($"<polygon id=\"{Escape(r.StableId)}\" points=\"{points(r.Boundary)}\"/>");sb.AppendLine("</g>");
+ sb.AppendLine("<g id=\"cut-contours\" fill=\"white\" stroke=\"#dc2626\" stroke-width=\"0.5\">");foreach(var c in flat.CutLoops.OrderBy(c=>c.FeatureId,StringComparer.Ordinal))if(c.Boundary.Count>=3)sb.AppendLine($"<polygon id=\"{Escape(c.FeatureId)}\" points=\"{points(c.Boundary)}\"/>");sb.AppendLine("</g>");
+ var labels=new List<(double X,double Y,double Width,string Text)>();
+ sb.AppendLine("<g id=\"bend-lines\" fill=\"none\" stroke=\"#2563eb\" stroke-width=\"0.45\" stroke-dasharray=\"3 2\">");foreach(var bend in flat.BendLines.OrderBy(b=>b.BendId,StringComparer.Ordinal)){var x1=x(bend.Start.X);var y1=y(bend.Start.Y);var x2=x(bend.End.X);var y2=y(bend.End.Y);sb.AppendLine($"<line x1=\"{F(x1)}\" y1=\"{F(y1)}\" x2=\"{F(x2)}\" y2=\"{F(y2)}\"/>");var label=$"{bend.Direction} {F(bend.BendAngleRadians*180/Math.PI)}° R{F(bend.InsideRadius)}";var dx=x2-x1;var dy=y2-y1;var length=Math.Sqrt(dx*dx+dy*dy);var nx=length<=1e-9?0d:-dy/length;var ny=length<=1e-9?-1d:dx/length;var lx=(x1+x2)/2+nx*4;var ly=(y1+y2)/2+ny*4;var labelWidth=Math.Max(18,label.Length*1.65);for(var attempt=0;attempt<8&&labels.Any(other=>Math.Abs(other.X-lx)<(other.Width+labelWidth)/2&&Math.Abs(other.Y-ly)<4.2);attempt++){lx+=nx*5;ly+=ny*5;}lx=Math.Clamp(lx,labelWidth/2+1,width-labelWidth/2-1);ly=Math.Clamp(ly,8,height-3);labels.Add((lx,ly,labelWidth,label));}sb.AppendLine("</g>");
+ sb.AppendLine("<g id=\"bend-labels\" stroke=\"none\" font-family=\"Inter, 'Segoe UI', Arial, sans-serif\" font-size=\"3\" text-anchor=\"middle\" dominant-baseline=\"central\">");foreach(var label in labels){sb.AppendLine($"<rect x=\"{F(label.X-label.Width/2-.7)}\" y=\"{F(label.Y-2.2)}\" width=\"{F(label.Width+1.4)}\" height=\"4.4\" rx=\"0.8\" fill=\"white\" fill-opacity=\"0.88\"/>");sb.AppendLine($"<text x=\"{F(label.X)}\" y=\"{F(label.Y)}\" fill=\"#1d4ed8\">{Escape(label.Text)}</text>");}sb.AppendLine("</g>");
+ sb.AppendLine($"<text x=\"4\" y=\"6\" font-family=\"sans-serif\" font-size=\"3\" fill=\"#334155\">{Escape(flat.Status.ToString())} · K={F(flat.Policy.KFactor)} · SHA-256 {flat.DeterministicHash[..12]}</text>");sb.AppendLine("</svg>");return sb.ToString();
+ }
+ public static void Write(string path,SheetMetalFlatPatternIr flat){ArgumentException.ThrowIfNullOrWhiteSpace(path);var full=Path.GetFullPath(path);Directory.CreateDirectory(Path.GetDirectoryName(full)!);File.WriteAllText(full,Render(flat),new UTF8Encoding(false));}
+ private static string F(double v)=>v.ToString("0.###",CultureInfo.InvariantCulture);private static string Escape(string s)=>System.Security.SecurityElement.Escape(s)??string.Empty;
+}
diff --git a/Aetheris.slnx b/Aetheris.slnx
index f3b424d8..906343b3 100644
--- a/Aetheris.slnx
+++ b/Aetheris.slnx
@@ -12,6 +12,7 @@
<Project Path="Aetheris.Surfacing/Aetheris.Surfacing.csproj" />
<Project Path="Aetheris.Piping/Aetheris.Piping.csproj" />
<Project Path="Aetheris.SheetMetal/Aetheris.SheetMetal.csproj" />
+ <Project Path="Aetheris.SheetMetal.Tests/Aetheris.SheetMetal.Tests.csproj" />
<Project Path="Aetheris.Modules.BuiltIn/Aetheris.Modules.BuiltIn.csproj" />
<Project Path="Aetheris.Modules.Tests/Aetheris.Modules.Tests.csproj" />
<Project Path="Aetheris.Continuum/Aetheris.Continuum.csproj" />
diff --git a/docs/firmament-v2/language-reference.md b/docs/firmament-v2/language-reference.md
index 0c04668b..1215b20f 100644
--- a/docs/firmament-v2/language-reference.md
+++ b/docs/firmament-v2/language-reference.md
@@ -12,7 +12,7 @@ Firmament is a deterministic, statically evaluated CAD authoring language. Sourc
### Engineering Modules (M0)
-Engineering Modules own domain vocabulary and lowering above the shared language/kernel. M0 built-ins are `Aetheris.Surfacing`, `Aetheris.Piping`, and the reserved `Aetheris.SheetMetal`. Firmament adds no `Module`, `Use`, or import keyword in M0: module-owned Templates expand to ordinary canonical Firmament/Core construction, while Forge capability boundaries use catalog-qualified IDs such as `Piping.PipeRoute`. This avoids syntax with no native collision to resolve. Module identity, version, ownership, and docs/tooling inspection come from the deterministic built-in catalog, not runtime plug-in discovery. See [Engineering Modules](../modules/architecture.md).
+Engineering Modules own domain vocabulary and lowering above the shared language/kernel. Built-ins are `Aetheris.Surfacing`, `Aetheris.Piping`, and `Aetheris.SheetMetal`. Firmament adds no `Module`, `Use`, or import keyword: module-owned declarations/Templates lower through their explicit built-in owner, while Forge capability boundaries use catalog-qualified IDs such as `Piping.PipeRoute`. Sheet Metal M1 adds the bounded authored `SheetMetal Name { ... }` document shape for a rectangular base, two opposite flanges, and base holes, plus a generated loss-aware recovery form with explicit `RecoveredRegion`, `RecoveredBend`, and `RecoveredCut` declarations. The recovery form recompiles recovered manufacturing intent without treating it as source-geometry authority. Both `aetheris build` and `aetheris sheetmetal` consume the applicable forms. See [Engineering Modules](../modules/architecture.md) and [Sheet Metal](../modules/sheet-metal.md).
**The 3D semantic model is the product definition. A Drawing is a printable projection of that definition, not a parallel source of engineering truth.** Drawing M0B binds `Source` to an authoritative Part or AssemblyIR Product, retains occurrence identity, derives BOM directly from leaf Part instances, and lowers manually selected views/PMI to zoned DrawingIR plus A4 vector output. See [Drawing concepts and templates](../drawing/templates.md).
@@ -225,11 +225,11 @@ A `Proposal` may add `Property`, `Current`, `Proposed`, `Units`, and `Reason`. I
| Status | Constructs |
|---|---|
-| Supported | Model, Units, primitive literals/types, let, Record, Static Record/Table/array, indexing, with, Concept, Concept Struct, Struct, Expose, Concept Path, Profile, Compose, bounded Modify/Hole/Pattern/EdgeFinish/Selection, Template, Match, Require, Panel with ParametricSurface/named/RuledSurface/RuledTransition/BoundaryPatch/SectionSurface construction, semantic Panel edges/corners, exact G0 Panel edge Mates, InlineStep, bounded Recognize/Replace, PMI datum/diameter binding, Analysis declarations, bounded Drawing declaration/Concept/Template specialization, Review/Comment/Issue/Proposal/Resolution, SemanticValue, Interface/Role/Lower/Fit/Allow, Assembly/Part/Panel/Anchor/Mate/Relation/Dimension/tol, Assert Volume, Assert ToleranceStackup |
+| Supported | Model, Units, primitive literals/types, let, Record, Static Record/Table/array, indexing, with, Concept, Concept Struct, Struct, Expose, Concept Path, Profile, Compose, bounded Modify/Hole/Pattern/EdgeFinish/Selection, Template, Match, Require, Panel with ParametricSurface/named/RuledSurface/RuledTransition/BoundaryPatch/SectionSurface construction, semantic Panel edges/corners, exact G0 Panel edge Mates, bounded SheetMetal rectangular-base/two-flange/base-hole authoring and flat pattern, InlineStep, bounded Recognize/Replace, PMI datum/diameter binding, Analysis declarations, bounded Drawing declaration/Concept/Template specialization, Review/Comment/Issue/Proposal/Resolution, SemanticValue, Interface/Role/Lower/Fit/Allow, Assembly/Part/Panel/Anchor/Mate/Relation/Dimension/tol, Assert Volume, Assert ToleranceStackup |
| Experimental | standalone/fill lattice routes, broader PMI controls/export, general Forge source invocation, some Slot/EdgeFinish/Boolean/placement routes, M1 Template Part syntax while the central grammar remains split |
| Internal-only | AIR/CIR/BRep plans, topology IDs, semantic source maps, Template expansion artifacts, Judgment/route machinery |
| Legacy/Deprecated | Firmament V1 TOON-style fixture syntax, `.firmasm`, transform-first assembly execution, legacy lowercase/alternate PMI spellings accepted for compatibility |
| Parser-only / dead | no syntax is promoted solely from an AST type; historical AST `FirmamentV2TemplateDecl` manufacturing-template representation and broad parser regex branches without binder/lowering evidence remain internal/legacy, not public Template syntax |
-| Future/incomplete | Panel G1/G2 verification, arbitrary trim networks, SheetMetal flat patterns, SubD/SDF-backed Panels, native AP242 Panel semantics, recognizer-produced datum/dimension capabilities, unrestricted symbolic relations, general kinematics/contact/assembly FEA |
+| Future/incomplete | Panel G1/G2 verification, arbitrary trim networks, production SheetMetal boundary stitching/relief/bend tables and broader flange families, SubD/SDF-backed Panels, native AP242 Panel semantics, recognizer-produced datum/dimension capabilities, unrestricted symbolic relations, general kinematics/contact/assembly FEA |
The machine-readable status and source evidence are in `language-features.json` and `artifacts/language-audit-m1/`.
diff --git a/docs/modules/architecture.md b/docs/modules/architecture.md
index f8008388..c64e4cf3 100644
--- a/docs/modules/architecture.md
+++ b/docs/modules/architecture.md
@@ -16,7 +16,7 @@ An `AetherisModule` has an explicit dotted `AetherisModuleId`, semantic version,
flowchart TD
Core["Aetheris.Core\ngeometry/compiler semantics"] --> Piping["Aetheris.Piping\nPipeRoute / PathPipe"]
Core --> Surfacing["Aetheris.Surfacing\nRuledSurface / RuledTransition"]
- Core --> Sheet["Aetheris.SheetMetal\nreserved"]
+ Core --> Sheet["Aetheris.SheetMetal\nSheetMetalPartIr / bend recovery / flat pattern"]
Surfacing --> Sheet
Piping --> BRep["exact cylinder / torus BRep"]
Surfacing --> BRep2["exact analytic / degree-(1,1) ruled BRep"]
@@ -32,6 +32,8 @@ M0 adds no import keyword. Domain APIs and module-owned Templates resolve the ow
This choice is intentional: the current canonical Firmament grammar does not have two competing domain declarations requiring an import/name-resolution system. Adding `Use` now would create syntax without a native domain construct consumer. Tooling obtains ownership from the catalog. If native domain declarations later create real collisions, the smallest future import form can enable a Module once per document; fully qualified IDs remain the unambiguous fallback.
+`Aetheris.SheetMetal` advanced to 0.2.0 in Sheet Metal M1. Its native module-owned `SheetMetal` declaration is intentionally bounded to a two-flange bracket family, while ordinary STEP recognition consumes Core exact BRep without changing source authority. See [Sheet Metal](sheet-metal.md).
+
## M0 scope and limitations
Modules are built in and in-repository. Registration is static. Module versions are exact semantic versions, while dependencies specify minimum versions. Version ranges, unload/reload, external package acquisition, runtime scanning, and arbitrary service injection are non-goals.
diff --git a/docs/modules/sheet-metal.md b/docs/modules/sheet-metal.md
index dbb4383c..416a7321 100644
--- a/docs/modules/sheet-metal.md
+++ b/docs/modules/sheet-metal.md
@@ -1,7 +1,34 @@
-# Sheet Metal Module design note
+# Sheet Metal Module
-`Aetheris.SheetMetal` 0.1.0 is an architecture/design-pressure placeholder, not a Sheet Metal implementation. It depends explicitly on Core and Surfacing and publishes no M0 capability.
+`Aetheris.SheetMetal` 0.2.0 is the first implemented Sheet Metal milestone. It owns manufacturing semantics above Core BRep: nominal thickness, reference-sheet regions, explicit bends, neutral-axis policy, cut correspondence, flat-pattern lowering, validation, and bounded DFM. Imported STEP remains the formed-geometry authority; recovered `SheetMetalPartIr` is an evidence-bearing interpretation and never silently replaces or repairs the source.
-The future Module owns developability, neutral surface and thickness, formed/fabricated state, bends and bend allowance, seams/reliefs, and flat-pattern correspondence. Flattening must be based on proved developability and stable boundary/feature provenance, not on tessellated visual similarity.
+## Supported M1 boundary
-Panel M0 makes that future seam explicit: `PanelIr` retains boundary provenance, stable directed semantic edges, optional thickness/material metadata, and first-class developability evidence. A future Sheet Metal lowering can therefore consume `Developable Panel + thickness + material` rather than reverse-engineering a mystery BRep. It must reject `NonDevelopable` and treat `Indeterminate` explicitly. M0 does not claim all ruled surfaces are developable, calculate general Gaussian curvature, infer neutral axes, or emit flat patterns.
+- Firmament V2 module-owned `SheetMetal` syntax for one rectangular base with two opposite 90° flanges and circular base holes.
+- Exact formed analytic BRep for that authored family: planar skins, concentric cylindrical bends, exact circular hole walls, closed-manifold STEP AP242 export, and no generic Boolean fallback.
+- Tolerance-bounded recognition of parallel planar skin pairs and coaxial cylindrical skin pairs in ordinary exact BRep/STEP.
+- Planar midpoint reference planes and geometric mid-cylinders. These are deliberately distinct from the manufacturing neutral axis.
+- Planar/cylindrical developability using the existing Surfacing evidence vocabulary.
+- Deterministic largest-planar-area base selection, bend-graph traversal, exact neutral-axis cylindrical development, cut mapping, overlap checks, a thickness-bearing flat AP242 solid, explicit recovered Firmament intent, and a compact secondary SVG view.
+- Explicit provisional K-factor policy. The default is `0.5`; authored source may override it. This is not a material/process database.
+- Parameterized first-pass DFM checks for positive thickness, bend-radius ratio, hole-to-bend distance, and flat overlap.
+
+M1 does not advertise arbitrary forming, stamping, hems, jogs, beads, springback, arbitrary lofted bends, double-curvature approximation, bend tables, automatic relief families, or a production nesting boundary. Unsupported and ambiguous input returns typed `Partial`/`Unsupported` evidence.
+
+## Canonical commands
+
+```text
+aetheris sheetmetal inspect part.step
+aetheris sheetmetal flatten part.step --step part-flat.step --firmament part-recovered.firmament --svg part-flat.svg --k-factor 0.5
+aetheris build fixtures/FirmamentV2/SheetMetal/simple-u-channel.firmament
+```
+
+The canonical authored fixture is [`simple-u-channel.firmament`](../../fixtures/FirmamentV2/SheetMetal/simple-u-channel.firmament). The hostile imported fixture is the existing NIST CTC-03 corpus file at `testdata/step242/nist/CTC/nist_ctc_03_asme1_ap242-e2.stp`.
+
+## Recognition doctrine
+
+Thickness candidates come from overlapping parallel planes and axially overlapping coaxial cylinders. Candidate separations are clustered under an explicit linear tolerance, then the bounded alternatives are admitted/scored/tie-broken by `JudgmentEngine`. BRep face IDs remain source bindings only; stable semantic region and bend IDs derive deterministically from ordered source bindings.
+
+The flat STEP is generated from the same analytic flat IR as the Firmament and SVG artifacts. It is a closed thickness-bearing solid and re-imports through Aetheris, but the current imported flattening preserves recovered region hulls and mapped inner-loop cut profiles rather than stitching every source edge fragment into an exact production-ready blank contour. That boundary-stitching/corner-relief problem is why imported CTC-03 remains `Partial`.
+
+See the compact [M1 evidence bundle](sheetmetal/artifacts/m1/README.md).
diff --git a/docs/modules/sheetmetal/artifacts/m1/README.md b/docs/modules/sheetmetal/artifacts/m1/README.md
new file mode 100644
index 00000000..eef129b3
--- /dev/null
+++ b/docs/modules/sheetmetal/artifacts/m1/README.md
@@ -0,0 +1,23 @@
+# AETHERIS-SHEETMETAL-M1 evidence
+
+This bundle records compact, reproducible evidence for the first implemented Sheet Metal milestone. It intentionally excludes STEP entity dumps and generated heavyweight meshes.
+
+| Evidence | Result |
+|---|---|
+| [CTC-03 geometry audit](ctc03-geometry-audit.md) | One enclosed manifold; 120 faces; analytic plane/cylinder support only. |
+| [CTC-03 recognition](ctc03-recognition.md) | Partial, honest recovery: 1.90754 mm, 8 planar regions, 7 bends, 2 openings. |
+| [Authored bracket](authored-bracket.md) | Exact closed formed BRep, two bends/two holes, valid deterministic flat. |
+| [Flat validation](flat-pattern-validation.md) | Finite/closed/contained, no planar-region overlap in either canonical fixture. |
+| [DFM summary](dfm-summary.md) | Parameterized provisional checks, no universal fabrication claims. |
+| [Validation report](validation-report.md) | Build/test/CLI/determinism and known limitations. |
+
+Primary recovered manufacturing artifacts:
+
+- [`ctc03-flat.step`](ctc03-flat.step) — closed 1.90754 mm flat solid exported through the real AP242 BRep path and re-import validated.
+- [`ctc03-recovered.firmament`](ctc03-recovered.firmament) — explicit recovered planar/cylindrical regions, seven bends, two cuts, source-face bindings, thickness, K-factor, and recovery status. Recompilation reproduces the flat hash.
+
+Secondary review artifacts:
+
+- [`authored-u-channel-flat.svg`](authored-u-channel-flat.svg) — cut contours and two labeled 90° bend lines.
+- [`ctc03-flat.svg`](ctc03-flat.svg) — recovered region contours, two slot profiles, and seven labeled bend lines.
+- [`ctc03-flat-preview.png`](ctc03-flat-preview.png) — raster QA render of the SVG; not geometry authority.
diff --git a/docs/modules/sheetmetal/artifacts/m1/authored-bracket.md b/docs/modules/sheetmetal/artifacts/m1/authored-bracket.md
new file mode 100644
index 00000000..8a03b762
--- /dev/null
+++ b/docs/modules/sheetmetal/artifacts/m1/authored-bracket.md
@@ -0,0 +1,16 @@
+# Authored U-channel
+
+Source: `fixtures/FirmamentV2/SheetMetal/simple-u-channel.firmament`.
+
+- Thickness 1.5 mm; 5052-H32 Aluminum provenance string; K = 0.42.
+- Base 100 × 60 mm; left/right flange heights 25/20 mm; two 90° bends at R2 mm.
+- Two Ø8 mm base holes at (25,30) and (75,30).
+- Formed exact BRep: one enclosed manifold, 28 vertices, 40 edges, 16 faces, 10 planes, 6 cylinders.
+- Bounds: (-3.5, 0, 0) to (103.5, 60, 25) mm.
+- STEP export/reimport succeeds through the ordinary AP242 path.
+- Each bend neutral radius is 2 + 0.42×1.5 = 2.63 mm; allowance is π/2×2.63 = 4.13119433947 mm.
+- Valid flat envelope: 146.262388679 × 60 mm. Two cut loops and two bend lines map successfully.
+- Reference-surface flat→re-fold check: point and bend-angle residuals within 1e-8 mm/rad.
+- Deterministic flat hash: `a5ce4b0368a79014b3505f3613f3449cf5d884569e3694780b4d55354b55e30d`.
+
+The formed body is explicit analytic topology produced by the Sheet Metal domain builder; it does not invoke generic `BrepBoolean`.
diff --git a/docs/modules/sheetmetal/artifacts/m1/authored-u-channel-flat.svg b/docs/modules/sheetmetal/artifacts/m1/authored-u-channel-flat.svg
new file mode 100644
index 00000000..ecfaf45c
--- /dev/null
+++ b/docs/modules/sheetmetal/artifacts/m1/authored-u-channel-flat.svg
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="170.262mm" height="84mm" viewBox="0 0 170.262 84">
+<rect width="100%" height="100%" fill="white"/>
+<g id="sheet-regions" fill="#dbeafe" fill-opacity="0.55" stroke="#0f172a" stroke-width="0.45">
+<polygon id="flat-bend-left" points="37.631,72 37.631,12 33.5,12 33.5,72"/>
+<polygon id="flat-bend-right" points="137.631,72 137.631,12 141.762,12 141.762,72"/>
+<polygon id="flat-region-base" points="37.631,72 137.631,72 137.631,12 37.631,12"/>
+<polygon id="flat-region-left-flange" points="12,72 33.5,72 33.5,12 12,12"/>
+<polygon id="flat-region-right-flange" points="141.762,72 158.262,72 158.262,12 141.762,12"/>
+</g>
+<g id="cut-contours" fill="white" stroke="#dc2626" stroke-width="0.5">
+<polygon id="feature-MountA" points="66.631,42 66.597,41.478 66.495,40.965 66.327,40.469 66.095,40 65.805,39.565 65.46,39.172 65.066,38.827 64.631,38.536 64.162,38.304 63.666,38.136 63.153,38.034 62.631,38 62.109,38.034 61.596,38.136 61.1,38.304 60.631,38.536 60.196,38.827 59.803,39.172 59.458,39.565 59.167,40 58.936,40.469 58.767,40.965 58.665,41.478 58.631,42 58.665,42.522 58.767,43.035 58.936,43.531 59.167,44 59.458,44.435 59.803,44.828 60.196,45.173 60.631,45.464 61.1,45.696 61.596,45.864 62.109,45.966 62.631,46 63.153,45.966 63.666,45.864 64.162,45.696 64.631,45.464 65.066,45.173 65.46,44.828 65.805,44.435 66.095,44 66.327,43.531 66.495,43.035 66.597,42.522"/>
+<polygon id="feature-MountB" points="116.631,42 116.597,41.478 116.495,40.965 116.327,40.469 116.095,40 115.805,39.565 115.46,39.172 115.066,38.827 114.631,38.536 114.162,38.304 113.666,38.136 113.153,38.034 112.631,38 112.109,38.034 111.596,38.136 111.1,38.304 110.631,38.536 110.196,38.827 109.803,39.172 109.458,39.565 109.167,40 108.936,40.469 108.767,40.965 108.665,41.478 108.631,42 108.665,42.522 108.767,43.035 108.936,43.531 109.167,44 109.458,44.435 109.803,44.828 110.196,45.173 110.631,45.464 111.1,45.696 111.596,45.864 112.109,45.966 112.631,46 113.153,45.966 113.666,45.864 114.162,45.696 114.631,45.464 115.066,45.173 115.46,44.828 115.805,44.435 116.095,44 116.327,43.531 116.495,43.035 116.597,42.522"/>
+</g>
+<g id="bend-lines" fill="none" stroke="#2563eb" stroke-width="0.45" stroke-dasharray="3 2">
+<line x1="35.566" y1="72" x2="35.566" y2="12"/>
+<line x1="139.697" y1="72" x2="139.697" y2="12"/>
+</g>
+<g id="bend-labels" stroke="none" font-family="Inter, 'Segoe UI', Arial, sans-serif" font-size="3" text-anchor="middle" dominant-baseline="central">
+<rect x="29.866" y="39.8" width="19.4" height="4.4" rx="0.8" fill="white" fill-opacity="0.88"/>
+<text x="39.566" y="42" fill="#1d4ed8">Up 90° R2</text>
+<rect x="133.997" y="39.8" width="19.4" height="4.4" rx="0.8" fill="white" fill-opacity="0.88"/>
+<text x="143.697" y="42" fill="#1d4ed8">Up 90° R2</text>
+</g>
+<text x="4" y="6" font-family="sans-serif" font-size="3" fill="#334155">Valid · K=0.42 · SHA-256 a5ce4b0368a7</text>
+</svg>
diff --git a/docs/modules/sheetmetal/artifacts/m1/ctc03-flat-preview.png b/docs/modules/sheetmetal/artifacts/m1/ctc03-flat-preview.png
new file mode 100644
index 00000000..be2d13c7
Binary files /dev/null and b/docs/modules/sheetmetal/artifacts/m1/ctc03-flat-preview.png differ
diff --git a/docs/modules/sheetmetal/artifacts/m1/ctc03-flat.step b/docs/modules/sheetmetal/artifacts/m1/ctc03-flat.step
new file mode 100644
index 00000000..54e9d256
--- /dev/null
+++ b/docs/modules/sheetmetal/artifacts/m1/ctc03-flat.step
@@ -0,0 +1,2028 @@
+ISO-10303-21;
+HEADER;
+FILE_DESCRIPTION(('Aetheris AP242 subset export'),'2;1');
+FILE_NAME('aetheris_export.step','1970-01-01T00:00:00',('Aetheris'),('Aetheris'),'Aetheris.Kernel','Aetheris.Kernel','');
+FILE_SCHEMA(('AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF'));
+ENDSEC;
+DATA;
+#1=CARTESIAN_POINT($,(0,0,0));
+#2=DIRECTION($,(0,0,-1));
+#3=DIRECTION($,(1,0,0));
+#4=AXIS2_PLACEMENT_3D($,#1,#2,#3);
+#5=PLANE($,#4);
+#6=CARTESIAN_POINT($,(353.540237720761,257.250330176499,0));
+#7=VERTEX_POINT($,#6);
+#8=CARTESIAN_POINT($,(402.054237720955,257.250330176499,-0));
+#9=VERTEX_POINT($,#8);
+#10=CARTESIAN_POINT($,(353.540237720761,257.250330176499,0));
+#11=DIRECTION($,(1,0,0));
+#12=VECTOR($,#11,1);
+#13=LINE($,#10,#12);
+#14=EDGE_CURVE($,#7,#9,#13,.T.);
+#15=ORIENTED_EDGE($,$,$,#14,.T.);
+#16=CARTESIAN_POINT($,(414.754237721006,269.950330176549,-0));
+#17=VERTEX_POINT($,#16);
+#18=CARTESIAN_POINT($,(402.054237720955,257.250330176499,-0));
+#19=DIRECTION($,(0.707106781186568,0.707106781186527,0));
+#20=VECTOR($,#19,1);
+#21=LINE($,#18,#20);
+#22=EDGE_CURVE($,#9,#17,#21,.T.);
+#23=ORIENTED_EDGE($,$,$,#22,.T.);
+#24=CARTESIAN_POINT($,(414.754237721006,371.550330176956,-0));
+#25=VERTEX_POINT($,#24);
+#26=CARTESIAN_POINT($,(414.754237721006,269.950330176549,-0));
+#27=DIRECTION($,(0,1,0));
+#28=VECTOR($,#27,1);
+#29=LINE($,#26,#28);
+#30=EDGE_CURVE($,#17,#25,#29,.T.);
+#31=ORIENTED_EDGE($,$,$,#30,.T.);
+#32=CARTESIAN_POINT($,(402.054237720955,384.250330177006,-0));
+#33=VERTEX_POINT($,#32);
+#34=CARTESIAN_POINT($,(414.754237721006,371.550330176956,-0));
+#35=DIRECTION($,(-0.707106781186565,0.70710678118653,0));
+#36=VECTOR($,#35,1);
+#37=LINE($,#34,#36);
+#38=EDGE_CURVE($,#25,#33,#37,.T.);
+#39=ORIENTED_EDGE($,$,$,#38,.T.);
+#40=CARTESIAN_POINT($,(353.540237720761,384.250330177006,0));
+#41=VERTEX_POINT($,#40);
+#42=CARTESIAN_POINT($,(402.054237720955,384.250330177006,-0));
+#43=DIRECTION($,(-1,0,0));
+#44=VECTOR($,#43,1);
+#45=LINE($,#42,#44);
+#46=EDGE_CURVE($,#33,#41,#45,.T.);
+#47=ORIENTED_EDGE($,$,$,#46,.T.);
+#48=CARTESIAN_POINT($,(350.445470176871,384.250330177006,0));
+#49=VERTEX_POINT($,#48);
+#50=CARTESIAN_POINT($,(353.540237720761,384.250330177006,0));
+#51=DIRECTION($,(-1,0,0));
+#52=VECTOR($,#51,1);
+#53=LINE($,#50,#52);
+#54=EDGE_CURVE($,#41,#49,#53,.T.);
+#55=ORIENTED_EDGE($,$,$,#54,.T.);
+#56=CARTESIAN_POINT($,(350.445470176871,492.685470177441,-0));
+#57=VERTEX_POINT($,#56);
+#58=CARTESIAN_POINT($,(350.445470176871,384.250330177006,0));
+#59=DIRECTION($,(0,1,0));
+#60=VECTOR($,#59,1);
+#61=LINE($,#58,#60);
+#62=EDGE_CURVE($,#49,#57,#61,.T.);
+#63=ORIENTED_EDGE($,$,$,#62,.T.);
+#64=CARTESIAN_POINT($,(337.74547017682,505.385470177492,-0));
+#65=VERTEX_POINT($,#64);
+#66=CARTESIAN_POINT($,(350.445470176871,492.685470177441,-0));
+#67=DIRECTION($,(-0.707106781186551,0.707106781186544,0));
+#68=VECTOR($,#67,1);
+#69=LINE($,#66,#68);
+#70=EDGE_CURVE($,#57,#65,#69,.T.);
+#71=ORIENTED_EDGE($,$,$,#70,.T.);
+#72=CARTESIAN_POINT($,(318.695470176744,505.385470177491,0));
+#73=VERTEX_POINT($,#72);
+#74=CARTESIAN_POINT($,(337.74547017682,505.385470177492,-0));
+#75=DIRECTION($,(-1,0,0));
+#76=VECTOR($,#75,1);
+#77=LINE($,#74,#76);
+#78=EDGE_CURVE($,#65,#73,#77,.T.);
+#79=ORIENTED_EDGE($,$,$,#78,.T.);
+#80=CARTESIAN_POINT($,(307.222735088943,505.385470177492,0));
+#81=VERTEX_POINT($,#80);
+#82=CARTESIAN_POINT($,(318.695470176744,505.385470177491,0));
+#83=DIRECTION($,(-1,0,0));
+#84=VECTOR($,#83,1);
+#85=LINE($,#82,#84);
+#86=EDGE_CURVE($,#73,#81,#85,.T.);
+#87=ORIENTED_EDGE($,$,$,#86,.T.);
+#88=CARTESIAN_POINT($,(298.332735088908,507.287930177499,0));
+#89=VERTEX_POINT($,#88);
+#90=CARTESIAN_POINT($,(307.222735088943,505.385470177492,0));
+#91=DIRECTION($,(-0.977859618153247,0.209261958284793,0));
+#92=VECTOR($,#91,1);
+#93=LINE($,#90,#92);
+#94=EDGE_CURVE($,#81,#89,#93,.T.);
+#95=ORIENTED_EDGE($,$,$,#94,.T.);
+#96=CARTESIAN_POINT($,(298.332735088908,518.7606652653,0));
+#97=VERTEX_POINT($,#96);
+#98=CARTESIAN_POINT($,(298.332735088908,507.287930177499,0));
+#99=DIRECTION($,(0,1,0));
+#100=VECTOR($,#99,1);
+#101=LINE($,#98,#100);
+#102=EDGE_CURVE($,#89,#97,#101,.T.);
+#103=ORIENTED_EDGE($,$,$,#102,.T.);
+#104=CARTESIAN_POINT($,(307.222735088944,531.33112526535,-0));
+#105=VERTEX_POINT($,#104);
+#106=CARTESIAN_POINT($,(298.332735088908,518.7606652653,0));
+#107=DIRECTION($,(0.57740839789431,0.816455474622546,0));
+#108=VECTOR($,#107,1);
+#109=LINE($,#106,#108);
+#110=EDGE_CURVE($,#97,#105,#109,.T.);
+#111=ORIENTED_EDGE($,$,$,#110,.T.);
+#112=CARTESIAN_POINT($,(307.222735088944,580.353125265546,0));
+#113=VERTEX_POINT($,#112);
+#114=CARTESIAN_POINT($,(307.222735088944,531.33112526535,-0));
+#115=DIRECTION($,(0,1,0));
+#116=VECTOR($,#115,1);
+#117=LINE($,#114,#116);
+#118=EDGE_CURVE($,#105,#113,#117,.T.);
+#119=ORIENTED_EDGE($,$,$,#118,.T.);
+#120=CARTESIAN_POINT($,(307.222735088944,591.825860353347,0));
+#121=VERTEX_POINT($,#120);
+#122=CARTESIAN_POINT($,(307.222735088944,580.353125265546,0));
+#123=DIRECTION($,(0,1,0));
+#124=VECTOR($,#123,1);
+#125=LINE($,#122,#124);
+#126=EDGE_CURVE($,#113,#121,#125,.T.);
+#127=ORIENTED_EDGE($,$,$,#126,.T.);
+#128=CARTESIAN_POINT($,(307.222735088944,622.60558035347,-0));
+#129=VERTEX_POINT($,#128);
+#130=CARTESIAN_POINT($,(307.222735088944,591.825860353347,0));
+#131=DIRECTION($,(0,1,0));
+#132=VECTOR($,#131,1);
+#133=LINE($,#130,#132);
+#134=EDGE_CURVE($,#121,#129,#133,.T.);
+#135=ORIENTED_EDGE($,$,$,#134,.T.);
+#136=CARTESIAN_POINT($,(294.522735088893,635.305580353521,-0));
+#137=VERTEX_POINT($,#136);
+#138=CARTESIAN_POINT($,(307.222735088944,622.60558035347,-0));
+#139=DIRECTION($,(-0.707106781186549,0.707106781186546,0));
+#140=VECTOR($,#139,1);
+#141=LINE($,#138,#140);
+#142=EDGE_CURVE($,#129,#137,#141,.T.);
+#143=ORIENTED_EDGE($,$,$,#142,.T.);
+#144=CARTESIAN_POINT($,(78.6227350880296,635.305580353521,-0));
+#145=VERTEX_POINT($,#144);
+#146=CARTESIAN_POINT($,(294.522735088893,635.305580353521,-0));
+#147=DIRECTION($,(-1,0,0));
+#148=VECTOR($,#147,1);
+#149=LINE($,#146,#148);
+#150=EDGE_CURVE($,#137,#145,#149,.T.);
+#151=ORIENTED_EDGE($,$,$,#150,.T.);
+#152=CARTESIAN_POINT($,(65.9227350879785,622.60558035347,-0));
+#153=VERTEX_POINT($,#152);
+#154=CARTESIAN_POINT($,(78.6227350880296,635.305580353521,-0));
+#155=DIRECTION($,(-0.707106781186555,-0.70710678118654,0));
+#156=VECTOR($,#155,1);
+#157=LINE($,#154,#156);
+#158=EDGE_CURVE($,#145,#153,#157,.T.);
+#159=ORIENTED_EDGE($,$,$,#158,.T.);
+#160=CARTESIAN_POINT($,(65.9227350879785,591.825860353347,0));
+#161=VERTEX_POINT($,#160);
+#162=CARTESIAN_POINT($,(65.9227350879785,622.60558035347,-0));
+#163=DIRECTION($,(0,-1,0));
+#164=VECTOR($,#163,1);
+#165=LINE($,#162,#164);
+#166=EDGE_CURVE($,#153,#161,#165,.T.);
+#167=ORIENTED_EDGE($,$,$,#166,.T.);
+#168=CARTESIAN_POINT($,(65.9227350879785,580.353125265546,0));
+#169=VERTEX_POINT($,#168);
+#170=CARTESIAN_POINT($,(65.9227350879785,591.825860353347,0));
+#171=DIRECTION($,(0,-1,0));
+#172=VECTOR($,#171,1);
+#173=LINE($,#170,#172);
+#174=EDGE_CURVE($,#161,#169,#173,.T.);
+#175=ORIENTED_EDGE($,$,$,#174,.T.);
+#176=CARTESIAN_POINT($,(65.9227350879785,531.33112526535,-0));
+#177=VERTEX_POINT($,#176);
+#178=CARTESIAN_POINT($,(65.9227350879785,580.353125265546,0));
+#179=DIRECTION($,(0,-1,0));
+#180=VECTOR($,#179,1);
+#181=LINE($,#178,#180);
+#182=EDGE_CURVE($,#169,#177,#181,.T.);
+#183=ORIENTED_EDGE($,$,$,#182,.T.);
+#184=CARTESIAN_POINT($,(74.8127350880135,518.7606652653,0));
+#185=VERTEX_POINT($,#184);
+#186=CARTESIAN_POINT($,(65.9227350879785,531.33112526535,-0));
+#187=DIRECTION($,(0.577408397894285,-0.816455474622563,0));
+#188=VECTOR($,#187,1);
+#189=LINE($,#186,#188);
+#190=EDGE_CURVE($,#177,#185,#189,.T.);
+#191=ORIENTED_EDGE($,$,$,#190,.T.);
+#192=CARTESIAN_POINT($,(74.8127350880135,507.287930177499,0));
+#193=VERTEX_POINT($,#192);
+#194=CARTESIAN_POINT($,(74.8127350880135,518.7606652653,0));
+#195=DIRECTION($,(0,-1,0));
+#196=VECTOR($,#195,1);
+#197=LINE($,#194,#196);
+#198=EDGE_CURVE($,#185,#193,#197,.T.);
+#199=ORIENTED_EDGE($,$,$,#198,.T.);
+#200=CARTESIAN_POINT($,(65.9227350879787,505.385470177492,0));
+#201=VERTEX_POINT($,#200);
+#202=CARTESIAN_POINT($,(74.8127350880135,507.287930177499,0));
+#203=DIRECTION($,(-0.977859618153244,-0.209261958284804,0));
+#204=VECTOR($,#203,1);
+#205=LINE($,#202,#204);
+#206=EDGE_CURVE($,#193,#201,#205,.T.);
+#207=ORIENTED_EDGE($,$,$,#206,.T.);
+#208=CARTESIAN_POINT($,(54.450000000178,505.385470177491,0));
+#209=VERTEX_POINT($,#208);
+#210=CARTESIAN_POINT($,(65.9227350879787,505.385470177492,0));
+#211=DIRECTION($,(-1,0,0));
+#212=VECTOR($,#211,1);
+#213=LINE($,#210,#212);
+#214=EDGE_CURVE($,#201,#209,#213,.T.);
+#215=ORIENTED_EDGE($,$,$,#214,.T.);
+#216=CARTESIAN_POINT($,(35.400000000102,505.385470177491,-0));
+#217=VERTEX_POINT($,#216);
+#218=CARTESIAN_POINT($,(54.450000000178,505.385470177491,0));
+#219=DIRECTION($,(-1,0,0));
+#220=VECTOR($,#219,1);
+#221=LINE($,#218,#220);
+#222=EDGE_CURVE($,#209,#217,#221,.T.);
+#223=ORIENTED_EDGE($,$,$,#222,.T.);
+#224=CARTESIAN_POINT($,(10,479.98547017739,-0));
+#225=VERTEX_POINT($,#224);
+#226=CARTESIAN_POINT($,(35.400000000102,505.385470177491,-0));
+#227=DIRECTION($,(-0.707106781186553,-0.707106781186542,0));
+#228=VECTOR($,#227,1);
+#229=LINE($,#226,#228);
+#230=EDGE_CURVE($,#217,#225,#229,.T.);
+#231=ORIENTED_EDGE($,$,$,#230,.T.);
+#232=CARTESIAN_POINT($,(10,165.320110176131,-0));
+#233=VERTEX_POINT($,#232);
+#234=CARTESIAN_POINT($,(10,479.98547017739,-0));
+#235=DIRECTION($,(0,-1,0));
+#236=VECTOR($,#235,1);
+#237=LINE($,#234,#236);
+#238=EDGE_CURVE($,#225,#233,#237,.T.);
+#239=ORIENTED_EDGE($,$,$,#238,.T.);
+#240=CARTESIAN_POINT($,(35.400000000102,139.920110176029,-0));
+#241=VERTEX_POINT($,#240);
+#242=CARTESIAN_POINT($,(10,165.320110176131,-0));
+#243=DIRECTION($,(0.707106781186548,-0.707106781186548,0));
+#244=VECTOR($,#243,1);
+#245=LINE($,#242,#244);
+#246=EDGE_CURVE($,#233,#241,#245,.T.);
+#247=ORIENTED_EDGE($,$,$,#246,.T.);
+#248=CARTESIAN_POINT($,(54.450000000178,139.920110176029,0));
+#249=VERTEX_POINT($,#248);
+#250=CARTESIAN_POINT($,(35.400000000102,139.920110176029,-0));
+#251=DIRECTION($,(1,0,0));
+#252=VECTOR($,#251,1);
+#253=LINE($,#250,#252);
+#254=EDGE_CURVE($,#241,#249,#253,.T.);
+#255=ORIENTED_EDGE($,$,$,#254,.T.);
+#256=CARTESIAN_POINT($,(65.922735087978,139.920110176029,0));
+#257=VERTEX_POINT($,#256);
+#258=CARTESIAN_POINT($,(54.450000000178,139.920110176029,0));
+#259=DIRECTION($,(1,0,0));
+#260=VECTOR($,#259,1);
+#261=LINE($,#258,#260);
+#262=EDGE_CURVE($,#249,#257,#261,.T.);
+#263=ORIENTED_EDGE($,$,$,#262,.T.);
+#264=CARTESIAN_POINT($,(74.8127350880135,138.987930176026,0));
+#265=VERTEX_POINT($,#264);
+#266=CARTESIAN_POINT($,(65.922735087978,139.920110176029,0));
+#267=DIRECTION($,(0.994547412307714,-0.104285400090474,0));
+#268=VECTOR($,#267,1);
+#269=LINE($,#266,#268);
+#270=EDGE_CURVE($,#257,#265,#269,.T.);
+#271=ORIENTED_EDGE($,$,$,#270,.T.);
+#272=CARTESIAN_POINT($,(74.8127350880135,127.515195088225,0));
+#273=VERTEX_POINT($,#272);
+#274=CARTESIAN_POINT($,(74.8127350880135,138.987930176026,0));
+#275=DIRECTION($,(0,-1,0));
+#276=VECTOR($,#275,1);
+#277=LINE($,#274,#276);
+#278=EDGE_CURVE($,#265,#273,#277,.T.);
+#279=ORIENTED_EDGE($,$,$,#278,.T.);
+#280=CARTESIAN_POINT($,(65.9227350879785,114.944735088175,-0));
+#281=VERTEX_POINT($,#280);
+#282=CARTESIAN_POINT($,(74.8127350880135,127.515195088225,0));
+#283=DIRECTION($,(-0.577408397894291,-0.816455474622559,0));
+#284=VECTOR($,#283,1);
+#285=LINE($,#282,#284);
+#286=EDGE_CURVE($,#273,#281,#285,.T.);
+#287=ORIENTED_EDGE($,$,$,#286,.T.);
+#288=CARTESIAN_POINT($,(65.9227350879785,65.9227350879786,0));
+#289=VERTEX_POINT($,#288);
+#290=CARTESIAN_POINT($,(65.9227350879785,114.944735088175,-0));
+#291=DIRECTION($,(0,-1,0));
+#292=VECTOR($,#291,1);
+#293=LINE($,#290,#292);
+#294=EDGE_CURVE($,#281,#289,#293,.T.);
+#295=ORIENTED_EDGE($,$,$,#294,.T.);
+#296=CARTESIAN_POINT($,(65.9227350879785,54.450000000178,0));
+#297=VERTEX_POINT($,#296);
+#298=CARTESIAN_POINT($,(65.9227350879785,65.9227350879786,0));
+#299=DIRECTION($,(0,-1,0));
+#300=VECTOR($,#299,1);
+#301=LINE($,#298,#300);
+#302=EDGE_CURVE($,#289,#297,#301,.T.);
+#303=ORIENTED_EDGE($,$,$,#302,.T.);
+#304=CARTESIAN_POINT($,(65.9227350879785,22.700000000051,-0));
+#305=VERTEX_POINT($,#304);
+#306=CARTESIAN_POINT($,(65.9227350879785,54.450000000178,0));
+#307=DIRECTION($,(0,-1,0));
+#308=VECTOR($,#307,1);
+#309=LINE($,#306,#308);
+#310=EDGE_CURVE($,#297,#305,#309,.T.);
+#311=ORIENTED_EDGE($,$,$,#310,.T.);
+#312=CARTESIAN_POINT($,(78.6227350880295,10,-0));
+#313=VERTEX_POINT($,#312);
+#314=CARTESIAN_POINT($,(65.9227350879785,22.700000000051,-0));
+#315=DIRECTION($,(0.707106781186548,-0.707106781186547,0));
+#316=VECTOR($,#315,1);
+#317=LINE($,#314,#316);
+#318=EDGE_CURVE($,#305,#313,#317,.T.);
+#319=ORIENTED_EDGE($,$,$,#318,.T.);
+#320=CARTESIAN_POINT($,(294.522735088893,10,-0));
+#321=VERTEX_POINT($,#320);
+#322=CARTESIAN_POINT($,(78.6227350880295,10,-0));
+#323=DIRECTION($,(1,0,0));
+#324=VECTOR($,#323,1);
+#325=LINE($,#322,#324);
+#326=EDGE_CURVE($,#313,#321,#325,.T.);
+#327=ORIENTED_EDGE($,$,$,#326,.T.);
+#328=CARTESIAN_POINT($,(307.222735088944,22.700000000051,-0));
+#329=VERTEX_POINT($,#328);
+#330=CARTESIAN_POINT($,(294.522735088893,10,-0));
+#331=DIRECTION($,(0.707106781186543,0.707106781186552,0));
+#332=VECTOR($,#331,1);
+#333=LINE($,#330,#332);
+#334=EDGE_CURVE($,#321,#329,#333,.T.);
+#335=ORIENTED_EDGE($,$,$,#334,.T.);
+#336=CARTESIAN_POINT($,(307.222735088944,54.450000000178,0));
+#337=VERTEX_POINT($,#336);
+#338=CARTESIAN_POINT($,(307.222735088944,22.700000000051,-0));
+#339=DIRECTION($,(0,1,0));
+#340=VECTOR($,#339,1);
+#341=LINE($,#338,#340);
+#342=EDGE_CURVE($,#329,#337,#341,.T.);
+#343=ORIENTED_EDGE($,$,$,#342,.T.);
+#344=CARTESIAN_POINT($,(307.222735088944,65.9227350879785,0));
+#345=VERTEX_POINT($,#344);
+#346=CARTESIAN_POINT($,(307.222735088944,54.450000000178,0));
+#347=DIRECTION($,(0,1,0));
+#348=VECTOR($,#347,1);
+#349=LINE($,#346,#348);
+#350=EDGE_CURVE($,#337,#345,#349,.T.);
+#351=ORIENTED_EDGE($,$,$,#350,.T.);
+#352=CARTESIAN_POINT($,(307.222735088944,114.944735088175,-0));
+#353=VERTEX_POINT($,#352);
+#354=CARTESIAN_POINT($,(307.222735088944,65.9227350879785,0));
+#355=DIRECTION($,(0,1,0));
+#356=VECTOR($,#355,1);
+#357=LINE($,#354,#356);
+#358=EDGE_CURVE($,#345,#353,#357,.T.);
+#359=ORIENTED_EDGE($,$,$,#358,.T.);
+#360=CARTESIAN_POINT($,(298.332735088908,127.515195088225,0));
+#361=VERTEX_POINT($,#360);
+#362=CARTESIAN_POINT($,(307.222735088944,114.944735088175,-0));
+#363=DIRECTION($,(-0.577408397894315,0.816455474622542,0));
+#364=VECTOR($,#363,1);
+#365=LINE($,#362,#364);
+#366=EDGE_CURVE($,#353,#361,#365,.T.);
+#367=ORIENTED_EDGE($,$,$,#366,.T.);
+#368=CARTESIAN_POINT($,(298.332735088908,138.987930176026,0));
+#369=VERTEX_POINT($,#368);
+#370=CARTESIAN_POINT($,(298.332735088908,127.515195088225,0));
+#371=DIRECTION($,(0,1,0));
+#372=VECTOR($,#371,1);
+#373=LINE($,#370,#372);
+#374=EDGE_CURVE($,#361,#369,#373,.T.);
+#375=ORIENTED_EDGE($,$,$,#374,.T.);
+#376=CARTESIAN_POINT($,(307.222735088944,139.920110176029,0));
+#377=VERTEX_POINT($,#376);
+#378=CARTESIAN_POINT($,(298.332735088908,138.987930176026,0));
+#379=DIRECTION($,(0.994547412307714,0.104285400090468,0));
+#380=VECTOR($,#379,1);
+#381=LINE($,#378,#380);
+#382=EDGE_CURVE($,#369,#377,#381,.T.);
+#383=ORIENTED_EDGE($,$,$,#382,.T.);
+#384=CARTESIAN_POINT($,(318.695470176744,139.920110176029,0));
+#385=VERTEX_POINT($,#384);
+#386=CARTESIAN_POINT($,(307.222735088944,139.920110176029,0));
+#387=DIRECTION($,(1,0,0));
+#388=VECTOR($,#387,1);
+#389=LINE($,#386,#388);
+#390=EDGE_CURVE($,#377,#385,#389,.T.);
+#391=ORIENTED_EDGE($,$,$,#390,.T.);
+#392=CARTESIAN_POINT($,(337.74547017682,139.920110176029,-0));
+#393=VERTEX_POINT($,#392);
+#394=CARTESIAN_POINT($,(318.695470176744,139.920110176029,0));
+#395=DIRECTION($,(1,0,0));
+#396=VECTOR($,#395,1);
+#397=LINE($,#394,#396);
+#398=EDGE_CURVE($,#385,#393,#397,.T.);
+#399=ORIENTED_EDGE($,$,$,#398,.T.);
+#400=CARTESIAN_POINT($,(350.445470176871,152.62011017608,-0));
+#401=VERTEX_POINT($,#400);
+#402=CARTESIAN_POINT($,(337.74547017682,139.920110176029,-0));
+#403=DIRECTION($,(0.707106781186546,0.707106781186549,0));
+#404=VECTOR($,#403,1);
+#405=LINE($,#402,#404);
+#406=EDGE_CURVE($,#393,#401,#405,.T.);
+#407=ORIENTED_EDGE($,$,$,#406,.T.);
+#408=CARTESIAN_POINT($,(350.445470176871,257.250330176499,0));
+#409=VERTEX_POINT($,#408);
+#410=CARTESIAN_POINT($,(350.445470176871,152.62011017608,-0));
+#411=DIRECTION($,(0,1,0));
+#412=VECTOR($,#411,1);
+#413=LINE($,#410,#412);
+#414=EDGE_CURVE($,#401,#409,#413,.T.);
+#415=ORIENTED_EDGE($,$,$,#414,.T.);
+#416=CARTESIAN_POINT($,(350.445470176871,257.250330176499,0));
+#417=DIRECTION($,(1,0,0));
+#418=VECTOR($,#417,1);
+#419=LINE($,#416,#418);
+#420=EDGE_CURVE($,#409,#7,#419,.T.);
+#421=ORIENTED_EDGE($,$,$,#420,.T.);
+#422=EDGE_LOOP($,(#15,#23,#31,#39,#47,#55,#63,#71,#79,#87,#95,#103,#111,#119,#127,#135,#143,#151,#159,#167,#175,#183,#191,#199,#207,#215,#223,#231,#239,#247,#255,#263,#271,#279,#287,#295,#303,#311,#319,#327,#335,#343,#351,#359,#367,#375,#383,#391,#399,#407,#415,#421));
+#423=FACE_OUTER_BOUND('',#422,.T.);
+#424=CARTESIAN_POINT($,(171.1803350884,354.402790176887,-0));
+#425=VERTEX_POINT($,#424);
+#426=CARTESIAN_POINT($,(190.230335088476,354.402790176887,0));
+#427=VERTEX_POINT($,#426);
+#428=CARTESIAN_POINT($,(171.1803350884,354.402790176887,-0));
+#429=DIRECTION($,(1,0,0));
+#430=VECTOR($,#429,1);
+#431=LINE($,#428,#430);
+#432=EDGE_CURVE($,#425,#427,#431,.T.);
+#433=ORIENTED_EDGE($,$,$,#432,.F.);
+#434=CARTESIAN_POINT($,(171.1803350884,443.302790177243,-0));
+#435=VERTEX_POINT($,#434);
+#436=CARTESIAN_POINT($,(171.1803350884,443.302790177243,-0));
+#437=DIRECTION($,(0,-1,0));
+#438=VECTOR($,#437,1);
+#439=LINE($,#436,#438);
+#440=EDGE_CURVE($,#435,#425,#439,.T.);
+#441=ORIENTED_EDGE($,$,$,#440,.F.);
+#442=CARTESIAN_POINT($,(190.230335088476,443.302790177243,-0));
+#443=VERTEX_POINT($,#442);
+#444=CARTESIAN_POINT($,(190.230335088476,443.302790177243,-0));
+#445=DIRECTION($,(-1,0,0));
+#446=VECTOR($,#445,1);
+#447=LINE($,#444,#446);
+#448=EDGE_CURVE($,#443,#435,#447,.T.);
+#449=ORIENTED_EDGE($,$,$,#448,.F.);
+#450=CARTESIAN_POINT($,(190.230335088476,354.402790176887,0));
+#451=DIRECTION($,(0,1,0));
+#452=VECTOR($,#451,1);
+#453=LINE($,#450,#452);
+#454=EDGE_CURVE($,#427,#443,#453,.T.);
+#455=ORIENTED_EDGE($,$,$,#454,.F.);
+#456=EDGE_LOOP($,(#433,#441,#449,#455));
+#457=FACE_BOUND('',#456,.T.);
+#458=CARTESIAN_POINT($,(107.680335088146,354.402790176887,-0));
+#459=VERTEX_POINT($,#458);
+#460=CARTESIAN_POINT($,(126.730335088222,354.402790176887,0));
+#461=VERTEX_POINT($,#460);
+#462=CARTESIAN_POINT($,(107.680335088146,354.402790176887,-0));
+#463=DIRECTION($,(1,0,0));
+#464=VECTOR($,#463,1);
+#465=LINE($,#462,#464);
+#466=EDGE_CURVE($,#459,#461,#465,.T.);
+#467=ORIENTED_EDGE($,$,$,#466,.F.);
+#468=CARTESIAN_POINT($,(107.680335088146,443.302790177243,-0));
+#469=VERTEX_POINT($,#468);
+#470=CARTESIAN_POINT($,(107.680335088146,443.302790177243,-0));
+#471=DIRECTION($,(0,-1,0));
+#472=VECTOR($,#471,1);
+#473=LINE($,#470,#472);
+#474=EDGE_CURVE($,#469,#459,#473,.T.);
+#475=ORIENTED_EDGE($,$,$,#474,.F.);
+#476=CARTESIAN_POINT($,(126.730335088222,443.302790177243,-0));
+#477=VERTEX_POINT($,#476);
+#478=CARTESIAN_POINT($,(126.730335088222,443.302790177243,-0));
+#479=DIRECTION($,(-1,0,0));
+#480=VECTOR($,#479,1);
+#481=LINE($,#478,#480);
+#482=EDGE_CURVE($,#477,#469,#481,.T.);
+#483=ORIENTED_EDGE($,$,$,#482,.F.);
+#484=CARTESIAN_POINT($,(126.730335088222,354.402790176887,0));
+#485=DIRECTION($,(0,1,0));
+#486=VECTOR($,#485,1);
+#487=LINE($,#484,#486);
+#488=EDGE_CURVE($,#461,#477,#487,.T.);
+#489=ORIENTED_EDGE($,$,$,#488,.F.);
+#490=EDGE_LOOP($,(#467,#475,#483,#489));
+#491=FACE_BOUND('',#490,.T.);
+#492=ADVANCED_FACE('',(#423,#457,#491),#5,.T.);
+#493=CARTESIAN_POINT($,(0,0,1.90754000000764));
+#494=DIRECTION($,(0,0,1));
+#495=DIRECTION($,(1,0,0));
+#496=AXIS2_PLACEMENT_3D($,#493,#494,#495);
+#497=PLANE($,#496);
+#498=CARTESIAN_POINT($,(353.540237720761,257.250330176499,1.90754000000764));
+#499=VERTEX_POINT($,#498);
+#500=CARTESIAN_POINT($,(402.054237720955,257.250330176499,1.90754000000764));
+#501=VERTEX_POINT($,#500);
+#502=CARTESIAN_POINT($,(353.540237720761,257.250330176499,1.90754000000764));
+#503=DIRECTION($,(1,0,0));
+#504=VECTOR($,#503,1);
+#505=LINE($,#502,#504);
+#506=EDGE_CURVE($,#499,#501,#505,.T.);
+#507=ORIENTED_EDGE($,$,$,#506,.T.);
+#508=CARTESIAN_POINT($,(414.754237721006,269.950330176549,1.90754000000764));
+#509=VERTEX_POINT($,#508);
+#510=CARTESIAN_POINT($,(402.054237720955,257.250330176499,1.90754000000764));
+#511=DIRECTION($,(0.707106781186568,0.707106781186527,0));
+#512=VECTOR($,#511,1);
+#513=LINE($,#510,#512);
+#514=EDGE_CURVE($,#501,#509,#513,.T.);
+#515=ORIENTED_EDGE($,$,$,#514,.T.);
+#516=CARTESIAN_POINT($,(414.754237721006,371.550330176956,1.90754000000764));
+#517=VERTEX_POINT($,#516);
+#518=CARTESIAN_POINT($,(414.754237721006,269.950330176549,1.90754000000764));
+#519=DIRECTION($,(0,1,0));
+#520=VECTOR($,#519,1);
+#521=LINE($,#518,#520);
+#522=EDGE_CURVE($,#509,#517,#521,.T.);
+#523=ORIENTED_EDGE($,$,$,#522,.T.);
+#524=CARTESIAN_POINT($,(402.054237720955,384.250330177006,1.90754000000764));
+#525=VERTEX_POINT($,#524);
+#526=CARTESIAN_POINT($,(414.754237721006,371.550330176956,1.90754000000764));
+#527=DIRECTION($,(-0.707106781186565,0.70710678118653,0));
+#528=VECTOR($,#527,1);
+#529=LINE($,#526,#528);
+#530=EDGE_CURVE($,#517,#525,#529,.T.);
+#531=ORIENTED_EDGE($,$,$,#530,.T.);
+#532=CARTESIAN_POINT($,(353.540237720761,384.250330177006,1.90754000000764));
+#533=VERTEX_POINT($,#532);
+#534=CARTESIAN_POINT($,(402.054237720955,384.250330177006,1.90754000000764));
+#535=DIRECTION($,(-1,0,0));
+#536=VECTOR($,#535,1);
+#537=LINE($,#534,#536);
+#538=EDGE_CURVE($,#525,#533,#537,.T.);
+#539=ORIENTED_EDGE($,$,$,#538,.T.);
+#540=CARTESIAN_POINT($,(350.445470176871,384.250330177006,1.90754000000764));
+#541=VERTEX_POINT($,#540);
+#542=CARTESIAN_POINT($,(353.540237720761,384.250330177006,1.90754000000764));
+#543=DIRECTION($,(-1,0,0));
+#544=VECTOR($,#543,1);
+#545=LINE($,#542,#544);
+#546=EDGE_CURVE($,#533,#541,#545,.T.);
+#547=ORIENTED_EDGE($,$,$,#546,.T.);
+#548=CARTESIAN_POINT($,(350.445470176871,492.685470177441,1.90754000000764));
+#549=VERTEX_POINT($,#548);
+#550=CARTESIAN_POINT($,(350.445470176871,384.250330177006,1.90754000000764));
+#551=DIRECTION($,(0,1,0));
+#552=VECTOR($,#551,1);
+#553=LINE($,#550,#552);
+#554=EDGE_CURVE($,#541,#549,#553,.T.);
+#555=ORIENTED_EDGE($,$,$,#554,.T.);
+#556=CARTESIAN_POINT($,(337.74547017682,505.385470177492,1.90754000000764));
+#557=VERTEX_POINT($,#556);
+#558=CARTESIAN_POINT($,(350.445470176871,492.685470177441,1.90754000000764));
+#559=DIRECTION($,(-0.707106781186551,0.707106781186544,0));
+#560=VECTOR($,#559,1);
+#561=LINE($,#558,#560);
+#562=EDGE_CURVE($,#549,#557,#561,.T.);
+#563=ORIENTED_EDGE($,$,$,#562,.T.);
+#564=CARTESIAN_POINT($,(318.695470176744,505.385470177491,1.90754000000764));
+#565=VERTEX_POINT($,#564);
+#566=CARTESIAN_POINT($,(337.74547017682,505.385470177492,1.90754000000764));
+#567=DIRECTION($,(-1,0,0));
+#568=VECTOR($,#567,1);
+#569=LINE($,#566,#568);
+#570=EDGE_CURVE($,#557,#565,#569,.T.);
+#571=ORIENTED_EDGE($,$,$,#570,.T.);
+#572=CARTESIAN_POINT($,(307.222735088943,505.385470177492,1.90754000000764));
+#573=VERTEX_POINT($,#572);
+#574=CARTESIAN_POINT($,(318.695470176744,505.385470177491,1.90754000000764));
+#575=DIRECTION($,(-1,0,0));
+#576=VECTOR($,#575,1);
+#577=LINE($,#574,#576);
+#578=EDGE_CURVE($,#565,#573,#577,.T.);
+#579=ORIENTED_EDGE($,$,$,#578,.T.);
+#580=CARTESIAN_POINT($,(298.332735088908,507.287930177499,1.90754000000764));
+#581=VERTEX_POINT($,#580);
+#582=CARTESIAN_POINT($,(307.222735088943,505.385470177492,1.90754000000764));
+#583=DIRECTION($,(-0.977859618153247,0.209261958284793,0));
+#584=VECTOR($,#583,1);
+#585=LINE($,#582,#584);
+#586=EDGE_CURVE($,#573,#581,#585,.T.);
+#587=ORIENTED_EDGE($,$,$,#586,.T.);
+#588=CARTESIAN_POINT($,(298.332735088908,518.7606652653,1.90754000000764));
+#589=VERTEX_POINT($,#588);
+#590=CARTESIAN_POINT($,(298.332735088908,507.287930177499,1.90754000000764));
+#591=DIRECTION($,(0,1,0));
+#592=VECTOR($,#591,1);
+#593=LINE($,#590,#592);
+#594=EDGE_CURVE($,#581,#589,#593,.T.);
+#595=ORIENTED_EDGE($,$,$,#594,.T.);
+#596=CARTESIAN_POINT($,(307.222735088944,531.33112526535,1.90754000000764));
+#597=VERTEX_POINT($,#596);
+#598=CARTESIAN_POINT($,(298.332735088908,518.7606652653,1.90754000000764));
+#599=DIRECTION($,(0.57740839789431,0.816455474622546,0));
+#600=VECTOR($,#599,1);
+#601=LINE($,#598,#600);
+#602=EDGE_CURVE($,#589,#597,#601,.T.);
+#603=ORIENTED_EDGE($,$,$,#602,.T.);
+#604=CARTESIAN_POINT($,(307.222735088944,580.353125265546,1.90754000000764));
+#605=VERTEX_POINT($,#604);
+#606=CARTESIAN_POINT($,(307.222735088944,531.33112526535,1.90754000000764));
+#607=DIRECTION($,(0,1,0));
+#608=VECTOR($,#607,1);
+#609=LINE($,#606,#608);
+#610=EDGE_CURVE($,#597,#605,#609,.T.);
+#611=ORIENTED_EDGE($,$,$,#610,.T.);
+#612=CARTESIAN_POINT($,(307.222735088944,591.825860353347,1.90754000000764));
+#613=VERTEX_POINT($,#612);
+#614=CARTESIAN_POINT($,(307.222735088944,580.353125265546,1.90754000000764));
+#615=DIRECTION($,(0,1,0));
+#616=VECTOR($,#615,1);
+#617=LINE($,#614,#616);
+#618=EDGE_CURVE($,#605,#613,#617,.T.);
+#619=ORIENTED_EDGE($,$,$,#618,.T.);
+#620=CARTESIAN_POINT($,(307.222735088944,622.60558035347,1.90754000000764));
+#621=VERTEX_POINT($,#620);
+#622=CARTESIAN_POINT($,(307.222735088944,591.825860353347,1.90754000000764));
+#623=DIRECTION($,(0,1,0));
+#624=VECTOR($,#623,1);
+#625=LINE($,#622,#624);
+#626=EDGE_CURVE($,#613,#621,#625,.T.);
+#627=ORIENTED_EDGE($,$,$,#626,.T.);
+#628=CARTESIAN_POINT($,(294.522735088893,635.305580353521,1.90754000000764));
+#629=VERTEX_POINT($,#628);
+#630=CARTESIAN_POINT($,(307.222735088944,622.60558035347,1.90754000000764));
+#631=DIRECTION($,(-0.707106781186549,0.707106781186546,0));
+#632=VECTOR($,#631,1);
+#633=LINE($,#630,#632);
+#634=EDGE_CURVE($,#621,#629,#633,.T.);
+#635=ORIENTED_EDGE($,$,$,#634,.T.);
+#636=CARTESIAN_POINT($,(78.6227350880296,635.305580353521,1.90754000000764));
+#637=VERTEX_POINT($,#636);
+#638=CARTESIAN_POINT($,(294.522735088893,635.305580353521,1.90754000000764));
+#639=DIRECTION($,(-1,0,0));
+#640=VECTOR($,#639,1);
+#641=LINE($,#638,#640);
+#642=EDGE_CURVE($,#629,#637,#641,.T.);
+#643=ORIENTED_EDGE($,$,$,#642,.T.);
+#644=CARTESIAN_POINT($,(65.9227350879785,622.60558035347,1.90754000000764));
+#645=VERTEX_POINT($,#644);
+#646=CARTESIAN_POINT($,(78.6227350880296,635.305580353521,1.90754000000764));
+#647=DIRECTION($,(-0.707106781186555,-0.70710678118654,0));
+#648=VECTOR($,#647,1);
+#649=LINE($,#646,#648);
+#650=EDGE_CURVE($,#637,#645,#649,.T.);
+#651=ORIENTED_EDGE($,$,$,#650,.T.);
+#652=CARTESIAN_POINT($,(65.9227350879785,591.825860353347,1.90754000000764));
+#653=VERTEX_POINT($,#652);
+#654=CARTESIAN_POINT($,(65.9227350879785,622.60558035347,1.90754000000764));
+#655=DIRECTION($,(0,-1,0));
+#656=VECTOR($,#655,1);
+#657=LINE($,#654,#656);
+#658=EDGE_CURVE($,#645,#653,#657,.T.);
+#659=ORIENTED_EDGE($,$,$,#658,.T.);
+#660=CARTESIAN_POINT($,(65.9227350879785,580.353125265546,1.90754000000764));
+#661=VERTEX_POINT($,#660);
+#662=CARTESIAN_POINT($,(65.9227350879785,591.825860353347,1.90754000000764));
+#663=DIRECTION($,(0,-1,0));
+#664=VECTOR($,#663,1);
+#665=LINE($,#662,#664);
+#666=EDGE_CURVE($,#653,#661,#665,.T.);
+#667=ORIENTED_EDGE($,$,$,#666,.T.);
+#668=CARTESIAN_POINT($,(65.9227350879785,531.33112526535,1.90754000000764));
+#669=VERTEX_POINT($,#668);
+#670=CARTESIAN_POINT($,(65.9227350879785,580.353125265546,1.90754000000764));
+#671=DIRECTION($,(0,-1,0));
+#672=VECTOR($,#671,1);
+#673=LINE($,#670,#672);
+#674=EDGE_CURVE($,#661,#669,#673,.T.);
+#675=ORIENTED_EDGE($,$,$,#674,.T.);
+#676=CARTESIAN_POINT($,(74.8127350880135,518.7606652653,1.90754000000764));
+#677=VERTEX_POINT($,#676);
+#678=CARTESIAN_POINT($,(65.9227350879785,531.33112526535,1.90754000000764));
+#679=DIRECTION($,(0.577408397894285,-0.816455474622563,0));
+#680=VECTOR($,#679,1);
+#681=LINE($,#678,#680);
+#682=EDGE_CURVE($,#669,#677,#681,.T.);
+#683=ORIENTED_EDGE($,$,$,#682,.T.);
+#684=CARTESIAN_POINT($,(74.8127350880135,507.287930177499,1.90754000000764));
+#685=VERTEX_POINT($,#684);
+#686=CARTESIAN_POINT($,(74.8127350880135,518.7606652653,1.90754000000764));
+#687=DIRECTION($,(0,-1,0));
+#688=VECTOR($,#687,1);
+#689=LINE($,#686,#688);
+#690=EDGE_CURVE($,#677,#685,#689,.T.);
+#691=ORIENTED_EDGE($,$,$,#690,.T.);
+#692=CARTESIAN_POINT($,(65.9227350879787,505.385470177492,1.90754000000764));
+#693=VERTEX_POINT($,#692);
+#694=CARTESIAN_POINT($,(74.8127350880135,507.287930177499,1.90754000000764));
+#695=DIRECTION($,(-0.977859618153244,-0.209261958284804,0));
+#696=VECTOR($,#695,1);
+#697=LINE($,#694,#696);
+#698=EDGE_CURVE($,#685,#693,#697,.T.);
+#699=ORIENTED_EDGE($,$,$,#698,.T.);
+#700=CARTESIAN_POINT($,(54.450000000178,505.385470177491,1.90754000000764));
+#701=VERTEX_POINT($,#700);
+#702=CARTESIAN_POINT($,(65.9227350879787,505.385470177492,1.90754000000764));
+#703=DIRECTION($,(-1,0,0));
+#704=VECTOR($,#703,1);
+#705=LINE($,#702,#704);
+#706=EDGE_CURVE($,#693,#701,#705,.T.);
+#707=ORIENTED_EDGE($,$,$,#706,.T.);
+#708=CARTESIAN_POINT($,(35.400000000102,505.385470177491,1.90754000000764));
+#709=VERTEX_POINT($,#708);
+#710=CARTESIAN_POINT($,(54.450000000178,505.385470177491,1.90754000000764));
+#711=DIRECTION($,(-1,0,0));
+#712=VECTOR($,#711,1);
+#713=LINE($,#710,#712);
+#714=EDGE_CURVE($,#701,#709,#713,.T.);
+#715=ORIENTED_EDGE($,$,$,#714,.T.);
+#716=CARTESIAN_POINT($,(10,479.98547017739,1.90754000000764));
+#717=VERTEX_POINT($,#716);
+#718=CARTESIAN_POINT($,(35.400000000102,505.385470177491,1.90754000000764));
+#719=DIRECTION($,(-0.707106781186553,-0.707106781186542,0));
+#720=VECTOR($,#719,1);
+#721=LINE($,#718,#720);
+#722=EDGE_CURVE($,#709,#717,#721,.T.);
+#723=ORIENTED_EDGE($,$,$,#722,.T.);
+#724=CARTESIAN_POINT($,(10,165.320110176131,1.90754000000764));
+#725=VERTEX_POINT($,#724);
+#726=CARTESIAN_POINT($,(10,479.98547017739,1.90754000000764));
+#727=DIRECTION($,(0,-1,0));
+#728=VECTOR($,#727,1);
+#729=LINE($,#726,#728);
+#730=EDGE_CURVE($,#717,#725,#729,.T.);
+#731=ORIENTED_EDGE($,$,$,#730,.T.);
+#732=CARTESIAN_POINT($,(35.400000000102,139.920110176029,1.90754000000764));
+#733=VERTEX_POINT($,#732);
+#734=CARTESIAN_POINT($,(10,165.320110176131,1.90754000000764));
+#735=DIRECTION($,(0.707106781186548,-0.707106781186548,0));
+#736=VECTOR($,#735,1);
+#737=LINE($,#734,#736);
+#738=EDGE_CURVE($,#725,#733,#737,.T.);
+#739=ORIENTED_EDGE($,$,$,#738,.T.);
+#740=CARTESIAN_POINT($,(54.450000000178,139.920110176029,1.90754000000764));
+#741=VERTEX_POINT($,#740);
+#742=CARTESIAN_POINT($,(35.400000000102,139.920110176029,1.90754000000764));
+#743=DIRECTION($,(1,0,0));
+#744=VECTOR($,#743,1);
+#745=LINE($,#742,#744);
+#746=EDGE_CURVE($,#733,#741,#745,.T.);
+#747=ORIENTED_EDGE($,$,$,#746,.T.);
+#748=CARTESIAN_POINT($,(65.922735087978,139.920110176029,1.90754000000764));
+#749=VERTEX_POINT($,#748);
+#750=CARTESIAN_POINT($,(54.450000000178,139.920110176029,1.90754000000764));
+#751=DIRECTION($,(1,0,0));
+#752=VECTOR($,#751,1);
+#753=LINE($,#750,#752);
+#754=EDGE_CURVE($,#741,#749,#753,.T.);
+#755=ORIENTED_EDGE($,$,$,#754,.T.);
+#756=CARTESIAN_POINT($,(74.8127350880135,138.987930176026,1.90754000000764));
+#757=VERTEX_POINT($,#756);
+#758=CARTESIAN_POINT($,(65.922735087978,139.920110176029,1.90754000000764));
+#759=DIRECTION($,(0.994547412307714,-0.104285400090474,0));
+#760=VECTOR($,#759,1);
+#761=LINE($,#758,#760);
+#762=EDGE_CURVE($,#749,#757,#761,.T.);
+#763=ORIENTED_EDGE($,$,$,#762,.T.);
+#764=CARTESIAN_POINT($,(74.8127350880135,127.515195088225,1.90754000000764));
+#765=VERTEX_POINT($,#764);
+#766=CARTESIAN_POINT($,(74.8127350880135,138.987930176026,1.90754000000764));
+#767=DIRECTION($,(0,-1,0));
+#768=VECTOR($,#767,1);
+#769=LINE($,#766,#768);
+#770=EDGE_CURVE($,#757,#765,#769,.T.);
+#771=ORIENTED_EDGE($,$,$,#770,.T.);
+#772=CARTESIAN_POINT($,(65.9227350879785,114.944735088175,1.90754000000764));
+#773=VERTEX_POINT($,#772);
+#774=CARTESIAN_POINT($,(74.8127350880135,127.515195088225,1.90754000000764));
+#775=DIRECTION($,(-0.577408397894291,-0.816455474622559,0));
+#776=VECTOR($,#775,1);
+#777=LINE($,#774,#776);
+#778=EDGE_CURVE($,#765,#773,#777,.T.);
+#779=ORIENTED_EDGE($,$,$,#778,.T.);
+#780=CARTESIAN_POINT($,(65.9227350879785,65.9227350879786,1.90754000000764));
+#781=VERTEX_POINT($,#780);
+#782=CARTESIAN_POINT($,(65.9227350879785,114.944735088175,1.90754000000764));
+#783=DIRECTION($,(0,-1,0));
+#784=VECTOR($,#783,1);
+#785=LINE($,#782,#784);
+#786=EDGE_CURVE($,#773,#781,#785,.T.);
+#787=ORIENTED_EDGE($,$,$,#786,.T.);
+#788=CARTESIAN_POINT($,(65.9227350879785,54.450000000178,1.90754000000764));
+#789=VERTEX_POINT($,#788);
+#790=CARTESIAN_POINT($,(65.9227350879785,65.9227350879786,1.90754000000764));
+#791=DIRECTION($,(0,-1,0));
+#792=VECTOR($,#791,1);
+#793=LINE($,#790,#792);
+#794=EDGE_CURVE($,#781,#789,#793,.T.);
+#795=ORIENTED_EDGE($,$,$,#794,.T.);
+#796=CARTESIAN_POINT($,(65.9227350879785,22.700000000051,1.90754000000764));
+#797=VERTEX_POINT($,#796);
+#798=CARTESIAN_POINT($,(65.9227350879785,54.450000000178,1.90754000000764));
+#799=DIRECTION($,(0,-1,0));
+#800=VECTOR($,#799,1);
+#801=LINE($,#798,#800);
+#802=EDGE_CURVE($,#789,#797,#801,.T.);
+#803=ORIENTED_EDGE($,$,$,#802,.T.);
+#804=CARTESIAN_POINT($,(78.6227350880295,10,1.90754000000764));
+#805=VERTEX_POINT($,#804);
+#806=CARTESIAN_POINT($,(65.9227350879785,22.700000000051,1.90754000000764));
+#807=DIRECTION($,(0.707106781186548,-0.707106781186547,0));
+#808=VECTOR($,#807,1);
+#809=LINE($,#806,#808);
+#810=EDGE_CURVE($,#797,#805,#809,.T.);
+#811=ORIENTED_EDGE($,$,$,#810,.T.);
+#812=CARTESIAN_POINT($,(294.522735088893,10,1.90754000000764));
+#813=VERTEX_POINT($,#812);
+#814=CARTESIAN_POINT($,(78.6227350880295,10,1.90754000000764));
+#815=DIRECTION($,(1,0,0));
+#816=VECTOR($,#815,1);
+#817=LINE($,#814,#816);
+#818=EDGE_CURVE($,#805,#813,#817,.T.);
+#819=ORIENTED_EDGE($,$,$,#818,.T.);
+#820=CARTESIAN_POINT($,(307.222735088944,22.700000000051,1.90754000000764));
+#821=VERTEX_POINT($,#820);
+#822=CARTESIAN_POINT($,(294.522735088893,10,1.90754000000764));
+#823=DIRECTION($,(0.707106781186543,0.707106781186552,0));
+#824=VECTOR($,#823,1);
+#825=LINE($,#822,#824);
+#826=EDGE_CURVE($,#813,#821,#825,.T.);
+#827=ORIENTED_EDGE($,$,$,#826,.T.);
+#828=CARTESIAN_POINT($,(307.222735088944,54.450000000178,1.90754000000764));
+#829=VERTEX_POINT($,#828);
+#830=CARTESIAN_POINT($,(307.222735088944,22.700000000051,1.90754000000764));
+#831=DIRECTION($,(0,1,0));
+#832=VECTOR($,#831,1);
+#833=LINE($,#830,#832);
+#834=EDGE_CURVE($,#821,#829,#833,.T.);
+#835=ORIENTED_EDGE($,$,$,#834,.T.);
+#836=CARTESIAN_POINT($,(307.222735088944,65.9227350879785,1.90754000000764));
+#837=VERTEX_POINT($,#836);
+#838=CARTESIAN_POINT($,(307.222735088944,54.450000000178,1.90754000000764));
+#839=DIRECTION($,(0,1,0));
+#840=VECTOR($,#839,1);
+#841=LINE($,#838,#840);
+#842=EDGE_CURVE($,#829,#837,#841,.T.);
+#843=ORIENTED_EDGE($,$,$,#842,.T.);
+#844=CARTESIAN_POINT($,(307.222735088944,114.944735088175,1.90754000000764));
+#845=VERTEX_POINT($,#844);
+#846=CARTESIAN_POINT($,(307.222735088944,65.9227350879785,1.90754000000764));
+#847=DIRECTION($,(0,1,0));
+#848=VECTOR($,#847,1);
+#849=LINE($,#846,#848);
+#850=EDGE_CURVE($,#837,#845,#849,.T.);
+#851=ORIENTED_EDGE($,$,$,#850,.T.);
+#852=CARTESIAN_POINT($,(298.332735088908,127.515195088225,1.90754000000764));
+#853=VERTEX_POINT($,#852);
+#854=CARTESIAN_POINT($,(307.222735088944,114.944735088175,1.90754000000764));
+#855=DIRECTION($,(-0.577408397894315,0.816455474622542,0));
+#856=VECTOR($,#855,1);
+#857=LINE($,#854,#856);
+#858=EDGE_CURVE($,#845,#853,#857,.T.);
+#859=ORIENTED_EDGE($,$,$,#858,.T.);
+#860=CARTESIAN_POINT($,(298.332735088908,138.987930176026,1.90754000000764));
+#861=VERTEX_POINT($,#860);
+#862=CARTESIAN_POINT($,(298.332735088908,127.515195088225,1.90754000000764));
+#863=DIRECTION($,(0,1,0));
+#864=VECTOR($,#863,1);
+#865=LINE($,#862,#864);
+#866=EDGE_CURVE($,#853,#861,#865,.T.);
+#867=ORIENTED_EDGE($,$,$,#866,.T.);
+#868=CARTESIAN_POINT($,(307.222735088944,139.920110176029,1.90754000000764));
+#869=VERTEX_POINT($,#868);
+#870=CARTESIAN_POINT($,(298.332735088908,138.987930176026,1.90754000000764));
+#871=DIRECTION($,(0.994547412307714,0.104285400090468,0));
+#872=VECTOR($,#871,1);
+#873=LINE($,#870,#872);
+#874=EDGE_CURVE($,#861,#869,#873,.T.);
+#875=ORIENTED_EDGE($,$,$,#874,.T.);
+#876=CARTESIAN_POINT($,(318.695470176744,139.920110176029,1.90754000000764));
+#877=VERTEX_POINT($,#876);
+#878=CARTESIAN_POINT($,(307.222735088944,139.920110176029,1.90754000000764));
+#879=DIRECTION($,(1,0,0));
+#880=VECTOR($,#879,1);
+#881=LINE($,#878,#880);
+#882=EDGE_CURVE($,#869,#877,#881,.T.);
+#883=ORIENTED_EDGE($,$,$,#882,.T.);
+#884=CARTESIAN_POINT($,(337.74547017682,139.920110176029,1.90754000000764));
+#885=VERTEX_POINT($,#884);
+#886=CARTESIAN_POINT($,(318.695470176744,139.920110176029,1.90754000000764));
+#887=DIRECTION($,(1,0,0));
+#888=VECTOR($,#887,1);
+#889=LINE($,#886,#888);
+#890=EDGE_CURVE($,#877,#885,#889,.T.);
+#891=ORIENTED_EDGE($,$,$,#890,.T.);
+#892=CARTESIAN_POINT($,(350.445470176871,152.62011017608,1.90754000000764));
+#893=VERTEX_POINT($,#892);
+#894=CARTESIAN_POINT($,(337.74547017682,139.920110176029,1.90754000000764));
+#895=DIRECTION($,(0.707106781186546,0.707106781186549,0));
+#896=VECTOR($,#895,1);
+#897=LINE($,#894,#896);
+#898=EDGE_CURVE($,#885,#893,#897,.T.);
+#899=ORIENTED_EDGE($,$,$,#898,.T.);
+#900=CARTESIAN_POINT($,(350.445470176871,257.250330176499,1.90754000000764));
+#901=VERTEX_POINT($,#900);
+#902=CARTESIAN_POINT($,(350.445470176871,152.62011017608,1.90754000000764));
+#903=DIRECTION($,(0,1,0));
+#904=VECTOR($,#903,1);
+#905=LINE($,#902,#904);
+#906=EDGE_CURVE($,#893,#901,#905,.T.);
+#907=ORIENTED_EDGE($,$,$,#906,.T.);
+#908=CARTESIAN_POINT($,(350.445470176871,257.250330176499,1.90754000000764));
+#909=DIRECTION($,(1,0,0));
+#910=VECTOR($,#909,1);
+#911=LINE($,#908,#910);
+#912=EDGE_CURVE($,#901,#499,#911,.T.);
+#913=ORIENTED_EDGE($,$,$,#912,.T.);
+#914=EDGE_LOOP($,(#507,#515,#523,#531,#539,#547,#555,#563,#571,#579,#587,#595,#603,#611,#619,#627,#635,#643,#651,#659,#667,#675,#683,#691,#699,#707,#715,#723,#731,#739,#747,#755,#763,#771,#779,#787,#795,#803,#811,#819,#827,#835,#843,#851,#859,#867,#875,#883,#891,#899,#907,#913));
+#915=FACE_OUTER_BOUND('',#914,.T.);
+#916=CARTESIAN_POINT($,(171.1803350884,354.402790176887,1.90754000000764));
+#917=VERTEX_POINT($,#916);
+#918=CARTESIAN_POINT($,(190.230335088476,354.402790176887,1.90754000000764));
+#919=VERTEX_POINT($,#918);
+#920=CARTESIAN_POINT($,(171.1803350884,354.402790176887,1.90754000000764));
+#921=DIRECTION($,(1,0,0));
+#922=VECTOR($,#921,1);
+#923=LINE($,#920,#922);
+#924=EDGE_CURVE($,#917,#919,#923,.T.);
+#925=ORIENTED_EDGE($,$,$,#924,.F.);
+#926=CARTESIAN_POINT($,(171.1803350884,443.302790177243,1.90754000000764));
+#927=VERTEX_POINT($,#926);
+#928=CARTESIAN_POINT($,(171.1803350884,443.302790177243,1.90754000000764));
+#929=DIRECTION($,(0,-1,0));
+#930=VECTOR($,#929,1);
+#931=LINE($,#928,#930);
+#932=EDGE_CURVE($,#927,#917,#931,.T.);
+#933=ORIENTED_EDGE($,$,$,#932,.F.);
+#934=CARTESIAN_POINT($,(190.230335088476,443.302790177243,1.90754000000764));
+#935=VERTEX_POINT($,#934);
+#936=CARTESIAN_POINT($,(190.230335088476,443.302790177243,1.90754000000764));
+#937=DIRECTION($,(-1,0,0));
+#938=VECTOR($,#937,1);
+#939=LINE($,#936,#938);
+#940=EDGE_CURVE($,#935,#927,#939,.T.);
+#941=ORIENTED_EDGE($,$,$,#940,.F.);
+#942=CARTESIAN_POINT($,(190.230335088476,354.402790176887,1.90754000000764));
+#943=DIRECTION($,(0,1,0));
+#944=VECTOR($,#943,1);
+#945=LINE($,#942,#944);
+#946=EDGE_CURVE($,#919,#935,#945,.T.);
+#947=ORIENTED_EDGE($,$,$,#946,.F.);
+#948=EDGE_LOOP($,(#925,#933,#941,#947));
+#949=FACE_BOUND('',#948,.T.);
+#950=CARTESIAN_POINT($,(107.680335088146,354.402790176887,1.90754000000764));
+#951=VERTEX_POINT($,#950);
+#952=CARTESIAN_POINT($,(126.730335088222,354.402790176887,1.90754000000764));
+#953=VERTEX_POINT($,#952);
+#954=CARTESIAN_POINT($,(107.680335088146,354.402790176887,1.90754000000764));
+#955=DIRECTION($,(1,0,0));
+#956=VECTOR($,#955,1);
+#957=LINE($,#954,#956);
+#958=EDGE_CURVE($,#951,#953,#957,.T.);
+#959=ORIENTED_EDGE($,$,$,#958,.F.);
+#960=CARTESIAN_POINT($,(107.680335088146,443.302790177243,1.90754000000764));
+#961=VERTEX_POINT($,#960);
+#962=CARTESIAN_POINT($,(107.680335088146,443.302790177243,1.90754000000764));
+#963=DIRECTION($,(0,-1,0));
+#964=VECTOR($,#963,1);
+#965=LINE($,#962,#964);
+#966=EDGE_CURVE($,#961,#951,#965,.T.);
+#967=ORIENTED_EDGE($,$,$,#966,.F.);
+#968=CARTESIAN_POINT($,(126.730335088222,443.302790177243,1.90754000000764));
+#969=VERTEX_POINT($,#968);
+#970=CARTESIAN_POINT($,(126.730335088222,443.302790177243,1.90754000000764));
+#971=DIRECTION($,(-1,0,0));
+#972=VECTOR($,#971,1);
+#973=LINE($,#970,#972);
+#974=EDGE_CURVE($,#969,#961,#973,.T.);
+#975=ORIENTED_EDGE($,$,$,#974,.F.);
+#976=CARTESIAN_POINT($,(126.730335088222,354.402790176887,1.90754000000764));
+#977=DIRECTION($,(0,1,0));
+#978=VECTOR($,#977,1);
+#979=LINE($,#976,#978);
+#980=EDGE_CURVE($,#953,#969,#979,.T.);
+#981=ORIENTED_EDGE($,$,$,#980,.F.);
+#982=EDGE_LOOP($,(#959,#967,#975,#981));
+#983=FACE_BOUND('',#982,.T.);
+#984=ADVANCED_FACE('',(#915,#949,#983),#497,.T.);
+#985=CARTESIAN_POINT($,(307.222735088944,54.450000000178,0));
+#986=DIRECTION($,(1,0,0));
+#987=DIRECTION($,(0,0,1));
+#988=AXIS2_PLACEMENT_3D($,#985,#986,#987);
+#989=PLANE($,#988);
+#990=ORIENTED_EDGE($,$,$,#350,.T.);
+#991=CARTESIAN_POINT($,(307.222735088944,65.9227350879785,0));
+#992=DIRECTION($,(0,0,1));
+#993=VECTOR($,#992,1);
+#994=LINE($,#991,#993);
+#995=EDGE_CURVE($,#345,#837,#994,.T.);
+#996=ORIENTED_EDGE($,$,$,#995,.T.);
+#997=ORIENTED_EDGE($,$,$,#842,.F.);
+#998=CARTESIAN_POINT($,(307.222735088944,54.450000000178,0));
+#999=DIRECTION($,(0,0,1));
+#1000=VECTOR($,#999,1);
+#1001=LINE($,#998,#1000);
+#1002=EDGE_CURVE($,#337,#829,#1001,.T.);
+#1003=ORIENTED_EDGE($,$,$,#1002,.F.);
+#1004=EDGE_LOOP($,(#990,#996,#997,#1003));
+#1005=FACE_OUTER_BOUND('',#1004,.T.);
+#1006=ADVANCED_FACE('',(#1005),#989,.T.);
+#1007=CARTESIAN_POINT($,(307.222735088944,65.9227350879785,0));
+#1008=DIRECTION($,(1,0,0));
+#1009=DIRECTION($,(0,0,1));
+#1010=AXIS2_PLACEMENT_3D($,#1007,#1008,#1009);
+#1011=PLANE($,#1010);
+#1012=ORIENTED_EDGE($,$,$,#358,.T.);
+#1013=CARTESIAN_POINT($,(307.222735088944,114.944735088175,-0));
+#1014=DIRECTION($,(0,0,1));
+#1015=VECTOR($,#1014,1);
+#1016=LINE($,#1013,#1015);
+#1017=EDGE_CURVE($,#353,#845,#1016,.T.);
+#1018=ORIENTED_EDGE($,$,$,#1017,.T.);
+#1019=ORIENTED_EDGE($,$,$,#850,.F.);
+#1020=ORIENTED_EDGE($,$,$,#995,.F.);
+#1021=EDGE_LOOP($,(#1012,#1018,#1019,#1020));
+#1022=FACE_OUTER_BOUND('',#1021,.T.);
+#1023=ADVANCED_FACE('',(#1022),#1011,.T.);
+#1024=CARTESIAN_POINT($,(307.222735088944,114.944735088175,0));
+#1025=DIRECTION($,(0.816455474622542,0.577408397894315,0));
+#1026=DIRECTION($,(0,0,1));
+#1027=AXIS2_PLACEMENT_3D($,#1024,#1025,#1026);
+#1028=PLANE($,#1027);
+#1029=ORIENTED_EDGE($,$,$,#366,.T.);
+#1030=CARTESIAN_POINT($,(298.332735088908,127.515195088225,0));
+#1031=DIRECTION($,(0,0,1));
+#1032=VECTOR($,#1031,1);
+#1033=LINE($,#1030,#1032);
+#1034=EDGE_CURVE($,#361,#853,#1033,.T.);
+#1035=ORIENTED_EDGE($,$,$,#1034,.T.);
+#1036=ORIENTED_EDGE($,$,$,#858,.F.);
+#1037=ORIENTED_EDGE($,$,$,#1017,.F.);
+#1038=EDGE_LOOP($,(#1029,#1035,#1036,#1037));
+#1039=FACE_OUTER_BOUND('',#1038,.T.);
+#1040=ADVANCED_FACE('',(#1039),#1028,.T.);
+#1041=CARTESIAN_POINT($,(298.332735088908,127.515195088225,0));
+#1042=DIRECTION($,(1,0,0));
+#1043=DIRECTION($,(0,0,1));
+#1044=AXIS2_PLACEMENT_3D($,#1041,#1042,#1043);
+#1045=PLANE($,#1044);
+#1046=ORIENTED_EDGE($,$,$,#374,.T.);
+#1047=CARTESIAN_POINT($,(298.332735088908,138.987930176026,0));
+#1048=DIRECTION($,(0,0,1));
+#1049=VECTOR($,#1048,1);
+#1050=LINE($,#1047,#1049);
+#1051=EDGE_CURVE($,#369,#861,#1050,.T.);
+#1052=ORIENTED_EDGE($,$,$,#1051,.T.);
+#1053=ORIENTED_EDGE($,$,$,#866,.F.);
+#1054=ORIENTED_EDGE($,$,$,#1034,.F.);
+#1055=EDGE_LOOP($,(#1046,#1052,#1053,#1054));
+#1056=FACE_OUTER_BOUND('',#1055,.T.);
+#1057=ADVANCED_FACE('',(#1056),#1045,.T.);
+#1058=CARTESIAN_POINT($,(298.332735088908,138.987930176026,0));
+#1059=DIRECTION($,(0.104285400090468,-0.994547412307714,0));
+#1060=DIRECTION($,(0,0,1));
+#1061=AXIS2_PLACEMENT_3D($,#1058,#1059,#1060);
+#1062=PLANE($,#1061);
+#1063=ORIENTED_EDGE($,$,$,#382,.T.);
+#1064=CARTESIAN_POINT($,(307.222735088944,139.920110176029,0));
+#1065=DIRECTION($,(0,0,1));
+#1066=VECTOR($,#1065,1);
+#1067=LINE($,#1064,#1066);
+#1068=EDGE_CURVE($,#377,#869,#1067,.T.);
+#1069=ORIENTED_EDGE($,$,$,#1068,.T.);
+#1070=ORIENTED_EDGE($,$,$,#874,.F.);
+#1071=ORIENTED_EDGE($,$,$,#1051,.F.);
+#1072=EDGE_LOOP($,(#1063,#1069,#1070,#1071));
+#1073=FACE_OUTER_BOUND('',#1072,.T.);
+#1074=ADVANCED_FACE('',(#1073),#1062,.T.);
+#1075=CARTESIAN_POINT($,(307.222735088944,139.920110176029,0));
+#1076=DIRECTION($,(0,-1,0));
+#1077=DIRECTION($,(0,0,1));
+#1078=AXIS2_PLACEMENT_3D($,#1075,#1076,#1077);
+#1079=PLANE($,#1078);
+#1080=ORIENTED_EDGE($,$,$,#390,.T.);
+#1081=CARTESIAN_POINT($,(318.695470176744,139.920110176029,0));
+#1082=DIRECTION($,(0,0,1));
+#1083=VECTOR($,#1082,1);
+#1084=LINE($,#1081,#1083);
+#1085=EDGE_CURVE($,#385,#877,#1084,.T.);
+#1086=ORIENTED_EDGE($,$,$,#1085,.T.);
+#1087=ORIENTED_EDGE($,$,$,#882,.F.);
+#1088=ORIENTED_EDGE($,$,$,#1068,.F.);
+#1089=EDGE_LOOP($,(#1080,#1086,#1087,#1088));
+#1090=FACE_OUTER_BOUND('',#1089,.T.);
+#1091=ADVANCED_FACE('',(#1090),#1079,.T.);
+#1092=CARTESIAN_POINT($,(318.695470176744,139.920110176029,0));
+#1093=DIRECTION($,(0,-1,0));
+#1094=DIRECTION($,(0,0,1));
+#1095=AXIS2_PLACEMENT_3D($,#1092,#1093,#1094);
+#1096=PLANE($,#1095);
+#1097=ORIENTED_EDGE($,$,$,#398,.T.);
+#1098=CARTESIAN_POINT($,(337.74547017682,139.920110176029,-0));
+#1099=DIRECTION($,(0,0,1));
+#1100=VECTOR($,#1099,1);
+#1101=LINE($,#1098,#1100);
+#1102=EDGE_CURVE($,#393,#885,#1101,.T.);
+#1103=ORIENTED_EDGE($,$,$,#1102,.T.);
+#1104=ORIENTED_EDGE($,$,$,#890,.F.);
+#1105=ORIENTED_EDGE($,$,$,#1085,.F.);
+#1106=EDGE_LOOP($,(#1097,#1103,#1104,#1105));
+#1107=FACE_OUTER_BOUND('',#1106,.T.);
+#1108=ADVANCED_FACE('',(#1107),#1096,.T.);
+#1109=CARTESIAN_POINT($,(337.74547017682,139.920110176029,0));
+#1110=DIRECTION($,(0.707106781186549,-0.707106781186546,0));
+#1111=DIRECTION($,(0,0,1));
+#1112=AXIS2_PLACEMENT_3D($,#1109,#1110,#1111);
+#1113=PLANE($,#1112);
+#1114=ORIENTED_EDGE($,$,$,#406,.T.);
+#1115=CARTESIAN_POINT($,(350.445470176871,152.62011017608,-0));
+#1116=DIRECTION($,(0,0,1));
+#1117=VECTOR($,#1116,1);
+#1118=LINE($,#1115,#1117);
+#1119=EDGE_CURVE($,#401,#893,#1118,.T.);
+#1120=ORIENTED_EDGE($,$,$,#1119,.T.);
+#1121=ORIENTED_EDGE($,$,$,#898,.F.);
+#1122=ORIENTED_EDGE($,$,$,#1102,.F.);
+#1123=EDGE_LOOP($,(#1114,#1120,#1121,#1122));
+#1124=FACE_OUTER_BOUND('',#1123,.T.);
+#1125=ADVANCED_FACE('',(#1124),#1113,.T.);
+#1126=CARTESIAN_POINT($,(350.445470176871,152.62011017608,0));
+#1127=DIRECTION($,(1,0,0));
+#1128=DIRECTION($,(0,0,1));
+#1129=AXIS2_PLACEMENT_3D($,#1126,#1127,#1128);
+#1130=PLANE($,#1129);
+#1131=ORIENTED_EDGE($,$,$,#414,.T.);
+#1132=CARTESIAN_POINT($,(350.445470176871,257.250330176499,0));
+#1133=DIRECTION($,(0,0,1));
+#1134=VECTOR($,#1133,1);
+#1135=LINE($,#1132,#1134);
+#1136=EDGE_CURVE($,#409,#901,#1135,.T.);
+#1137=ORIENTED_EDGE($,$,$,#1136,.T.);
+#1138=ORIENTED_EDGE($,$,$,#906,.F.);
+#1139=ORIENTED_EDGE($,$,$,#1119,.F.);
+#1140=EDGE_LOOP($,(#1131,#1137,#1138,#1139));
+#1141=FACE_OUTER_BOUND('',#1140,.T.);
+#1142=ADVANCED_FACE('',(#1141),#1130,.T.);
+#1143=CARTESIAN_POINT($,(350.445470176871,257.250330176499,0));
+#1144=DIRECTION($,(0,-1,0));
+#1145=DIRECTION($,(0,0,1));
+#1146=AXIS2_PLACEMENT_3D($,#1143,#1144,#1145);
+#1147=PLANE($,#1146);
+#1148=ORIENTED_EDGE($,$,$,#420,.T.);
+#1149=CARTESIAN_POINT($,(353.540237720761,257.250330176499,0));
+#1150=DIRECTION($,(0,0,1));
+#1151=VECTOR($,#1150,1);
+#1152=LINE($,#1149,#1151);
+#1153=EDGE_CURVE($,#7,#499,#1152,.T.);
+#1154=ORIENTED_EDGE($,$,$,#1153,.T.);
+#1155=ORIENTED_EDGE($,$,$,#912,.F.);
+#1156=ORIENTED_EDGE($,$,$,#1136,.F.);
+#1157=EDGE_LOOP($,(#1148,#1154,#1155,#1156));
+#1158=FACE_OUTER_BOUND('',#1157,.T.);
+#1159=ADVANCED_FACE('',(#1158),#1147,.T.);
+#1160=CARTESIAN_POINT($,(353.540237720761,257.250330176499,0));
+#1161=DIRECTION($,(0,-1,0));
+#1162=DIRECTION($,(0,0,1));
+#1163=AXIS2_PLACEMENT_3D($,#1160,#1161,#1162);
+#1164=PLANE($,#1163);
+#1165=ORIENTED_EDGE($,$,$,#14,.T.);
+#1166=CARTESIAN_POINT($,(402.054237720955,257.250330176499,-0));
+#1167=DIRECTION($,(0,0,1));
+#1168=VECTOR($,#1167,1);
+#1169=LINE($,#1166,#1168);
+#1170=EDGE_CURVE($,#9,#501,#1169,.T.);
+#1171=ORIENTED_EDGE($,$,$,#1170,.T.);
+#1172=ORIENTED_EDGE($,$,$,#506,.F.);
+#1173=ORIENTED_EDGE($,$,$,#1153,.F.);
+#1174=EDGE_LOOP($,(#1165,#1171,#1172,#1173));
+#1175=FACE_OUTER_BOUND('',#1174,.T.);
+#1176=ADVANCED_FACE('',(#1175),#1164,.T.);
+#1177=CARTESIAN_POINT($,(402.054237720955,257.250330176499,0));
+#1178=DIRECTION($,(0.707106781186527,-0.707106781186568,0));
+#1179=DIRECTION($,(0,0,1));
+#1180=AXIS2_PLACEMENT_3D($,#1177,#1178,#1179);
+#1181=PLANE($,#1180);
+#1182=ORIENTED_EDGE($,$,$,#22,.T.);
+#1183=CARTESIAN_POINT($,(414.754237721006,269.950330176549,-0));
+#1184=DIRECTION($,(0,0,1));
+#1185=VECTOR($,#1184,1);
+#1186=LINE($,#1183,#1185);
+#1187=EDGE_CURVE($,#17,#509,#1186,.T.);
+#1188=ORIENTED_EDGE($,$,$,#1187,.T.);
+#1189=ORIENTED_EDGE($,$,$,#514,.F.);
+#1190=ORIENTED_EDGE($,$,$,#1170,.F.);
+#1191=EDGE_LOOP($,(#1182,#1188,#1189,#1190));
+#1192=FACE_OUTER_BOUND('',#1191,.T.);
+#1193=ADVANCED_FACE('',(#1192),#1181,.T.);
+#1194=CARTESIAN_POINT($,(414.754237721006,269.950330176549,0));
+#1195=DIRECTION($,(1,0,0));
+#1196=DIRECTION($,(0,0,1));
+#1197=AXIS2_PLACEMENT_3D($,#1194,#1195,#1196);
+#1198=PLANE($,#1197);
+#1199=ORIENTED_EDGE($,$,$,#30,.T.);
+#1200=CARTESIAN_POINT($,(414.754237721006,371.550330176956,-0));
+#1201=DIRECTION($,(0,0,1));
+#1202=VECTOR($,#1201,1);
+#1203=LINE($,#1200,#1202);
+#1204=EDGE_CURVE($,#25,#517,#1203,.T.);
+#1205=ORIENTED_EDGE($,$,$,#1204,.T.);
+#1206=ORIENTED_EDGE($,$,$,#522,.F.);
+#1207=ORIENTED_EDGE($,$,$,#1187,.F.);
+#1208=EDGE_LOOP($,(#1199,#1205,#1206,#1207));
+#1209=FACE_OUTER_BOUND('',#1208,.T.);
+#1210=ADVANCED_FACE('',(#1209),#1198,.T.);
+#1211=CARTESIAN_POINT($,(414.754237721006,371.550330176956,0));
+#1212=DIRECTION($,(0.70710678118653,0.707106781186565,0));
+#1213=DIRECTION($,(0,0,1));
+#1214=AXIS2_PLACEMENT_3D($,#1211,#1212,#1213);
+#1215=PLANE($,#1214);
+#1216=ORIENTED_EDGE($,$,$,#38,.T.);
+#1217=CARTESIAN_POINT($,(402.054237720955,384.250330177006,-0));
+#1218=DIRECTION($,(0,0,1));
+#1219=VECTOR($,#1218,1);
+#1220=LINE($,#1217,#1219);
+#1221=EDGE_CURVE($,#33,#525,#1220,.T.);
+#1222=ORIENTED_EDGE($,$,$,#1221,.T.);
+#1223=ORIENTED_EDGE($,$,$,#530,.F.);
+#1224=ORIENTED_EDGE($,$,$,#1204,.F.);
+#1225=EDGE_LOOP($,(#1216,#1222,#1223,#1224));
+#1226=FACE_OUTER_BOUND('',#1225,.T.);
+#1227=ADVANCED_FACE('',(#1226),#1215,.T.);
+#1228=CARTESIAN_POINT($,(402.054237720955,384.250330177006,0));
+#1229=DIRECTION($,(0,1,0));
+#1230=DIRECTION($,(0,0,1));
+#1231=AXIS2_PLACEMENT_3D($,#1228,#1229,#1230);
+#1232=PLANE($,#1231);
+#1233=ORIENTED_EDGE($,$,$,#46,.T.);
+#1234=CARTESIAN_POINT($,(353.540237720761,384.250330177006,0));
+#1235=DIRECTION($,(0,0,1));
+#1236=VECTOR($,#1235,1);
+#1237=LINE($,#1234,#1236);
+#1238=EDGE_CURVE($,#41,#533,#1237,.T.);
+#1239=ORIENTED_EDGE($,$,$,#1238,.T.);
+#1240=ORIENTED_EDGE($,$,$,#538,.F.);
+#1241=ORIENTED_EDGE($,$,$,#1221,.F.);
+#1242=EDGE_LOOP($,(#1233,#1239,#1240,#1241));
+#1243=FACE_OUTER_BOUND('',#1242,.T.);
+#1244=ADVANCED_FACE('',(#1243),#1232,.T.);
+#1245=CARTESIAN_POINT($,(353.540237720761,384.250330177006,0));
+#1246=DIRECTION($,(0,1,0));
+#1247=DIRECTION($,(0,0,1));
+#1248=AXIS2_PLACEMENT_3D($,#1245,#1246,#1247);
+#1249=PLANE($,#1248);
+#1250=ORIENTED_EDGE($,$,$,#54,.T.);
+#1251=CARTESIAN_POINT($,(350.445470176871,384.250330177006,0));
+#1252=DIRECTION($,(0,0,1));
+#1253=VECTOR($,#1252,1);
+#1254=LINE($,#1251,#1253);
+#1255=EDGE_CURVE($,#49,#541,#1254,.T.);
+#1256=ORIENTED_EDGE($,$,$,#1255,.T.);
+#1257=ORIENTED_EDGE($,$,$,#546,.F.);
+#1258=ORIENTED_EDGE($,$,$,#1238,.F.);
+#1259=EDGE_LOOP($,(#1250,#1256,#1257,#1258));
+#1260=FACE_OUTER_BOUND('',#1259,.T.);
+#1261=ADVANCED_FACE('',(#1260),#1249,.T.);
+#1262=CARTESIAN_POINT($,(350.445470176871,384.250330177006,0));
+#1263=DIRECTION($,(1,0,0));
+#1264=DIRECTION($,(0,0,1));
+#1265=AXIS2_PLACEMENT_3D($,#1262,#1263,#1264);
+#1266=PLANE($,#1265);
+#1267=ORIENTED_EDGE($,$,$,#62,.T.);
+#1268=CARTESIAN_POINT($,(350.445470176871,492.685470177441,-0));
+#1269=DIRECTION($,(0,0,1));
+#1270=VECTOR($,#1269,1);
+#1271=LINE($,#1268,#1270);
+#1272=EDGE_CURVE($,#57,#549,#1271,.T.);
+#1273=ORIENTED_EDGE($,$,$,#1272,.T.);
+#1274=ORIENTED_EDGE($,$,$,#554,.F.);
+#1275=ORIENTED_EDGE($,$,$,#1255,.F.);
+#1276=EDGE_LOOP($,(#1267,#1273,#1274,#1275));
+#1277=FACE_OUTER_BOUND('',#1276,.T.);
+#1278=ADVANCED_FACE('',(#1277),#1266,.T.);
+#1279=CARTESIAN_POINT($,(350.445470176871,492.685470177441,0));
+#1280=DIRECTION($,(0.707106781186544,0.707106781186551,0));
+#1281=DIRECTION($,(0,0,1));
+#1282=AXIS2_PLACEMENT_3D($,#1279,#1280,#1281);
+#1283=PLANE($,#1282);
+#1284=ORIENTED_EDGE($,$,$,#70,.T.);
+#1285=CARTESIAN_POINT($,(337.74547017682,505.385470177492,-0));
+#1286=DIRECTION($,(0,0,1));
+#1287=VECTOR($,#1286,1);
+#1288=LINE($,#1285,#1287);
+#1289=EDGE_CURVE($,#65,#557,#1288,.T.);
+#1290=ORIENTED_EDGE($,$,$,#1289,.T.);
+#1291=ORIENTED_EDGE($,$,$,#562,.F.);
+#1292=ORIENTED_EDGE($,$,$,#1272,.F.);
+#1293=EDGE_LOOP($,(#1284,#1290,#1291,#1292));
+#1294=FACE_OUTER_BOUND('',#1293,.T.);
+#1295=ADVANCED_FACE('',(#1294),#1283,.T.);
+#1296=CARTESIAN_POINT($,(337.74547017682,505.385470177491,0));
+#1297=DIRECTION($,(0,1,0));
+#1298=DIRECTION($,(0,0,1));
+#1299=AXIS2_PLACEMENT_3D($,#1296,#1297,#1298);
+#1300=PLANE($,#1299);
+#1301=ORIENTED_EDGE($,$,$,#78,.T.);
+#1302=CARTESIAN_POINT($,(318.695470176744,505.385470177491,0));
+#1303=DIRECTION($,(0,0,1));
+#1304=VECTOR($,#1303,1);
+#1305=LINE($,#1302,#1304);
+#1306=EDGE_CURVE($,#73,#565,#1305,.T.);
+#1307=ORIENTED_EDGE($,$,$,#1306,.T.);
+#1308=ORIENTED_EDGE($,$,$,#570,.F.);
+#1309=ORIENTED_EDGE($,$,$,#1289,.F.);
+#1310=EDGE_LOOP($,(#1301,#1307,#1308,#1309));
+#1311=FACE_OUTER_BOUND('',#1310,.T.);
+#1312=ADVANCED_FACE('',(#1311),#1300,.T.);
+#1313=CARTESIAN_POINT($,(318.695470176744,505.385470177492,0));
+#1314=DIRECTION($,(0,1,0));
+#1315=DIRECTION($,(0,0,1));
+#1316=AXIS2_PLACEMENT_3D($,#1313,#1314,#1315);
+#1317=PLANE($,#1316);
+#1318=ORIENTED_EDGE($,$,$,#86,.T.);
+#1319=CARTESIAN_POINT($,(307.222735088943,505.385470177492,0));
+#1320=DIRECTION($,(0,0,1));
+#1321=VECTOR($,#1320,1);
+#1322=LINE($,#1319,#1321);
+#1323=EDGE_CURVE($,#81,#573,#1322,.T.);
+#1324=ORIENTED_EDGE($,$,$,#1323,.T.);
+#1325=ORIENTED_EDGE($,$,$,#578,.F.);
+#1326=ORIENTED_EDGE($,$,$,#1306,.F.);
+#1327=EDGE_LOOP($,(#1318,#1324,#1325,#1326));
+#1328=FACE_OUTER_BOUND('',#1327,.T.);
+#1329=ADVANCED_FACE('',(#1328),#1317,.T.);
+#1330=CARTESIAN_POINT($,(307.222735088944,505.385470177491,0));
+#1331=DIRECTION($,(0.209261958284793,0.977859618153247,0));
+#1332=DIRECTION($,(0,0,1));
+#1333=AXIS2_PLACEMENT_3D($,#1330,#1331,#1332);
+#1334=PLANE($,#1333);
+#1335=ORIENTED_EDGE($,$,$,#94,.T.);
+#1336=CARTESIAN_POINT($,(298.332735088908,507.287930177499,0));
+#1337=DIRECTION($,(0,0,1));
+#1338=VECTOR($,#1337,1);
+#1339=LINE($,#1336,#1338);
+#1340=EDGE_CURVE($,#89,#581,#1339,.T.);
+#1341=ORIENTED_EDGE($,$,$,#1340,.T.);
+#1342=ORIENTED_EDGE($,$,$,#586,.F.);
+#1343=ORIENTED_EDGE($,$,$,#1323,.F.);
+#1344=EDGE_LOOP($,(#1335,#1341,#1342,#1343));
+#1345=FACE_OUTER_BOUND('',#1344,.T.);
+#1346=ADVANCED_FACE('',(#1345),#1334,.T.);
+#1347=CARTESIAN_POINT($,(298.332735088908,507.287930177499,0));
+#1348=DIRECTION($,(1,0,0));
+#1349=DIRECTION($,(0,0,1));
+#1350=AXIS2_PLACEMENT_3D($,#1347,#1348,#1349);
+#1351=PLANE($,#1350);
+#1352=ORIENTED_EDGE($,$,$,#102,.T.);
+#1353=CARTESIAN_POINT($,(298.332735088908,518.7606652653,0));
+#1354=DIRECTION($,(0,0,1));
+#1355=VECTOR($,#1354,1);
+#1356=LINE($,#1353,#1355);
+#1357=EDGE_CURVE($,#97,#589,#1356,.T.);
+#1358=ORIENTED_EDGE($,$,$,#1357,.T.);
+#1359=ORIENTED_EDGE($,$,$,#594,.F.);
+#1360=ORIENTED_EDGE($,$,$,#1340,.F.);
+#1361=EDGE_LOOP($,(#1352,#1358,#1359,#1360));
+#1362=FACE_OUTER_BOUND('',#1361,.T.);
+#1363=ADVANCED_FACE('',(#1362),#1351,.T.);
+#1364=CARTESIAN_POINT($,(298.332735088908,518.7606652653,0));
+#1365=DIRECTION($,(0.816455474622546,-0.57740839789431,0));
+#1366=DIRECTION($,(0,0,1));
+#1367=AXIS2_PLACEMENT_3D($,#1364,#1365,#1366);
+#1368=PLANE($,#1367);
+#1369=ORIENTED_EDGE($,$,$,#110,.T.);
+#1370=CARTESIAN_POINT($,(307.222735088944,531.33112526535,-0));
+#1371=DIRECTION($,(0,0,1));
+#1372=VECTOR($,#1371,1);
+#1373=LINE($,#1370,#1372);
+#1374=EDGE_CURVE($,#105,#597,#1373,.T.);
+#1375=ORIENTED_EDGE($,$,$,#1374,.T.);
+#1376=ORIENTED_EDGE($,$,$,#602,.F.);
+#1377=ORIENTED_EDGE($,$,$,#1357,.F.);
+#1378=EDGE_LOOP($,(#1369,#1375,#1376,#1377));
+#1379=FACE_OUTER_BOUND('',#1378,.T.);
+#1380=ADVANCED_FACE('',(#1379),#1368,.T.);
+#1381=CARTESIAN_POINT($,(307.222735088944,531.33112526535,0));
+#1382=DIRECTION($,(1,0,0));
+#1383=DIRECTION($,(0,0,1));
+#1384=AXIS2_PLACEMENT_3D($,#1381,#1382,#1383);
+#1385=PLANE($,#1384);
+#1386=ORIENTED_EDGE($,$,$,#118,.T.);
+#1387=CARTESIAN_POINT($,(307.222735088944,580.353125265546,0));
+#1388=DIRECTION($,(0,0,1));
+#1389=VECTOR($,#1388,1);
+#1390=LINE($,#1387,#1389);
+#1391=EDGE_CURVE($,#113,#605,#1390,.T.);
+#1392=ORIENTED_EDGE($,$,$,#1391,.T.);
+#1393=ORIENTED_EDGE($,$,$,#610,.F.);
+#1394=ORIENTED_EDGE($,$,$,#1374,.F.);
+#1395=EDGE_LOOP($,(#1386,#1392,#1393,#1394));
+#1396=FACE_OUTER_BOUND('',#1395,.T.);
+#1397=ADVANCED_FACE('',(#1396),#1385,.T.);
+#1398=CARTESIAN_POINT($,(307.222735088944,580.353125265546,0));
+#1399=DIRECTION($,(1,0,0));
+#1400=DIRECTION($,(0,0,1));
+#1401=AXIS2_PLACEMENT_3D($,#1398,#1399,#1400);
+#1402=PLANE($,#1401);
+#1403=ORIENTED_EDGE($,$,$,#126,.T.);
+#1404=CARTESIAN_POINT($,(307.222735088944,591.825860353347,0));
+#1405=DIRECTION($,(0,0,1));
+#1406=VECTOR($,#1405,1);
+#1407=LINE($,#1404,#1406);
+#1408=EDGE_CURVE($,#121,#613,#1407,.T.);
+#1409=ORIENTED_EDGE($,$,$,#1408,.T.);
+#1410=ORIENTED_EDGE($,$,$,#618,.F.);
+#1411=ORIENTED_EDGE($,$,$,#1391,.F.);
+#1412=EDGE_LOOP($,(#1403,#1409,#1410,#1411));
+#1413=FACE_OUTER_BOUND('',#1412,.T.);
+#1414=ADVANCED_FACE('',(#1413),#1402,.T.);
+#1415=CARTESIAN_POINT($,(307.222735088944,591.825860353347,0));
+#1416=DIRECTION($,(1,0,0));
+#1417=DIRECTION($,(0,0,1));
+#1418=AXIS2_PLACEMENT_3D($,#1415,#1416,#1417);
+#1419=PLANE($,#1418);
+#1420=ORIENTED_EDGE($,$,$,#134,.T.);
+#1421=CARTESIAN_POINT($,(307.222735088944,622.60558035347,-0));
+#1422=DIRECTION($,(0,0,1));
+#1423=VECTOR($,#1422,1);
+#1424=LINE($,#1421,#1423);
+#1425=EDGE_CURVE($,#129,#621,#1424,.T.);
+#1426=ORIENTED_EDGE($,$,$,#1425,.T.);
+#1427=ORIENTED_EDGE($,$,$,#626,.F.);
+#1428=ORIENTED_EDGE($,$,$,#1408,.F.);
+#1429=EDGE_LOOP($,(#1420,#1426,#1427,#1428));
+#1430=FACE_OUTER_BOUND('',#1429,.T.);
+#1431=ADVANCED_FACE('',(#1430),#1419,.T.);
+#1432=CARTESIAN_POINT($,(307.222735088944,622.60558035347,0));
+#1433=DIRECTION($,(0.707106781186546,0.707106781186549,0));
+#1434=DIRECTION($,(0,0,1));
+#1435=AXIS2_PLACEMENT_3D($,#1432,#1433,#1434);
+#1436=PLANE($,#1435);
+#1437=ORIENTED_EDGE($,$,$,#142,.T.);
+#1438=CARTESIAN_POINT($,(294.522735088893,635.305580353521,-0));
+#1439=DIRECTION($,(0,0,1));
+#1440=VECTOR($,#1439,1);
+#1441=LINE($,#1438,#1440);
+#1442=EDGE_CURVE($,#137,#629,#1441,.T.);
+#1443=ORIENTED_EDGE($,$,$,#1442,.T.);
+#1444=ORIENTED_EDGE($,$,$,#634,.F.);
+#1445=ORIENTED_EDGE($,$,$,#1425,.F.);
+#1446=EDGE_LOOP($,(#1437,#1443,#1444,#1445));
+#1447=FACE_OUTER_BOUND('',#1446,.T.);
+#1448=ADVANCED_FACE('',(#1447),#1436,.T.);
+#1449=CARTESIAN_POINT($,(294.522735088893,635.305580353521,0));
+#1450=DIRECTION($,(0,1,0));
+#1451=DIRECTION($,(0,0,1));
+#1452=AXIS2_PLACEMENT_3D($,#1449,#1450,#1451);
+#1453=PLANE($,#1452);
+#1454=ORIENTED_EDGE($,$,$,#150,.T.);
+#1455=CARTESIAN_POINT($,(78.6227350880296,635.305580353521,-0));
+#1456=DIRECTION($,(0,0,1));
+#1457=VECTOR($,#1456,1);
+#1458=LINE($,#1455,#1457);
+#1459=EDGE_CURVE($,#145,#637,#1458,.T.);
+#1460=ORIENTED_EDGE($,$,$,#1459,.T.);
+#1461=ORIENTED_EDGE($,$,$,#642,.F.);
+#1462=ORIENTED_EDGE($,$,$,#1442,.F.);
+#1463=EDGE_LOOP($,(#1454,#1460,#1461,#1462));
+#1464=FACE_OUTER_BOUND('',#1463,.T.);
+#1465=ADVANCED_FACE('',(#1464),#1453,.T.);
+#1466=CARTESIAN_POINT($,(78.6227350880295,635.305580353521,0));
+#1467=DIRECTION($,(-0.70710678118654,0.707106781186555,0));
+#1468=DIRECTION($,(0,0,1));
+#1469=AXIS2_PLACEMENT_3D($,#1466,#1467,#1468);
+#1470=PLANE($,#1469);
+#1471=ORIENTED_EDGE($,$,$,#158,.T.);
+#1472=CARTESIAN_POINT($,(65.9227350879785,622.60558035347,-0));
+#1473=DIRECTION($,(0,0,1));
+#1474=VECTOR($,#1473,1);
+#1475=LINE($,#1472,#1474);
+#1476=EDGE_CURVE($,#153,#645,#1475,.T.);
+#1477=ORIENTED_EDGE($,$,$,#1476,.T.);
+#1478=ORIENTED_EDGE($,$,$,#650,.F.);
+#1479=ORIENTED_EDGE($,$,$,#1459,.F.);
+#1480=EDGE_LOOP($,(#1471,#1477,#1478,#1479));
+#1481=FACE_OUTER_BOUND('',#1480,.T.);
+#1482=ADVANCED_FACE('',(#1481),#1470,.T.);
+#1483=CARTESIAN_POINT($,(65.9227350879785,622.60558035347,0));
+#1484=DIRECTION($,(-1,0,0));
+#1485=DIRECTION($,(0,0,1));
+#1486=AXIS2_PLACEMENT_3D($,#1483,#1484,#1485);
+#1487=PLANE($,#1486);
+#1488=ORIENTED_EDGE($,$,$,#166,.T.);
+#1489=CARTESIAN_POINT($,(65.9227350879785,591.825860353347,0));
+#1490=DIRECTION($,(0,0,1));
+#1491=VECTOR($,#1490,1);
+#1492=LINE($,#1489,#1491);
+#1493=EDGE_CURVE($,#161,#653,#1492,.T.);
+#1494=ORIENTED_EDGE($,$,$,#1493,.T.);
+#1495=ORIENTED_EDGE($,$,$,#658,.F.);
+#1496=ORIENTED_EDGE($,$,$,#1476,.F.);
+#1497=EDGE_LOOP($,(#1488,#1494,#1495,#1496));
+#1498=FACE_OUTER_BOUND('',#1497,.T.);
+#1499=ADVANCED_FACE('',(#1498),#1487,.T.);
+#1500=CARTESIAN_POINT($,(65.9227350879785,591.825860353347,0));
+#1501=DIRECTION($,(-1,0,0));
+#1502=DIRECTION($,(0,0,1));
+#1503=AXIS2_PLACEMENT_3D($,#1500,#1501,#1502);
+#1504=PLANE($,#1503);
+#1505=ORIENTED_EDGE($,$,$,#174,.T.);
+#1506=CARTESIAN_POINT($,(65.9227350879785,580.353125265546,0));
+#1507=DIRECTION($,(0,0,1));
+#1508=VECTOR($,#1507,1);
+#1509=LINE($,#1506,#1508);
+#1510=EDGE_CURVE($,#169,#661,#1509,.T.);
+#1511=ORIENTED_EDGE($,$,$,#1510,.T.);
+#1512=ORIENTED_EDGE($,$,$,#666,.F.);
+#1513=ORIENTED_EDGE($,$,$,#1493,.F.);
+#1514=EDGE_LOOP($,(#1505,#1511,#1512,#1513));
+#1515=FACE_OUTER_BOUND('',#1514,.T.);
+#1516=ADVANCED_FACE('',(#1515),#1504,.T.);
+#1517=CARTESIAN_POINT($,(65.9227350879785,580.353125265546,0));
+#1518=DIRECTION($,(-1,0,0));
+#1519=DIRECTION($,(0,0,1));
+#1520=AXIS2_PLACEMENT_3D($,#1517,#1518,#1519);
+#1521=PLANE($,#1520);
+#1522=ORIENTED_EDGE($,$,$,#182,.T.);
+#1523=CARTESIAN_POINT($,(65.9227350879785,531.33112526535,-0));
+#1524=DIRECTION($,(0,0,1));
+#1525=VECTOR($,#1524,1);
+#1526=LINE($,#1523,#1525);
+#1527=EDGE_CURVE($,#177,#669,#1526,.T.);
+#1528=ORIENTED_EDGE($,$,$,#1527,.T.);
+#1529=ORIENTED_EDGE($,$,$,#674,.F.);
+#1530=ORIENTED_EDGE($,$,$,#1510,.F.);
+#1531=EDGE_LOOP($,(#1522,#1528,#1529,#1530));
+#1532=FACE_OUTER_BOUND('',#1531,.T.);
+#1533=ADVANCED_FACE('',(#1532),#1521,.T.);
+#1534=CARTESIAN_POINT($,(65.9227350879785,531.33112526535,0));
+#1535=DIRECTION($,(-0.816455474622563,-0.577408397894285,0));
+#1536=DIRECTION($,(0,0,1));
+#1537=AXIS2_PLACEMENT_3D($,#1534,#1535,#1536);
+#1538=PLANE($,#1537);
+#1539=ORIENTED_EDGE($,$,$,#190,.T.);
+#1540=CARTESIAN_POINT($,(74.8127350880135,518.7606652653,0));
+#1541=DIRECTION($,(0,0,1));
+#1542=VECTOR($,#1541,1);
+#1543=LINE($,#1540,#1542);
+#1544=EDGE_CURVE($,#185,#677,#1543,.T.);
+#1545=ORIENTED_EDGE($,$,$,#1544,.T.);
+#1546=ORIENTED_EDGE($,$,$,#682,.F.);
+#1547=ORIENTED_EDGE($,$,$,#1527,.F.);
+#1548=EDGE_LOOP($,(#1539,#1545,#1546,#1547));
+#1549=FACE_OUTER_BOUND('',#1548,.T.);
+#1550=ADVANCED_FACE('',(#1549),#1538,.T.);
+#1551=CARTESIAN_POINT($,(74.8127350880135,518.7606652653,0));
+#1552=DIRECTION($,(-1,0,0));
+#1553=DIRECTION($,(0,0,1));
+#1554=AXIS2_PLACEMENT_3D($,#1551,#1552,#1553);
+#1555=PLANE($,#1554);
+#1556=ORIENTED_EDGE($,$,$,#198,.T.);
+#1557=CARTESIAN_POINT($,(74.8127350880135,507.287930177499,0));
+#1558=DIRECTION($,(0,0,1));
+#1559=VECTOR($,#1558,1);
+#1560=LINE($,#1557,#1559);
+#1561=EDGE_CURVE($,#193,#685,#1560,.T.);
+#1562=ORIENTED_EDGE($,$,$,#1561,.T.);
+#1563=ORIENTED_EDGE($,$,$,#690,.F.);
+#1564=ORIENTED_EDGE($,$,$,#1544,.F.);
+#1565=EDGE_LOOP($,(#1556,#1562,#1563,#1564));
+#1566=FACE_OUTER_BOUND('',#1565,.T.);
+#1567=ADVANCED_FACE('',(#1566),#1555,.T.);
+#1568=CARTESIAN_POINT($,(74.8127350880135,507.287930177499,0));
+#1569=DIRECTION($,(-0.209261958284804,0.977859618153244,0));
+#1570=DIRECTION($,(0,0,1));
+#1571=AXIS2_PLACEMENT_3D($,#1568,#1569,#1570);
+#1572=PLANE($,#1571);
+#1573=ORIENTED_EDGE($,$,$,#206,.T.);
+#1574=CARTESIAN_POINT($,(65.9227350879787,505.385470177492,0));
+#1575=DIRECTION($,(0,0,1));
+#1576=VECTOR($,#1575,1);
+#1577=LINE($,#1574,#1576);
+#1578=EDGE_CURVE($,#201,#693,#1577,.T.);
+#1579=ORIENTED_EDGE($,$,$,#1578,.T.);
+#1580=ORIENTED_EDGE($,$,$,#698,.F.);
+#1581=ORIENTED_EDGE($,$,$,#1561,.F.);
+#1582=EDGE_LOOP($,(#1573,#1579,#1580,#1581));
+#1583=FACE_OUTER_BOUND('',#1582,.T.);
+#1584=ADVANCED_FACE('',(#1583),#1572,.T.);
+#1585=CARTESIAN_POINT($,(65.9227350879785,505.385470177491,0));
+#1586=DIRECTION($,(0,1,0));
+#1587=DIRECTION($,(0,0,1));
+#1588=AXIS2_PLACEMENT_3D($,#1585,#1586,#1587);
+#1589=PLANE($,#1588);
+#1590=ORIENTED_EDGE($,$,$,#214,.T.);
+#1591=CARTESIAN_POINT($,(54.450000000178,505.385470177491,0));
+#1592=DIRECTION($,(0,0,1));
+#1593=VECTOR($,#1592,1);
+#1594=LINE($,#1591,#1593);
+#1595=EDGE_CURVE($,#209,#701,#1594,.T.);
+#1596=ORIENTED_EDGE($,$,$,#1595,.T.);
+#1597=ORIENTED_EDGE($,$,$,#706,.F.);
+#1598=ORIENTED_EDGE($,$,$,#1578,.F.);
+#1599=EDGE_LOOP($,(#1590,#1596,#1597,#1598));
+#1600=FACE_OUTER_BOUND('',#1599,.T.);
+#1601=ADVANCED_FACE('',(#1600),#1589,.T.);
+#1602=CARTESIAN_POINT($,(54.450000000178,505.385470177491,0));
+#1603=DIRECTION($,(0,1,0));
+#1604=DIRECTION($,(0,0,1));
+#1605=AXIS2_PLACEMENT_3D($,#1602,#1603,#1604);
+#1606=PLANE($,#1605);
+#1607=ORIENTED_EDGE($,$,$,#222,.T.);
+#1608=CARTESIAN_POINT($,(35.400000000102,505.385470177491,-0));
+#1609=DIRECTION($,(0,0,1));
+#1610=VECTOR($,#1609,1);
+#1611=LINE($,#1608,#1610);
+#1612=EDGE_CURVE($,#217,#709,#1611,.T.);
+#1613=ORIENTED_EDGE($,$,$,#1612,.T.);
+#1614=ORIENTED_EDGE($,$,$,#714,.F.);
+#1615=ORIENTED_EDGE($,$,$,#1595,.F.);
+#1616=EDGE_LOOP($,(#1607,#1613,#1614,#1615));
+#1617=FACE_OUTER_BOUND('',#1616,.T.);
+#1618=ADVANCED_FACE('',(#1617),#1606,.T.);
+#1619=CARTESIAN_POINT($,(35.400000000102,505.385470177491,0));
+#1620=DIRECTION($,(-0.707106781186542,0.707106781186553,0));
+#1621=DIRECTION($,(0,0,1));
+#1622=AXIS2_PLACEMENT_3D($,#1619,#1620,#1621);
+#1623=PLANE($,#1622);
+#1624=ORIENTED_EDGE($,$,$,#230,.T.);
+#1625=CARTESIAN_POINT($,(10,479.98547017739,-0));
+#1626=DIRECTION($,(0,0,1));
+#1627=VECTOR($,#1626,1);
+#1628=LINE($,#1625,#1627);
+#1629=EDGE_CURVE($,#225,#717,#1628,.T.);
+#1630=ORIENTED_EDGE($,$,$,#1629,.T.);
+#1631=ORIENTED_EDGE($,$,$,#722,.F.);
+#1632=ORIENTED_EDGE($,$,$,#1612,.F.);
+#1633=EDGE_LOOP($,(#1624,#1630,#1631,#1632));
+#1634=FACE_OUTER_BOUND('',#1633,.T.);
+#1635=ADVANCED_FACE('',(#1634),#1623,.T.);
+#1636=CARTESIAN_POINT($,(10,479.98547017739,0));
+#1637=DIRECTION($,(-1,0,0));
+#1638=DIRECTION($,(0,0,1));
+#1639=AXIS2_PLACEMENT_3D($,#1636,#1637,#1638);
+#1640=PLANE($,#1639);
+#1641=ORIENTED_EDGE($,$,$,#238,.T.);
+#1642=CARTESIAN_POINT($,(10,165.320110176131,-0));
+#1643=DIRECTION($,(0,0,1));
+#1644=VECTOR($,#1643,1);
+#1645=LINE($,#1642,#1644);
+#1646=EDGE_CURVE($,#233,#725,#1645,.T.);
+#1647=ORIENTED_EDGE($,$,$,#1646,.T.);
+#1648=ORIENTED_EDGE($,$,$,#730,.F.);
+#1649=ORIENTED_EDGE($,$,$,#1629,.F.);
+#1650=EDGE_LOOP($,(#1641,#1647,#1648,#1649));
+#1651=FACE_OUTER_BOUND('',#1650,.T.);
+#1652=ADVANCED_FACE('',(#1651),#1640,.T.);
+#1653=CARTESIAN_POINT($,(10,165.320110176131,0));
+#1654=DIRECTION($,(-0.707106781186547,-0.707106781186547,0));
+#1655=DIRECTION($,(0,0,1));
+#1656=AXIS2_PLACEMENT_3D($,#1653,#1654,#1655);
+#1657=PLANE($,#1656);
+#1658=ORIENTED_EDGE($,$,$,#246,.T.);
+#1659=CARTESIAN_POINT($,(35.400000000102,139.920110176029,-0));
+#1660=DIRECTION($,(0,0,1));
+#1661=VECTOR($,#1660,1);
+#1662=LINE($,#1659,#1661);
+#1663=EDGE_CURVE($,#241,#733,#1662,.T.);
+#1664=ORIENTED_EDGE($,$,$,#1663,.T.);
+#1665=ORIENTED_EDGE($,$,$,#738,.F.);
+#1666=ORIENTED_EDGE($,$,$,#1646,.F.);
+#1667=EDGE_LOOP($,(#1658,#1664,#1665,#1666));
+#1668=FACE_OUTER_BOUND('',#1667,.T.);
+#1669=ADVANCED_FACE('',(#1668),#1657,.T.);
+#1670=CARTESIAN_POINT($,(35.400000000102,139.920110176029,0));
+#1671=DIRECTION($,(0,-1,0));
+#1672=DIRECTION($,(0,0,1));
+#1673=AXIS2_PLACEMENT_3D($,#1670,#1671,#1672);
+#1674=PLANE($,#1673);
+#1675=ORIENTED_EDGE($,$,$,#254,.T.);
+#1676=CARTESIAN_POINT($,(54.450000000178,139.920110176029,0));
+#1677=DIRECTION($,(0,0,1));
+#1678=VECTOR($,#1677,1);
+#1679=LINE($,#1676,#1678);
+#1680=EDGE_CURVE($,#249,#741,#1679,.T.);
+#1681=ORIENTED_EDGE($,$,$,#1680,.T.);
+#1682=ORIENTED_EDGE($,$,$,#746,.F.);
+#1683=ORIENTED_EDGE($,$,$,#1663,.F.);
+#1684=EDGE_LOOP($,(#1675,#1681,#1682,#1683));
+#1685=FACE_OUTER_BOUND('',#1684,.T.);
+#1686=ADVANCED_FACE('',(#1685),#1674,.T.);
+#1687=CARTESIAN_POINT($,(54.450000000178,139.920110176029,0));
+#1688=DIRECTION($,(0,-1,0));
+#1689=DIRECTION($,(0,0,1));
+#1690=AXIS2_PLACEMENT_3D($,#1687,#1688,#1689);
+#1691=PLANE($,#1690);
+#1692=ORIENTED_EDGE($,$,$,#262,.T.);
+#1693=CARTESIAN_POINT($,(65.922735087978,139.920110176029,0));
+#1694=DIRECTION($,(0,0,1));
+#1695=VECTOR($,#1694,1);
+#1696=LINE($,#1693,#1695);
+#1697=EDGE_CURVE($,#257,#749,#1696,.T.);
+#1698=ORIENTED_EDGE($,$,$,#1697,.T.);
+#1699=ORIENTED_EDGE($,$,$,#754,.F.);
+#1700=ORIENTED_EDGE($,$,$,#1680,.F.);
+#1701=EDGE_LOOP($,(#1692,#1698,#1699,#1700));
+#1702=FACE_OUTER_BOUND('',#1701,.T.);
+#1703=ADVANCED_FACE('',(#1702),#1691,.T.);
+#1704=CARTESIAN_POINT($,(65.9227350879785,139.920110176029,0));
+#1705=DIRECTION($,(-0.104285400090474,-0.994547412307714,0));
+#1706=DIRECTION($,(0,0,1));
+#1707=AXIS2_PLACEMENT_3D($,#1704,#1705,#1706);
+#1708=PLANE($,#1707);
+#1709=ORIENTED_EDGE($,$,$,#270,.T.);
+#1710=CARTESIAN_POINT($,(74.8127350880135,138.987930176026,0));
+#1711=DIRECTION($,(0,0,1));
+#1712=VECTOR($,#1711,1);
+#1713=LINE($,#1710,#1712);
+#1714=EDGE_CURVE($,#265,#757,#1713,.T.);
+#1715=ORIENTED_EDGE($,$,$,#1714,.T.);
+#1716=ORIENTED_EDGE($,$,$,#762,.F.);
+#1717=ORIENTED_EDGE($,$,$,#1697,.F.);
+#1718=EDGE_LOOP($,(#1709,#1715,#1716,#1717));
+#1719=FACE_OUTER_BOUND('',#1718,.T.);
+#1720=ADVANCED_FACE('',(#1719),#1708,.T.);
+#1721=CARTESIAN_POINT($,(74.8127350880135,138.987930176025,0));
+#1722=DIRECTION($,(-1,0,0));
+#1723=DIRECTION($,(0,0,1));
+#1724=AXIS2_PLACEMENT_3D($,#1721,#1722,#1723);
+#1725=PLANE($,#1724);
+#1726=ORIENTED_EDGE($,$,$,#278,.T.);
+#1727=CARTESIAN_POINT($,(74.8127350880135,127.515195088225,0));
+#1728=DIRECTION($,(0,0,1));
+#1729=VECTOR($,#1728,1);
+#1730=LINE($,#1727,#1729);
+#1731=EDGE_CURVE($,#273,#765,#1730,.T.);
+#1732=ORIENTED_EDGE($,$,$,#1731,.T.);
+#1733=ORIENTED_EDGE($,$,$,#770,.F.);
+#1734=ORIENTED_EDGE($,$,$,#1714,.F.);
+#1735=EDGE_LOOP($,(#1726,#1732,#1733,#1734));
+#1736=FACE_OUTER_BOUND('',#1735,.T.);
+#1737=ADVANCED_FACE('',(#1736),#1725,.T.);
+#1738=CARTESIAN_POINT($,(74.8127350880135,127.515195088225,0));
+#1739=DIRECTION($,(-0.816455474622559,0.577408397894291,0));
+#1740=DIRECTION($,(0,0,1));
+#1741=AXIS2_PLACEMENT_3D($,#1738,#1739,#1740);
+#1742=PLANE($,#1741);
+#1743=ORIENTED_EDGE($,$,$,#286,.T.);
+#1744=CARTESIAN_POINT($,(65.9227350879785,114.944735088175,-0));
+#1745=DIRECTION($,(0,0,1));
+#1746=VECTOR($,#1745,1);
+#1747=LINE($,#1744,#1746);
+#1748=EDGE_CURVE($,#281,#773,#1747,.T.);
+#1749=ORIENTED_EDGE($,$,$,#1748,.T.);
+#1750=ORIENTED_EDGE($,$,$,#778,.F.);
+#1751=ORIENTED_EDGE($,$,$,#1731,.F.);
+#1752=EDGE_LOOP($,(#1743,#1749,#1750,#1751));
+#1753=FACE_OUTER_BOUND('',#1752,.T.);
+#1754=ADVANCED_FACE('',(#1753),#1742,.T.);
+#1755=CARTESIAN_POINT($,(65.9227350879785,114.944735088175,0));
+#1756=DIRECTION($,(-1,0,0));
+#1757=DIRECTION($,(0,0,1));
+#1758=AXIS2_PLACEMENT_3D($,#1755,#1756,#1757);
+#1759=PLANE($,#1758);
+#1760=ORIENTED_EDGE($,$,$,#294,.T.);
+#1761=CARTESIAN_POINT($,(65.9227350879785,65.9227350879786,0));
+#1762=DIRECTION($,(0,0,1));
+#1763=VECTOR($,#1762,1);
+#1764=LINE($,#1761,#1763);
+#1765=EDGE_CURVE($,#289,#781,#1764,.T.);
+#1766=ORIENTED_EDGE($,$,$,#1765,.T.);
+#1767=ORIENTED_EDGE($,$,$,#786,.F.);
+#1768=ORIENTED_EDGE($,$,$,#1748,.F.);
+#1769=EDGE_LOOP($,(#1760,#1766,#1767,#1768));
+#1770=FACE_OUTER_BOUND('',#1769,.T.);
+#1771=ADVANCED_FACE('',(#1770),#1759,.T.);
+#1772=CARTESIAN_POINT($,(65.9227350879785,65.9227350879786,0));
+#1773=DIRECTION($,(-1,0,0));
+#1774=DIRECTION($,(0,0,1));
+#1775=AXIS2_PLACEMENT_3D($,#1772,#1773,#1774);
+#1776=PLANE($,#1775);
+#1777=ORIENTED_EDGE($,$,$,#302,.T.);
+#1778=CARTESIAN_POINT($,(65.9227350879785,54.450000000178,0));
+#1779=DIRECTION($,(0,0,1));
+#1780=VECTOR($,#1779,1);
+#1781=LINE($,#1778,#1780);
+#1782=EDGE_CURVE($,#297,#789,#1781,.T.);
+#1783=ORIENTED_EDGE($,$,$,#1782,.T.);
+#1784=ORIENTED_EDGE($,$,$,#794,.F.);
+#1785=ORIENTED_EDGE($,$,$,#1765,.F.);
+#1786=EDGE_LOOP($,(#1777,#1783,#1784,#1785));
+#1787=FACE_OUTER_BOUND('',#1786,.T.);
+#1788=ADVANCED_FACE('',(#1787),#1776,.T.);
+#1789=CARTESIAN_POINT($,(65.9227350879785,54.450000000178,0));
+#1790=DIRECTION($,(-1,0,0));
+#1791=DIRECTION($,(0,0,1));
+#1792=AXIS2_PLACEMENT_3D($,#1789,#1790,#1791);
+#1793=PLANE($,#1792);
+#1794=ORIENTED_EDGE($,$,$,#310,.T.);
+#1795=CARTESIAN_POINT($,(65.9227350879785,22.700000000051,-0));
+#1796=DIRECTION($,(0,0,1));
+#1797=VECTOR($,#1796,1);
+#1798=LINE($,#1795,#1797);
+#1799=EDGE_CURVE($,#305,#797,#1798,.T.);
+#1800=ORIENTED_EDGE($,$,$,#1799,.T.);
+#1801=ORIENTED_EDGE($,$,$,#802,.F.);
+#1802=ORIENTED_EDGE($,$,$,#1782,.F.);
+#1803=EDGE_LOOP($,(#1794,#1800,#1801,#1802));
+#1804=FACE_OUTER_BOUND('',#1803,.T.);
+#1805=ADVANCED_FACE('',(#1804),#1793,.T.);
+#1806=CARTESIAN_POINT($,(65.9227350879785,22.700000000051,0));
+#1807=DIRECTION($,(-0.707106781186547,-0.707106781186548,0));
+#1808=DIRECTION($,(0,0,1));
+#1809=AXIS2_PLACEMENT_3D($,#1806,#1807,#1808);
+#1810=PLANE($,#1809);
+#1811=ORIENTED_EDGE($,$,$,#318,.T.);
+#1812=CARTESIAN_POINT($,(78.6227350880295,10,-0));
+#1813=DIRECTION($,(0,0,1));
+#1814=VECTOR($,#1813,1);
+#1815=LINE($,#1812,#1814);
+#1816=EDGE_CURVE($,#313,#805,#1815,.T.);
+#1817=ORIENTED_EDGE($,$,$,#1816,.T.);
+#1818=ORIENTED_EDGE($,$,$,#810,.F.);
+#1819=ORIENTED_EDGE($,$,$,#1799,.F.);
+#1820=EDGE_LOOP($,(#1811,#1817,#1818,#1819));
+#1821=FACE_OUTER_BOUND('',#1820,.T.);
+#1822=ADVANCED_FACE('',(#1821),#1810,.T.);
+#1823=CARTESIAN_POINT($,(78.6227350880295,10,0));
+#1824=DIRECTION($,(0,-1,0));
+#1825=DIRECTION($,(0,0,1));
+#1826=AXIS2_PLACEMENT_3D($,#1823,#1824,#1825);
+#1827=PLANE($,#1826);
+#1828=ORIENTED_EDGE($,$,$,#326,.T.);
+#1829=CARTESIAN_POINT($,(294.522735088893,10,-0));
+#1830=DIRECTION($,(0,0,1));
+#1831=VECTOR($,#1830,1);
+#1832=LINE($,#1829,#1831);
+#1833=EDGE_CURVE($,#321,#813,#1832,.T.);
+#1834=ORIENTED_EDGE($,$,$,#1833,.T.);
+#1835=ORIENTED_EDGE($,$,$,#818,.F.);
+#1836=ORIENTED_EDGE($,$,$,#1816,.F.);
+#1837=EDGE_LOOP($,(#1828,#1834,#1835,#1836));
+#1838=FACE_OUTER_BOUND('',#1837,.T.);
+#1839=ADVANCED_FACE('',(#1838),#1827,.T.);
+#1840=CARTESIAN_POINT($,(294.522735088893,10,0));
+#1841=DIRECTION($,(0.707106781186552,-0.707106781186543,0));
+#1842=DIRECTION($,(0,0,1));
+#1843=AXIS2_PLACEMENT_3D($,#1840,#1841,#1842);
+#1844=PLANE($,#1843);
+#1845=ORIENTED_EDGE($,$,$,#334,.T.);
+#1846=CARTESIAN_POINT($,(307.222735088944,22.700000000051,-0));
+#1847=DIRECTION($,(0,0,1));
+#1848=VECTOR($,#1847,1);
+#1849=LINE($,#1846,#1848);
+#1850=EDGE_CURVE($,#329,#821,#1849,.T.);
+#1851=ORIENTED_EDGE($,$,$,#1850,.T.);
+#1852=ORIENTED_EDGE($,$,$,#826,.F.);
+#1853=ORIENTED_EDGE($,$,$,#1833,.F.);
+#1854=EDGE_LOOP($,(#1845,#1851,#1852,#1853));
+#1855=FACE_OUTER_BOUND('',#1854,.T.);
+#1856=ADVANCED_FACE('',(#1855),#1844,.T.);
+#1857=CARTESIAN_POINT($,(307.222735088944,22.700000000051,0));
+#1858=DIRECTION($,(1,0,0));
+#1859=DIRECTION($,(0,0,1));
+#1860=AXIS2_PLACEMENT_3D($,#1857,#1858,#1859);
+#1861=PLANE($,#1860);
+#1862=ORIENTED_EDGE($,$,$,#342,.T.);
+#1863=ORIENTED_EDGE($,$,$,#1002,.T.);
+#1864=ORIENTED_EDGE($,$,$,#834,.F.);
+#1865=ORIENTED_EDGE($,$,$,#1850,.F.);
+#1866=EDGE_LOOP($,(#1862,#1863,#1864,#1865));
+#1867=FACE_OUTER_BOUND('',#1866,.T.);
+#1868=ADVANCED_FACE('',(#1867),#1861,.T.);
+#1869=CARTESIAN_POINT($,(190.230335088476,354.402790176887,0));
+#1870=DIRECTION($,(-1,0,0));
+#1871=DIRECTION($,(0,0,1));
+#1872=AXIS2_PLACEMENT_3D($,#1869,#1870,#1871);
+#1873=PLANE($,#1872);
+#1874=ORIENTED_EDGE($,$,$,#454,.T.);
+#1875=CARTESIAN_POINT($,(190.230335088476,443.302790177243,-0));
+#1876=DIRECTION($,(0,0,1));
+#1877=VECTOR($,#1876,1);
+#1878=LINE($,#1875,#1877);
+#1879=EDGE_CURVE($,#443,#935,#1878,.T.);
+#1880=ORIENTED_EDGE($,$,$,#1879,.T.);
+#1881=ORIENTED_EDGE($,$,$,#946,.F.);
+#1882=CARTESIAN_POINT($,(190.230335088476,354.402790176887,0));
+#1883=DIRECTION($,(0,0,1));
+#1884=VECTOR($,#1883,1);
+#1885=LINE($,#1882,#1884);
+#1886=EDGE_CURVE($,#427,#919,#1885,.T.);
+#1887=ORIENTED_EDGE($,$,$,#1886,.F.);
+#1888=EDGE_LOOP($,(#1874,#1880,#1881,#1887));
+#1889=FACE_OUTER_BOUND('',#1888,.T.);
+#1890=ADVANCED_FACE('',(#1889),#1873,.T.);
+#1891=CARTESIAN_POINT($,(190.230335088476,443.302790177243,0));
+#1892=DIRECTION($,(0,-1,0));
+#1893=DIRECTION($,(0,0,1));
+#1894=AXIS2_PLACEMENT_3D($,#1891,#1892,#1893);
+#1895=PLANE($,#1894);
+#1896=ORIENTED_EDGE($,$,$,#448,.T.);
+#1897=CARTESIAN_POINT($,(171.1803350884,443.302790177243,-0));
+#1898=DIRECTION($,(0,0,1));
+#1899=VECTOR($,#1898,1);
+#1900=LINE($,#1897,#1899);
+#1901=EDGE_CURVE($,#435,#927,#1900,.T.);
+#1902=ORIENTED_EDGE($,$,$,#1901,.T.);
+#1903=ORIENTED_EDGE($,$,$,#940,.F.);
+#1904=ORIENTED_EDGE($,$,$,#1879,.F.);
+#1905=EDGE_LOOP($,(#1896,#1902,#1903,#1904));
+#1906=FACE_OUTER_BOUND('',#1905,.T.);
+#1907=ADVANCED_FACE('',(#1906),#1895,.T.);
+#1908=CARTESIAN_POINT($,(171.1803350884,443.302790177243,0));
+#1909=DIRECTION($,(1,0,0));
+#1910=DIRECTION($,(0,0,1));
+#1911=AXIS2_PLACEMENT_3D($,#1908,#1909,#1910);
+#1912=PLANE($,#1911);
+#1913=ORIENTED_EDGE($,$,$,#440,.T.);
+#1914=CARTESIAN_POINT($,(171.1803350884,354.402790176887,-0));
+#1915=DIRECTION($,(0,0,1));
+#1916=VECTOR($,#1915,1);
+#1917=LINE($,#1914,#1916);
+#1918=EDGE_CURVE($,#425,#917,#1917,.T.);
+#1919=ORIENTED_EDGE($,$,$,#1918,.T.);
+#1920=ORIENTED_EDGE($,$,$,#932,.F.);
+#1921=ORIENTED_EDGE($,$,$,#1901,.F.);
+#1922=EDGE_LOOP($,(#1913,#1919,#1920,#1921));
+#1923=FACE_OUTER_BOUND('',#1922,.T.);
+#1924=ADVANCED_FACE('',(#1923),#1912,.T.);
+#1925=CARTESIAN_POINT($,(171.1803350884,354.402790176887,0));
+#1926=DIRECTION($,(0,1,0));
+#1927=DIRECTION($,(0,0,1));
+#1928=AXIS2_PLACEMENT_3D($,#1925,#1926,#1927);
+#1929=PLANE($,#1928);
+#1930=ORIENTED_EDGE($,$,$,#432,.T.);
+#1931=ORIENTED_EDGE($,$,$,#1886,.T.);
+#1932=ORIENTED_EDGE($,$,$,#924,.F.);
+#1933=ORIENTED_EDGE($,$,$,#1918,.F.);
+#1934=EDGE_LOOP($,(#1930,#1931,#1932,#1933));
+#1935=FACE_OUTER_BOUND('',#1934,.T.);
+#1936=ADVANCED_FACE('',(#1935),#1929,.T.);
+#1937=CARTESIAN_POINT($,(126.730335088222,354.402790176887,0));
+#1938=DIRECTION($,(-1,0,0));
+#1939=DIRECTION($,(0,0,1));
+#1940=AXIS2_PLACEMENT_3D($,#1937,#1938,#1939);
+#1941=PLANE($,#1940);
+#1942=ORIENTED_EDGE($,$,$,#488,.T.);
+#1943=CARTESIAN_POINT($,(126.730335088222,443.302790177243,-0));
+#1944=DIRECTION($,(0,0,1));
+#1945=VECTOR($,#1944,1);
+#1946=LINE($,#1943,#1945);
+#1947=EDGE_CURVE($,#477,#969,#1946,.T.);
+#1948=ORIENTED_EDGE($,$,$,#1947,.T.);
+#1949=ORIENTED_EDGE($,$,$,#980,.F.);
+#1950=CARTESIAN_POINT($,(126.730335088222,354.402790176887,0));
+#1951=DIRECTION($,(0,0,1));
+#1952=VECTOR($,#1951,1);
+#1953=LINE($,#1950,#1952);
+#1954=EDGE_CURVE($,#461,#953,#1953,.T.);
+#1955=ORIENTED_EDGE($,$,$,#1954,.F.);
+#1956=EDGE_LOOP($,(#1942,#1948,#1949,#1955));
+#1957=FACE_OUTER_BOUND('',#1956,.T.);
+#1958=ADVANCED_FACE('',(#1957),#1941,.T.);
+#1959=CARTESIAN_POINT($,(126.730335088222,443.302790177243,0));
+#1960=DIRECTION($,(0,-1,0));
+#1961=DIRECTION($,(0,0,1));
+#1962=AXIS2_PLACEMENT_3D($,#1959,#1960,#1961);
+#1963=PLANE($,#1962);
+#1964=ORIENTED_EDGE($,$,$,#482,.T.);
+#1965=CARTESIAN_POINT($,(107.680335088146,443.302790177243,-0));
+#1966=DIRECTION($,(0,0,1));
+#1967=VECTOR($,#1966,1);
+#1968=LINE($,#1965,#1967);
+#1969=EDGE_CURVE($,#469,#961,#1968,.T.);
+#1970=ORIENTED_EDGE($,$,$,#1969,.T.);
+#1971=ORIENTED_EDGE($,$,$,#974,.F.);
+#1972=ORIENTED_EDGE($,$,$,#1947,.F.);
+#1973=EDGE_LOOP($,(#1964,#1970,#1971,#1972));
+#1974=FACE_OUTER_BOUND('',#1973,.T.);
+#1975=ADVANCED_FACE('',(#1974),#1963,.T.);
+#1976=CARTESIAN_POINT($,(107.680335088146,443.302790177243,0));
+#1977=DIRECTION($,(1,0,0));
+#1978=DIRECTION($,(0,0,1));
+#1979=AXIS2_PLACEMENT_3D($,#1976,#1977,#1978);
+#1980=PLANE($,#1979);
+#1981=ORIENTED_EDGE($,$,$,#474,.T.);
+#1982=CARTESIAN_POINT($,(107.680335088146,354.402790176887,-0));
+#1983=DIRECTION($,(0,0,1));
+#1984=VECTOR($,#1983,1);
+#1985=LINE($,#1982,#1984);
+#1986=EDGE_CURVE($,#459,#951,#1985,.T.);
+#1987=ORIENTED_EDGE($,$,$,#1986,.T.);
+#1988=ORIENTED_EDGE($,$,$,#966,.F.);
+#1989=ORIENTED_EDGE($,$,$,#1969,.F.);
+#1990=EDGE_LOOP($,(#1981,#1987,#1988,#1989));
+#1991=FACE_OUTER_BOUND('',#1990,.T.);
+#1992=ADVANCED_FACE('',(#1991),#1980,.T.);
+#1993=CARTESIAN_POINT($,(107.680335088146,354.402790176887,0));
+#1994=DIRECTION($,(0,1,0));
+#1995=DIRECTION($,(0,0,1));
+#1996=AXIS2_PLACEMENT_3D($,#1993,#1994,#1995);
+#1997=PLANE($,#1996);
+#1998=ORIENTED_EDGE($,$,$,#466,.T.);
+#1999=ORIENTED_EDGE($,$,$,#1954,.T.);
+#2000=ORIENTED_EDGE($,$,$,#958,.F.);
+#2001=ORIENTED_EDGE($,$,$,#1986,.F.);
+#2002=EDGE_LOOP($,(#1998,#1999,#2000,#2001));
+#2003=FACE_OUTER_BOUND('',#2002,.T.);
+#2004=ADVANCED_FACE('',(#2003),#1997,.T.);
+#2005=CLOSED_SHELL($,(#492,#984,#1006,#1023,#1040,#1057,#1074,#1091,#1108,#1125,#1142,#1159,#1176,#1193,#1210,#1227,#1244,#1261,#1278,#1295,#1312,#1329,#1346,#1363,#1380,#1397,#1414,#1431,#1448,#1465,#1482,#1499,#1516,#1533,#1550,#1567,#1584,#1601,#1618,#1635,#1652,#1669,#1686,#1703,#1720,#1737,#1754,#1771,#1788,#1805,#1822,#1839,#1856,#1868,#1890,#1907,#1924,#1936,#1958,#1975,#1992,#2004));
+#2006=MANIFOLD_SOLID_BREP('sheetmetal-import-2979c3b6e9cf464c flat pattern',#2005);
+#2007=APPLICATION_CONTEXT('mechanical design');
+#2008=PRODUCT_CONTEXT('',#2007,'mechanical');
+#2009=PRODUCT('sheetmetal_import_2979c3b6e9cf464c_flat','sheetmetal-import-2979c3b6e9cf464c flat pattern','',(#2008));
+#2010=PRODUCT_DEFINITION_FORMATION('','',#2009);
+#2011=PRODUCT_DEFINITION_CONTEXT('design',#2007,'design');
+#2012=PRODUCT_DEFINITION('','',#2010,#2011);
+#2013=PRODUCT_DEFINITION_SHAPE('','',#2012);
+#2014=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.));
+#2015=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
+#2016=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT());
+#2017=(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNIT_ASSIGNED_CONTEXT((#2014,#2015,#2016))REPRESENTATION_CONTEXT('3','3D'));
+#2018=SHAPE_REPRESENTATION('sheetmetal-import-2979c3b6e9cf464c flat pattern',(#2006),#2017);
+#2019=SHAPE_DEFINITION_REPRESENTATION(#2013,#2018);
+ENDSEC;
+END-ISO-10303-21;
diff --git a/docs/modules/sheetmetal/artifacts/m1/ctc03-flat.svg b/docs/modules/sheetmetal/artifacts/m1/ctc03-flat.svg
new file mode 100644
index 00000000..efde7aef
--- /dev/null
+++ b/docs/modules/sheetmetal/artifacts/m1/ctc03-flat.svg
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="428.754mm" height="649.306mm" viewBox="0 0 428.754 649.306">
+<rect width="100%" height="100%" fill="white"/>
+<g id="sheet-regions" fill="#dbeafe" fill-opacity="0.55" stroke="#0f172a" stroke-width="0.45">
+<polygon id="flat-bend-c-0005-0024" points="67.923,581.383 309.223,581.383 309.223,592.856 67.923,592.856"/>
+<polygon id="flat-bend-c-0006-0009" points="67.923,66.952 309.223,66.952 309.223,55.48 67.923,55.48"/>
+<polygon id="flat-bend-c-0046-0050" points="349.804,263.055 349.804,390.055 355.54,390.055 355.54,263.055"/>
+<polygon id="flat-bend-c-0057-0070" points="309.223,141.92 309.223,507.385 320.695,507.385 320.695,141.92"/>
+<polygon id="flat-bend-c-0058-0064" points="76.813,140.018 300.333,140.018 300.333,128.545 76.813,128.545"/>
+<polygon id="flat-bend-c-0059-0068" points="67.923,141.92 67.923,507.385 56.45,507.385 56.45,141.92"/>
+<polygon id="flat-bend-c-0060-0067" points="76.813,508.318 300.333,508.318 300.333,519.79 76.813,519.79"/>
+<polygon id="flat-region-p-0061-0066" points="67.923,581.383 309.223,581.383 309.223,532.361 300.333,519.79 76.813,519.79 67.923,532.361"/>
+<polygon id="flat-region-p-0062-0063" points="67.923,115.974 76.813,128.545 300.333,128.545 309.223,115.974 309.223,66.952 67.923,66.952"/>
+<polygon id="flat-region-p-0065-0069" points="67.923,507.385 76.813,508.318 300.333,508.318 309.223,507.385 309.223,141.92 300.333,140.018 76.813,140.018 67.923,141.92"/>
+<polygon id="flat-region-p-0088-0089" points="67.923,624.606 80.623,637.306 296.523,637.306 309.223,624.606 309.223,592.856 67.923,592.856"/>
+<polygon id="flat-region-p-0096-0097" points="67.923,55.48 309.223,55.48 309.223,24.7 296.523,12 80.623,12 67.923,24.7"/>
+<polygon id="flat-region-p-0102-0104" points="12,481.985 37.4,507.385 56.45,507.385 56.45,141.92 37.4,141.92 12,167.32"/>
+<polygon id="flat-region-p-0109-0111" points="355.54,390.055 404.054,390.055 416.754,377.355 416.754,275.755 404.054,263.055 355.54,263.055"/>
+<polygon id="flat-region-p-0118-0119" points="320.695,507.385 339.745,507.385 352.445,494.685 352.445,154.62 339.745,141.92 320.695,141.92"/>
+</g>
+<g id="cut-contours" fill="white" stroke="#dc2626" stroke-width="0.5">
+<polygon id="feature-profile-f0065-l0069" points="173.18,292.903 192.23,292.903 192.23,204.003 173.18,204.003"/>
+<polygon id="feature-profile-f0065-l0070" points="109.68,292.903 128.73,292.903 128.73,204.003 109.68,204.003"/>
+</g>
+<g id="bend-lines" fill="none" stroke="#2563eb" stroke-width="0.45" stroke-dasharray="3 2">
+<line x1="67.923" y1="587.119" x2="309.223" y2="587.119"/>
+<line x1="67.923" y1="61.216" x2="309.223" y2="61.216"/>
+<line x1="352.672" y1="263.055" x2="352.672" y2="390.055"/>
+<line x1="314.959" y1="141.92" x2="314.959" y2="507.385"/>
+<line x1="76.813" y1="134.281" x2="300.333" y2="134.281"/>
+<line x1="62.186" y1="141.92" x2="62.186" y2="507.385"/>
+<line x1="76.813" y1="514.054" x2="300.333" y2="514.054"/>
+</g>
+<g id="bend-labels" stroke="none" font-family="Inter, 'Segoe UI', Arial, sans-serif" font-size="3" text-anchor="middle" dominant-baseline="central">
+<rect x="176.323" y="588.919" width="24.5" height="4.4" rx="0.8" fill="white" fill-opacity="0.88"/>
+<text x="188.573" y="591.119" fill="#1d4ed8">Down 90° R6.35</text>
+<rect x="177.973" y="63.016" width="21.2" height="4.4" rx="0.8" fill="white" fill-opacity="0.88"/>
+<text x="188.573" y="65.216" fill="#1d4ed8">Up 90° R6.35</text>
+<rect x="338.072" y="324.355" width="21.2" height="4.4" rx="0.8" fill="white" fill-opacity="0.88"/>
+<text x="348.672" y="326.555" fill="#1d4ed8">Up 45° R6.35</text>
+<rect x="300.359" y="322.453" width="21.2" height="4.4" rx="0.8" fill="white" fill-opacity="0.88"/>
+<text x="310.959" y="324.653" fill="#1d4ed8">Up 90° R6.35</text>
+<rect x="177.973" y="136.081" width="21.2" height="4.4" rx="0.8" fill="white" fill-opacity="0.88"/>
+<text x="188.573" y="138.281" fill="#1d4ed8">Up 90° R6.35</text>
+<rect x="47.586" y="322.453" width="21.2" height="4.4" rx="0.8" fill="white" fill-opacity="0.88"/>
+<text x="58.186" y="324.653" fill="#1d4ed8">Up 90° R6.35</text>
+<rect x="177.973" y="515.854" width="21.2" height="4.4" rx="0.8" fill="white" fill-opacity="0.88"/>
+<text x="188.573" y="518.054" fill="#1d4ed8">Up 90° R6.35</text>
+</g>
+<text x="4" y="6" font-family="sans-serif" font-size="3" fill="#334155">Partial · K=0.5 · SHA-256 2a7809249922</text>
+</svg>
diff --git a/docs/modules/sheetmetal/artifacts/m1/ctc03-geometry-audit.md b/docs/modules/sheetmetal/artifacts/m1/ctc03-geometry-audit.md
new file mode 100644
index 00000000..601d7f9f
--- /dev/null
+++ b/docs/modules/sheetmetal/artifacts/m1/ctc03-geometry-audit.md
@@ -0,0 +1,15 @@
+# CTC-03 ordinary-BRep geometry audit
+
+Source: `testdata/step242/nist/CTC/nist_ctc_03_asme1_ap242-e2.stp`, imported through the ordinary current AP242 exact-BRep path.
+
+| Fact | Value |
+|---|---:|
+| Bodies / shells | 1 / 1 |
+| Vertices / edges / faces | 236 / 354 / 120 |
+| Planes / cylinders | 62 / 58 |
+| Cones / spheres / tori / splines | 0 / 0 / 0 / 0 |
+| Bounds, mm | min (-249.55754, 0, 0), max (53.402246, 485.4448, 162.689737) |
+| Manifoldness | enclosed manifold from directed-coedge traversal/incidence |
+| PMI/semantic indicators in source | 416 entity-name occurrences; retained in the unchanged source file |
+
+Visually, CTC-03 reads as a large bent enclosure/bracket blank with a dominant central panel, surrounding flanges, one oblique 45° transition, multiple 90° bends, and two long rectangular openings. Machine-recoverable evidence is narrower: eight overlapping parallel plane pairs, seven coaxial cylinder pairs, exact source-face adjacency, and two paired planar inner-loop profiles. All supports are analytically developable families; the other 90 faces are thickness caps, cut walls, end faces, or unmatched feature boundaries, not evidence for 90 additional reference-sheet regions.
diff --git a/docs/modules/sheetmetal/artifacts/m1/ctc03-recognition.md b/docs/modules/sheetmetal/artifacts/m1/ctc03-recognition.md
new file mode 100644
index 00000000..6637218d
--- /dev/null
+++ b/docs/modules/sheetmetal/artifacts/m1/ctc03-recognition.md
@@ -0,0 +1,19 @@
+# CTC-03 recognition
+
+Status: **Partial**. Aetheris believes CTC-03 is a 1.90754 mm (0.075 in) constant-thickness fabricated sheet with a dominant planar base, seven cylindrical bends, seven attached planar regions, and two long profile/slot openings. Partial is deliberate because the recognizer does not yet stitch every cap/cut/end face into exact global blank topology.
+
+Thickness tolerance is 0.01 mm. `JudgmentEngine` selected the dominant candidate cluster from 15 admitted source pairs: eight plane pairs and seven coaxial cylinder pairs. Every admitted residual is below tolerance. The candidate inside radius is 6.35 mm (0.25 in) for all seven bends.
+
+| Bend | Angle | Axis direction | Direction | Adjacent regions |
+|---|---:|---|---|---|
+| `bend-c-0005-0024` | 90° | +X | Down | p0061/0066 → p0088/0089 |
+| `bend-c-0006-0009` | 90° | +X | Up | p0062/0063 → p0096/0097 |
+| `bend-c-0046-0050` | 45° | +Y | Up | p0109/0111 → p0118/0119 |
+| `bend-c-0057-0070` | 90° | +Y | Up | p0065/0069 → p0118/0119 |
+| `bend-c-0058-0064` | 90° | +X | Up | p0062/0063 → p0065/0069 |
+| `bend-c-0059-0068` | 90° | +Y | Up | p0065/0069 → p0102/0104 |
+| `bend-c-0060-0067` | 90° | +X | Up | p0061/0066 → p0065/0069 |
+
+Base selection is deterministic heuristic evidence: largest recovered planar area, then stable-ID tie-break. Bends, regions, and cuts retain ordered STEP face/edge bindings. No filename, product name, PMI label, or hardcoded CTC coordinate participates in recognition.
+
+The recovery result is serialized in [`ctc03-recovered.firmament`](ctc03-recovered.firmament). This loss-aware form records analytic plane/cylinder frames, reference boundaries, bend adjacency and policy, feature ownership, source face bindings, and the `Partial` status. It does not copy or claim authority over the source STEP BRep. Parsing and lowering this file reproduces the CTC flat hash `2a78092499226525b3b12cdd403d52d1dfa40224a1e23cf296415fc8f153f7f2`.
diff --git a/docs/modules/sheetmetal/artifacts/m1/ctc03-recovered.firmament b/docs/modules/sheetmetal/artifacts/m1/ctc03-recovered.firmament
new file mode 100644
index 00000000..4c20e828
--- /dev/null
+++ b/docs/modules/sheetmetal/artifacts/m1/ctc03-recovered.firmament
@@ -0,0 +1,264 @@
+// Generated recovered Sheet Metal intent. Source STEP geometry is referenced, not embedded or mutated.
+SheetMetal sheetmetal_import_2979c3b6e9cf464c {
+ Thickness: 1.907540000007641mm;
+ KFactor: 0.5;
+ RecoveryStatus: Partial;
+ RecoverySource: "../../../../../testdata/step242/nist/CTC/nist_ctc_03_asme1_ap242-e2.stp";
+ BaseRegion: "region-p-0065-0069";
+ RecoveredRegion "region-c-0005-0024" {
+ Kind: CylindricalBend;
+ Area: 2768.370976697361mm2;
+ AxisOrigin: (-120.6500000004825mm, 440.994800001764mm, 8.25754000003309mm);
+ AxisDirection: (1, 0, 0);
+ MidRadius: 7.3037700000292105mm;
+ InsideRadius: 6.35000000002538mm;
+ AngularSpan: 89.9999999999998deg;
+ AxisLength: 241.300000000965mm;
+ MaterialOutside: false;
+ Boundary: [(0mm, 440.994800001764mm, 1.90754000000777mm), (-241.300000000965mm, 440.994800001764mm, 1.90754000000777mm), (-241.300000000965mm, 434.644800001739mm, 8.25754000003309mm), (0mm, 434.644800001739mm, 8.25754000003309mm), (-241.300000000965mm, 432.737260001731mm, 8.25754000003306mm), (-241.300000000965mm, 440.994800001764mm, 5.6843418860808E-14mm), (0mm, 440.994800001764mm, 5.6843418860808E-14mm), (0mm, 432.737260001731mm, 8.25754000003306mm)];
+ SourceFaces: [5, 24];
+ }
+ RecoveredRegion "region-c-0006-0009" {
+ Kind: CylindricalBend;
+ Area: 2768.370976697373mm2;
+ AxisOrigin: (-120.6500000004825mm, 43.4797200001739mm, 8.25754000003303mm);
+ AxisDirection: (1, 0, 0);
+ MidRadius: 7.303770000029226mm;
+ InsideRadius: 6.35000000002541mm;
+ AngularSpan: 90deg;
+ AxisLength: 241.300000000965mm;
+ MaterialOutside: false;
+ Boundary: [(-241.300000000965mm, 43.4797200001739mm, 0mm), (-241.300000000965mm, 51.7372600002069mm, 8.25754000003303mm), (0mm, 51.7372600002069mm, 8.25754000003303mm), (0mm, 43.4797200001739mm, 0mm), (0mm, 49.8297200001993mm, 8.25754000003317mm), (-241.300000000965mm, 49.8297200001993mm, 8.25754000003317mm), (-241.300000000965mm, 43.4797200001739mm, 1.90754000000777mm), (0mm, 43.4797200001739mm, 1.90754000000777mm)];
+ SourceFaces: [6, 9];
+ }
+ RecoveredRegion "region-c-0046-0050" {
+ Kind: CylindricalBend;
+ Area: 728.5186780782884mm2;
+ AxisOrigin: (14.6075400000584mm, 244.6248600009785mm, 113.565940000454mm);
+ AxisDirection: (0, 1, 0);
+ MidRadius: 7.303770000029215mm;
+ InsideRadius: 6.3500000000254mm;
+ AngularSpan: 45.00000000000239deg;
+ AxisLength: 127.00000000050699mm;
+ MaterialOutside: false;
+ Boundary: [(6.35000000002539mm, 181.124860000725mm, 113.565940000454mm), (8.7685774701159mm, 181.124860000725mm, 119.404902530397mm), (8.7685774701159mm, 308.124860001232mm, 119.404902530397mm), (6.35000000002539mm, 308.124860001232mm, 113.565940000454mm), (10.1174119395059mm, 308.124860001232mm, 118.056068061007mm), (10.1174119395059mm, 181.124860000725mm, 118.056068061007mm), (8.25754000003304mm, 181.124860000725mm, 113.565940000454mm), (8.25754000003304mm, 308.124860001232mm, 113.565940000454mm)];
+ SourceFaces: [46, 50];
+ }
+ RecoveredRegion "region-c-0057-0070" {
+ Kind: CylindricalBend;
+ Area: 4192.887259064475mm2;
+ AxisOrigin: (4.44089209850063E-16mm, 242.72240000097088mm, 84.457540000338mm);
+ AxisDirection: (0, 1, 0);
+ MidRadius: 7.303770000029219mm;
+ InsideRadius: 6.35000000002539mm;
+ AngularSpan: 90deg;
+ AxisLength: 365.4653600014622mm;
+ MaterialOutside: false;
+ Boundary: [(0mm, 425.455080001702mm, 76.2000000003048mm), (8.25754000003304mm, 425.455080001702mm, 84.457540000338mm), (8.25754000003304mm, 59.9897200002399mm, 84.457540000338mm), (0mm, 59.9897200002399mm, 76.2000000003048mm), (6.3500000000254mm, 425.455080001702mm, 84.457540000338mm), (0mm, 425.455080001702mm, 78.1075400003126mm), (0mm, 59.9897200002398mm, 78.1075400003126mm), (6.3500000000254mm, 59.9897200002399mm, 84.457540000338mm)];
+ SourceFaces: [57, 70];
+ }
+ RecoveredRegion "region-c-0058-0064" {
+ Kind: CylindricalBend;
+ Area: 2564.385746835481mm2;
+ AxisOrigin: (-120.65000000048278mm, 58.0872600002323mm, 69.8500000002795mm);
+ AxisDirection: (1, 0, 0);
+ MidRadius: 7.303770000029205mm;
+ InsideRadius: 6.3500000000254mm;
+ AngularSpan: 90.00000000000071deg;
+ AxisLength: 223.52000000089447mm;
+ MaterialOutside: false;
+ Boundary: [(-8.89000000003555mm, 49.8297200001993mm, 69.8500000002794mm), (-8.89000000003555mm, 58.0872600002323mm, 78.1075400003126mm), (-232.41000000093mm, 58.0872600002323mm, 78.1075400003126mm), (-232.41000000093mm, 49.8297200001993mm, 69.8500000002794mm), (-8.89000000003556mm, 58.0872600002323mm, 76.2000000003048mm), (-8.89000000003556mm, 51.7372600002069mm, 69.8500000002793mm), (-232.41000000093mm, 51.7372600002069mm, 69.8500000002793mm), (-232.41000000093mm, 58.0872600002323mm, 76.2000000003048mm)];
+ SourceFaces: [58, 64];
+ }
+ RecoveredRegion "region-c-0059-0068" {
+ Kind: CylindricalBend;
+ Area: 4192.8872590644105mm2;
+ AxisOrigin: (-241.300000000965mm, 242.72240000097094mm, 84.457540000338mm);
+ AxisDirection: (0, 1, 0);
+ MidRadius: 7.303770000029175mm;
+ InsideRadius: 6.35000000002538mm;
+ AngularSpan: 89.99999999999919deg;
+ AxisLength: 365.4653600014621mm;
+ MaterialOutside: false;
+ Boundary: [(-249.557540000998mm, 425.455080001702mm, 84.457540000338mm), (-241.300000000965mm, 425.455080001702mm, 76.2000000003049mm), (-241.300000000965mm, 59.9897200002399mm, 76.2000000003049mm), (-249.557540000998mm, 59.9897200002399mm, 84.457540000338mm), (-241.300000000965mm, 425.455080001702mm, 78.1075400003126mm), (-247.650000000991mm, 425.455080001702mm, 84.4575400003379mm), (-247.650000000991mm, 59.9897200002399mm, 84.4575400003379mm), (-241.300000000965mm, 59.98972000024mm, 78.1075400003126mm)];
+ SourceFaces: [59, 68];
+ }
+ RecoveredRegion "region-c-0060-0067" {
+ Kind: CylindricalBend;
+ Area: 2564.3857468354454mm2;
+ AxisOrigin: (-120.65000000048278mm, 426.387260001706mm, 69.8500000002793mm);
+ AxisDirection: (1, 0, 0);
+ MidRadius: 7.30377000002922mm;
+ InsideRadius: 6.3500000000254mm;
+ AngularSpan: 89.9999999999993deg;
+ AxisLength: 223.52000000089447mm;
+ MaterialOutside: false;
+ Boundary: [(-8.89000000003556mm, 432.737260001731mm, 69.8500000002793mm), (-8.89000000003554mm, 426.387260001705mm, 76.2000000003048mm), (-232.41000000093mm, 426.387260001705mm, 76.2000000003048mm), (-232.41000000093mm, 432.737260001731mm, 69.8500000002793mm), (-8.89000000003554mm, 426.387260001706mm, 78.1075400003125mm), (-8.89000000003556mm, 434.644800001739mm, 69.8500000002794mm), (-232.41000000093mm, 434.644800001739mm, 69.8500000002794mm), (-232.41000000093mm, 426.387260001706mm, 78.1075400003125mm)];
+ SourceFaces: [60, 67];
+ }
+ RecoveredRegion "region-p-0061-0066" {
+ Kind: Planar;
+ Area: 14638.757819317092mm2;
+ PlaneOrigin: (0mm, 433.691030001735mm, 69.8500000002793mm);
+ PlaneNormal: (0, -1, 0);
+ PlaneU: (1, -0, -0);
+ PlaneV: (0, 0, 1);
+ MaterialPositiveSide: true;
+ Boundary: [(-8.89000000003555mm, 434.644800001739mm, 57.2795400002293mm), (-8.89000000003556mm, 434.644800001739mm, 69.8500000002793mm), (-232.41000000093mm, 434.644800001739mm, 69.8500000002793mm), (-232.41000000093mm, 434.644800001739mm, 57.2795400002293mm), (-241.300000000965mm, 434.644800001739mm, 57.2795400002293mm), (-241.300000000965mm, 434.644800001739mm, 8.25754000003306mm), (0mm, 434.644800001739mm, 8.25754000003306mm), (0mm, 434.644800001739mm, 57.2795400002293mm)];
+ SourceFaces: [61, 66];
+ }
+ RecoveredRegion "region-p-0062-0063" {
+ Kind: Planar;
+ Area: 14638.757819317085mm2;
+ PlaneOrigin: (0mm, 50.7834900002031mm, 8.25754000003317mm);
+ PlaneNormal: (0, -1, 0);
+ PlaneU: (0, 0, 1);
+ PlaneV: (-1, 0, 0);
+ MaterialPositiveSide: true;
+ Boundary: [(1.77635683940025E-15mm, 51.7372600002069mm, 57.2795400002293mm), (-8.89000000003555mm, 51.7372600002069mm, 57.2795400002293mm), (-8.89000000003555mm, 51.7372600002069mm, 69.8500000002794mm), (-232.41000000093mm, 51.7372600002069mm, 69.8500000002794mm), (-232.41000000093mm, 51.7372600002069mm, 57.2795400002293mm), (-241.300000000965mm, 51.7372600002069mm, 57.2795400002293mm), (-241.300000000965mm, 51.7372600002069mm, 8.25754000003317mm), (0mm, 51.7372600002069mm, 8.25754000003317mm)];
+ SourceFaces: [62, 63];
+ }
+ RecoveredRegion "region-p-0065-0069" {
+ Kind: Planar;
+ Area: 88820.39010151062mm2;
+ PlaneOrigin: (0mm, 58.0872600002323mm, 77.1537700003087mm);
+ PlaneNormal: (0, 0, -1);
+ PlaneU: (1, -0, -0);
+ PlaneV: (-0, -1, -0);
+ MaterialPositiveSide: true;
+ Boundary: [(-8.89000000003555mm, 59.9897200002399mm, 78.1075400003126mm), (-8.89000000003556mm, 58.0872600002323mm, 78.1075400003126mm), (-232.41000000093mm, 58.0872600002323mm, 78.1075400003126mm), (-232.41000000093mm, 59.9897200002399mm, 78.1075400003126mm), (-241.300000000965mm, 59.9897200002399mm, 78.1075400003126mm), (-241.300000000965mm, 425.455080001702mm, 78.1075400003126mm), (-232.41000000093mm, 425.455080001702mm, 78.1075400003126mm), (-232.41000000093mm, 426.387260001705mm, 78.1075400003126mm), (-8.89000000003554mm, 426.387260001705mm, 78.1075400003126mm), (-8.89000000003556mm, 425.455080001702mm, 78.1075400003126mm), (0mm, 425.455080001702mm, 78.1075400003126mm), (0mm, 59.9897200002399mm, 78.1075400003126mm)];
+ SourceFaces: [65, 69];
+ }
+ RecoveredRegion "region-p-0088-0089" {
+ Kind: Planar;
+ Area: 6532.245000052288mm2;
+ PlaneOrigin: (0mm, 485.444800001942mm, 0.953770000003885mm);
+ PlaneNormal: (0, 0, 1);
+ PlaneU: (1, -0, -0);
+ PlaneV: (0, 1, -0);
+ MaterialPositiveSide: true;
+ Boundary: [(-190.500000000762mm, 485.444800001942mm, 0mm), (-228.600000000914mm, 485.444800001942mm, 0mm), (-241.300000000965mm, 472.744800001891mm, 0mm), (-241.300000000965mm, 440.994800001764mm, 0mm), (0mm, 440.994800001764mm, 0mm), (0mm, 472.744800001891mm, 0mm), (-12.7000000000508mm, 485.444800001942mm, 0mm), (-50.8000000002032mm, 485.444800001942mm, 0mm), (-57.1500000002286mm, 479.094800001916mm, 0mm), (-57.1500000002286mm, 460.04480000184mm, 0mm), (-63.500000000254mm, 453.694800001815mm, 0mm), (-177.800000000711mm, 453.694800001815mm, 0mm), (-184.150000000737mm, 460.04480000184mm, 0mm), (-184.150000000737mm, 479.094800001916mm, 0mm)];
+ SourceFaces: [88, 89];
+ }
+ RecoveredRegion "region-p-0096-0097" {
+ Kind: Planar;
+ Area: 6338.438936050684mm2;
+ PlaneOrigin: (0mm, 43.4797200001739mm, 0.953770000003885mm);
+ PlaneNormal: (0, 0, -1);
+ PlaneU: (-0, 1, -0);
+ PlaneV: (1, 0, 0);
+ MaterialPositiveSide: true;
+ Boundary: [(-241.300000000965mm, 12.7000000000508mm, 1.90754000000777mm), (-241.300000000965mm, 43.4797200001739mm, 1.90754000000777mm), (0mm, 43.4797200001739mm, 1.90754000000777mm), (0mm, 12.7000000000508mm, 1.90754000000777mm), (-12.7000000000508mm, 0mm, 1.90754000000777mm), (-57.1500000002286mm, 0mm, 1.90754000000777mm), (-57.1500000002286mm, 25.4000000001016mm, 1.90754000000777mm), (-63.500000000254mm, 31.750000000127mm, 1.90754000000777mm), (-177.800000000711mm, 31.750000000127mm, 1.90754000000777mm), (-184.150000000737mm, 25.4000000001016mm, 1.90754000000777mm), (-184.150000000737mm, 0mm, 1.90754000000777mm), (-228.600000000914mm, 0mm, 1.90754000000777mm)];
+ SourceFaces: [96, 97];
+ }
+ RecoveredRegion "region-p-0102-0104" {
+ Kind: Planar;
+ Area: 15599.77525212491mm2;
+ PlaneOrigin: (-248.6037700009945mm, 425.455080001702mm, 84.457540000338mm);
+ PlaneNormal: (-1, 0, 0);
+ PlaneU: (-0, 1, -0);
+ PlaneV: (-0, -0, -1);
+ MaterialPositiveSide: true;
+ Boundary: [(-247.650000000991mm, 85.3897200003415mm, 128.907540000516mm), (-247.650000000991mm, 400.0550800016mm, 128.907540000516mm), (-247.650000000991mm, 425.455080001702mm, 103.507540000414mm), (-247.650000000991mm, 425.455080001702mm, 84.457540000338mm), (-247.650000000991mm, 59.9897200002399mm, 84.457540000338mm), (-247.650000000991mm, 59.9897200002399mm, 103.507540000414mm)];
+ SourceFaces: [102, 104];
+ }
+ RecoveredRegion "region-p-0109-0111" {
+ Kind: Planar;
+ Area: 7612.888000060819mm2;
+ PlaneOrigin: (9.44299470481089mm, 308.124860001232mm, 118.73048529570198mm);
+ PlaneNormal: (0.707106781186559, 0, -0.707106781186536);
+ PlaneU: (0.7071067811865361, 0, 0.707106781186559);
+ PlaneV: (0, -1, 0);
+ MaterialPositiveSide: true;
+ Boundary: [(43.073155852736534mm, 181.124860000725mm, 153.70948091301875mm), (8.768577470115881mm, 181.124860000725mm, 119.40490253039697mm), (8.768577470115881mm, 308.124860001232mm, 119.40490253039697mm), (43.073155852736534mm, 308.124860001232mm, 153.70948091301875mm), (52.05341197384143mm, 295.424860001182mm, 162.68973703412394mm), (52.05341197384143mm, 193.824860000775mm, 162.68973703412394mm)];
+ SourceFaces: [109, 111];
+ }
+ RecoveredRegion "region-p-0118-0119" {
+ Kind: Planar;
+ Area: 8939.014380071452mm2;
+ PlaneOrigin: (7.303770000029216mm, 425.455080001702mm, 116.207540000465mm);
+ PlaneNormal: (-1, 0, 0);
+ PlaneU: (-0, -0, 1);
+ PlaneV: (0, 1, 0);
+ MaterialPositiveSide: true;
+ Boundary: [(8.25754000003304mm, 72.6897200002907mm, 116.207540000465mm), (8.25754000003304mm, 102.38486000041mm, 116.207540000465mm), (8.25754000003304mm, 117.62486000047mm, 100.967540000404mm), (8.25754000003304mm, 181.124860000725mm, 100.967540000404mm), (8.25754000003304mm, 181.124860000725mm, 113.565940000454mm), (8.25754000003304mm, 308.124860001232mm, 113.565940000454mm), (8.25754000003304mm, 308.124860001232mm, 100.967540000404mm), (8.25754000003304mm, 371.624860001486mm, 100.967540000404mm), (8.25754000003304mm, 386.864860001547mm, 116.207540000465mm), (8.25754000003304mm, 412.755080001651mm, 116.207540000465mm), (8.25754000003304mm, 425.455080001702mm, 103.507540000414mm), (8.25754000003304mm, 425.455080001702mm, 84.457540000338mm), (8.25754000003304mm, 59.9897200002399mm, 84.457540000338mm), (8.25754000003304mm, 59.9897200002399mm, 103.507540000414mm)];
+ SourceFaces: [118, 119];
+ }
+ RecoveredBend "bend-c-0005-0024" {
+ AxisOrigin: (-120.6500000004825mm, 440.994800001764mm, 8.25754000003309mm);
+ AxisDirection: (1, 0, 0);
+ Angle: 89.9999999999998deg;
+ InsideRadius: 6.35000000002538mm;
+ Direction: Down;
+ Between: ["region-p-0061-0066", "region-p-0088-0089"];
+ SourceFaces: [5, 24];
+ }
+ RecoveredBend "bend-c-0006-0009" {
+ AxisOrigin: (-120.6500000004825mm, 43.4797200001739mm, 8.25754000003303mm);
+ AxisDirection: (1, 0, 0);
+ Angle: 90deg;
+ InsideRadius: 6.35000000002541mm;
+ Direction: Up;
+ Between: ["region-p-0062-0063", "region-p-0096-0097"];
+ SourceFaces: [6, 9];
+ }
+ RecoveredBend "bend-c-0046-0050" {
+ AxisOrigin: (14.6075400000584mm, 244.6248600009785mm, 113.565940000454mm);
+ AxisDirection: (0, 1, 0);
+ Angle: 45.00000000000239deg;
+ InsideRadius: 6.3500000000254mm;
+ Direction: Up;
+ Between: ["region-p-0109-0111", "region-p-0118-0119"];
+ SourceFaces: [46, 50];
+ }
+ RecoveredBend "bend-c-0057-0070" {
+ AxisOrigin: (4.44089209850063E-16mm, 242.72240000097088mm, 84.457540000338mm);
+ AxisDirection: (0, 1, 0);
+ Angle: 90deg;
+ InsideRadius: 6.35000000002539mm;
+ Direction: Up;
+ Between: ["region-p-0065-0069", "region-p-0118-0119"];
+ SourceFaces: [57, 70];
+ }
+ RecoveredBend "bend-c-0058-0064" {
+ AxisOrigin: (-120.65000000048278mm, 58.0872600002323mm, 69.8500000002795mm);
+ AxisDirection: (1, 0, 0);
+ Angle: 90.00000000000071deg;
+ InsideRadius: 6.3500000000254mm;
+ Direction: Up;
+ Between: ["region-p-0062-0063", "region-p-0065-0069"];
+ SourceFaces: [58, 64];
+ }
+ RecoveredBend "bend-c-0059-0068" {
+ AxisOrigin: (-241.300000000965mm, 242.72240000097094mm, 84.457540000338mm);
+ AxisDirection: (0, 1, 0);
+ Angle: 89.99999999999919deg;
+ InsideRadius: 6.35000000002538mm;
+ Direction: Up;
+ Between: ["region-p-0065-0069", "region-p-0102-0104"];
+ SourceFaces: [59, 68];
+ }
+ RecoveredBend "bend-c-0060-0067" {
+ AxisOrigin: (-120.65000000048278mm, 426.387260001706mm, 69.8500000002793mm);
+ AxisDirection: (1, 0, 0);
+ Angle: 89.9999999999993deg;
+ InsideRadius: 6.3500000000254mm;
+ Direction: Up;
+ Between: ["region-p-0061-0066", "region-p-0065-0069"];
+ SourceFaces: [60, 67];
+ }
+ RecoveredCut "feature-profile-f0065-l0069" {
+ Kind: Slot;
+ On: "region-p-0065-0069";
+ Center: (-126.517400000506mm, 166.52240000066598mm, 77.1537700003087mm);
+ Boundary: [(-116.992400000468mm, 210.972400000844mm, 77.1537700003087mm), (-136.042400000544mm, 210.972400000844mm, 77.1537700003087mm), (-136.042400000544mm, 122.072400000488mm, 77.1537700003087mm), (-116.992400000468mm, 122.072400000488mm, 77.1537700003087mm)];
+ SourceFaces: [65];
+ }
+ RecoveredCut "feature-profile-f0065-l0070" {
+ Kind: Slot;
+ On: "region-p-0065-0069";
+ Center: (-190.01740000076mm, 166.522400000666mm, 77.1537700003087mm);
+ Boundary: [(-199.542400000798mm, 122.072400000488mm, 77.1537700003087mm), (-180.492400000722mm, 122.072400000488mm, 77.1537700003087mm), (-180.492400000722mm, 210.972400000844mm, 77.1537700003087mm), (-199.542400000798mm, 210.972400000844mm, 77.1537700003087mm)];
+ SourceFaces: [65];
+ }
+}
diff --git a/docs/modules/sheetmetal/artifacts/m1/dfm-summary.md b/docs/modules/sheetmetal/artifacts/m1/dfm-summary.md
new file mode 100644
index 00000000..c193de94
--- /dev/null
+++ b/docs/modules/sheetmetal/artifacts/m1/dfm-summary.md
@@ -0,0 +1,10 @@
+# M1 DFM summary
+
+The typed `SheetMetalDfmPolicy` exposes provisional, parameterized checks only:
+
+- thickness > 0;
+- inside bend radius / thickness ratio (default minimum 1.0);
+- cut-center to bend-line distance (default 2× thickness);
+- flat planar-region overlap.
+
+The authored fixture passes all applicable rules. CTC-03 has R/T = 3.3289 and no detected flat overlap; both mapped openings exceed the provisional hole-to-bend threshold. These are geometry-policy observations, not universal shop limits. Cut-to-edge distance has a policy field but awaits exact stitched blank ownership before it can be evaluated honestly.
diff --git a/docs/modules/sheetmetal/artifacts/m1/flat-pattern-validation.md b/docs/modules/sheetmetal/artifacts/m1/flat-pattern-validation.md
new file mode 100644
index 00000000..f111dfde
--- /dev/null
+++ b/docs/modules/sheetmetal/artifacts/m1/flat-pattern-validation.md
@@ -0,0 +1,14 @@
+# Flat-pattern validation
+
+| Fixture | Status | Envelope (mm) | Bend lines | Cuts | Planar overlap | Hash |
+|---|---|---:|---:|---:|---|---|
+| Authored U-channel, K=.42 | Valid | 146.262388679 × 60 | 2 | 2 circular | none | `a5ce4b0368a7…` |
+| NIST CTC-03, K=.5 | Partial | 404.754237721 × 625.305580354 | 7 | 2 profile/slot | none | `2a7809249922…` |
+
+Validation checks finite coordinates, minimum closed-loop cardinality, owning-region feature containment, positive-area convex planar overlap (shared boundaries are allowed), bend-line correspondence, and deterministic ordering/hash. Cylindrical regions lower to rectangles whose width is `angle × (inside radius + K × thickness)`; this is manufacturing neutral-axis development, not projection of either physical cylinder skin.
+
+The CTC-03 SVG was raster-rendered in a headless browser and visually inspected: the dominant central panel, seven unfolded bend strips/lines, attached planar regions, and two red opening contours are visible. Bend text is isolated in a `stroke="none"` label layer with collision offsets and a translucent knockout, preventing the inherited-stroke glyph distortion that was found during review. Axis-length lookup is geometry-based, so bend lines cannot silently collapse through an ID mismatch.
+
+The CTC-03 flat STEP re-imports as one enclosed manifold: one body, one shell, 62 planar faces, 180 edges, 120 vertices, bounds `(10,10,0)`–`(414.754237721,635.305580354,1.90754)` mm. The 10 mm XY translation avoids signed-zero topology buckets and does not alter the manufactured shape or dimensions.
+
+The imported outer boundary is currently a deterministic set of per-region convex analytic contours plus bend strips, not one exact stitched production/nesting loop. Consequently CTC-03 remains `Partial` even though the recovered bend component flattens without overlap.
diff --git a/docs/modules/sheetmetal/artifacts/m1/validation-report.md b/docs/modules/sheetmetal/artifacts/m1/validation-report.md
new file mode 100644
index 00000000..4260b6f6
--- /dev/null
+++ b/docs/modules/sheetmetal/artifacts/m1/validation-report.md
@@ -0,0 +1,24 @@
+# M1 validation report
+
+Implementation evidence:
+
+- Whole-solution restore/build succeeds across 60 projects with zero warnings and zero errors.
+- Module 0.2.0 advertises four bounded capabilities: constant thickness, bend recovery, flat pattern, and authored bracket.
+- Sheet Metal domain tests cover allowance, authored formed/flat/STEP, imported self-recognition, CTC-03 recognition/determinism, overlap/touching, invalid radius/policy, double-curvature rejection, disconnected graph, and reference re-fold.
+- CLI tests cover CTC-03 inspect JSON, authored SVG layers and label-stroke regression, authored real STEP build, and a three-artifact CTC-03 run whose flat STEP re-imports and recovered Firmament recompiles.
+- CTC-03 source is read/imported but never mutated; its source PMI remains in place. Recognition does not reinterpret PMI.
+- Repeated recognition preserves part/region/bend IDs; repeated flat lowering preserves byte-derived deterministic hashes.
+- Representative CTC-03 timings on the development machine: import about 118 ms, recognition about 58 ms, flatten about 17 ms. Timings are observational; hashes exclude them.
+- CTC-03 flat STEP validation: one enclosed manifold, one body/shell, 62 planar faces, 180 edges, 120 vertices; AP242 export and ordinary Aetheris re-import succeed.
+- Recovered Firmament validation: 15 regions, seven bends, two cuts, `Partial` status, and deterministic flat hash equal to direct STEP recovery.
+- The parallel whole-solution test run passed 2,819 tests but transiently failed two unrelated Core timing/display tests under load. Both failing cases passed immediately in isolation, the display case passed twice, and the full 959-test Core suite then passed in isolation. All 368 CLI tests, 37 module tests, and nine Sheet Metal tests passed in the whole-solution run.
+
+Artifact SHA-256:
+
+- `ctc03-flat.step`: `50d95d01cae9c272725df7c3564241ac94714848aefb0385fde6379e86b942dc`
+- `ctc03-recovered.firmament`: `0c8f378a9766b5cec7d2d6d1a1144a21bfdb6509be75ded3e11a63a49d5f7dc6`
+- `authored-u-channel-flat.svg`: `21b4e69a94d6fb8734e4770fc586e4873fe8c372c9df25c520fa3956b6d82fb5`
+- `ctc03-flat.svg`: `0701af1c21d58c6173964ad535f0372e0b0d6d49fbbff87e963e3ff0fb599319`
+- `ctc03-flat-preview.png`: `0abff4d299f853cc89c51f6ab3b68fb8e7cf8e8efd848ae614b523b410784ad3`
+
+Known boundary: exact source-edge blank stitching, corner/relief semantics, and robust feature ownership across split faces are not yet production-complete. M1 returns `Partial` rather than claiming an exact nest-ready CTC-03 blank.
diff --git a/fixtures/FirmamentV2/SheetMetal/simple-u-channel.firmament b/fixtures/FirmamentV2/SheetMetal/simple-u-channel.firmament
new file mode 100644
index 00000000..c5a9eb92
--- /dev/null
+++ b/fixtures/FirmamentV2/SheetMetal/simple-u-channel.firmament
@@ -0,0 +1,36 @@
+// AETHERIS-SHEETMETAL-M1 canonical authored fixture.
+SheetMetal SimpleUChannel {
+ Thickness: 1.5mm;
+ Material: "5052-H32 Aluminum";
+ KFactor: 0.42;
+
+ Base: Rectangle(100mm, 60mm);
+
+ Flange LeftFlange {
+ From: Base.Left;
+ Length: 25mm;
+ Angle: 90deg;
+ InsideRadius: 2mm;
+ Direction: Up;
+ }
+
+ Flange RightFlange {
+ From: Base.Right;
+ Length: 20mm;
+ Angle: 90deg;
+ InsideRadius: 2mm;
+ Direction: Up;
+ }
+
+ Hole MountA {
+ On: Base;
+ Center: (25mm, 30mm);
+ Diameter: 8mm;
+ }
+
+ Hole MountB {
+ On: Base;
+ Center: (75mm, 30mm);
+ Diameter: 8mm;
+ }
+}