Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Implement narrow box-cylinder through-hole subtract support

Yuechen Lic6f427c8a254
diff --git a/Aetheris.Kernel.Core.Tests/Brep/Boolean/BrepBooleanTests.cs b/Aetheris.Kernel.Core.Tests/Brep/Boolean/BrepBooleanTests.cs
index 59a9c3ff..7971f2ce 100644
--- a/Aetheris.Kernel.Core.Tests/Brep/Boolean/BrepBooleanTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Brep/Boolean/BrepBooleanTests.cs
@@ -1,7 +1,13 @@
using Aetheris.Kernel.Core.Brep;
using Aetheris.Kernel.Core.Brep.Boolean;
using Aetheris.Kernel.Core.Diagnostics;
+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.Numerics;
+using Aetheris.Kernel.Core.Step242;
+using Aetheris.Kernel.Core.Topology;
namespace Aetheris.Kernel.Core.Tests.Brep.Boolean;
@@ -185,6 +191,145 @@ public sealed class BrepBooleanTests
Assert.True(BrepBindingValidator.Validate(result.Value, true).IsSuccess);
}
+
+ [Fact]
+ public void Subtract_BoxCylinderThroughHole_Returns_ManifoldBodyWithCylindricalHole()
+ {
+ var left = BrepBooleanBoxRecognition.CreateBoxFromExtents(new AxisAlignedBoxExtents(-20d, 20d, -15d, 15d, 0d, 12d)).Value;
+ var right = TransformBody(BrepPrimitives.CreateCylinder(4d, 20d).Value, Transform3D.CreateTranslation(new Vector3D(3d, -2d, 6d)));
+
+ var result = BrepBoolean.Subtract(left, right);
+
+ Assert.True(result.IsSuccess);
+ var body = result.Value;
+ Assert.Single(body.Topology.Bodies);
+ Assert.Single(body.Topology.Shells);
+ Assert.Equal(7, body.Topology.Faces.Count());
+ Assert.Equal(15, body.Topology.Edges.Count());
+ Assert.Equal(12, body.Topology.Vertices.Count());
+ Assert.True(BrepBindingValidator.Validate(body, true).IsSuccess);
+
+ var cylindricalFace = Assert.Single(body.Topology.Faces, face =>
+ body.TryGetFaceSurfaceGeometry(face.Id, out var surface)
+ && surface?.Kind == SurfaceGeometryKind.Cylinder);
+ Assert.Single(body.GetLoopIds(cylindricalFace.Id));
+
+ var topFace = Assert.Single(body.Topology.Faces, face =>
+ body.TryGetFaceSurfaceGeometry(face.Id, out var surface)
+ && surface?.Kind == SurfaceGeometryKind.Plane
+ && surface.Plane!.Value.Normal.Z > 0.5d);
+ Assert.Equal(2, body.GetLoopIds(topFace.Id).Count);
+
+ var bottomFace = Assert.Single(body.Topology.Faces, face =>
+ body.TryGetFaceSurfaceGeometry(face.Id, out var surface)
+ && surface?.Kind == SurfaceGeometryKind.Plane
+ && surface.Plane!.Value.Normal.Z < -0.5d);
+ Assert.Equal(2, body.GetLoopIds(bottomFace.Id).Count);
+ }
+
+ [Fact]
+ public void Subtract_BoxCylinderThroughHole_Exports_And_RoundTrips_Deterministically()
+ {
+ var left = BrepBooleanBoxRecognition.CreateBoxFromExtents(new AxisAlignedBoxExtents(-20d, 20d, -15d, 15d, 0d, 12d)).Value;
+ var right = TransformBody(BrepPrimitives.CreateCylinder(4d, 20d).Value, Transform3D.CreateTranslation(new Vector3D(3d, -2d, 6d)));
+
+ var first = BrepBoolean.Subtract(left, right);
+ var second = BrepBoolean.Subtract(left, right);
+
+ Assert.True(first.IsSuccess);
+ Assert.True(second.IsSuccess);
+
+ var firstExport = Step242Exporter.ExportBody(first.Value);
+ var secondExport = Step242Exporter.ExportBody(second.Value);
+ Assert.True(firstExport.IsSuccess);
+ Assert.True(secondExport.IsSuccess);
+ Assert.Equal(firstExport.Value, secondExport.Value);
+ Assert.Contains("MANIFOLD_SOLID_BREP", firstExport.Value, StringComparison.Ordinal);
+ Assert.Contains("CYLINDRICAL_SURFACE", firstExport.Value, StringComparison.Ordinal);
+ Assert.Contains("FACE_BOUND('',", firstExport.Value, StringComparison.Ordinal);
+ Assert.Contains("FACE_OUTER_BOUND('',", firstExport.Value, StringComparison.Ordinal);
+
+ var import = Step242Importer.ImportBody(firstExport.Value);
+ Assert.True(import.IsSuccess);
+ Assert.True(BrepBindingValidator.Validate(import.Value, true).IsSuccess);
+ Assert.Contains(import.Value.Topology.Faces, face =>
+ import.Value.TryGetFaceSurfaceGeometry(face.Id, out var surface)
+ && surface?.Kind == SurfaceGeometryKind.Cylinder);
+ }
+
+ [Fact]
+ public void Subtract_BoxCylinderRotatedAxis_ReturnsDeterministicNotImplemented()
+ {
+ var left = BrepBooleanBoxRecognition.CreateBoxFromExtents(new AxisAlignedBoxExtents(-20d, 20d, -15d, 15d, 0d, 12d)).Value;
+ var rotated = TransformBody(BrepPrimitives.CreateCylinder(4d, 20d).Value, Transform3D.CreateRotationX(System.Math.PI / 2d) * Transform3D.CreateTranslation(new Vector3D(0d, 0d, 6d)));
+
+ var result = BrepBoolean.Subtract(left, rotated);
+
+ Assert.False(result.IsSuccess);
+ var diagnostic = Assert.Single(result.Diagnostics);
+ Assert.Equal(KernelDiagnosticCode.NotImplemented, diagnostic.Code);
+ Assert.Contains("strict Z-aligned through-hole subset", diagnostic.Message, StringComparison.Ordinal);
+ Assert.Contains("cylinder axis is not aligned with the box Z axis", diagnostic.Message, StringComparison.Ordinal);
+ }
+
+ [Fact]
+ public void Subtract_BoxCylinderPartialHeight_ReturnsDeterministicNotImplemented()
+ {
+ var left = BrepBooleanBoxRecognition.CreateBoxFromExtents(new AxisAlignedBoxExtents(-20d, 20d, -15d, 15d, 0d, 12d)).Value;
+ var partial = TransformBody(BrepPrimitives.CreateCylinder(4d, 6d).Value, Transform3D.CreateTranslation(new Vector3D(0d, 0d, 6d)));
+
+ var result = BrepBoolean.Subtract(left, partial);
+
+ Assert.False(result.IsSuccess);
+ var diagnostic = Assert.Single(result.Diagnostics);
+ Assert.Equal(KernelDiagnosticCode.NotImplemented, diagnostic.Code);
+ Assert.Contains("strict Z-aligned through-hole subset", diagnostic.Message, StringComparison.Ordinal);
+ Assert.Contains("does not fully span the box Z range", diagnostic.Message, StringComparison.Ordinal);
+ }
+
+ [Fact]
+ public void Subtract_BoxCylinderOutsideFootprint_ReturnsDeterministicNotImplemented()
+ {
+ var left = BrepBooleanBoxRecognition.CreateBoxFromExtents(new AxisAlignedBoxExtents(-20d, 20d, -15d, 15d, 0d, 12d)).Value;
+ var outside = TransformBody(BrepPrimitives.CreateCylinder(4d, 20d).Value, Transform3D.CreateTranslation(new Vector3D(30d, 0d, 6d)));
+
+ var result = BrepBoolean.Subtract(left, outside);
+
+ Assert.False(result.IsSuccess);
+ var diagnostic = Assert.Single(result.Diagnostics);
+ Assert.Equal(KernelDiagnosticCode.NotImplemented, diagnostic.Code);
+ Assert.Contains("strict Z-aligned through-hole subset", diagnostic.Message, StringComparison.Ordinal);
+ Assert.Contains("strictly inside the box XY footprint", diagnostic.Message, StringComparison.Ordinal);
+ }
+
+ [Fact]
+ public void Add_BoxCylinder_StillReturnsDeterministicNotImplemented()
+ {
+ var left = BrepBooleanBoxRecognition.CreateBoxFromExtents(new AxisAlignedBoxExtents(-20d, 20d, -15d, 15d, 0d, 12d)).Value;
+ var right = TransformBody(BrepPrimitives.CreateCylinder(4d, 20d).Value, Transform3D.CreateTranslation(new Vector3D(0d, 0d, 6d)));
+
+ var result = BrepBoolean.Union(left, right);
+
+ Assert.False(result.IsSuccess);
+ var diagnostic = Assert.Single(result.Diagnostics);
+ Assert.Equal(KernelDiagnosticCode.NotImplemented, diagnostic.Code);
+ Assert.Equal("Boolean Union: M13 only supports recognized axis-aligned boxes from BrepPrimitives.CreateBox(...).", diagnostic.Message);
+ }
+
+ [Fact]
+ public void Intersect_BoxCylinder_StillReturnsDeterministicNotImplemented()
+ {
+ var left = BrepBooleanBoxRecognition.CreateBoxFromExtents(new AxisAlignedBoxExtents(-20d, 20d, -15d, 15d, 0d, 12d)).Value;
+ var right = TransformBody(BrepPrimitives.CreateCylinder(4d, 20d).Value, Transform3D.CreateTranslation(new Vector3D(0d, 0d, 6d)));
+
+ var result = BrepBoolean.Intersect(left, right);
+
+ Assert.False(result.IsSuccess);
+ var diagnostic = Assert.Single(result.Diagnostics);
+ Assert.Equal(KernelDiagnosticCode.NotImplemented, diagnostic.Code);
+ Assert.Equal("Boolean Intersect: M13 only supports recognized axis-aligned boxes from BrepPrimitives.CreateBox(...).", diagnostic.Message);
+ }
+
[Fact]
public void Execute_NonBoxInput_ReturnsDeterministicNotImplementedWithoutThrowing()
{
@@ -200,4 +345,53 @@ public sealed class BrepBooleanTests
Assert.Equal(KernelDiagnosticCode.NotImplemented, diagnostic.Code);
Assert.Equal("Boolean Union: M13 only supports recognized axis-aligned boxes from BrepPrimitives.CreateBox(...).", diagnostic.Message);
}
+
+ private static BrepBody TransformBody(BrepBody body, Transform3D transform)
+ {
+ var geometry = new BrepGeometryStore();
+ foreach (var curveEntry in body.Geometry.Curves)
+ {
+ geometry.AddCurve(curveEntry.Key, curveEntry.Value.Kind switch
+ {
+ CurveGeometryKind.Line3 => CurveGeometry.FromLine(new Line3Curve(
+ transform.Apply(curveEntry.Value.Line3!.Value.Origin),
+ transform.Apply(curveEntry.Value.Line3.Value.Direction))),
+ CurveGeometryKind.Circle3 => CurveGeometry.FromCircle(new Circle3Curve(
+ transform.Apply(curveEntry.Value.Circle3!.Value.Center),
+ transform.Apply(curveEntry.Value.Circle3.Value.Normal),
+ curveEntry.Value.Circle3.Value.Radius,
+ transform.Apply(curveEntry.Value.Circle3.Value.XAxis))),
+ _ => curveEntry.Value
+ });
+ }
+
+ foreach (var surfaceEntry in body.Geometry.Surfaces)
+ {
+ geometry.AddSurface(surfaceEntry.Key, surfaceEntry.Value.Kind switch
+ {
+ SurfaceGeometryKind.Plane => SurfaceGeometry.FromPlane(new PlaneSurface(
+ transform.Apply(surfaceEntry.Value.Plane!.Value.Origin),
+ transform.Apply(surfaceEntry.Value.Plane.Value.Normal),
+ transform.Apply(surfaceEntry.Value.Plane.Value.UAxis))),
+ SurfaceGeometryKind.Cylinder => SurfaceGeometry.FromCylinder(new CylinderSurface(
+ transform.Apply(surfaceEntry.Value.Cylinder!.Value.Origin),
+ transform.Apply(surfaceEntry.Value.Cylinder.Value.Axis),
+ surfaceEntry.Value.Cylinder.Value.Radius,
+ transform.Apply(surfaceEntry.Value.Cylinder.Value.XAxis))),
+ _ => surfaceEntry.Value
+ });
+ }
+
+ var vertexPoints = new Dictionary<VertexId, Point3D>();
+ foreach (var vertex in body.Topology.Vertices)
+ {
+ if (body.TryGetVertexPoint(vertex.Id, out var point))
+ {
+ vertexPoints[vertex.Id] = transform.Apply(point);
+ }
+ }
+
+ return new BrepBody(body.Topology, geometry, body.Bindings, vertexPoints);
+ }
+
}
diff --git a/Aetheris.Kernel.Core/Brep/Boolean/BrepBoolean.cs b/Aetheris.Kernel.Core/Brep/Boolean/BrepBoolean.cs
index 352cda76..66435508 100644
--- a/Aetheris.Kernel.Core/Brep/Boolean/BrepBoolean.cs
+++ b/Aetheris.Kernel.Core/Brep/Boolean/BrepBoolean.cs
@@ -24,6 +24,7 @@ public sealed record BooleanAnalysis(
string? ShortcutReason,
AxisAlignedBoxExtents? LeftBox,
AxisAlignedBoxExtents? RightBox,
+ RecognizedCylinder? RightCylinder,
string? UnsupportedReason);
public sealed record BooleanIntersectionData(
@@ -38,6 +39,7 @@ public sealed record BooleanClassificationData(
bool IsComputed,
int FragmentCount,
AxisAlignedBoxExtents? SingleBoxResult,
+ RecognizedCylinder? ThroughHoleCylinder,
string? UnsupportedReason);
public sealed record BooleanRebuildData(
@@ -46,7 +48,8 @@ public sealed record BooleanRebuildData(
IReadOnlyList<KernelDiagnostic> Diagnostics);
/// <summary>
-/// M13 boolean pipeline with narrow real support for axis-aligned box/box cases that resolve to a single box.
+/// M13 boolean pipeline with narrow real support for axis-aligned box/box cases that resolve to a single box
+/// plus the M10k box-minus-Z-aligned-through-cylinder subset that rebuilds to a single box-with-hole solid.
/// Unsupported and non-solid cases return deterministic NotImplemented diagnostics.
/// </summary>
public static class BrepBoolean
@@ -122,20 +125,35 @@ public static class BrepBoolean
var tolerance = request.Tolerance ?? ToleranceContext.Default;
var leftRecognized = BrepBooleanBoxRecognition.TryRecognizeAxisAlignedBox(request.Left, tolerance, out var leftBox, out _);
var rightRecognized = BrepBooleanBoxRecognition.TryRecognizeAxisAlignedBox(request.Right, tolerance, out var rightBox, out _);
- var unsupportedReason = leftRecognized && rightRecognized
+ var rightCylinderRecognized = BrepBooleanCylinderRecognition.TryRecognizeCylinder(request.Right, tolerance, out var rightCylinder, out _);
+ var supportsBoxBox = leftRecognized && rightRecognized;
+ var supportsThroughHoleSubtract = request.Operation == BooleanOperation.Subtract && leftRecognized && rightCylinderRecognized;
+ var unsupportedReason = supportsBoxBox || supportsThroughHoleSubtract
? null
: $"Boolean {request.Operation}: M13 only supports recognized axis-aligned boxes from BrepPrimitives.CreateBox(...).";
- return new BooleanAnalysis(request.Operation, isSameBodyInstance, shortcutReason, leftBox, rightBox, unsupportedReason);
+ return new BooleanAnalysis(
+ request.Operation,
+ isSameBodyInstance,
+ shortcutReason,
+ leftRecognized ? leftBox : null,
+ rightRecognized ? rightBox : null,
+ supportsThroughHoleSubtract ? rightCylinder : null,
+ unsupportedReason);
}
private static BooleanIntersectionData ComputeIntersections(BooleanRequest request, BooleanAnalysis analysis)
{
- if (analysis.LeftBox is null || analysis.RightBox is null)
+ if (analysis.LeftBox is null || (analysis.RightBox is null && analysis.RightCylinder is null))
{
return new BooleanIntersectionData(analysis, IsComputed: true, CandidatePairCount: 0, OverlapBox: null, IsTouchingOnly: false);
}
+ if (analysis.RightBox is null)
+ {
+ return new BooleanIntersectionData(analysis, IsComputed: true, CandidatePairCount: 1, OverlapBox: null, IsTouchingOnly: false);
+ }
+
var overlap = AxisAlignedBoxExtents.Intersection(analysis.LeftBox.Value, analysis.RightBox.Value);
var tolerance = request.Tolerance ?? ToleranceContext.Default;
var isTouchingOnly = overlap is not null && !overlap.Value.HasPositiveVolume(tolerance);
@@ -150,76 +168,100 @@ public static class BrepBoolean
{
if (intersections.Analysis.UnsupportedReason is not null)
{
- return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 0, SingleBoxResult: null, UnsupportedReason: intersections.Analysis.UnsupportedReason);
+ return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 0, SingleBoxResult: null, ThroughHoleCylinder: null, UnsupportedReason: intersections.Analysis.UnsupportedReason);
}
var left = intersections.Analysis.LeftBox!.Value;
- var right = intersections.Analysis.RightBox!.Value;
var tolerance = request.Tolerance ?? ToleranceContext.Default;
var operation = request.Operation;
+ if (intersections.Analysis.RightBox is null)
+ {
+ var cylinder = intersections.Analysis.RightCylinder!.Value;
+ if (!BrepBooleanCylinderRecognition.ValidateThroughHole(left, cylinder, tolerance, out var reason))
+ {
+ return new BooleanClassificationData(
+ intersections,
+ IsComputed: true,
+ FragmentCount: 0,
+ SingleBoxResult: null,
+ ThroughHoleCylinder: null,
+ UnsupportedReason: $"Boolean {operation}: box-cylinder subtract only supports a strict Z-aligned through-hole subset ({reason}).");
+ }
+
+ return new BooleanClassificationData(
+ intersections,
+ IsComputed: true,
+ FragmentCount: 1,
+ SingleBoxResult: null,
+ ThroughHoleCylinder: cylinder,
+ UnsupportedReason: null);
+ }
+
+ var right = intersections.Analysis.RightBox!.Value;
+
if (operation == BooleanOperation.Intersect)
{
if (intersections.IsTouchingOnly)
{
- return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 0, SingleBoxResult: null, UnsupportedReason: $"Boolean {operation}: touching-only intersection is non-solid and empty results are not representable in M13.");
+ return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 0, SingleBoxResult: null, ThroughHoleCylinder: null, UnsupportedReason: $"Boolean {operation}: touching-only intersection is non-solid and empty results are not representable in M13.");
}
if (intersections.OverlapBox is null)
{
- return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 0, SingleBoxResult: null, UnsupportedReason: $"Boolean {operation}: empty intersection result is not representable in M13.");
+ return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 0, SingleBoxResult: null, ThroughHoleCylinder: null, UnsupportedReason: $"Boolean {operation}: empty intersection result is not representable in M13.");
}
- return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 1, SingleBoxResult: intersections.OverlapBox, UnsupportedReason: null);
+ return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 1, SingleBoxResult: intersections.OverlapBox, ThroughHoleCylinder: null, UnsupportedReason: null);
}
if (operation == BooleanOperation.Union)
{
if (left.ApproximatelyEquals(right, tolerance))
{
- return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 1, SingleBoxResult: left, UnsupportedReason: null);
+ return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 1, SingleBoxResult: left, ThroughHoleCylinder: null, UnsupportedReason: null);
}
if (left.Contains(right, tolerance))
{
- return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 1, SingleBoxResult: left, UnsupportedReason: null);
+ return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 1, SingleBoxResult: left, ThroughHoleCylinder: null, UnsupportedReason: null);
}
if (right.Contains(left, tolerance))
{
- return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 1, SingleBoxResult: right, UnsupportedReason: null);
+ return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 1, SingleBoxResult: right, ThroughHoleCylinder: null, UnsupportedReason: null);
}
var bounds = AxisAlignedBoxExtents.Bounding(left, right);
if (AxisAlignedBoxExtents.UnionIsSingleBox(left, right, bounds, tolerance))
{
- return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 1, SingleBoxResult: bounds, UnsupportedReason: null);
+ return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 1, SingleBoxResult: bounds, ThroughHoleCylinder: null, UnsupportedReason: null);
}
if (AxisAlignedBoxExtents.Intersection(left, right) is null)
{
- return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 0, SingleBoxResult: null, UnsupportedReason: $"Boolean {operation}: disjoint box union is multi-body and not supported in M13.");
+ return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 0, SingleBoxResult: null, ThroughHoleCylinder: null, UnsupportedReason: $"Boolean {operation}: disjoint box union is multi-body and not supported in M13.");
}
- return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 0, SingleBoxResult: null, UnsupportedReason: $"Boolean {operation}: box union is not a single box in M13 (for example L-shaped unions)." );
+ return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 0, SingleBoxResult: null, ThroughHoleCylinder: null, UnsupportedReason: $"Boolean {operation}: box union is not a single box in M13 (for example L-shaped unions)." );
}
if (!left.OverlapsWithPositiveVolume(right, tolerance))
{
- return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 1, SingleBoxResult: left, UnsupportedReason: null);
+ return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 1, SingleBoxResult: left, ThroughHoleCylinder: null, UnsupportedReason: null);
}
if (right.Contains(left, tolerance))
{
- return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 0, SingleBoxResult: null, UnsupportedReason: $"Boolean {operation}: subtraction fully removes the left box and empty results are not representable in M13.");
+ return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 0, SingleBoxResult: null, ThroughHoleCylinder: null, UnsupportedReason: $"Boolean {operation}: subtraction fully removes the left box and empty results are not representable in M13.");
}
if (TrySubtractToSingleBox(left, right, tolerance, out var singleBox))
{
- return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 1, SingleBoxResult: singleBox, UnsupportedReason: null);
+ return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 1, SingleBoxResult: singleBox, ThroughHoleCylinder: null, UnsupportedReason: null);
}
- return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 0, SingleBoxResult: null, UnsupportedReason: $"Boolean {operation}: box subtraction result is not representable as a single box in M13.");
+ return new BooleanClassificationData(intersections, IsComputed: true, FragmentCount: 0, SingleBoxResult: null, ThroughHoleCylinder: null, UnsupportedReason: $"Boolean {operation}: box subtraction result is not representable as a single box in M13.");
}
private static BooleanRebuildData RebuildResult(BooleanRequest request, BooleanClassificationData classification)
@@ -236,6 +278,14 @@ public static class BrepBoolean
]);
}
+ if (classification.ThroughHoleCylinder is not null)
+ {
+ var rebuiltThroughHole = BrepBooleanBoxCylinderHoleBuilder.CreateThroughHoleBody(classification.Intersections.Analysis.LeftBox!.Value, classification.ThroughHoleCylinder.Value);
+ return rebuiltThroughHole.IsSuccess
+ ? new BooleanRebuildData(classification, rebuiltThroughHole.Value, rebuiltThroughHole.Diagnostics)
+ : new BooleanRebuildData(classification, RebuiltBody: null, Diagnostics: rebuiltThroughHole.Diagnostics);
+ }
+
if (classification.SingleBoxResult is null)
{
return new BooleanRebuildData(
diff --git a/Aetheris.Kernel.Core/Brep/Boolean/BrepBooleanBoxCylinderHoleBuilder.cs b/Aetheris.Kernel.Core/Brep/Boolean/BrepBooleanBoxCylinderHoleBuilder.cs
new file mode 100644
index 00000000..565cc6a7
--- /dev/null
+++ b/Aetheris.Kernel.Core/Brep/Boolean/BrepBooleanBoxCylinderHoleBuilder.cs
@@ -0,0 +1,189 @@
+using Aetheris.Kernel.Core.Diagnostics;
+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;
+
+namespace Aetheris.Kernel.Core.Brep.Boolean;
+
+public static class BrepBooleanBoxCylinderHoleBuilder
+{
+ public static KernelResult<BrepBody> CreateThroughHoleBody(AxisAlignedBoxExtents box, in RecognizedCylinder cylinder)
+ {
+ var builder = new TopologyBuilder();
+
+ var v1 = builder.AddVertex();
+ var v2 = builder.AddVertex();
+ var v3 = builder.AddVertex();
+ var v4 = builder.AddVertex();
+ var v5 = builder.AddVertex();
+ var v6 = builder.AddVertex();
+ var v7 = builder.AddVertex();
+ var v8 = builder.AddVertex();
+ var topHoleVertex = builder.AddVertex();
+ var bottomHoleVertex = builder.AddVertex();
+ var seamTopVertex = builder.AddVertex();
+ var seamBottomVertex = builder.AddVertex();
+
+ var e1 = builder.AddEdge(v1, v2);
+ var e2 = builder.AddEdge(v2, v3);
+ var e3 = builder.AddEdge(v3, v4);
+ var e4 = builder.AddEdge(v4, v1);
+ var e5 = builder.AddEdge(v5, v6);
+ var e6 = builder.AddEdge(v6, v7);
+ var e7 = builder.AddEdge(v7, v8);
+ var e8 = builder.AddEdge(v8, v5);
+ var e9 = builder.AddEdge(v1, v5);
+ var e10 = builder.AddEdge(v2, v6);
+ var e11 = builder.AddEdge(v3, v7);
+ var e12 = builder.AddEdge(v4, v8);
+ var topCircle = builder.AddEdge(topHoleVertex, topHoleVertex);
+ var bottomCircle = builder.AddEdge(bottomHoleVertex, bottomHoleVertex);
+ var seam = builder.AddEdge(seamTopVertex, seamBottomVertex);
+
+ var bottomOuterLoop = AddLoop(builder, [Forward(e1), Forward(e2), Forward(e3), Forward(e4)]);
+ var topOuterLoop = AddLoop(builder, [Forward(e5), Forward(e6), Forward(e7), Forward(e8)]);
+ var topInnerLoop = AddLoop(builder, [Forward(topCircle)]);
+ var bottomInnerLoop = AddLoop(builder, [Reversed(bottomCircle)]);
+ var yMinFace = builder.AddFace([bottomOuterLoop, bottomInnerLoop]);
+ var yMaxFace = builder.AddFace([topOuterLoop, topInnerLoop]);
+
+ var xMinFace = builder.AddFace([AddLoop(builder, [Forward(e1), Forward(e10), Reversed(e5), Reversed(e9)])]);
+ var xMaxFace = builder.AddFace([AddLoop(builder, [Forward(e2), Forward(e11), Reversed(e6), Reversed(e10)])]);
+ var yFarFace = builder.AddFace([AddLoop(builder, [Forward(e3), Forward(e12), Reversed(e7), Reversed(e11)])]);
+ var yNearFace = builder.AddFace([AddLoop(builder, [Forward(e4), Forward(e9), Reversed(e8), Reversed(e12)])]);
+ var holeFace = builder.AddFace([AddLoop(builder, [Forward(seam), Reversed(topCircle), Reversed(seam), Forward(bottomCircle)])]);
+
+ var shell = builder.AddShell([yMinFace, yMaxFace, xMinFace, xMaxFace, yFarFace, yNearFace, holeFace]);
+ builder.AddBody([shell]);
+
+ var geometry = new BrepGeometryStore();
+ var width = box.MaxX - box.MinX;
+ var depth = box.MaxY - box.MinY;
+ var height = box.MaxZ - box.MinZ;
+
+ var p1 = new Point3D(box.MinX, box.MinY, box.MinZ);
+ var p2 = new Point3D(box.MaxX, box.MinY, box.MinZ);
+ var p3 = new Point3D(box.MaxX, box.MaxY, box.MinZ);
+ var p4 = new Point3D(box.MinX, box.MaxY, box.MinZ);
+ var p5 = new Point3D(box.MinX, box.MinY, box.MaxZ);
+ var p6 = new Point3D(box.MaxX, box.MinY, box.MaxZ);
+ var p7 = new Point3D(box.MaxX, box.MaxY, box.MaxZ);
+ var p8 = new Point3D(box.MinX, box.MaxY, box.MaxZ);
+
+ var axis = Direction3D.Create(new Vector3D(0d, 0d, 1d));
+ var xAxis = Direction3D.Create(new Vector3D(1d, 0d, 0d));
+ var yAxis = Direction3D.Create(new Vector3D(0d, 1d, 0d));
+ var centerX = cylinder.MinCenter.X;
+ var centerY = cylinder.MinCenter.Y;
+ var bottomCenter = new Point3D(centerX, centerY, box.MinZ);
+ var topCenter = new Point3D(centerX, centerY, box.MaxZ);
+ var seamBottomPoint = new Point3D(centerX + cylinder.Radius, centerY, box.MinZ);
+ var seamTopPoint = new Point3D(centerX + cylinder.Radius, centerY, box.MaxZ);
+
+ var lineCurves = new[]
+ {
+ (p1, new Vector3D(width, 0d, 0d)),
+ (p2, new Vector3D(0d, depth, 0d)),
+ (p3, new Vector3D(-width, 0d, 0d)),
+ (p4, new Vector3D(0d, -depth, 0d)),
+ (p5, new Vector3D(width, 0d, 0d)),
+ (p6, new Vector3D(0d, depth, 0d)),
+ (p7, new Vector3D(-width, 0d, 0d)),
+ (p8, new Vector3D(0d, -depth, 0d)),
+ (p1, new Vector3D(0d, 0d, height)),
+ (p2, new Vector3D(0d, 0d, height)),
+ (p3, new Vector3D(0d, 0d, height)),
+ (p4, new Vector3D(0d, 0d, height)),
+ (topCenter, axis.ToVector()),
+ (bottomCenter, axis.ToVector()),
+ (seamTopPoint, new Vector3D(0d, 0d, box.MinZ - box.MaxZ)),
+ };
+
+ for (var i = 0; i < 12; i++)
+ {
+ geometry.AddCurve(new CurveGeometryId(i + 1), CurveGeometry.FromLine(new Line3Curve(lineCurves[i].Item1, Direction3D.Create(lineCurves[i].Item2))));
+ }
+
+ geometry.AddCurve(new CurveGeometryId(13), CurveGeometry.FromCircle(new Circle3Curve(topCenter, axis, cylinder.Radius, xAxis)));
+ geometry.AddCurve(new CurveGeometryId(14), CurveGeometry.FromCircle(new Circle3Curve(bottomCenter, axis, cylinder.Radius, xAxis)));
+ geometry.AddCurve(new CurveGeometryId(15), CurveGeometry.FromLine(new Line3Curve(seamTopPoint, Direction3D.Create(lineCurves[14].Item2))));
+
+ geometry.AddSurface(new SurfaceGeometryId(1), SurfaceGeometry.FromPlane(new PlaneSurface(new Point3D(0d, 0d, box.MinZ), Direction3D.Create(new Vector3D(0d, 0d, -1d)), xAxis)));
+ geometry.AddSurface(new SurfaceGeometryId(2), SurfaceGeometry.FromPlane(new PlaneSurface(new Point3D(0d, 0d, box.MaxZ), axis, xAxis)));
+ geometry.AddSurface(new SurfaceGeometryId(3), SurfaceGeometry.FromPlane(new PlaneSurface(new Point3D(0d, box.MinY, 0d), Direction3D.Create(new Vector3D(0d, -1d, 0d)), xAxis)));
+ geometry.AddSurface(new SurfaceGeometryId(4), SurfaceGeometry.FromPlane(new PlaneSurface(new Point3D(box.MaxX, 0d, 0d), Direction3D.Create(new Vector3D(1d, 0d, 0d)), yAxis)));
+ geometry.AddSurface(new SurfaceGeometryId(5), SurfaceGeometry.FromPlane(new PlaneSurface(new Point3D(0d, box.MaxY, 0d), Direction3D.Create(new Vector3D(0d, 1d, 0d)), Direction3D.Create(new Vector3D(-1d, 0d, 0d)))));
+ geometry.AddSurface(new SurfaceGeometryId(6), SurfaceGeometry.FromPlane(new PlaneSurface(new Point3D(box.MinX, 0d, 0d), Direction3D.Create(new Vector3D(-1d, 0d, 0d)), yAxis)));
+ geometry.AddSurface(new SurfaceGeometryId(7), SurfaceGeometry.FromCylinder(new CylinderSurface(bottomCenter, axis, cylinder.Radius, xAxis)));
+
+ var bindings = new BrepBindingModel();
+ for (var i = 0; i < 12; i++)
+ {
+ bindings.AddEdgeBinding(new EdgeGeometryBinding(new EdgeId(i + 1), new CurveGeometryId(i + 1), new ParameterInterval(0d, 1d)));
+ }
+
+ bindings.AddEdgeBinding(new EdgeGeometryBinding(topCircle, new CurveGeometryId(13), new ParameterInterval(0d, 2d * double.Pi)));
+ bindings.AddEdgeBinding(new EdgeGeometryBinding(bottomCircle, new CurveGeometryId(14), new ParameterInterval(0d, 2d * double.Pi)));
+ bindings.AddEdgeBinding(new EdgeGeometryBinding(seam, new CurveGeometryId(15), new ParameterInterval(0d, height)));
+
+ bindings.AddFaceBinding(new FaceGeometryBinding(yMinFace, new SurfaceGeometryId(1)));
+ bindings.AddFaceBinding(new FaceGeometryBinding(yMaxFace, new SurfaceGeometryId(2)));
+ bindings.AddFaceBinding(new FaceGeometryBinding(xMinFace, new SurfaceGeometryId(3)));
+ bindings.AddFaceBinding(new FaceGeometryBinding(xMaxFace, new SurfaceGeometryId(4)));
+ bindings.AddFaceBinding(new FaceGeometryBinding(yFarFace, new SurfaceGeometryId(5)));
+ bindings.AddFaceBinding(new FaceGeometryBinding(yNearFace, new SurfaceGeometryId(6)));
+ bindings.AddFaceBinding(new FaceGeometryBinding(holeFace, new SurfaceGeometryId(7)));
+
+ var vertexPoints = new Dictionary<VertexId, Point3D>
+ {
+ [v1] = p1,
+ [v2] = p2,
+ [v3] = p3,
+ [v4] = p4,
+ [v5] = p5,
+ [v6] = p6,
+ [v7] = p7,
+ [v8] = p8,
+ [topHoleVertex] = seamTopPoint,
+ [bottomHoleVertex] = seamBottomPoint,
+ [seamTopVertex] = seamTopPoint,
+ [seamBottomVertex] = seamBottomPoint,
+ };
+
+ var body = new BrepBody(builder.Model, geometry, bindings, vertexPoints);
+ var validation = BrepBindingValidator.Validate(body, requireAllEdgeAndFaceBindings: true);
+ return validation.IsSuccess
+ ? KernelResult<BrepBody>.Success(body, validation.Diagnostics)
+ : KernelResult<BrepBody>.Failure(validation.Diagnostics);
+ }
+
+ private static LoopId AddLoop(TopologyBuilder builder, IReadOnlyList<EdgeUse> edgeUses)
+ {
+ var loopId = builder.AllocateLoopId();
+ var coedgeIds = new CoedgeId[edgeUses.Count];
+
+ for (var i = 0; i < edgeUses.Count; i++)
+ {
+ coedgeIds[i] = builder.AllocateCoedgeId();
+ }
+
+ for (var i = 0; i < edgeUses.Count; i++)
+ {
+ var next = coedgeIds[(i + 1) % edgeUses.Count];
+ var prev = coedgeIds[(i + edgeUses.Count - 1) % edgeUses.Count];
+ builder.AddCoedge(new Coedge(coedgeIds[i], edgeUses[i].EdgeId, loopId, next, prev, edgeUses[i].IsReversed));
+ }
+
+ builder.AddLoop(new Loop(loopId, coedgeIds));
+ return loopId;
+ }
+
+ private readonly record struct EdgeUse(EdgeId EdgeId, bool IsReversed);
+
+ private static EdgeUse Forward(EdgeId edgeId) => new(edgeId, IsReversed: false);
+
+ private static EdgeUse Reversed(EdgeId edgeId) => new(edgeId, IsReversed: true);
+}
diff --git a/Aetheris.Kernel.Core/Brep/Boolean/BrepBooleanCylinderRecognition.cs b/Aetheris.Kernel.Core/Brep/Boolean/BrepBooleanCylinderRecognition.cs
new file mode 100644
index 00000000..299530e0
--- /dev/null
+++ b/Aetheris.Kernel.Core/Brep/Boolean/BrepBooleanCylinderRecognition.cs
@@ -0,0 +1,202 @@
+using Aetheris.Kernel.Core.Diagnostics;
+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.Numerics;
+
+namespace Aetheris.Kernel.Core.Brep.Boolean;
+
+public readonly record struct RecognizedCylinder(
+ Point3D AxisOrigin,
+ Direction3D Axis,
+ double Radius,
+ double MinAxisParameter,
+ double MaxAxisParameter)
+{
+ public double Height => MaxAxisParameter - MinAxisParameter;
+
+ public Point3D MinCenter => AxisOrigin + (Axis.ToVector() * MinAxisParameter);
+
+ public Point3D MaxCenter => AxisOrigin + (Axis.ToVector() * MaxAxisParameter);
+}
+
+public static class BrepBooleanCylinderRecognition
+{
+ public static bool TryRecognizeCylinder(BrepBody body, ToleranceContext tolerance, out RecognizedCylinder cylinder, out string reason)
+ {
+ cylinder = default;
+ reason = string.Empty;
+
+ if (body.Topology.Vertices.Count() != 4 || body.Topology.Edges.Count() != 3 || body.Topology.Faces.Count() != 3)
+ {
+ reason = "topology does not match M08 cylinder counts.";
+ return false;
+ }
+
+ var faceBindings = body.Bindings.FaceBindings.ToArray();
+ if (faceBindings.Length != 3)
+ {
+ reason = "cylinder recognition requires exactly three face bindings.";
+ return false;
+ }
+
+ if (body.Bindings.EdgeBindings.Count() != 3)
+ {
+ reason = "cylinder recognition requires exactly three edge bindings.";
+ return false;
+ }
+
+ var cylinderBindings = new List<FaceGeometryBinding>(1);
+ var planeBindings = new List<(FaceGeometryBinding Binding, PlaneSurface Plane)>(2);
+
+ foreach (var binding in faceBindings)
+ {
+ var surface = body.Geometry.GetSurface(binding.SurfaceGeometryId);
+ switch (surface.Kind)
+ {
+ case SurfaceGeometryKind.Cylinder when surface.Cylinder is CylinderSurface:
+ cylinderBindings.Add(binding);
+ break;
+ case SurfaceGeometryKind.Plane when surface.Plane is PlaneSurface plane:
+ planeBindings.Add((binding, plane));
+ break;
+ default:
+ reason = "cylinder recognition requires exactly one cylindrical face and two planar cap faces.";
+ return false;
+ }
+ }
+
+ if (cylinderBindings.Count != 1 || planeBindings.Count != 2)
+ {
+ reason = "cylinder recognition requires exactly one cylindrical face and two planar cap faces.";
+ return false;
+ }
+
+ var cylinderSurface = body.Geometry.GetSurface(cylinderBindings[0].SurfaceGeometryId).Cylinder!.Value;
+ var axis = cylinderSurface.Axis;
+ var axisVector = axis.ToVector();
+
+ foreach (var edgeBinding in body.Bindings.EdgeBindings)
+ {
+ var edgeCurve = body.Geometry.GetCurve(edgeBinding.CurveGeometryId);
+ if (edgeCurve.Kind != CurveGeometryKind.Line3 && edgeCurve.Kind != CurveGeometryKind.Circle3)
+ {
+ reason = "cylinder recognition requires one line seam and circular cap edges only.";
+ return false;
+ }
+ }
+
+ var axisParameters = new List<double>(2);
+ var sawPositiveCap = false;
+ var sawNegativeCap = false;
+
+ foreach (var (_, plane) in planeBindings)
+ {
+ var normal = plane.Normal.ToVector();
+ var dot = normal.Dot(axisVector);
+ if (!ToleranceMath.AlmostEqual(double.Abs(dot), 1d, tolerance))
+ {
+ reason = "cylinder recognition requires cap plane normals parallel to the cylinder axis.";
+ return false;
+ }
+
+ if (dot > 0d)
+ {
+ sawPositiveCap = true;
+ }
+ else
+ {
+ sawNegativeCap = true;
+ }
+
+ var centerOffset = plane.Origin - cylinderSurface.Origin;
+ var axisParameter = centerOffset.Dot(axisVector);
+ var radialOffset = centerOffset - (axisVector * axisParameter);
+ if (radialOffset.Length > tolerance.Linear)
+ {
+ reason = "cylinder recognition requires cap centers to stay on the cylinder axis.";
+ return false;
+ }
+
+ axisParameters.Add(axisParameter);
+ }
+
+ if (!sawPositiveCap || !sawNegativeCap)
+ {
+ reason = "cylinder recognition requires opposite cap normals along the cylinder axis.";
+ return false;
+ }
+
+ axisParameters.Sort();
+ if ((axisParameters[1] - axisParameters[0]) <= tolerance.Linear)
+ {
+ reason = "recognized cylinder height must be positive.";
+ return false;
+ }
+
+ cylinder = new RecognizedCylinder(
+ cylinderSurface.Origin,
+ axis,
+ cylinderSurface.Radius,
+ axisParameters[0],
+ axisParameters[1]);
+ return true;
+ }
+
+ public static bool ValidateAxisAlignedZ(in RecognizedCylinder cylinder, ToleranceContext tolerance)
+ {
+ var axis = cylinder.Axis.ToVector();
+ return ToleranceMath.AlmostZero(axis.X, tolerance)
+ && ToleranceMath.AlmostZero(axis.Y, tolerance)
+ && ToleranceMath.AlmostEqual(double.Abs(axis.Z), 1d, tolerance);
+ }
+
+ public static bool ValidateThroughHole(AxisAlignedBoxExtents box, in RecognizedCylinder cylinder, ToleranceContext tolerance, out string reason)
+ {
+ reason = string.Empty;
+
+ if (!ValidateAxisAlignedZ(cylinder, tolerance))
+ {
+ reason = "cylinder axis is not aligned with the box Z axis.";
+ return false;
+ }
+
+ var minCenter = cylinder.MinCenter;
+ var maxCenter = cylinder.MaxCenter;
+ if (!ToleranceMath.AlmostEqual(minCenter.X, maxCenter.X, tolerance) || !ToleranceMath.AlmostEqual(minCenter.Y, maxCenter.Y, tolerance))
+ {
+ reason = "cylinder cap centers are not vertically aligned in XY.";
+ return false;
+ }
+
+ var centerX = minCenter.X;
+ var centerY = minCenter.Y;
+ var minZ = System.Math.Min(minCenter.Z, maxCenter.Z);
+ var maxZ = System.Math.Max(minCenter.Z, maxCenter.Z);
+
+ if (minZ > (box.MinZ + tolerance.Linear) || maxZ < (box.MaxZ - tolerance.Linear))
+ {
+ reason = "cylinder does not fully span the box Z range.";
+ return false;
+ }
+
+ if ((centerX - cylinder.Radius) <= (box.MinX + tolerance.Linear)
+ || (centerX + cylinder.Radius) >= (box.MaxX - tolerance.Linear)
+ || (centerY - cylinder.Radius) <= (box.MinY + tolerance.Linear)
+ || (centerY + cylinder.Radius) >= (box.MaxY - tolerance.Linear))
+ {
+ reason = "cylinder radial footprint must stay strictly inside the box XY footprint.";
+ return false;
+ }
+
+ return true;
+ }
+
+ public static KernelDiagnostic CreateUnsupportedThroughHoleDiagnostic(string operation, string reason)
+ => new(
+ KernelDiagnosticCode.NotImplemented,
+ KernelDiagnosticSeverity.Error,
+ $"Boolean {operation}: box-cylinder subtract only supports a strict Z-aligned through-hole subset ({reason}).",
+ Source: "BrepBoolean.RebuildResult");
+}
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanCanonicalSuccessTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanCanonicalSuccessTests.cs
index 0d9cbdaf..a0d8ad16 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanCanonicalSuccessTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentBooleanCanonicalSuccessTests.cs
@@ -10,7 +10,8 @@ public sealed class FirmamentBooleanCanonicalSuccessTests
{
{ "testdata/firmament/examples/boolean_add_basic.firmament", "joined", FirmamentLoweredBooleanKind.Add },
{ "testdata/firmament/examples/boolean_subtract_basic.firmament", "carved", FirmamentLoweredBooleanKind.Subtract },
- { "testdata/firmament/examples/boolean_intersect_basic.firmament", "overlap", FirmamentLoweredBooleanKind.Intersect }
+ { "testdata/firmament/examples/boolean_intersect_basic.firmament", "overlap", FirmamentLoweredBooleanKind.Intersect },
+ { "testdata/firmament/examples/boolean_box_cylinder_hole.firmament", "hole", FirmamentLoweredBooleanKind.Subtract }
};
[Theory]
@@ -34,6 +35,7 @@ public sealed class FirmamentBooleanCanonicalSuccessTests
[InlineData("testdata/firmament/examples/boolean_add_basic.firmament", "joined", 2, "add")]
[InlineData("testdata/firmament/examples/boolean_subtract_basic.firmament", "carved", 2, "subtract")]
[InlineData("testdata/firmament/examples/boolean_intersect_basic.firmament", "overlap", 2, "intersect")]
+ [InlineData("testdata/firmament/examples/boolean_box_cylinder_hole.firmament", "hole", 1, "subtract")]
public void CanonicalBooleanExamples_Export_Deterministically_WithExpectedMarkers(string fixturePath, string expectedFeatureId, int expectedOpIndex, string expectedKind)
{
var first = ExportFixture(fixturePath);
@@ -57,6 +59,7 @@ public sealed class FirmamentBooleanCanonicalSuccessTests
{
var unsupportedSingleBoxSubtract = FirmamentCorpusHarness.Compile(
FirmamentCorpusHarness.ReadFixtureText("testdata/firmament/fixtures/m3d-valid-subtract-exec.firmament"));
+ var supportedCylinderHoleExport = ExportFixture("testdata/firmament/examples/boolean_box_cylinder_hole.firmament");
var unsupportedCylinderHoleExport = ExportFixture("testdata/firmament/fixtures/m10h1-unsupported-box-with-cylinder-hole.firmament");
Assert.False(unsupportedSingleBoxSubtract.Compilation.IsSuccess);
@@ -64,6 +67,9 @@ public sealed class FirmamentBooleanCanonicalSuccessTests
diagnostic.Code == KernelDiagnosticCode.NotImplemented
&& diagnostic.Message.Contains("Requested boolean feature 'cut' (subtract) could not be executed.", StringComparison.Ordinal));
+ Assert.True(supportedCylinderHoleExport.IsSuccess);
+ Assert.Contains("CYLINDRICAL_SURFACE", supportedCylinderHoleExport.Value.StepText, StringComparison.Ordinal);
+
Assert.False(unsupportedCylinderHoleExport.IsSuccess);
Assert.Contains(unsupportedCylinderHoleExport.Diagnostics, diagnostic =>
diagnostic.Code == KernelDiagnosticCode.NotImplemented
@@ -93,7 +99,8 @@ public sealed class FirmamentBooleanCanonicalSuccessTests
&& diagnostic.Message.Contains($"Requested boolean feature '{expectedFeatureId}' ({expectedKind}) could not be executed.", StringComparison.Ordinal));
Assert.Contains(result.Compilation.Diagnostics, diagnostic =>
diagnostic.Code == KernelDiagnosticCode.NotImplemented
- && diagnostic.Message.Contains("M13 only supports recognized axis-aligned boxes from BrepPrimitives.CreateBox(...).", StringComparison.Ordinal));
+ && (diagnostic.Message.Contains("M13 only supports recognized axis-aligned boxes from BrepPrimitives.CreateBox(...).", StringComparison.Ordinal)
+ || diagnostic.Message.Contains("strict Z-aligned through-hole subset", StringComparison.Ordinal)));
}
private static Aetheris.Kernel.Core.Results.KernelResult<FirmamentStepExportResult> ExportFixture(string fixturePath) =>
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs
index e3fa3f55..d74f5ea9 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs
@@ -125,6 +125,18 @@ public sealed class FirmamentBuildAndExportTests
"intersect");
}
+ [Fact]
+ public void Run_BooleanBoxCylinderHoleExample_Writes_Default_Export_Artifact()
+ {
+ AssertExampleBuildAndExport(
+ "testdata/firmament/examples/boolean_box_cylinder_hole.firmament",
+ "boolean_box_cylinder_hole.step",
+ "hole",
+ 1,
+ "boolean",
+ "subtract");
+ }
+
[Fact]
public void Run_UnsupportedBoxWithCylinderHoleFixture_Fails_And_Does_Not_Write_Fallback_Export()
{
@@ -183,6 +195,6 @@ public sealed class FirmamentBuildAndExportTests
Assert.False(result.IsSuccess);
Assert.False(File.Exists(expectedOutputPath));
Assert.Contains(result.Diagnostics, diagnostic => diagnostic.Message.Contains($"Requested boolean feature '{expectedFeatureId}' ({expectedKind}) could not be executed.", StringComparison.Ordinal));
- Assert.Contains(result.Diagnostics, diagnostic => diagnostic.Message.Contains("M13 only supports recognized axis-aligned boxes from BrepPrimitives.CreateBox(...).", StringComparison.Ordinal));
+ Assert.Contains(result.Diagnostics, diagnostic => diagnostic.Message.Contains("M13 only supports recognized axis-aligned boxes from BrepPrimitives.CreateBox(...).", StringComparison.Ordinal) || diagnostic.Message.Contains("strict Z-aligned through-hole subset", StringComparison.Ordinal));
}
}
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentSchemaCncDfmValidationTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentSchemaCncDfmValidationTests.cs
index 1ebd5807..c5d0e628 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentSchemaCncDfmValidationTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentSchemaCncDfmValidationTests.cs
@@ -36,9 +36,9 @@ ops[2]:
var result = Compile(source);
- Assert.False(result.Compilation.IsSuccess);
+ Assert.True(result.Compilation.IsSuccess);
+ Assert.Empty(result.Compilation.Diagnostics);
Assert.DoesNotContain(result.Compilation.Diagnostics, diagnostic => diagnostic.Message.Contains(FirmamentDiagnosticCodes.SchemaCncMinimumToolRadiusViolated.Value, StringComparison.Ordinal));
- Assert.Contains(result.Compilation.Diagnostics, diagnostic => diagnostic.Message.Contains("Requested boolean feature 'hole' (subtract) could not be executed.", StringComparison.Ordinal));
}
[Fact]
@@ -46,8 +46,8 @@ ops[2]:
{
var result = CompileFixture("testdata/firmament/fixtures/m8c-valid-schema-cnc-minimum-tool-radius.firmament");
- Assert.False(result.Compilation.IsSuccess);
- Assert.Contains(result.Compilation.Diagnostics, diagnostic => diagnostic.Message.Contains("Requested boolean feature 'hole' (subtract) could not be executed.", StringComparison.Ordinal));
+ Assert.True(result.Compilation.IsSuccess);
+ Assert.Empty(result.Compilation.Diagnostics);
}
[Fact]
@@ -104,9 +104,9 @@ ops[2]:
height: 8
""");
- Assert.False(result.Compilation.IsSuccess);
+ Assert.True(result.Compilation.IsSuccess);
+ Assert.Empty(result.Compilation.Diagnostics);
Assert.DoesNotContain(result.Compilation.Diagnostics, diagnostic => diagnostic.Message.Contains(FirmamentDiagnosticCodes.SchemaCncMinimumToolRadiusViolated.Value, StringComparison.Ordinal));
- Assert.Contains(result.Compilation.Diagnostics, diagnostic => diagnostic.Message.Contains("Requested boolean feature 'hole' (subtract) could not be executed.", StringComparison.Ordinal));
}
[Fact]
@@ -210,10 +210,10 @@ ops[2]:
var first = Compile(baseline);
var second = Compile(withSchema);
- Assert.False(first.Compilation.IsSuccess);
- Assert.False(second.Compilation.IsSuccess);
+ Assert.True(first.Compilation.IsSuccess);
+ Assert.True(second.Compilation.IsSuccess);
Assert.Equal(first.Compilation.Diagnostics, second.Compilation.Diagnostics);
- Assert.Contains(first.Compilation.Diagnostics, diagnostic => diagnostic.Message.Contains("Requested boolean feature 'hole' (subtract) could not be executed.", StringComparison.Ordinal));
+ Assert.Empty(first.Compilation.Diagnostics);
}
private static FirmamentCompileResult Compile(string source)
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.cs
index 8d352935..0770bbbf 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.cs
@@ -66,6 +66,23 @@ public sealed class FirmamentStepExporterTests
Assert.Equal(first.Value.StepText, File.ReadAllText(artifactPath));
}
+ [Fact]
+ public void Export_SupportedBoxCylinderHole_Exports_Deterministically_With_CylindricalSurface()
+ {
+ var first = ExportFixture("testdata/firmament/examples/boolean_box_cylinder_hole.firmament");
+ var second = ExportFixture("testdata/firmament/examples/boolean_box_cylinder_hole.firmament");
+
+ Assert.True(first.IsSuccess);
+ Assert.True(second.IsSuccess);
+ Assert.Equal(first.Value.StepText, second.Value.StepText);
+ Assert.Equal("hole", first.Value.ExportedFeatureId);
+ Assert.Equal(1, first.Value.ExportedOpIndex);
+ Assert.Equal("boolean", first.Value.ExportedBodyCategory);
+ Assert.Equal("subtract", first.Value.ExportedFeatureKind);
+ Assert.Contains("CYLINDRICAL_SURFACE", first.Value.StepText, StringComparison.Ordinal);
+ Assert.Contains("MANIFOLD_SOLID_BREP", first.Value.StepText, StringComparison.Ordinal);
+ }
+
[Fact]
public void Export_UnsupportedBoxWithCylinderHole_Fails_Instead_Of_Falling_Back_To_Base_Primitive()
{
@@ -76,6 +93,7 @@ public sealed class FirmamentStepExporterTests
Assert.False(second.IsSuccess);
Assert.Equal(first.Diagnostics, second.Diagnostics);
Assert.Contains(first.Diagnostics, diagnostic => diagnostic.Message.Contains("Requested boolean feature 'hole' (subtract) could not be executed.", StringComparison.Ordinal));
+ Assert.Contains(first.Diagnostics, diagnostic => diagnostic.Message.Contains("strict Z-aligned through-hole subset", StringComparison.Ordinal));
Assert.DoesNotContain(first.Diagnostics, diagnostic => diagnostic.Message.Contains("requires at least one executed primitive or boolean body", StringComparison.Ordinal));
}
diff --git a/testdata/firmament/examples/README.md b/testdata/firmament/examples/README.md
index 2c055435..d1650ce5 100644
--- a/testdata/firmament/examples/README.md
+++ b/testdata/firmament/examples/README.md
@@ -15,7 +15,8 @@ Other combinations may fail and are intentionally not supported yet.
- `boolean_add_basic.firmament` — canonical proven boolean add example for the current box/box single-box subset; helper export path: `testdata/firmament/exports/boolean_add_basic.step`.
- `boolean_subtract_basic.firmament` — canonical proven boolean subtract example for the current box/box single-box subset; helper export path: `testdata/firmament/exports/boolean_subtract_basic.step`.
- `boolean_intersect_basic.firmament` — canonical proven boolean intersect example for the current box/box single-box subset; helper export path: `testdata/firmament/exports/boolean_intersect_basic.step`.
+- `boolean_box_cylinder_hole.firmament` — the only supported box+cylinder boolean case: subtracting a Z-aligned cylinder that cleanly spans the full box height to form a single box-with-through-hole solid; helper export path: `testdata/firmament/exports/boolean_box_cylinder_hole.step`.
- `placed_primitive.firmament` — selector-based placement using `place.on` and `offset[3]`; helper export path: `testdata/firmament/exports/placed_primitive.step`.
- `schema_box_basic.firmament` — minimal schema-present export example showing schema presence without changing export body semantics; helper export path: `testdata/firmament/exports/schema_box_basic.step`.
-Unsupported boolean requests are tracked as fixtures/tests, not presented in this working example pack. In particular, box+cylinder `add`, `subtract`, and `intersect` are not part of the current supported subset; the current kernel boolean path only proves box/box cases that rebuild to a single box. 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.
+Unsupported boolean requests are tracked as fixtures/tests, not presented in this working example pack. The only supported box+cylinder case is `subtract(box, cylinder)` where the cylinder stays axis-aligned with +Z/-Z, fully spans the box from bottom face to top face, and remains strictly inside the box footprint so the result is one connected box-with-through-hole solid. Box+cylinder `add`, box+cylinder `intersect`, rotated cylinders, partial-depth cuts, tangent/grazing cases, and outside-footprint cuts remain unsupported. 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/examples/boolean_box_cylinder_hole.firmament b/testdata/firmament/examples/boolean_box_cylinder_hole.firmament
new file mode 100644
index 00000000..ac4aa16a
--- /dev/null
+++ b/testdata/firmament/examples/boolean_box_cylinder_hole.firmament
@@ -0,0 +1,24 @@
+firmament:
+ version: 1
+
+model:
+ name: boolean_box_cylinder_hole
+ units: mm
+
+ops[2]:
+ -
+ op: box
+ id: base
+ size[3]:
+ 40
+ 30
+ 12
+
+ -
+ op: subtract
+ id: hole
+ from: base
+ with:
+ op: cylinder
+ radius: 4
+ height: 20
diff --git a/testdata/firmament/exports/boolean_box_cylinder_hole.step b/testdata/firmament/exports/boolean_box_cylinder_hole.step
new file mode 100644
index 00000000..e5680897
--- /dev/null
+++ b/testdata/firmament/exports/boolean_box_cylinder_hole.step
@@ -0,0 +1,215 @@
+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,-6));
+#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,-6));
+#7=VERTEX_POINT($,#6);
+#8=CARTESIAN_POINT($,(20,-15,-6));
+#9=VERTEX_POINT($,#8);
+#10=CARTESIAN_POINT($,(-20,-15,-6));
+#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,-6));
+#17=VERTEX_POINT($,#16);
+#18=CARTESIAN_POINT($,(20,-15,-6));
+#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,-6));
+#25=VERTEX_POINT($,#24);
+#26=CARTESIAN_POINT($,(20,15,-6));
+#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,-6));
+#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=CARTESIAN_POINT($,(4,0,-6));
+#41=VERTEX_POINT($,#40);
+#42=CARTESIAN_POINT($,(0,0,-6));
+#43=DIRECTION($,(0,0,1));
+#44=DIRECTION($,(1,0,0));
+#45=AXIS2_PLACEMENT_3D($,#42,#43,#44);
+#46=CIRCLE($,#45,4);
+#47=EDGE_CURVE($,#41,#41,#46,.T.);
+#48=ORIENTED_EDGE($,$,$,#47,.F.);
+#49=EDGE_LOOP($,(#48));
+#50=FACE_BOUND('',#49,.T.);
+#51=ADVANCED_FACE('',(#39,#50),#5,.T.);
+#52=CARTESIAN_POINT($,(0,0,6));
+#53=DIRECTION($,(0,0,1));
+#54=DIRECTION($,(1,0,0));
+#55=AXIS2_PLACEMENT_3D($,#52,#53,#54);
+#56=PLANE($,#55);
+#57=CARTESIAN_POINT($,(-20,-15,6));
+#58=VERTEX_POINT($,#57);
+#59=CARTESIAN_POINT($,(20,-15,6));
+#60=VERTEX_POINT($,#59);
+#61=CARTESIAN_POINT($,(-20,-15,6));
+#62=DIRECTION($,(1,0,0));
+#63=VECTOR($,#62,1);
+#64=LINE($,#61,#63);
+#65=EDGE_CURVE($,#58,#60,#64,.T.);
+#66=ORIENTED_EDGE($,$,$,#65,.T.);
+#67=CARTESIAN_POINT($,(20,15,6));
+#68=VERTEX_POINT($,#67);
+#69=CARTESIAN_POINT($,(20,-15,6));
+#70=DIRECTION($,(0,1,0));
+#71=VECTOR($,#70,1);
+#72=LINE($,#69,#71);
+#73=EDGE_CURVE($,#60,#68,#72,.T.);
+#74=ORIENTED_EDGE($,$,$,#73,.T.);
+#75=CARTESIAN_POINT($,(-20,15,6));
+#76=VERTEX_POINT($,#75);
+#77=CARTESIAN_POINT($,(20,15,6));
+#78=DIRECTION($,(-1,0,0));
+#79=VECTOR($,#78,1);
+#80=LINE($,#77,#79);
+#81=EDGE_CURVE($,#68,#76,#80,.T.);
+#82=ORIENTED_EDGE($,$,$,#81,.T.);
+#83=CARTESIAN_POINT($,(-20,15,6));
+#84=DIRECTION($,(0,-1,0));
+#85=VECTOR($,#84,1);
+#86=LINE($,#83,#85);
+#87=EDGE_CURVE($,#76,#58,#86,.T.);
+#88=ORIENTED_EDGE($,$,$,#87,.T.);
+#89=EDGE_LOOP($,(#66,#74,#82,#88));
+#90=FACE_OUTER_BOUND('',#89,.T.);
+#91=CARTESIAN_POINT($,(4,0,6));
+#92=VERTEX_POINT($,#91);
+#93=CARTESIAN_POINT($,(0,0,6));
+#94=DIRECTION($,(0,0,1));
+#95=DIRECTION($,(1,0,0));
+#96=AXIS2_PLACEMENT_3D($,#93,#94,#95);
+#97=CIRCLE($,#96,4);
+#98=EDGE_CURVE($,#92,#92,#97,.T.);
+#99=ORIENTED_EDGE($,$,$,#98,.T.);
+#100=EDGE_LOOP($,(#99));
+#101=FACE_BOUND('',#100,.T.);
+#102=ADVANCED_FACE('',(#90,#101),#56,.T.);
+#103=CARTESIAN_POINT($,(0,-15,0));
+#104=DIRECTION($,(0,-1,0));
+#105=DIRECTION($,(1,0,0));
+#106=AXIS2_PLACEMENT_3D($,#103,#104,#105);
+#107=PLANE($,#106);
+#108=ORIENTED_EDGE($,$,$,#14,.T.);
+#109=CARTESIAN_POINT($,(20,-15,-6));
+#110=DIRECTION($,(0,0,1));
+#111=VECTOR($,#110,1);
+#112=LINE($,#109,#111);
+#113=EDGE_CURVE($,#9,#60,#112,.T.);
+#114=ORIENTED_EDGE($,$,$,#113,.T.);
+#115=ORIENTED_EDGE($,$,$,#65,.F.);
+#116=CARTESIAN_POINT($,(-20,-15,-6));
+#117=DIRECTION($,(0,0,1));
+#118=VECTOR($,#117,1);
+#119=LINE($,#116,#118);
+#120=EDGE_CURVE($,#7,#58,#119,.T.);
+#121=ORIENTED_EDGE($,$,$,#120,.F.);
+#122=EDGE_LOOP($,(#108,#114,#115,#121));
+#123=FACE_OUTER_BOUND('',#122,.T.);
+#124=ADVANCED_FACE('',(#123),#107,.T.);
+#125=CARTESIAN_POINT($,(20,0,0));
+#126=DIRECTION($,(1,0,0));
+#127=DIRECTION($,(0,1,0));
+#128=AXIS2_PLACEMENT_3D($,#125,#126,#127);
+#129=PLANE($,#128);
+#130=ORIENTED_EDGE($,$,$,#22,.T.);
+#131=CARTESIAN_POINT($,(20,15,-6));
+#132=DIRECTION($,(0,0,1));
+#133=VECTOR($,#132,1);
+#134=LINE($,#131,#133);
+#135=EDGE_CURVE($,#17,#68,#134,.T.);
+#136=ORIENTED_EDGE($,$,$,#135,.T.);
+#137=ORIENTED_EDGE($,$,$,#73,.F.);
+#138=ORIENTED_EDGE($,$,$,#113,.F.);
+#139=EDGE_LOOP($,(#130,#136,#137,#138));
+#140=FACE_OUTER_BOUND('',#139,.T.);
+#141=ADVANCED_FACE('',(#140),#129,.T.);
+#142=CARTESIAN_POINT($,(0,15,0));
+#143=DIRECTION($,(0,1,0));
+#144=DIRECTION($,(-1,0,0));
+#145=AXIS2_PLACEMENT_3D($,#142,#143,#144);
+#146=PLANE($,#145);
+#147=ORIENTED_EDGE($,$,$,#30,.T.);
+#148=CARTESIAN_POINT($,(-20,15,-6));
+#149=DIRECTION($,(0,0,1));
+#150=VECTOR($,#149,1);
+#151=LINE($,#148,#150);
+#152=EDGE_CURVE($,#25,#76,#151,.T.);
+#153=ORIENTED_EDGE($,$,$,#152,.T.);
+#154=ORIENTED_EDGE($,$,$,#81,.F.);
+#155=ORIENTED_EDGE($,$,$,#135,.F.);
+#156=EDGE_LOOP($,(#147,#153,#154,#155));
+#157=FACE_OUTER_BOUND('',#156,.T.);
+#158=ADVANCED_FACE('',(#157),#146,.T.);
+#159=CARTESIAN_POINT($,(-20,0,0));
+#160=DIRECTION($,(-1,0,0));
+#161=DIRECTION($,(0,1,0));
+#162=AXIS2_PLACEMENT_3D($,#159,#160,#161);
+#163=PLANE($,#162);
+#164=ORIENTED_EDGE($,$,$,#36,.T.);
+#165=ORIENTED_EDGE($,$,$,#120,.T.);
+#166=ORIENTED_EDGE($,$,$,#87,.F.);
+#167=ORIENTED_EDGE($,$,$,#152,.F.);
+#168=EDGE_LOOP($,(#164,#165,#166,#167));
+#169=FACE_OUTER_BOUND('',#168,.T.);
+#170=ADVANCED_FACE('',(#169),#163,.T.);
+#171=CARTESIAN_POINT($,(0,0,-6));
+#172=DIRECTION($,(0,0,1));
+#173=DIRECTION($,(1,0,0));
+#174=AXIS2_PLACEMENT_3D($,#171,#172,#173);
+#175=CYLINDRICAL_SURFACE($,#174,4);
+#176=CARTESIAN_POINT($,(4,0,6));
+#177=VERTEX_POINT($,#176);
+#178=CARTESIAN_POINT($,(4,0,-6));
+#179=VERTEX_POINT($,#178);
+#180=CARTESIAN_POINT($,(4,0,6));
+#181=DIRECTION($,(0,0,-1));
+#182=VECTOR($,#181,1);
+#183=LINE($,#180,#182);
+#184=EDGE_CURVE($,#177,#179,#183,.T.);
+#185=ORIENTED_EDGE($,$,$,#184,.T.);
+#186=ORIENTED_EDGE($,$,$,#98,.F.);
+#187=ORIENTED_EDGE($,$,$,#184,.F.);
+#188=ORIENTED_EDGE($,$,$,#47,.T.);
+#189=EDGE_LOOP($,(#185,#186,#187,#188));
+#190=FACE_OUTER_BOUND('',#189,.T.);
+#191=ADVANCED_FACE('',(#190),#175,.T.);
+#192=CLOSED_SHELL($,(#51,#102,#124,#141,#158,#170,#191));
+#193=MANIFOLD_SOLID_BREP('AetherisBody',#192);
+#194=APPLICATION_CONTEXT('mechanical design');
+#195=PRODUCT_CONTEXT('',#194,'mechanical');
+#196=PRODUCT('AETHERIS','AetherisBody','',(#195));
+#197=PRODUCT_DEFINITION_FORMATION('','',#196);
+#198=PRODUCT_DEFINITION_CONTEXT('design',#194,'design');
+#199=PRODUCT_DEFINITION('','',#197,#198);
+#200=PRODUCT_DEFINITION_SHAPE('','',#199);
+#201=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.));
+#202=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
+#203=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT());
+#204=(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNIT_ASSIGNED_CONTEXT((#201,#202,#203))REPRESENTATION_CONTEXT('3','3D'));
+#205=SHAPE_REPRESENTATION('AetherisBody',(#193),#204);
+#206=SHAPE_DEFINITION_REPRESENTATION(#200,#205);
+ENDSEC;
+END-ISO-10303-21;
diff --git a/testdata/firmament/fixtures/m10h1-unsupported-box-with-cylinder-hole.firmament b/testdata/firmament/fixtures/m10h1-unsupported-box-with-cylinder-hole.firmament
index 44dde2b1..fdcff604 100644
--- a/testdata/firmament/fixtures/m10h1-unsupported-box-with-cylinder-hole.firmament
+++ b/testdata/firmament/fixtures/m10h1-unsupported-box-with-cylinder-hole.firmament
@@ -2,7 +2,7 @@ firmament:
version: 1
model:
- name: m10h1_unsupported_box_with_cylinder_hole
+ name: m10h1_unsupported_box_with_partial_cylinder_hole
units: mm
ops[2]:
@@ -21,4 +21,4 @@ ops[2]:
with:
op: cylinder
radius: 4
- height: 12
+ height: 8