Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Add Firmament frustum cone primitive

Yuechen Li7fbf9888fff7
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs
index 5954a753..53736f7f 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs
@@ -41,6 +41,18 @@ public sealed class FirmamentBuildAndExportTests
"sphere");
}
+ [Fact]
+ public void Run_ConeFrustumBasicExample_Writes_Default_Export_Artifact()
+ {
+ AssertExampleBuildAndExport(
+ "testdata/firmament/examples/cone_frustum_basic.firmament",
+ "cone_frustum_basic.step",
+ "frustum1",
+ 0,
+ "primitive",
+ "cone");
+ }
+
[Fact]
public void Run_BoxWithHoleExample_Writes_Default_Export_Artifact()
{
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentExamplePackSmokeTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentExamplePackSmokeTests.cs
index 624b4552..a88929d0 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentExamplePackSmokeTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentExamplePackSmokeTests.cs
@@ -8,6 +8,7 @@ public sealed class FirmamentExamplePackSmokeTests
[
"testdata/firmament/examples/box_basic.firmament",
"testdata/firmament/examples/cylinder_basic.firmament",
+ "testdata/firmament/examples/cone_frustum_basic.firmament",
"testdata/firmament/examples/sphere_basic.firmament",
"testdata/firmament/examples/box_with_hole.firmament",
"testdata/firmament/examples/placed_primitive.firmament",
@@ -31,6 +32,7 @@ public sealed class FirmamentExamplePackSmokeTests
[Theory]
[InlineData("testdata/firmament/examples/box_basic.firmament", "base", 0, "primitive", "box")]
[InlineData("testdata/firmament/examples/cylinder_basic.firmament", "post", 0, "primitive", "cylinder")]
+ [InlineData("testdata/firmament/examples/cone_frustum_basic.firmament", "frustum1", 0, "primitive", "cone")]
[InlineData("testdata/firmament/examples/sphere_basic.firmament", "ball", 0, "primitive", "sphere")]
[InlineData("testdata/firmament/examples/box_with_hole.firmament", "base", 0, "primitive", "box")]
[InlineData("testdata/firmament/examples/placed_primitive.firmament", "post", 1, "primitive", "cylinder")]
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs
index 00a1d44a..665901aa 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs
@@ -48,6 +48,29 @@ public sealed class FirmamentPrimitiveExecutionTests
Assert.NotEmpty(executed.Body.Topology.Faces);
}
+ [Fact]
+ public void Compile_Executes_Cone_Primitive_Into_Real_Body_With_Truthful_Frustum_Topology()
+ {
+ var result = CompileFixture("testdata/firmament/fixtures/m10e-valid-cone-exec.firmament");
+
+ Assert.True(result.Compilation.IsSuccess);
+ var executed = Assert.Single(result.Compilation.Value.PrimitiveExecutionResult!.ExecutedPrimitives);
+ Assert.Equal("frustum1", executed.FeatureId);
+ Assert.Equal(FirmamentLoweredPrimitiveKind.Cone, executed.Kind);
+ Assert.Equal(3, executed.Body.Topology.Faces.Count());
+ Assert.Equal(3, executed.Body.Topology.Edges.Count());
+ Assert.Equal(4, executed.Body.Topology.Vertices.Count());
+
+ Assert.True(executed.Body.TryGetFaceSurfaceGeometry(new FaceId(1), out var side));
+ Assert.Equal(Aetheris.Kernel.Core.Geometry.SurfaceGeometryKind.Cone, side!.Kind);
+
+ Assert.True(executed.Body.TryGetFaceSurfaceGeometry(new FaceId(2), out var bottom));
+ Assert.Equal(new Point3D(0d, 0d, 0d), bottom!.Plane!.Value.Origin);
+
+ Assert.True(executed.Body.TryGetFaceSurfaceGeometry(new FaceId(3), out var top));
+ Assert.Equal(new Point3D(0d, 0d, 20d), top!.Plane!.Value.Origin);
+ }
+
[Fact]
public void Compile_Executes_Multiple_Primitives_In_Source_Order_With_Preserved_Ids()
{
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveLoweringTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveLoweringTests.cs
index 4eb55781..e7525ecd 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveLoweringTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveLoweringTests.cs
@@ -66,6 +66,37 @@ public sealed class FirmamentPrimitiveLoweringTests
Assert.Equal(8, parameters.Height);
}
+ [Fact]
+ public void Compile_Lowers_Cone_Primitive()
+ {
+ var result = Compile(
+ """
+ firmament:
+ version: 1
+
+ model:
+ name: demo
+ units: mm
+
+ ops[1]:
+ -
+ op: cone
+ id: frustum1
+ bottom_radius: 8
+ top_radius: 3
+ height: 20
+ """);
+
+ Assert.True(result.Compilation.IsSuccess);
+ var primitive = Assert.Single(result.Compilation.Value.PrimitiveLoweringPlan!.Primitives);
+ var parameters = Assert.IsType<FirmamentLoweredConeParameters>(primitive.Parameters);
+ Assert.Equal("frustum1", primitive.FeatureId);
+ Assert.Equal(FirmamentLoweredPrimitiveKind.Cone, primitive.Kind);
+ Assert.Equal(8, parameters.BottomRadius);
+ Assert.Equal(3, parameters.TopRadius);
+ Assert.Equal(20, parameters.Height);
+ }
+
[Fact]
public void Compile_Lowers_Sphere_Primitive()
{
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs
index 5be22aae..b507d65f 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs
@@ -139,6 +139,10 @@ public sealed class FirmamentScaffoldTests
public void Compiler_Classifies_KnownPrimitiveOpFamily() =>
AssertClassifiedFamily("box", FirmamentOpFamily.Primitive);
+ [Fact]
+ public void Compiler_Classifies_Cone_As_KnownPrimitiveOpFamily() =>
+ AssertClassifiedFamily("cone", FirmamentOpFamily.Primitive);
+
[Fact]
public void Compiler_Classifies_KnownBooleanOpFamily() =>
AssertClassifiedFamily("intersect", FirmamentOpFamily.Boolean);
@@ -665,6 +669,34 @@ public sealed class FirmamentScaffoldTests
FirmamentDiagnosticCodes.PrimitiveInvalidFieldValue,
"Primitive op 'cylinder' at index 0 has invalid field 'radius' value; expected a numeric value greater than 0.");
+ [Fact]
+ public void Compiler_Rejects_Cone_NonPositiveBottomRadius() =>
+ AssertSingleValidationError(
+ FirmamentCorpusHarness.ReadFixtureText("testdata/firmament/fixtures/m10e-invalid-cone-bottom-radius-non-positive.firmament"),
+ FirmamentDiagnosticCodes.PrimitiveInvalidFieldValue,
+ "Primitive op 'cone' at index 0 has invalid field 'bottom_radius' value; expected a numeric value greater than 0.");
+
+ [Fact]
+ public void Compiler_Rejects_Cone_NonPositiveTopRadius() =>
+ AssertSingleValidationError(
+ FirmamentCorpusHarness.ReadFixtureText("testdata/firmament/fixtures/m10e-invalid-cone-top-radius-non-positive.firmament"),
+ FirmamentDiagnosticCodes.PrimitiveInvalidFieldValue,
+ "Primitive op 'cone' at index 0 has invalid field 'top_radius' value; expected a numeric value greater than 0.");
+
+ [Fact]
+ public void Compiler_Rejects_Cone_NonPositiveHeight() =>
+ AssertSingleValidationError(
+ FirmamentCorpusHarness.ReadFixtureText("testdata/firmament/fixtures/m10e-invalid-cone-height-non-positive.firmament"),
+ FirmamentDiagnosticCodes.PrimitiveInvalidFieldValue,
+ "Primitive op 'cone' at index 0 has invalid field 'height' value; expected a numeric value greater than 0.");
+
+ [Fact]
+ public void Compiler_Rejects_Cone_EqualRadii() =>
+ AssertSingleValidationError(
+ FirmamentCorpusHarness.ReadFixtureText("testdata/firmament/fixtures/m10e-invalid-cone-equal-radii.firmament"),
+ FirmamentDiagnosticCodes.PrimitiveInvalidFieldValue,
+ "Primitive op 'cone' at index 0 has invalid field 'top_radius' value; expected a numeric value different from 'bottom_radius'.");
+
[Fact]
public void Compiler_Rejects_Sphere_MissingRadius() =>
AssertSingleValidationError(
@@ -807,6 +839,14 @@ public sealed class FirmamentScaffoldTests
id: c1
radius: 1
height: 2
+""",
+ "cone" => """
+ -
+ op: cone
+ id: frustum1
+ bottom_radius: 3
+ top_radius: 1
+ height: 5
""",
"sphere" => """
-
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.cs
index af7dfd3e..39332f8a 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.cs
@@ -126,6 +126,27 @@ public sealed class FirmamentStepExporterTests
Assert.Equal(first.Value.StepText, File.ReadAllText(artifactPath));
}
+ [Fact]
+ public void Export_ConeExample_Exports_Successfully_With_Metadata_Deterministic_Text_And_Persisted_Artifact()
+ {
+ var first = ExportFixture("testdata/firmament/examples/cone_frustum_basic.firmament");
+ var second = ExportFixture("testdata/firmament/examples/cone_frustum_basic.firmament");
+
+ Assert.True(first.IsSuccess);
+ Assert.True(second.IsSuccess);
+ Assert.Equal("frustum1", first.Value.ExportedFeatureId);
+ Assert.Equal(0, first.Value.ExportedOpIndex);
+ Assert.Equal("primitive", first.Value.ExportedBodyCategory);
+ Assert.Equal("cone", first.Value.ExportedFeatureKind);
+ Assert.NotEmpty(first.Value.StepText);
+ Assert.Equal(first.Value.StepText, second.Value.StepText);
+ Assert.Contains("CONICAL_SURFACE", first.Value.StepText, StringComparison.Ordinal);
+
+ var artifactPath = WriteExportArtifact("m10e-cone.step", first.Value.StepText);
+ Assert.True(File.Exists(artifactPath));
+ Assert.Equal(first.Value.StepText, File.ReadAllText(artifactPath));
+ }
+
[Fact]
public void Export_MultipleExecutedGeometryBodies_Selects_Last_Executed_Geometric_Feature_Body()
{
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentValidationExecutionTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentValidationExecutionTests.cs
index 47bbbffe..6c114fd4 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentValidationExecutionTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentValidationExecutionTests.cs
@@ -122,6 +122,21 @@ ops[7]:
});
}
+ [Fact]
+ public void Compile_Executes_Cone_Selector_Contract_With_Truthful_Runtime_Counts()
+ {
+ var result = CompileFixture("testdata/firmament/fixtures/m10e-valid-cone-selector-contract.firmament");
+
+ Assert.True(result.Compilation.IsSuccess);
+ Assert.Equal(6, result.Compilation.Value.ValidationExecutionResult!.Validations.Count);
+ Assert.All(result.Compilation.Value.ValidationExecutionResult.Validations, validation =>
+ {
+ Assert.True(validation.IsExecuted);
+ Assert.True(validation.IsSuccess);
+ Assert.Null(validation.Reason);
+ });
+ }
+
[Fact]
public void Compile_Executes_Sphere_Selector_Contract_With_Truthful_Runtime_Counts()
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentValidationTargetFeatureExistenceTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentValidationTargetFeatureExistenceTests.cs
index fe09cc77..a4192568 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentValidationTargetFeatureExistenceTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentValidationTargetFeatureExistenceTests.cs
@@ -170,6 +170,8 @@ public sealed partial class FirmamentValidationTargetFeatureExistenceTests
[InlineData("base.side_faces", "FaceSet", "Many")]
[InlineData("cyl.side_face", "Face", "One")]
[InlineData("cyl.circular_edges", "EdgeSet", "Many")]
+ [InlineData("frustum.side_face", "Face", "One")]
+ [InlineData("frustum.circular_edges", "EdgeSet", "Many")]
[InlineData("sphere.surface", "Face", "One")]
public void Compiler_Attaches_SelectorContractMetadata_For_Legal_SelectorTargets(string selectorTarget, string expectedResultKind, string expectedCardinality)
{
@@ -181,7 +183,7 @@ model:
name: demo
units: mm
-ops[4]:
+ops[5]:
-
op: box
id: base
@@ -198,6 +200,12 @@ ops[4]:
op: sphere
id: sphere
radius: 4
+ -
+ op: cone
+ id: frustum
+ bottom_radius: 5
+ top_radius: 2
+ height: 9
-
op: expect_exists
target: {{selectorTarget}}
@@ -206,7 +214,7 @@ ops[4]:
var result = new FirmamentCompiler().Compile(new FirmamentCompileRequest(new FirmamentSourceDocument(source)));
Assert.True(result.Compilation.IsSuccess);
- var validationOp = result.Compilation.Value.ParsedDocument!.Ops.Entries[3];
+ var validationOp = result.Compilation.Value.ParsedDocument!.Ops.Entries[4];
Assert.NotNull(validationOp.ClassifiedFields);
Assert.Equal("SelectorShaped", validationOp.ClassifiedFields!["targetShape"]);
Assert.Equal(expectedResultKind, validationOp.ClassifiedFields["selectorResultKind"]);
diff --git a/Aetheris.Kernel.Firmament/Execution/FirmamentPlacementResolver.cs b/Aetheris.Kernel.Firmament/Execution/FirmamentPlacementResolver.cs
index de76776a..c7640e1a 100644
--- a/Aetheris.Kernel.Firmament/Execution/FirmamentPlacementResolver.cs
+++ b/Aetheris.Kernel.Firmament/Execution/FirmamentPlacementResolver.cs
@@ -2,6 +2,7 @@ using System.Linq;
using Aetheris.Kernel.Core.Brep;
using Aetheris.Kernel.Core.Diagnostics;
using Aetheris.Kernel.Core.Geometry;
+using Aetheris.Kernel.Core.Geometry.Surfaces;
using Aetheris.Kernel.Core.Math;
using Aetheris.Kernel.Core.Results;
using Aetheris.Kernel.Core.Topology;
@@ -93,11 +94,37 @@ internal static class FirmamentPlacementResolver
{
SurfaceGeometryKind.Plane => s.Plane!.Value.Origin,
SurfaceGeometryKind.Cylinder => s.Cylinder!.Value.Origin,
+ SurfaceGeometryKind.Cone => GetConicalFaceRepresentativePoint(body, faceId, s.Cone!.Value),
SurfaceGeometryKind.Sphere => s.Sphere!.Value.Center,
_ => null
};
}
+ private static Point3D? GetConicalFaceRepresentativePoint(BrepBody body, FaceId faceId, ConeSurface cone)
+ {
+ var points = new List<Point3D>();
+ foreach (var edgeId in body.GetEdges(faceId))
+ {
+ var (startVertexId, endVertexId) = body.GetEdgeVertices(edgeId);
+ if (TryGetVertexPoint(body, startVertexId, out var startPoint))
+ {
+ points.Add(startPoint);
+ }
+
+ if (TryGetVertexPoint(body, endVertexId, out var endPoint))
+ {
+ points.Add(endPoint);
+ }
+ }
+
+ if (points.Count > 0)
+ {
+ return ComputeCentroid(points);
+ }
+
+ return cone.Evaluate(0d, 1d);
+ }
+
private static KernelResult<Point3D> ResolveEdgeAnchor(BrepBody body, string _)
{
var points = new List<Point3D>();
@@ -158,7 +185,27 @@ internal static class FirmamentPlacementResolver
var f = body.Topology.Faces.Count();
var e = body.Topology.Edges.Count();
if (f == 6 && e == 12) return FirmamentKnownOpKind.Box;
- if (f == 3) return FirmamentKnownOpKind.Cylinder;
+ if (f == 3)
+ {
+ foreach (var face in body.Topology.Faces)
+ {
+ if (!body.TryGetFaceSurfaceGeometry(face.Id, out var surface) || surface is null)
+ {
+ continue;
+ }
+
+ if (surface.Kind == SurfaceGeometryKind.Cone)
+ {
+ return FirmamentKnownOpKind.Cone;
+ }
+
+ if (surface.Kind == SurfaceGeometryKind.Cylinder)
+ {
+ return FirmamentKnownOpKind.Cylinder;
+ }
+ }
+ }
+
if (f == 1) return FirmamentKnownOpKind.Sphere;
return FirmamentKnownOpKind.Add;
}
diff --git a/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutor.cs b/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutor.cs
index aa23beac..a79bbf7b 100644
--- a/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutor.cs
+++ b/Aetheris.Kernel.Firmament/Execution/FirmamentPrimitiveExecutor.cs
@@ -1,5 +1,6 @@
using Aetheris.Kernel.Core.Brep;
using Aetheris.Kernel.Core.Brep.Boolean;
+using Aetheris.Kernel.Core.Brep.Features;
using Aetheris.Kernel.Core.Diagnostics;
using Aetheris.Kernel.Core.Geometry;
using Aetheris.Kernel.Core.Geometry.Curves;
@@ -111,11 +112,29 @@ internal static class FirmamentPrimitiveExecutor
{
FirmamentLoweredPrimitiveKind.Box => BrepPrimitives.CreateBox(((FirmamentLoweredBoxParameters)primitive.Parameters).SizeX, ((FirmamentLoweredBoxParameters)primitive.Parameters).SizeY, ((FirmamentLoweredBoxParameters)primitive.Parameters).SizeZ),
FirmamentLoweredPrimitiveKind.Cylinder => BrepPrimitives.CreateCylinder(((FirmamentLoweredCylinderParameters)primitive.Parameters).Radius, ((FirmamentLoweredCylinderParameters)primitive.Parameters).Height),
+ FirmamentLoweredPrimitiveKind.Cone => ExecuteCone((FirmamentLoweredConeParameters)primitive.Parameters),
FirmamentLoweredPrimitiveKind.Sphere => BrepPrimitives.CreateSphere(((FirmamentLoweredSphereParameters)primitive.Parameters).Radius),
_ => KernelResult<BrepBody>.Failure([new KernelDiagnostic(KernelDiagnosticCode.NotImplemented, KernelDiagnosticSeverity.Error, $"Primitive execution for kind '{primitive.Kind}' is not implemented.")])
};
}
+ private static KernelResult<BrepBody> ExecuteCone(FirmamentLoweredConeParameters parameters)
+ {
+ var frame = new ExtrudeFrame3D(
+ origin: Point3D.Origin,
+ normal: Direction3D.Create(new Vector3D(0d, 0d, 1d)),
+ uAxis: Direction3D.Create(new Vector3D(1d, 0d, 0d)));
+ var axis = new RevolveAxis3D(Point3D.Origin, new Vector3D(0d, 0d, 1d));
+
+ return BrepRevolve.Create(
+ [
+ new ProfilePoint2D(parameters.BottomRadius, 0d),
+ new ProfilePoint2D(parameters.TopRadius, parameters.Height)
+ ],
+ frame,
+ axis);
+ }
+
private static KernelResult<BrepBody> ExecuteTool(FirmamentLoweredToolOp tool)
{
if (string.Equals(tool.OpName, "box", StringComparison.Ordinal))
@@ -183,6 +202,7 @@ internal static class FirmamentPrimitiveExecutor
{
SurfaceGeometryKind.Plane => SurfaceGeometry.FromPlane(new PlaneSurface(surfaceEntry.Value.Plane!.Value.Origin + translation, surfaceEntry.Value.Plane.Value.Normal, surfaceEntry.Value.Plane.Value.UAxis)),
SurfaceGeometryKind.Cylinder => SurfaceGeometry.FromCylinder(new CylinderSurface(surfaceEntry.Value.Cylinder!.Value.Origin + translation, surfaceEntry.Value.Cylinder.Value.Axis, surfaceEntry.Value.Cylinder.Value.Radius, surfaceEntry.Value.Cylinder.Value.XAxis)),
+ SurfaceGeometryKind.Cone => SurfaceGeometry.FromCone(new ConeSurface(surfaceEntry.Value.Cone!.Value.PlacementOrigin + translation, surfaceEntry.Value.Cone.Value.Axis, surfaceEntry.Value.Cone.Value.PlacementRadius, surfaceEntry.Value.Cone.Value.SemiAngleRadians, surfaceEntry.Value.Cone.Value.ReferenceAxis)),
SurfaceGeometryKind.Sphere => SurfaceGeometry.FromSphere(new SphereSurface(surfaceEntry.Value.Sphere!.Value.Center + translation, surfaceEntry.Value.Sphere.Value.Axis, surfaceEntry.Value.Sphere.Value.Radius, surfaceEntry.Value.Sphere.Value.XAxis)),
_ => surfaceEntry.Value
});
diff --git a/Aetheris.Kernel.Firmament/Execution/FirmamentSelectorResolver.cs b/Aetheris.Kernel.Firmament/Execution/FirmamentSelectorResolver.cs
index 1f26b54b..a24cd6b8 100644
--- a/Aetheris.Kernel.Firmament/Execution/FirmamentSelectorResolver.cs
+++ b/Aetheris.Kernel.Firmament/Execution/FirmamentSelectorResolver.cs
@@ -32,6 +32,8 @@ internal static class FirmamentSelectorResolver
var count = TryResolveCylinderCount(body, port, resultKind, out var cylinderCount)
? cylinderCount
+ : TryResolveConeCount(body, port, resultKind, out var coneCount)
+ ? coneCount
: resultKind switch
{
FirmamentSelectorResultKind.Face or FirmamentSelectorResultKind.FaceSet => body.Topology.Faces.Count(),
@@ -44,6 +46,29 @@ internal static class FirmamentSelectorResolver
return true;
}
+ private static bool TryResolveConeCount(BrepBody body, string port, FirmamentSelectorResultKind resultKind, out int count)
+ {
+ count = 0;
+
+ if (!LooksLikeCone(body))
+ {
+ return false;
+ }
+
+ count = port switch
+ {
+ "top_face" => CountFaces(body, surface => surface.Kind == SurfaceGeometryKind.Plane && surface.Plane!.Value.Normal.ToVector().Z > 0.5d),
+ "bottom_face" => CountFaces(body, surface => surface.Kind == SurfaceGeometryKind.Plane && surface.Plane!.Value.Normal.ToVector().Z < -0.5d),
+ "side_face" => CountFaces(body, surface => surface.Kind == SurfaceGeometryKind.Cone),
+ "circular_edges" => CountEdges(body, curve => curve.Kind == CurveGeometryKind.Circle3),
+ "edges" when resultKind == FirmamentSelectorResultKind.EdgeSet => body.Topology.Edges.Count(),
+ "vertices" when resultKind == FirmamentSelectorResultKind.VertexSet => body.Topology.Vertices.Count(),
+ _ => 0
+ };
+
+ return true;
+ }
+
private static bool TryResolveCylinderCount(BrepBody body, string port, FirmamentSelectorResultKind resultKind, out int count)
{
count = 0;
@@ -100,6 +125,39 @@ internal static class FirmamentSelectorResolver
return cylindricalFaces == 1 && planarFaces == 2;
}
+ private static bool LooksLikeCone(BrepBody body)
+ {
+ if (body.Topology.Faces.Count() != 3 || body.Topology.Edges.Count() != 3)
+ {
+ return false;
+ }
+
+ var conicalFaces = 0;
+ var planarFaces = 0;
+
+ foreach (var face in body.Topology.Faces)
+ {
+ if (!body.TryGetFaceSurfaceGeometry(face.Id, out var surface) || surface is null)
+ {
+ return false;
+ }
+
+ switch (surface.Kind)
+ {
+ case SurfaceGeometryKind.Cone:
+ conicalFaces++;
+ break;
+ case SurfaceGeometryKind.Plane:
+ planarFaces++;
+ break;
+ default:
+ return false;
+ }
+ }
+
+ return conicalFaces == 1 && planarFaces == 2;
+ }
+
private static int CountFaces(BrepBody body, Func<SurfaceGeometry, bool> predicate)
{
var count = 0;
diff --git a/Aetheris.Kernel.Firmament/Formatting/FirmamentCanonicalFormatter.cs b/Aetheris.Kernel.Firmament/Formatting/FirmamentCanonicalFormatter.cs
index de964150..5f34e282 100644
--- a/Aetheris.Kernel.Firmament/Formatting/FirmamentCanonicalFormatter.cs
+++ b/Aetheris.Kernel.Firmament/Formatting/FirmamentCanonicalFormatter.cs
@@ -119,6 +119,11 @@ internal static class FirmamentCanonicalFormatter
EmitIfPresent(builder, entry.RawFields, emitted, indentLevel, "radius");
EmitIfPresent(builder, entry.RawFields, emitted, indentLevel, "height");
break;
+ case FirmamentKnownOpKind.Cone:
+ EmitIfPresent(builder, entry.RawFields, emitted, indentLevel, "bottom_radius");
+ EmitIfPresent(builder, entry.RawFields, emitted, indentLevel, "top_radius");
+ EmitIfPresent(builder, entry.RawFields, emitted, indentLevel, "height");
+ break;
case FirmamentKnownOpKind.Sphere:
EmitIfPresent(builder, entry.RawFields, emitted, indentLevel, "radius");
break;
diff --git a/Aetheris.Kernel.Firmament/Lowering/FirmamentPrimitiveLowerer.cs b/Aetheris.Kernel.Firmament/Lowering/FirmamentPrimitiveLowerer.cs
index f97af9b0..e97cce39 100644
--- a/Aetheris.Kernel.Firmament/Lowering/FirmamentPrimitiveLowerer.cs
+++ b/Aetheris.Kernel.Firmament/Lowering/FirmamentPrimitiveLowerer.cs
@@ -43,6 +43,18 @@ internal static class FirmamentPrimitiveLowerer
Placement: LowerPlacement(entry.Placement)));
break;
+ case FirmamentKnownOpKind.Cone:
+ loweredPrimitives.Add(new FirmamentLoweredPrimitive(
+ OpIndex: index,
+ FeatureId: entry.RawFields["id"],
+ Kind: FirmamentLoweredPrimitiveKind.Cone,
+ Parameters: new FirmamentLoweredConeParameters(
+ BottomRadius: ParseScalar(entry.RawFields["bottom_radius"]),
+ TopRadius: ParseScalar(entry.RawFields["top_radius"]),
+ Height: ParseScalar(entry.RawFields["height"])),
+ Placement: LowerPlacement(entry.Placement)));
+ break;
+
case FirmamentKnownOpKind.Sphere:
loweredPrimitives.Add(new FirmamentLoweredPrimitive(
OpIndex: index,
diff --git a/Aetheris.Kernel.Firmament/Lowering/FirmamentPrimitiveLoweringPlan.cs b/Aetheris.Kernel.Firmament/Lowering/FirmamentPrimitiveLoweringPlan.cs
index 6b7c914b..30249f3b 100644
--- a/Aetheris.Kernel.Firmament/Lowering/FirmamentPrimitiveLoweringPlan.cs
+++ b/Aetheris.Kernel.Firmament/Lowering/FirmamentPrimitiveLoweringPlan.cs
@@ -44,6 +44,7 @@ public enum FirmamentLoweredPrimitiveKind
{
Box,
Cylinder,
+ Cone,
Sphere
}
@@ -55,6 +56,9 @@ public sealed record FirmamentLoweredBoxParameters(double SizeX, double SizeY, d
public sealed record FirmamentLoweredCylinderParameters(double Radius, double Height)
: FirmamentLoweredPrimitiveParameters;
+public sealed record FirmamentLoweredConeParameters(double BottomRadius, double TopRadius, double Height)
+ : FirmamentLoweredPrimitiveParameters;
+
public sealed record FirmamentLoweredSphereParameters(double Radius)
: FirmamentLoweredPrimitiveParameters;
diff --git a/Aetheris.Kernel.Firmament/ParsedModel/FirmamentKnownOpKind.cs b/Aetheris.Kernel.Firmament/ParsedModel/FirmamentKnownOpKind.cs
index 31f09e09..294e9666 100644
--- a/Aetheris.Kernel.Firmament/ParsedModel/FirmamentKnownOpKind.cs
+++ b/Aetheris.Kernel.Firmament/ParsedModel/FirmamentKnownOpKind.cs
@@ -4,6 +4,7 @@ public enum FirmamentKnownOpKind
{
Box,
Cylinder,
+ Cone,
Sphere,
Add,
Subtract,
@@ -20,6 +21,7 @@ internal static class FirmamentKnownOpKinds
{
["box"] = FirmamentKnownOpKind.Box,
["cylinder"] = FirmamentKnownOpKind.Cylinder,
+ ["cone"] = FirmamentKnownOpKind.Cone,
["sphere"] = FirmamentKnownOpKind.Sphere,
["add"] = FirmamentKnownOpKind.Add,
["subtract"] = FirmamentKnownOpKind.Subtract,
@@ -37,6 +39,7 @@ internal static class FirmamentKnownOpKinds
{
FirmamentKnownOpKind.Box => FirmamentOpFamily.Primitive,
FirmamentKnownOpKind.Cylinder => FirmamentOpFamily.Primitive,
+ FirmamentKnownOpKind.Cone => FirmamentOpFamily.Primitive,
FirmamentKnownOpKind.Sphere => FirmamentOpFamily.Primitive,
FirmamentKnownOpKind.Add => FirmamentOpFamily.Boolean,
FirmamentKnownOpKind.Subtract => FirmamentOpFamily.Boolean,
diff --git a/Aetheris.Kernel.Firmament/Validation/FirmamentPrimitiveRequiredFieldValidator.cs b/Aetheris.Kernel.Firmament/Validation/FirmamentPrimitiveRequiredFieldValidator.cs
index 56765add..9ae90a52 100644
--- a/Aetheris.Kernel.Firmament/Validation/FirmamentPrimitiveRequiredFieldValidator.cs
+++ b/Aetheris.Kernel.Firmament/Validation/FirmamentPrimitiveRequiredFieldValidator.cs
@@ -26,6 +26,7 @@ internal static class FirmamentPrimitiveRequiredFieldValidator
{
FirmamentKnownOpKind.Box => ValidateBox(entry, index),
FirmamentKnownOpKind.Cylinder => ValidateCylinder(entry, index),
+ FirmamentKnownOpKind.Cone => ValidateCone(entry, index),
FirmamentKnownOpKind.Sphere => ValidateSphere(entry, index),
_ => KernelResult<bool>.Success(true)
};
@@ -128,6 +129,47 @@ internal static class FirmamentPrimitiveRequiredFieldValidator
return KernelResult<bool>.Success(true);
}
+ private static KernelResult<bool> ValidateCone(FirmamentParsedOpEntry entry, int opIndex)
+ {
+ if (!TryGetRequiredNonEmptyScalar(entry, "id", opIndex, out var missingOrTypeDiagnostic))
+ {
+ return KernelResult<bool>.Failure([missingOrTypeDiagnostic!]);
+ }
+
+ var bottomRadiusResult = ValidatePositiveNumericField(entry, "bottom_radius", opIndex);
+ if (!bottomRadiusResult.IsSuccess)
+ {
+ return bottomRadiusResult;
+ }
+
+ var topRadiusResult = ValidatePositiveNumericField(entry, "top_radius", opIndex);
+ if (!topRadiusResult.IsSuccess)
+ {
+ return topRadiusResult;
+ }
+
+ var heightResult = ValidatePositiveNumericField(entry, "height", opIndex);
+ if (!heightResult.IsSuccess)
+ {
+ return heightResult;
+ }
+
+ var bottomRadius = ParseRequiredNumeric(entry.RawFields["bottom_radius"]);
+ var topRadius = ParseRequiredNumeric(entry.RawFields["top_radius"]);
+ if (double.Abs(bottomRadius - topRadius) <= 1e-12d)
+ {
+ return InvalidFieldValue("top_radius", opIndex, entry.OpName, "expected a numeric value different from 'bottom_radius'");
+ }
+
+ var placementResult = ValidatePlacement(entry, opIndex);
+ if (!placementResult.IsSuccess)
+ {
+ return placementResult;
+ }
+
+ return KernelResult<bool>.Success(true);
+ }
+
private static KernelResult<bool> ValidatePlacement(FirmamentParsedOpEntry entry, int opIndex)
{
if (!entry.RawFields.ContainsKey("place"))
@@ -312,6 +354,12 @@ internal static class FirmamentPrimitiveRequiredFieldValidator
return double.TryParse(trimmed, NumberStyles.Float, CultureInfo.InvariantCulture, out value);
}
+ private static double ParseRequiredNumeric(string raw)
+ {
+ _ = TryParseNumeric(raw, out var value);
+ return value;
+ }
+
private static bool TryParseVector(string raw, out List<double> components)
{
components = [];
diff --git a/Aetheris.Kernel.Firmament/Validation/FirmamentSelectorContracts.cs b/Aetheris.Kernel.Firmament/Validation/FirmamentSelectorContracts.cs
index 3bcccdcd..3390819c 100644
--- a/Aetheris.Kernel.Firmament/Validation/FirmamentSelectorContracts.cs
+++ b/Aetheris.Kernel.Firmament/Validation/FirmamentSelectorContracts.cs
@@ -25,6 +25,17 @@ internal static class FirmamentSelectorContracts
["vertices"] = new(FirmamentSelectorResultKind.VertexSet, FirmamentSelectorCardinality.Many)
};
+ private static readonly IReadOnlyDictionary<string, FirmamentSelectorPortContract> ConePorts =
+ new Dictionary<string, FirmamentSelectorPortContract>(StringComparer.Ordinal)
+ {
+ ["top_face"] = new(FirmamentSelectorResultKind.Face, FirmamentSelectorCardinality.One),
+ ["bottom_face"] = new(FirmamentSelectorResultKind.Face, FirmamentSelectorCardinality.One),
+ ["side_face"] = new(FirmamentSelectorResultKind.Face, FirmamentSelectorCardinality.One),
+ ["circular_edges"] = new(FirmamentSelectorResultKind.EdgeSet, FirmamentSelectorCardinality.Many),
+ ["edges"] = new(FirmamentSelectorResultKind.EdgeSet, FirmamentSelectorCardinality.Many),
+ ["vertices"] = new(FirmamentSelectorResultKind.VertexSet, FirmamentSelectorCardinality.Many)
+ };
+
private static readonly IReadOnlyDictionary<string, FirmamentSelectorPortContract> SpherePorts =
new Dictionary<string, FirmamentSelectorPortContract>(StringComparer.Ordinal)
{
@@ -51,6 +62,9 @@ internal static class FirmamentSelectorContracts
case FirmamentKnownOpKind.Cylinder:
allowedPorts = CylinderAllowedPorts;
return true;
+ case FirmamentKnownOpKind.Cone:
+ allowedPorts = ConeAllowedPorts;
+ return true;
case FirmamentKnownOpKind.Sphere:
allowedPorts = SphereAllowedPorts;
return true;
@@ -87,6 +101,9 @@ internal static class FirmamentSelectorContracts
case FirmamentKnownOpKind.Cylinder:
contracts = CylinderPorts;
return true;
+ case FirmamentKnownOpKind.Cone:
+ contracts = ConePorts;
+ return true;
case FirmamentKnownOpKind.Sphere:
contracts = SpherePorts;
return true;
@@ -106,6 +123,7 @@ internal static class FirmamentSelectorContracts
private static readonly IReadOnlySet<string> BoxAllowedPorts = new HashSet<string>(BoxPorts.Keys, StringComparer.Ordinal);
private static readonly IReadOnlySet<string> CylinderAllowedPorts = new HashSet<string>(CylinderPorts.Keys, StringComparer.Ordinal);
+ private static readonly IReadOnlySet<string> ConeAllowedPorts = new HashSet<string>(ConePorts.Keys, StringComparer.Ordinal);
private static readonly IReadOnlySet<string> SphereAllowedPorts = new HashSet<string>(SpherePorts.Keys, StringComparer.Ordinal);
private static readonly IReadOnlySet<string> BooleanAllowedPorts = new HashSet<string>(BooleanPorts.Keys, StringComparer.Ordinal);
private static readonly IReadOnlySet<string> EmptyPorts = new HashSet<string>(StringComparer.Ordinal);
diff --git a/testdata/firmament/examples/README.md b/testdata/firmament/examples/README.md
index ef42cccf..33c1eb58 100644
--- a/testdata/firmament/examples/README.md
+++ b/testdata/firmament/examples/README.md
@@ -4,6 +4,7 @@ This directory contains small canonical Firmament examples for the current v1 su
- `box_basic.firmament` — minimal single-box golden-path example; helper export path: `testdata/firmament/exports/box_basic.step`.
- `cylinder_basic.firmament` — minimal single-cylinder export example; helper export path: `testdata/firmament/exports/cylinder_basic.step`.
+- `cone_frustum_basic.firmament` — minimal single frustum-cone export example using the v1 `cone` primitive; helper export path: `testdata/firmament/exports/cone_frustum_basic.step`.
- `sphere_basic.firmament` — minimal single-sphere export example; helper export path: `testdata/firmament/exports/sphere_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`.
diff --git a/testdata/firmament/examples/cone_frustum_basic.firmament b/testdata/firmament/examples/cone_frustum_basic.firmament
new file mode 100644
index 00000000..4f45b2ae
--- /dev/null
+++ b/testdata/firmament/examples/cone_frustum_basic.firmament
@@ -0,0 +1,14 @@
+firmament:
+ version: 1
+
+model:
+ name: cone_frustum_basic
+ units: mm
+
+ops[1]:
+ -
+ op: cone
+ id: frustum1
+ bottom_radius: 8
+ top_radius: 3
+ height: 20
diff --git a/testdata/firmament/exports/cone_frustum_basic.step b/testdata/firmament/exports/cone_frustum_basic.step
new file mode 100644
index 00000000..6c4ebe7e
--- /dev/null
+++ b/testdata/firmament/exports/cone_frustum_basic.step
@@ -0,0 +1,79 @@
+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,32));
+#2=DIRECTION($,(-0,-0,-1));
+#3=DIRECTION($,(1,0,0));
+#4=AXIS2_PLACEMENT_3D($,#1,#2,#3);
+#5=CONICAL_SURFACE($,#4,0,0.244978663126864);
+#6=CARTESIAN_POINT($,(8,0,0));
+#7=VERTEX_POINT($,#6);
+#8=CARTESIAN_POINT($,(3,0,20));
+#9=VERTEX_POINT($,#8);
+#10=CARTESIAN_POINT($,(8,0,0));
+#11=DIRECTION($,(-0.242535625036333,0,0.970142500145332));
+#12=VECTOR($,#11,1);
+#13=LINE($,#10,#12);
+#14=EDGE_CURVE($,#7,#9,#13,.T.);
+#15=ORIENTED_EDGE($,$,$,#14,.T.);
+#16=CARTESIAN_POINT($,(3,0,20));
+#17=VERTEX_POINT($,#16);
+#18=CARTESIAN_POINT($,(0,0,20));
+#19=DIRECTION($,(0,0,1));
+#20=DIRECTION($,(1,0,0));
+#21=AXIS2_PLACEMENT_3D($,#18,#19,#20);
+#22=CIRCLE($,#21,3);
+#23=EDGE_CURVE($,#17,#17,#22,.T.);
+#24=ORIENTED_EDGE($,$,$,#23,.T.);
+#25=ORIENTED_EDGE($,$,$,#14,.F.);
+#26=CARTESIAN_POINT($,(8,0,0));
+#27=VERTEX_POINT($,#26);
+#28=CARTESIAN_POINT($,(0,0,0));
+#29=DIRECTION($,(0,0,1));
+#30=DIRECTION($,(1,0,0));
+#31=AXIS2_PLACEMENT_3D($,#28,#29,#30);
+#32=CIRCLE($,#31,8);
+#33=EDGE_CURVE($,#27,#27,#32,.T.);
+#34=ORIENTED_EDGE($,$,$,#33,.F.);
+#35=EDGE_LOOP($,(#15,#24,#25,#34));
+#36=FACE_OUTER_BOUND('',#35,.T.);
+#37=ADVANCED_FACE('',(#36),#5,.T.);
+#38=CARTESIAN_POINT($,(0,0,0));
+#39=DIRECTION($,(-0,-0,-1));
+#40=DIRECTION($,(1,0,0));
+#41=AXIS2_PLACEMENT_3D($,#38,#39,#40);
+#42=PLANE($,#41);
+#43=ORIENTED_EDGE($,$,$,#33,.T.);
+#44=EDGE_LOOP($,(#43));
+#45=FACE_OUTER_BOUND('',#44,.T.);
+#46=ADVANCED_FACE('',(#45),#42,.T.);
+#47=CARTESIAN_POINT($,(0,0,20));
+#48=DIRECTION($,(0,0,1));
+#49=DIRECTION($,(1,0,0));
+#50=AXIS2_PLACEMENT_3D($,#47,#48,#49);
+#51=PLANE($,#50);
+#52=ORIENTED_EDGE($,$,$,#23,.F.);
+#53=EDGE_LOOP($,(#52));
+#54=FACE_OUTER_BOUND('',#53,.T.);
+#55=ADVANCED_FACE('',(#54),#51,.T.);
+#56=CLOSED_SHELL($,(#37,#46,#55));
+#57=MANIFOLD_SOLID_BREP('AetherisBody',#56);
+#58=APPLICATION_CONTEXT('mechanical design');
+#59=PRODUCT_CONTEXT('',#58,'mechanical');
+#60=PRODUCT('AETHERIS','AetherisBody','',(#59));
+#61=PRODUCT_DEFINITION_FORMATION('','',#60);
+#62=PRODUCT_DEFINITION_CONTEXT('design',#58,'design');
+#63=PRODUCT_DEFINITION('','',#61,#62);
+#64=PRODUCT_DEFINITION_SHAPE('','',#63);
+#65=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.));
+#66=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
+#67=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT());
+#68=(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNIT_ASSIGNED_CONTEXT((#65,#66,#67))REPRESENTATION_CONTEXT('3','3D'));
+#69=SHAPE_REPRESENTATION('AetherisBody',(#57),#68);
+#70=SHAPE_DEFINITION_REPRESENTATION(#64,#69);
+ENDSEC;
+END-ISO-10303-21;
diff --git a/testdata/firmament/exports/m10e-cone.step b/testdata/firmament/exports/m10e-cone.step
new file mode 100644
index 00000000..6c4ebe7e
--- /dev/null
+++ b/testdata/firmament/exports/m10e-cone.step
@@ -0,0 +1,79 @@
+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,32));
+#2=DIRECTION($,(-0,-0,-1));
+#3=DIRECTION($,(1,0,0));
+#4=AXIS2_PLACEMENT_3D($,#1,#2,#3);
+#5=CONICAL_SURFACE($,#4,0,0.244978663126864);
+#6=CARTESIAN_POINT($,(8,0,0));
+#7=VERTEX_POINT($,#6);
+#8=CARTESIAN_POINT($,(3,0,20));
+#9=VERTEX_POINT($,#8);
+#10=CARTESIAN_POINT($,(8,0,0));
+#11=DIRECTION($,(-0.242535625036333,0,0.970142500145332));
+#12=VECTOR($,#11,1);
+#13=LINE($,#10,#12);
+#14=EDGE_CURVE($,#7,#9,#13,.T.);
+#15=ORIENTED_EDGE($,$,$,#14,.T.);
+#16=CARTESIAN_POINT($,(3,0,20));
+#17=VERTEX_POINT($,#16);
+#18=CARTESIAN_POINT($,(0,0,20));
+#19=DIRECTION($,(0,0,1));
+#20=DIRECTION($,(1,0,0));
+#21=AXIS2_PLACEMENT_3D($,#18,#19,#20);
+#22=CIRCLE($,#21,3);
+#23=EDGE_CURVE($,#17,#17,#22,.T.);
+#24=ORIENTED_EDGE($,$,$,#23,.T.);
+#25=ORIENTED_EDGE($,$,$,#14,.F.);
+#26=CARTESIAN_POINT($,(8,0,0));
+#27=VERTEX_POINT($,#26);
+#28=CARTESIAN_POINT($,(0,0,0));
+#29=DIRECTION($,(0,0,1));
+#30=DIRECTION($,(1,0,0));
+#31=AXIS2_PLACEMENT_3D($,#28,#29,#30);
+#32=CIRCLE($,#31,8);
+#33=EDGE_CURVE($,#27,#27,#32,.T.);
+#34=ORIENTED_EDGE($,$,$,#33,.F.);
+#35=EDGE_LOOP($,(#15,#24,#25,#34));
+#36=FACE_OUTER_BOUND('',#35,.T.);
+#37=ADVANCED_FACE('',(#36),#5,.T.);
+#38=CARTESIAN_POINT($,(0,0,0));
+#39=DIRECTION($,(-0,-0,-1));
+#40=DIRECTION($,(1,0,0));
+#41=AXIS2_PLACEMENT_3D($,#38,#39,#40);
+#42=PLANE($,#41);
+#43=ORIENTED_EDGE($,$,$,#33,.T.);
+#44=EDGE_LOOP($,(#43));
+#45=FACE_OUTER_BOUND('',#44,.T.);
+#46=ADVANCED_FACE('',(#45),#42,.T.);
+#47=CARTESIAN_POINT($,(0,0,20));
+#48=DIRECTION($,(0,0,1));
+#49=DIRECTION($,(1,0,0));
+#50=AXIS2_PLACEMENT_3D($,#47,#48,#49);
+#51=PLANE($,#50);
+#52=ORIENTED_EDGE($,$,$,#23,.F.);
+#53=EDGE_LOOP($,(#52));
+#54=FACE_OUTER_BOUND('',#53,.T.);
+#55=ADVANCED_FACE('',(#54),#51,.T.);
+#56=CLOSED_SHELL($,(#37,#46,#55));
+#57=MANIFOLD_SOLID_BREP('AetherisBody',#56);
+#58=APPLICATION_CONTEXT('mechanical design');
+#59=PRODUCT_CONTEXT('',#58,'mechanical');
+#60=PRODUCT('AETHERIS','AetherisBody','',(#59));
+#61=PRODUCT_DEFINITION_FORMATION('','',#60);
+#62=PRODUCT_DEFINITION_CONTEXT('design',#58,'design');
+#63=PRODUCT_DEFINITION('','',#61,#62);
+#64=PRODUCT_DEFINITION_SHAPE('','',#63);
+#65=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.));
+#66=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
+#67=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT());
+#68=(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNIT_ASSIGNED_CONTEXT((#65,#66,#67))REPRESENTATION_CONTEXT('3','3D'));
+#69=SHAPE_REPRESENTATION('AetherisBody',(#57),#68);
+#70=SHAPE_DEFINITION_REPRESENTATION(#64,#69);
+ENDSEC;
+END-ISO-10303-21;
diff --git a/testdata/firmament/fixtures/m10e-invalid-cone-bottom-radius-non-positive.firmament b/testdata/firmament/fixtures/m10e-invalid-cone-bottom-radius-non-positive.firmament
new file mode 100644
index 00000000..cec152b9
--- /dev/null
+++ b/testdata/firmament/fixtures/m10e-invalid-cone-bottom-radius-non-positive.firmament
@@ -0,0 +1,14 @@
+firmament:
+ version: 1
+
+model:
+ name: cone_invalid_bottom_radius
+ units: mm
+
+ops[1]:
+ -
+ op: cone
+ id: frustum1
+ bottom_radius: 0
+ top_radius: 3
+ height: 20
diff --git a/testdata/firmament/fixtures/m10e-invalid-cone-equal-radii.firmament b/testdata/firmament/fixtures/m10e-invalid-cone-equal-radii.firmament
new file mode 100644
index 00000000..dd281ae9
--- /dev/null
+++ b/testdata/firmament/fixtures/m10e-invalid-cone-equal-radii.firmament
@@ -0,0 +1,14 @@
+firmament:
+ version: 1
+
+model:
+ name: cone_invalid_equal_radii
+ units: mm
+
+ops[1]:
+ -
+ op: cone
+ id: frustum1
+ bottom_radius: 8
+ top_radius: 8
+ height: 20
diff --git a/testdata/firmament/fixtures/m10e-invalid-cone-height-non-positive.firmament b/testdata/firmament/fixtures/m10e-invalid-cone-height-non-positive.firmament
new file mode 100644
index 00000000..40dd3e91
--- /dev/null
+++ b/testdata/firmament/fixtures/m10e-invalid-cone-height-non-positive.firmament
@@ -0,0 +1,14 @@
+firmament:
+ version: 1
+
+model:
+ name: cone_invalid_height
+ units: mm
+
+ops[1]:
+ -
+ op: cone
+ id: frustum1
+ bottom_radius: 8
+ top_radius: 3
+ height: 0
diff --git a/testdata/firmament/fixtures/m10e-invalid-cone-top-radius-non-positive.firmament b/testdata/firmament/fixtures/m10e-invalid-cone-top-radius-non-positive.firmament
new file mode 100644
index 00000000..d6e863f2
--- /dev/null
+++ b/testdata/firmament/fixtures/m10e-invalid-cone-top-radius-non-positive.firmament
@@ -0,0 +1,14 @@
+firmament:
+ version: 1
+
+model:
+ name: cone_invalid_top_radius
+ units: mm
+
+ops[1]:
+ -
+ op: cone
+ id: frustum1
+ bottom_radius: 8
+ top_radius: -1
+ height: 20
diff --git a/testdata/firmament/fixtures/m10e-valid-cone-exec.firmament b/testdata/firmament/fixtures/m10e-valid-cone-exec.firmament
new file mode 100644
index 00000000..9fced989
--- /dev/null
+++ b/testdata/firmament/fixtures/m10e-valid-cone-exec.firmament
@@ -0,0 +1,14 @@
+firmament:
+ version: 1
+
+model:
+ name: cone_exec
+ units: mm
+
+ops[1]:
+ -
+ op: cone
+ id: frustum1
+ bottom_radius: 8
+ top_radius: 3
+ height: 20
diff --git a/testdata/firmament/fixtures/m10e-valid-cone-selector-contract.firmament b/testdata/firmament/fixtures/m10e-valid-cone-selector-contract.firmament
new file mode 100644
index 00000000..75d78566
--- /dev/null
+++ b/testdata/firmament/fixtures/m10e-valid-cone-selector-contract.firmament
@@ -0,0 +1,44 @@
+firmament:
+ version: 1
+
+model:
+ name: cone_selector_contract
+ units: mm
+
+ops[7]:
+ -
+ op: cone
+ id: frustum1
+ bottom_radius: 8
+ top_radius: 3
+ height: 20
+
+ -
+ op: expect_selectable
+ target: frustum1.bottom_face
+ count: 1
+
+ -
+ op: expect_selectable
+ target: frustum1.top_face
+ count: 1
+
+ -
+ op: expect_selectable
+ target: frustum1.side_face
+ count: 1
+
+ -
+ op: expect_selectable
+ target: frustum1.circular_edges
+ count: 2
+
+ -
+ op: expect_selectable
+ target: frustum1.edges
+ count: 3
+
+ -
+ op: expect_selectable
+ target: frustum1.vertices
+ count: 4