Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Add Firmament v1 demo packaging surface

Yuechen Li9a08df2dd845
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs
new file mode 100644
index 00000000..ab0f5c29
--- /dev/null
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs
@@ -0,0 +1,52 @@
+using System.Text;
+
+namespace Aetheris.Kernel.Firmament.Tests;
+
+public sealed class FirmamentBuildAndExportTests
+{
+ [Fact]
+ public void Run_BoxBasicExample_Writes_Default_Export_Artifact()
+ {
+ AssertExampleBuildAndExport(
+ "testdata/firmament/examples/box_basic.firmament",
+ "box_basic.step",
+ "base",
+ 0,
+ "primitive",
+ "box");
+ }
+
+ [Fact]
+ public void Run_BoxWithHoleExample_Writes_Default_Export_Artifact()
+ {
+ AssertExampleBuildAndExport(
+ "testdata/firmament/examples/box_with_hole.firmament",
+ "box_with_hole.step",
+ "base",
+ 0,
+ "primitive",
+ "box");
+ }
+
+ private static void AssertExampleBuildAndExport(string sourcePath, string expectedFileName, string expectedFeatureId, int expectedOpIndex, string expectedBodyCategory, string expectedFeatureKind)
+ {
+ var fullSourcePath = FirmamentCorpusHarness.ResolveFixtureFullPath(sourcePath);
+ var expectedOutputPath = Path.Combine(FirmamentCorpusHarness.RepoRoot(), "testdata", "firmament", "exports", expectedFileName);
+ if (File.Exists(expectedOutputPath))
+ {
+ File.Delete(expectedOutputPath);
+ }
+
+ var result = FirmamentBuildAndExport.Run(fullSourcePath);
+
+ Assert.True(result.IsSuccess);
+ Assert.Equal(fullSourcePath, result.Value.SourcePath);
+ Assert.Equal(expectedOutputPath, result.Value.OutputPath);
+ Assert.Equal(expectedFeatureId, result.Value.Export.ExportedFeatureId);
+ Assert.Equal(expectedOpIndex, result.Value.Export.ExportedOpIndex);
+ Assert.Equal(expectedBodyCategory, result.Value.Export.ExportedBodyCategory);
+ Assert.Equal(expectedFeatureKind, result.Value.Export.ExportedFeatureKind);
+ Assert.True(File.Exists(expectedOutputPath));
+ Assert.Equal(result.Value.Export.StepText, File.ReadAllText(expectedOutputPath, Encoding.UTF8));
+ }
+}
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentExamplePackSmokeTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentExamplePackSmokeTests.cs
index 814b608b..aa654c85 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentExamplePackSmokeTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentExamplePackSmokeTests.cs
@@ -28,6 +28,7 @@ public sealed class FirmamentExamplePackSmokeTests
[Theory]
[InlineData("testdata/firmament/examples/box_basic.firmament", "base", 0, "primitive", "box")]
+ [InlineData("testdata/firmament/examples/box_with_hole.firmament", "base", 0, "primitive", "box")]
[InlineData("testdata/firmament/examples/placed_primitive.firmament", "post", 1, "primitive", "cylinder")]
public void ExamplePack_GoldenPath_Examples_Export(string fixturePath, string expectedFeatureId, int expectedOpIndex, string expectedBodyCategory, string expectedFeatureKind)
{
diff --git a/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs b/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs
new file mode 100644
index 00000000..39095ef2
--- /dev/null
+++ b/Aetheris.Kernel.Firmament/FirmamentBuildAndExport.cs
@@ -0,0 +1,56 @@
+using System.Text;
+using Aetheris.Kernel.Core.Results;
+
+namespace Aetheris.Kernel.Firmament;
+
+public static class FirmamentBuildAndExport
+{
+ public static KernelResult<FirmamentBuildAndExportResult> Run(string sourcePath)
+ {
+ ArgumentException.ThrowIfNullOrWhiteSpace(sourcePath);
+
+ var fullSourcePath = Path.GetFullPath(sourcePath);
+ var sourceText = NormalizeLf(File.ReadAllText(fullSourcePath, Encoding.UTF8));
+ var exportResult = FirmamentStepExporter.Export(new FirmamentCompileRequest(new FirmamentSourceDocument(sourceText)));
+ if (!exportResult.IsSuccess)
+ {
+ return KernelResult<FirmamentBuildAndExportResult>.Failure(exportResult.Diagnostics);
+ }
+
+ var outputPath = ResolveDefaultOutputPath(fullSourcePath);
+ Directory.CreateDirectory(Path.GetDirectoryName(outputPath)!);
+ File.WriteAllText(outputPath, exportResult.Value.StepText, new UTF8Encoding(false));
+
+ return KernelResult<FirmamentBuildAndExportResult>.Success(
+ new FirmamentBuildAndExportResult(
+ fullSourcePath,
+ outputPath,
+ exportResult.Value));
+ }
+
+ private static string ResolveDefaultOutputPath(string fullSourcePath)
+ {
+ var root = FindRepositoryRoot(Path.GetDirectoryName(fullSourcePath)!);
+ var sourceFileName = Path.GetFileNameWithoutExtension(fullSourcePath);
+ return Path.Combine(root, "testdata", "firmament", "exports", sourceFileName + ".step");
+ }
+
+ private static string FindRepositoryRoot(string startDirectory)
+ {
+ var directory = new DirectoryInfo(startDirectory);
+ while (directory is not null)
+ {
+ if (File.Exists(Path.Combine(directory.FullName, "Aetheris.slnx")))
+ {
+ return directory.FullName;
+ }
+
+ directory = directory.Parent;
+ }
+
+ throw new InvalidOperationException("Unable to locate repository root for Firmament export output.");
+ }
+
+ private static string NormalizeLf(string value) =>
+ value.Replace("\r\n", "\n", StringComparison.Ordinal).Replace("\r", "\n", StringComparison.Ordinal);
+}
diff --git a/Aetheris.Kernel.Firmament/FirmamentBuildAndExportResult.cs b/Aetheris.Kernel.Firmament/FirmamentBuildAndExportResult.cs
new file mode 100644
index 00000000..0bcda2ee
--- /dev/null
+++ b/Aetheris.Kernel.Firmament/FirmamentBuildAndExportResult.cs
@@ -0,0 +1,6 @@
+namespace Aetheris.Kernel.Firmament;
+
+public sealed record FirmamentBuildAndExportResult(
+ string SourcePath,
+ string OutputPath,
+ FirmamentStepExportResult Export);
diff --git a/README.md b/README.md
index b2ae20db..0d9dccc9 100644
--- a/README.md
+++ b/README.md
@@ -1,62 +1,49 @@
-# Aetheris
+# Aetheris + Firmament v1
-Aetheris is a server/web-first solid modeling project with an ASP.NET backend and React TypeScript frontend.
+Firmament is a deterministic DSL for generating CAD geometry (STEP AP242) via Aetheris.
-## Current status
+## What works today
-Milestone **M00** is complete scaffolding work:
+- primitives and booleans: `box`, `cylinder`, `sphere`, `add`, `subtract`, `intersect`
+- placement with `place.on` anchors and `offset[3]`
+- validation ops: `expect_exists`, `expect_selectable`, `expect_manifold`
+- schema-aware CNC minimum tool radius validation
+- deterministic canonical formatting for supported `.firmament` source
+- STEP AP242 export for the current single-body golden path
-- Kernel project/test scaffolding exists.
-- Core vision, non-goals, architecture, numerics, and milestone docs are defined.
-- Baseline .NET CI is configured for restore/build/test.
+## 30-second demo
-No CAD/kernel feature implementation has started yet.
+Open the example at `testdata/firmament/examples/box_with_hole.firmament`.
-## Repository structure
-
-- `Aetheris.Server/` — ASP.NET host/API project.
-- `aetheris.client/` — React + Vite TypeScript client.
-- `Aetheris.Kernel.Core/` — placeholder kernel core class library (no modeling logic yet).
-- `Aetheris.Kernel.Core.Tests/` — xUnit baseline tests for kernel core scaffolding.
-- `docs/` — project charter, scope, and policy documentation.
-
-## Run .NET checks
+Then run the demo-oriented helper test:
```bash
-dotnet restore Aetheris.Server/Aetheris.Server.csproj
-dotnet restore Aetheris.Kernel.Core.Tests/Aetheris.Kernel.Core.Tests.csproj
-dotnet build Aetheris.Server/Aetheris.Server.csproj --no-restore
-dotnet build Aetheris.Kernel.Core.Tests/Aetheris.Kernel.Core.Tests.csproj --no-restore
-dotnet test Aetheris.Kernel.Core.Tests/Aetheris.Kernel.Core.Tests.csproj --no-build
+export PATH="$HOME/.dotnet:$PATH"
+dotnet test Aetheris.Kernel.Firmament.Tests/Aetheris.Kernel.Firmament.Tests.csproj --filter "FullyQualifiedName~FirmamentBuildAndExportTests.Run_BoxWithHoleExample_Writes_Default_Export_Artifact"
```
-Kernel implementation milestones begin after M00.
+That flow compiles the example, exports STEP using the current last-successful-body policy, and writes the artifact to:
-## Debug quickstart
+- `testdata/firmament/exports/box_with_hole.step`
-### Visual Studio (canonical)
+For `box_with_hole.firmament`, the exported body is currently the deterministic fallback body selected by the existing export contract, so the demo stays behaviorally accurate without changing runtime semantics.
-1. Open `Aetheris.slnx`.
-2. Set `Aetheris.Server` as the startup project.
-3. Press `F5`.
+If you want the API entry point instead of the test wrapper, use `FirmamentBuildAndExport.Run(string sourcePath)` from `Aetheris.Kernel.Firmament`.
-Visual Studio launches the ASP.NET host and the Vite dev server automatically via SpaProxy, then opens the app root page. API traffic remains under `/api` and proxies to the backend automatically in development.
+## Repo map
-### CLI (works everywhere, including VS Code terminals)
+- language/compiler/runtime: `Aetheris.Kernel.Firmament/`
+- examples: `testdata/firmament/examples/`
+- exported STEP artifacts: `testdata/firmament/exports/`
-Run in two terminals:
+## Docs
-```bash
-# Terminal 1
-cd Aetheris.Server
-dotnet watch run
-```
-
-```bash
-# Terminal 2
-cd aetheris.client
-npm run dev
-```
+- overview: `docs/firmament-overview.md`
+- build/export workflow: `docs/firmament-build-workflow.md`
+- selector contracts: `docs/firmament-selectors.md`
+- demo script: `docs/firmament-demo.md`
-Backend defaults to `https://localhost:7145` and the client dev server is pinned to `https://localhost:5173`.
+## Notes
+- This slice keeps the current v1 surface only; it does not add PMI, assemblies, or multi-body export.
+- The repository still contains the broader Aetheris server/client scaffolding, but the Firmament kernel path above is the v1 demo-ready entry point.
diff --git a/docs/firmament-build-workflow.md b/docs/firmament-build-workflow.md
index 88277961..98a69d66 100644
--- a/docs/firmament-build-workflow.md
+++ b/docs/firmament-build-workflow.md
@@ -25,7 +25,7 @@ The current in-repo flow is:
5. execute validation ops against the compiled/executed result
6. optionally export the selected executed body to STEP AP242
-There is not yet a polished standalone Firmament CLI documented in this repository. Today, the workflow is exercised through the compiler/exporter code paths and the automated tests.
+There is not yet a polished standalone Firmament CLI documented in this repository. Today, the workflow is exercised through the compiler/exporter code paths, the `FirmamentBuildAndExport.Run(string sourcePath)` helper, and the automated tests.
## Export policy
@@ -53,7 +53,7 @@ So the exported body is tied to execution success, not simply to the last textua
- example source files: `testdata/firmament/examples/`
- existing fixture corpus used by implementation tests: `testdata/firmament/fixtures/`
-- generated STEP artifacts checked by exporter tests: `testdata/firmament/exports/`
+- generated STEP artifacts checked by exporter tests and demo helper flows: `testdata/firmament/exports/`
## How to review the golden path today
diff --git a/docs/firmament-demo.md b/docs/firmament-demo.md
new file mode 100644
index 00000000..9d450a57
--- /dev/null
+++ b/docs/firmament-demo.md
@@ -0,0 +1,42 @@
+# Firmament Demo Script
+
+Use this when you need to demo Firmament v1 quickly and without improvising.
+
+## Step 1 — Open an example
+
+Open `testdata/firmament/examples/box_with_hole.firmament`.
+
+Point out that it is a tiny ordered feature program:
+- first a `box`
+- then a `subtract` with a cylinder tool
+- and that v1 preserves its current export-selection behavior instead of pretending subtraction is a new capability
+
+## Step 2 — Run export
+
+Run:
+
+```bash
+export PATH="$HOME/.dotnet:$PATH"
+dotnet test Aetheris.Kernel.Firmament.Tests/Aetheris.Kernel.Firmament.Tests.csproj --filter "FullyQualifiedName~FirmamentBuildAndExportTests.Run_BoxWithHoleExample_Writes_Default_Export_Artifact"
+```
+
+That test calls `FirmamentBuildAndExport.Run(...)`, which reads the `.firmament` file, compiles it through the current pipeline, exports STEP, and writes:
+
+- `testdata/firmament/exports/box_with_hole.step`
+
+## Step 3 — Open the generated STEP file
+
+Open `testdata/firmament/exports/box_with_hole.step` in a STEP viewer or CAD tool that reads AP242.
+
+## Step 4 — What to point out
+
+- exact geometry: the generated STEP body is the exported rectangular base box for this example under the current contract
+- boolean cut: the source clearly shows a subtract-with-cylinder feature, which lets you explain the authored intent without changing runtime behavior
+- deterministic result: rerunning the same source produces the same STEP text
+- export metadata: the export contract keeps the exported feature id and source op index, so you can explain why the selected body is `base` at op index `0`
+
+## Optional talking points
+
+- machine-first DSL
+- deterministic output
+- STEP AP242
diff --git a/testdata/firmament/examples/README.md b/testdata/firmament/examples/README.md
index c3d42056..f3419db4 100644
--- a/testdata/firmament/examples/README.md
+++ b/testdata/firmament/examples/README.md
@@ -2,9 +2,9 @@
This directory contains small canonical Firmament examples for the current v1 surface.
-- `box_basic.firmament` — minimal single-box golden-path example.
-- `box_with_hole.firmament` — box plus subtract-with-cylinder boolean syntax example.
-- `placed_primitive.firmament` — selector-based placement using `place.on` and `offset[3]`.
+- `box_basic.firmament` — minimal single-box golden-path example; helper export path: `testdata/firmament/exports/box_basic.step`.
+- `box_with_hole.firmament` — box plus subtract-with-cylinder boolean syntax example; helper export path: `testdata/firmament/exports/box_with_hole.step`.
+- `placed_primitive.firmament` — selector-based placement using `place.on` and `offset[3]`; helper export path: `testdata/firmament/exports/placed_primitive.step`.
- `cnc_min_tool_radius_demo.firmament` — schema-aware CNC example using `minimum_tool_radius` with a subtract cylinder sized to pass the current rule.
-These files are intended to stay minimal, readable, and aligned with the implemented language surface.
+These files are intended to stay minimal, readable, and aligned with the implemented language surface. Export artifacts are kept separately under `testdata/firmament/exports/` so examples remain source-only and demo outputs stay easy to find.
diff --git a/testdata/firmament/exports/box_basic.step b/testdata/firmament/exports/box_basic.step
new file mode 100644
index 00000000..e1bee10a
--- /dev/null
+++ b/testdata/firmament/exports/box_basic.step
@@ -0,0 +1,172 @@
+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($,(-20,-15,-0));
+#7=VERTEX_POINT($,#6);
+#8=CARTESIAN_POINT($,(20,-15,-0));
+#9=VERTEX_POINT($,#8);
+#10=CARTESIAN_POINT($,(-20,-15,-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($,(20,15,-0));
+#17=VERTEX_POINT($,#16);
+#18=CARTESIAN_POINT($,(20,-15,-0));
+#19=DIRECTION($,(0,1,0));
+#20=VECTOR($,#19,1);
+#21=LINE($,#18,#20);
+#22=EDGE_CURVE($,#9,#17,#21,.T.);
+#23=ORIENTED_EDGE($,$,$,#22,.T.);
+#24=CARTESIAN_POINT($,(-20,15,-0));
+#25=VERTEX_POINT($,#24);
+#26=CARTESIAN_POINT($,(20,15,-0));
+#27=DIRECTION($,(-1,0,0));
+#28=VECTOR($,#27,1);
+#29=LINE($,#26,#28);
+#30=EDGE_CURVE($,#17,#25,#29,.T.);
+#31=ORIENTED_EDGE($,$,$,#30,.T.);
+#32=CARTESIAN_POINT($,(-20,15,-0));
+#33=DIRECTION($,(0,-1,0));
+#34=VECTOR($,#33,1);
+#35=LINE($,#32,#34);
+#36=EDGE_CURVE($,#25,#7,#35,.T.);
+#37=ORIENTED_EDGE($,$,$,#36,.T.);
+#38=EDGE_LOOP($,(#15,#23,#31,#37));
+#39=FACE_OUTER_BOUND('',#38,.T.);
+#40=ADVANCED_FACE('',(#39),#5,.T.);
+#41=CARTESIAN_POINT($,(0,0,12));
+#42=DIRECTION($,(0,0,1));
+#43=DIRECTION($,(1,0,0));
+#44=AXIS2_PLACEMENT_3D($,#41,#42,#43);
+#45=PLANE($,#44);
+#46=CARTESIAN_POINT($,(-20,-15,12));
+#47=VERTEX_POINT($,#46);
+#48=CARTESIAN_POINT($,(20,-15,12));
+#49=VERTEX_POINT($,#48);
+#50=CARTESIAN_POINT($,(-20,-15,12));
+#51=DIRECTION($,(1,0,0));
+#52=VECTOR($,#51,1);
+#53=LINE($,#50,#52);
+#54=EDGE_CURVE($,#47,#49,#53,.T.);
+#55=ORIENTED_EDGE($,$,$,#54,.T.);
+#56=CARTESIAN_POINT($,(20,15,12));
+#57=VERTEX_POINT($,#56);
+#58=CARTESIAN_POINT($,(20,-15,12));
+#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($,(-20,15,12));
+#65=VERTEX_POINT($,#64);
+#66=CARTESIAN_POINT($,(20,15,12));
+#67=DIRECTION($,(-1,0,0));
+#68=VECTOR($,#67,1);
+#69=LINE($,#66,#68);
+#70=EDGE_CURVE($,#57,#65,#69,.T.);
+#71=ORIENTED_EDGE($,$,$,#70,.T.);
+#72=CARTESIAN_POINT($,(-20,15,12));
+#73=DIRECTION($,(0,-1,0));
+#74=VECTOR($,#73,1);
+#75=LINE($,#72,#74);
+#76=EDGE_CURVE($,#65,#47,#75,.T.);
+#77=ORIENTED_EDGE($,$,$,#76,.T.);
+#78=EDGE_LOOP($,(#55,#63,#71,#77));
+#79=FACE_OUTER_BOUND('',#78,.T.);
+#80=ADVANCED_FACE('',(#79),#45,.T.);
+#81=CARTESIAN_POINT($,(0,-15,6));
+#82=DIRECTION($,(0,-1,0));
+#83=DIRECTION($,(1,0,0));
+#84=AXIS2_PLACEMENT_3D($,#81,#82,#83);
+#85=PLANE($,#84);
+#86=ORIENTED_EDGE($,$,$,#14,.T.);
+#87=CARTESIAN_POINT($,(20,-15,-0));
+#88=DIRECTION($,(0,0,1));
+#89=VECTOR($,#88,1);
+#90=LINE($,#87,#89);
+#91=EDGE_CURVE($,#9,#49,#90,.T.);
+#92=ORIENTED_EDGE($,$,$,#91,.T.);
+#93=ORIENTED_EDGE($,$,$,#54,.F.);
+#94=CARTESIAN_POINT($,(-20,-15,-0));
+#95=DIRECTION($,(0,0,1));
+#96=VECTOR($,#95,1);
+#97=LINE($,#94,#96);
+#98=EDGE_CURVE($,#7,#47,#97,.T.);
+#99=ORIENTED_EDGE($,$,$,#98,.F.);
+#100=EDGE_LOOP($,(#86,#92,#93,#99));
+#101=FACE_OUTER_BOUND('',#100,.T.);
+#102=ADVANCED_FACE('',(#101),#85,.T.);
+#103=CARTESIAN_POINT($,(20,0,6));
+#104=DIRECTION($,(1,0,0));
+#105=DIRECTION($,(0,1,0));
+#106=AXIS2_PLACEMENT_3D($,#103,#104,#105);
+#107=PLANE($,#106);
+#108=ORIENTED_EDGE($,$,$,#22,.T.);
+#109=CARTESIAN_POINT($,(20,15,-0));
+#110=DIRECTION($,(0,0,1));
+#111=VECTOR($,#110,1);
+#112=LINE($,#109,#111);
+#113=EDGE_CURVE($,#17,#57,#112,.T.);
+#114=ORIENTED_EDGE($,$,$,#113,.T.);
+#115=ORIENTED_EDGE($,$,$,#62,.F.);
+#116=ORIENTED_EDGE($,$,$,#91,.F.);
+#117=EDGE_LOOP($,(#108,#114,#115,#116));
+#118=FACE_OUTER_BOUND('',#117,.T.);
+#119=ADVANCED_FACE('',(#118),#107,.T.);
+#120=CARTESIAN_POINT($,(0,15,6));
+#121=DIRECTION($,(0,1,0));
+#122=DIRECTION($,(-1,0,0));
+#123=AXIS2_PLACEMENT_3D($,#120,#121,#122);
+#124=PLANE($,#123);
+#125=ORIENTED_EDGE($,$,$,#30,.T.);
+#126=CARTESIAN_POINT($,(-20,15,-0));
+#127=DIRECTION($,(0,0,1));
+#128=VECTOR($,#127,1);
+#129=LINE($,#126,#128);
+#130=EDGE_CURVE($,#25,#65,#129,.T.);
+#131=ORIENTED_EDGE($,$,$,#130,.T.);
+#132=ORIENTED_EDGE($,$,$,#70,.F.);
+#133=ORIENTED_EDGE($,$,$,#113,.F.);
+#134=EDGE_LOOP($,(#125,#131,#132,#133));
+#135=FACE_OUTER_BOUND('',#134,.T.);
+#136=ADVANCED_FACE('',(#135),#124,.T.);
+#137=CARTESIAN_POINT($,(-20,0,6));
+#138=DIRECTION($,(-1,0,0));
+#139=DIRECTION($,(0,1,0));
+#140=AXIS2_PLACEMENT_3D($,#137,#138,#139);
+#141=PLANE($,#140);
+#142=ORIENTED_EDGE($,$,$,#36,.T.);
+#143=ORIENTED_EDGE($,$,$,#98,.T.);
+#144=ORIENTED_EDGE($,$,$,#76,.F.);
+#145=ORIENTED_EDGE($,$,$,#130,.F.);
+#146=EDGE_LOOP($,(#142,#143,#144,#145));
+#147=FACE_OUTER_BOUND('',#146,.T.);
+#148=ADVANCED_FACE('',(#147),#141,.T.);
+#149=CLOSED_SHELL($,(#40,#80,#102,#119,#136,#148));
+#150=MANIFOLD_SOLID_BREP('AetherisBody',#149);
+#151=APPLICATION_CONTEXT('mechanical design');
+#152=PRODUCT_CONTEXT('',#151,'mechanical');
+#153=PRODUCT('AETHERIS','AetherisBody','',(#152));
+#154=PRODUCT_DEFINITION_FORMATION('','',#153);
+#155=PRODUCT_DEFINITION_CONTEXT('design',#151,'design');
+#156=PRODUCT_DEFINITION('','',#154,#155);
+#157=PRODUCT_DEFINITION_SHAPE('','',#156);
+#158=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.));
+#159=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
+#160=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT());
+#161=(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNIT_ASSIGNED_CONTEXT((#158,#159,#160))REPRESENTATION_CONTEXT('3','3D'));
+#162=SHAPE_REPRESENTATION('AetherisBody',(#150),#161);
+#163=SHAPE_DEFINITION_REPRESENTATION(#157,#162);
+ENDSEC;
+END-ISO-10303-21;
diff --git a/testdata/firmament/exports/box_with_hole.step b/testdata/firmament/exports/box_with_hole.step
new file mode 100644
index 00000000..e1bee10a
--- /dev/null
+++ b/testdata/firmament/exports/box_with_hole.step
@@ -0,0 +1,172 @@
+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($,(-20,-15,-0));
+#7=VERTEX_POINT($,#6);
+#8=CARTESIAN_POINT($,(20,-15,-0));
+#9=VERTEX_POINT($,#8);
+#10=CARTESIAN_POINT($,(-20,-15,-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($,(20,15,-0));
+#17=VERTEX_POINT($,#16);
+#18=CARTESIAN_POINT($,(20,-15,-0));
+#19=DIRECTION($,(0,1,0));
+#20=VECTOR($,#19,1);
+#21=LINE($,#18,#20);
+#22=EDGE_CURVE($,#9,#17,#21,.T.);
+#23=ORIENTED_EDGE($,$,$,#22,.T.);
+#24=CARTESIAN_POINT($,(-20,15,-0));
+#25=VERTEX_POINT($,#24);
+#26=CARTESIAN_POINT($,(20,15,-0));
+#27=DIRECTION($,(-1,0,0));
+#28=VECTOR($,#27,1);
+#29=LINE($,#26,#28);
+#30=EDGE_CURVE($,#17,#25,#29,.T.);
+#31=ORIENTED_EDGE($,$,$,#30,.T.);
+#32=CARTESIAN_POINT($,(-20,15,-0));
+#33=DIRECTION($,(0,-1,0));
+#34=VECTOR($,#33,1);
+#35=LINE($,#32,#34);
+#36=EDGE_CURVE($,#25,#7,#35,.T.);
+#37=ORIENTED_EDGE($,$,$,#36,.T.);
+#38=EDGE_LOOP($,(#15,#23,#31,#37));
+#39=FACE_OUTER_BOUND('',#38,.T.);
+#40=ADVANCED_FACE('',(#39),#5,.T.);
+#41=CARTESIAN_POINT($,(0,0,12));
+#42=DIRECTION($,(0,0,1));
+#43=DIRECTION($,(1,0,0));
+#44=AXIS2_PLACEMENT_3D($,#41,#42,#43);
+#45=PLANE($,#44);
+#46=CARTESIAN_POINT($,(-20,-15,12));
+#47=VERTEX_POINT($,#46);
+#48=CARTESIAN_POINT($,(20,-15,12));
+#49=VERTEX_POINT($,#48);
+#50=CARTESIAN_POINT($,(-20,-15,12));
+#51=DIRECTION($,(1,0,0));
+#52=VECTOR($,#51,1);
+#53=LINE($,#50,#52);
+#54=EDGE_CURVE($,#47,#49,#53,.T.);
+#55=ORIENTED_EDGE($,$,$,#54,.T.);
+#56=CARTESIAN_POINT($,(20,15,12));
+#57=VERTEX_POINT($,#56);
+#58=CARTESIAN_POINT($,(20,-15,12));
+#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($,(-20,15,12));
+#65=VERTEX_POINT($,#64);
+#66=CARTESIAN_POINT($,(20,15,12));
+#67=DIRECTION($,(-1,0,0));
+#68=VECTOR($,#67,1);
+#69=LINE($,#66,#68);
+#70=EDGE_CURVE($,#57,#65,#69,.T.);
+#71=ORIENTED_EDGE($,$,$,#70,.T.);
+#72=CARTESIAN_POINT($,(-20,15,12));
+#73=DIRECTION($,(0,-1,0));
+#74=VECTOR($,#73,1);
+#75=LINE($,#72,#74);
+#76=EDGE_CURVE($,#65,#47,#75,.T.);
+#77=ORIENTED_EDGE($,$,$,#76,.T.);
+#78=EDGE_LOOP($,(#55,#63,#71,#77));
+#79=FACE_OUTER_BOUND('',#78,.T.);
+#80=ADVANCED_FACE('',(#79),#45,.T.);
+#81=CARTESIAN_POINT($,(0,-15,6));
+#82=DIRECTION($,(0,-1,0));
+#83=DIRECTION($,(1,0,0));
+#84=AXIS2_PLACEMENT_3D($,#81,#82,#83);
+#85=PLANE($,#84);
+#86=ORIENTED_EDGE($,$,$,#14,.T.);
+#87=CARTESIAN_POINT($,(20,-15,-0));
+#88=DIRECTION($,(0,0,1));
+#89=VECTOR($,#88,1);
+#90=LINE($,#87,#89);
+#91=EDGE_CURVE($,#9,#49,#90,.T.);
+#92=ORIENTED_EDGE($,$,$,#91,.T.);
+#93=ORIENTED_EDGE($,$,$,#54,.F.);
+#94=CARTESIAN_POINT($,(-20,-15,-0));
+#95=DIRECTION($,(0,0,1));
+#96=VECTOR($,#95,1);
+#97=LINE($,#94,#96);
+#98=EDGE_CURVE($,#7,#47,#97,.T.);
+#99=ORIENTED_EDGE($,$,$,#98,.F.);
+#100=EDGE_LOOP($,(#86,#92,#93,#99));
+#101=FACE_OUTER_BOUND('',#100,.T.);
+#102=ADVANCED_FACE('',(#101),#85,.T.);
+#103=CARTESIAN_POINT($,(20,0,6));
+#104=DIRECTION($,(1,0,0));
+#105=DIRECTION($,(0,1,0));
+#106=AXIS2_PLACEMENT_3D($,#103,#104,#105);
+#107=PLANE($,#106);
+#108=ORIENTED_EDGE($,$,$,#22,.T.);
+#109=CARTESIAN_POINT($,(20,15,-0));
+#110=DIRECTION($,(0,0,1));
+#111=VECTOR($,#110,1);
+#112=LINE($,#109,#111);
+#113=EDGE_CURVE($,#17,#57,#112,.T.);
+#114=ORIENTED_EDGE($,$,$,#113,.T.);
+#115=ORIENTED_EDGE($,$,$,#62,.F.);
+#116=ORIENTED_EDGE($,$,$,#91,.F.);
+#117=EDGE_LOOP($,(#108,#114,#115,#116));
+#118=FACE_OUTER_BOUND('',#117,.T.);
+#119=ADVANCED_FACE('',(#118),#107,.T.);
+#120=CARTESIAN_POINT($,(0,15,6));
+#121=DIRECTION($,(0,1,0));
+#122=DIRECTION($,(-1,0,0));
+#123=AXIS2_PLACEMENT_3D($,#120,#121,#122);
+#124=PLANE($,#123);
+#125=ORIENTED_EDGE($,$,$,#30,.T.);
+#126=CARTESIAN_POINT($,(-20,15,-0));
+#127=DIRECTION($,(0,0,1));
+#128=VECTOR($,#127,1);
+#129=LINE($,#126,#128);
+#130=EDGE_CURVE($,#25,#65,#129,.T.);
+#131=ORIENTED_EDGE($,$,$,#130,.T.);
+#132=ORIENTED_EDGE($,$,$,#70,.F.);
+#133=ORIENTED_EDGE($,$,$,#113,.F.);
+#134=EDGE_LOOP($,(#125,#131,#132,#133));
+#135=FACE_OUTER_BOUND('',#134,.T.);
+#136=ADVANCED_FACE('',(#135),#124,.T.);
+#137=CARTESIAN_POINT($,(-20,0,6));
+#138=DIRECTION($,(-1,0,0));
+#139=DIRECTION($,(0,1,0));
+#140=AXIS2_PLACEMENT_3D($,#137,#138,#139);
+#141=PLANE($,#140);
+#142=ORIENTED_EDGE($,$,$,#36,.T.);
+#143=ORIENTED_EDGE($,$,$,#98,.T.);
+#144=ORIENTED_EDGE($,$,$,#76,.F.);
+#145=ORIENTED_EDGE($,$,$,#130,.F.);
+#146=EDGE_LOOP($,(#142,#143,#144,#145));
+#147=FACE_OUTER_BOUND('',#146,.T.);
+#148=ADVANCED_FACE('',(#147),#141,.T.);
+#149=CLOSED_SHELL($,(#40,#80,#102,#119,#136,#148));
+#150=MANIFOLD_SOLID_BREP('AetherisBody',#149);
+#151=APPLICATION_CONTEXT('mechanical design');
+#152=PRODUCT_CONTEXT('',#151,'mechanical');
+#153=PRODUCT('AETHERIS','AetherisBody','',(#152));
+#154=PRODUCT_DEFINITION_FORMATION('','',#153);
+#155=PRODUCT_DEFINITION_CONTEXT('design',#151,'design');
+#156=PRODUCT_DEFINITION('','',#154,#155);
+#157=PRODUCT_DEFINITION_SHAPE('','',#156);
+#158=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.));
+#159=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
+#160=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT());
+#161=(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNIT_ASSIGNED_CONTEXT((#158,#159,#160))REPRESENTATION_CONTEXT('3','3D'));
+#162=SHAPE_REPRESENTATION('AetherisBody',(#150),#161);
+#163=SHAPE_DEFINITION_REPRESENTATION(#157,#162);
+ENDSEC;
+END-ISO-10303-21;