Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Add pointed cone support to Firmament cone primitive

Yuechen Lid09ae59d80f6
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs
index 53736f7f..e601c6a5 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentBuildAndExportTests.cs
@@ -53,6 +53,18 @@ public sealed class FirmamentBuildAndExportTests
"cone");
}
+ [Fact]
+ public void Run_ConePointedTopZeroExample_Writes_Default_Export_Artifact()
+ {
+ AssertExampleBuildAndExport(
+ "testdata/firmament/examples/cone_pointed_top_zero.firmament",
+ "cone_pointed_top_zero.step",
+ "pointed1",
+ 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 a88929d0..5ca920c7 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentExamplePackSmokeTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentExamplePackSmokeTests.cs
@@ -9,6 +9,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/cone_pointed_top_zero.firmament",
"testdata/firmament/examples/sphere_basic.firmament",
"testdata/firmament/examples/box_with_hole.firmament",
"testdata/firmament/examples/placed_primitive.firmament",
@@ -33,6 +34,7 @@ public sealed class FirmamentExamplePackSmokeTests
[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/cone_pointed_top_zero.firmament", "pointed1", 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 665901aa..d1a70aa6 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveExecutionTests.cs
@@ -61,14 +61,82 @@ public sealed class FirmamentPrimitiveExecutionTests
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));
+ var sideFace = Assert.Single(executed.Body.Topology.Faces, face =>
+ {
+ executed.Body.TryGetFaceSurfaceGeometry(face.Id, out var surface);
+ return surface!.Kind == Aetheris.Kernel.Core.Geometry.SurfaceGeometryKind.Cone;
+ });
+ Assert.True(executed.Body.TryGetFaceSurfaceGeometry(sideFace.Id, 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);
+ var planarFaces = executed.Body.Topology.Faces
+ .Where(face =>
+ {
+ executed.Body.TryGetFaceSurfaceGeometry(face.Id, out var surface);
+ return surface!.Kind == Aetheris.Kernel.Core.Geometry.SurfaceGeometryKind.Plane;
+ })
+ .Select(face =>
+ {
+ executed.Body.TryGetFaceSurfaceGeometry(face.Id, out var surface);
+ return surface!.Plane!.Value;
+ })
+ .OrderBy(plane => plane.Origin.Z)
+ .ToArray();
+ Assert.Equal(2, planarFaces.Length);
+ Assert.Equal(new Point3D(0d, 0d, 0d), planarFaces[0].Origin);
+ Assert.Equal(new Point3D(0d, 0d, 20d), planarFaces[1].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_PointedCone_With_TopRadiusZero_Into_Truthful_Topology()
+ {
+ var result = CompileFixture("testdata/firmament/fixtures/m10f2-valid-cone-pointed-top-zero-exec.firmament");
+
+ Assert.True(result.Compilation.IsSuccess);
+ var executed = Assert.Single(result.Compilation.Value.PrimitiveExecutionResult!.ExecutedPrimitives);
+ Assert.Equal("pointed_top", executed.FeatureId);
+ Assert.Equal(FirmamentLoweredPrimitiveKind.Cone, executed.Kind);
+ Assert.Equal(2, executed.Body.Topology.Faces.Count());
+ Assert.Equal(2, executed.Body.Topology.Edges.Count());
+ Assert.Equal(3, executed.Body.Topology.Vertices.Count());
+
+ Assert.Equal(1, executed.Body.Topology.Faces.Count(face =>
+ {
+ executed.Body.TryGetFaceSurfaceGeometry(face.Id, out var surface);
+ return surface!.Kind == Aetheris.Kernel.Core.Geometry.SurfaceGeometryKind.Cone;
+ }));
+ Assert.Equal(1, executed.Body.Topology.Faces.Count(face =>
+ {
+ executed.Body.TryGetFaceSurfaceGeometry(face.Id, out var surface);
+ return surface!.Kind == Aetheris.Kernel.Core.Geometry.SurfaceGeometryKind.Plane;
+ }));
+ Assert.Equal(1, executed.Body.Topology.Edges.Count(edge =>
+ {
+ executed.Body.TryGetEdgeCurveGeometry(edge.Id, out var curve);
+ return curve!.Kind == Aetheris.Kernel.Core.Geometry.CurveGeometryKind.Circle3;
+ }));
+ }
+
+ [Fact]
+ public void Compile_Executes_PointedCone_With_BottomRadiusZero_Into_Truthful_Topology()
+ {
+ var result = CompileFixture("testdata/firmament/fixtures/m10f2-valid-cone-pointed-bottom-zero-exec.firmament");
+
+ Assert.True(result.Compilation.IsSuccess);
+ var executed = Assert.Single(result.Compilation.Value.PrimitiveExecutionResult!.ExecutedPrimitives);
+ Assert.Equal("pointed_bottom", executed.FeatureId);
+ Assert.Equal(FirmamentLoweredPrimitiveKind.Cone, executed.Kind);
+ Assert.Equal(2, executed.Body.Topology.Faces.Count());
+ Assert.Equal(2, executed.Body.Topology.Edges.Count());
+ Assert.Equal(3, executed.Body.Topology.Vertices.Count());
+
+ var planarFace = Assert.Single(executed.Body.Topology.Faces, face =>
+ {
+ executed.Body.TryGetFaceSurfaceGeometry(face.Id, out var surface);
+ return surface!.Kind == Aetheris.Kernel.Core.Geometry.SurfaceGeometryKind.Plane;
+ });
+ executed.Body.TryGetFaceSurfaceGeometry(planarFace.Id, out var planeSurface);
+ Assert.Equal(20d, planeSurface!.Plane!.Value.Origin.Z, 9);
}
[Fact]
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveLoweringTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveLoweringTests.cs
index e7525ecd..1ddfab75 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveLoweringTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentPrimitiveLoweringTests.cs
@@ -97,6 +97,37 @@ public sealed class FirmamentPrimitiveLoweringTests
Assert.Equal(20, parameters.Height);
}
+ [Fact]
+ public void Compile_Lowers_PointedCone_Primitive_Without_Forking_The_Cone_Surface()
+ {
+ var result = Compile(
+ """
+ firmament:
+ version: 1
+
+ model:
+ name: demo
+ units: mm
+
+ ops[1]:
+ -
+ op: cone
+ id: pointed1
+ bottom_radius: 8
+ top_radius: 0
+ 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("pointed1", primitive.FeatureId);
+ Assert.Equal(FirmamentLoweredPrimitiveKind.Cone, primitive.Kind);
+ Assert.Equal(8, parameters.BottomRadius);
+ Assert.Equal(0, 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 b507d65f..99fc41f5 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs
@@ -670,18 +670,18 @@ public sealed class FirmamentScaffoldTests
"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() =>
+ public void Compiler_Rejects_Cone_NegativeBottomRadius() =>
AssertSingleValidationError(
- FirmamentCorpusHarness.ReadFixtureText("testdata/firmament/fixtures/m10e-invalid-cone-bottom-radius-non-positive.firmament"),
+ FirmamentCorpusHarness.ReadFixtureText("testdata/firmament/fixtures/m10f2-invalid-cone-bottom-radius-negative.firmament"),
FirmamentDiagnosticCodes.PrimitiveInvalidFieldValue,
- "Primitive op 'cone' at index 0 has invalid field 'bottom_radius' value; expected a numeric value greater than 0.");
+ "Primitive op 'cone' at index 0 has invalid field 'bottom_radius' value; expected a numeric value greater than or equal to 0.");
[Fact]
- public void Compiler_Rejects_Cone_NonPositiveTopRadius() =>
+ public void Compiler_Rejects_Cone_NegativeTopRadius() =>
AssertSingleValidationError(
- FirmamentCorpusHarness.ReadFixtureText("testdata/firmament/fixtures/m10e-invalid-cone-top-radius-non-positive.firmament"),
+ FirmamentCorpusHarness.ReadFixtureText("testdata/firmament/fixtures/m10f2-invalid-cone-top-radius-negative.firmament"),
FirmamentDiagnosticCodes.PrimitiveInvalidFieldValue,
- "Primitive op 'cone' at index 0 has invalid field 'top_radius' value; expected a numeric value greater than 0.");
+ "Primitive op 'cone' at index 0 has invalid field 'top_radius' value; expected a numeric value greater than or equal to 0.");
[Fact]
public void Compiler_Rejects_Cone_NonPositiveHeight() =>
@@ -691,11 +691,18 @@ public sealed class FirmamentScaffoldTests
"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() =>
+ public void Compiler_Rejects_Cone_EqualPositiveRadii() =>
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'.");
+ "Primitive op 'cone' at index 0 has invalid field 'top_radius' value; expected a numeric value different from 'bottom_radius' when both cone radii are greater than 0.");
+
+ [Fact]
+ public void Compiler_Rejects_Cone_BothRadiiZero() =>
+ AssertSingleValidationError(
+ FirmamentCorpusHarness.ReadFixtureText("testdata/firmament/fixtures/m10f2-invalid-cone-both-radii-zero.firmament"),
+ FirmamentDiagnosticCodes.PrimitiveInvalidFieldValue,
+ "Primitive op 'cone' at index 0 has invalid field 'top_radius' value; expected at least one of 'bottom_radius' or 'top_radius' to be greater than 0.");
[Fact]
public void Compiler_Rejects_Sphere_MissingRadius() =>
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.cs
index 39332f8a..fa8b8580 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentStepExporterTests.cs
@@ -147,6 +147,27 @@ public sealed class FirmamentStepExporterTests
Assert.Equal(first.Value.StepText, File.ReadAllText(artifactPath));
}
+ [Fact]
+ public void Export_PointedConeExample_Exports_Successfully_With_Metadata_Deterministic_Text_And_Persisted_Artifact()
+ {
+ var first = ExportFixture("testdata/firmament/examples/cone_pointed_top_zero.firmament");
+ var second = ExportFixture("testdata/firmament/examples/cone_pointed_top_zero.firmament");
+
+ Assert.True(first.IsSuccess);
+ Assert.True(second.IsSuccess);
+ Assert.Equal("pointed1", 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("m10f2-pointed-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 6c114fd4..a70213ec 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentValidationExecutionTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentValidationExecutionTests.cs
@@ -123,7 +123,7 @@ ops[7]:
}
[Fact]
- public void Compile_Executes_Cone_Selector_Contract_With_Truthful_Runtime_Counts()
+ public void Compile_Executes_FrustumCone_Selector_Contract_With_Truthful_Runtime_Counts()
{
var result = CompileFixture("testdata/firmament/fixtures/m10e-valid-cone-selector-contract.firmament");
@@ -137,6 +137,69 @@ ops[7]:
});
}
+ [Fact]
+ public void Compile_Executes_PointedCone_TopRadiusZero_Selector_Contract_With_Truthful_Runtime_Counts()
+ {
+ var result = CompileFixture("testdata/firmament/fixtures/m10f2-valid-cone-pointed-top-zero-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_PointedCone_BottomRadiusZero_Selector_Contract_With_Truthful_Runtime_Counts()
+ {
+ var result = CompileFixture("testdata/firmament/fixtures/m10f2-valid-cone-pointed-bottom-zero-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_PointedCone_MissingCap_Selector_ExpectExists_Fails_Truthfully()
+ {
+ const string source = """
+firmament:
+ version: 1
+
+model:
+ name: pointed_missing_cap_selector
+ units: mm
+
+ops[2]:
+ -
+ op: cone
+ id: pointed
+ bottom_radius: 8
+ top_radius: 0
+ height: 20
+
+ -
+ op: expect_exists
+ target: pointed.top_face
+""";
+
+ var result = Compile(source);
+
+ Assert.True(result.Compilation.IsSuccess);
+ var validation = Assert.Single(result.Compilation.Value.ValidationExecutionResult!.Validations);
+ Assert.True(validation.IsExecuted);
+ Assert.False(validation.IsSuccess);
+ Assert.Equal("Selector 'pointed.top_face' resolved to no topology elements.", validation.Reason);
+ }
+
[Fact]
public void Compile_Executes_Sphere_Selector_Contract_With_Truthful_Runtime_Counts()
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentValidationRequiredFieldValidationTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentValidationRequiredFieldValidationTests.cs
index e4052ab2..61de5421 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentValidationRequiredFieldValidationTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentValidationRequiredFieldValidationTests.cs
@@ -188,10 +188,35 @@ public sealed class FirmamentValidationRequiredFieldValidationTests
count: 1.5
""",
FirmamentDiagnosticCodes.ValidationInvalidFieldValue,
- "Validation op 'expect_selectable' at index 0 has invalid field 'count' value; expected an integer-valued number greater than 0.");
+ "Validation op 'expect_selectable' at index 0 has invalid field 'count' value; expected an integer-valued number greater than or equal to 0.");
[Fact]
- public void Compiler_Rejects_ExpectSelectable_NonPositiveCount() =>
+ public void Compiler_Accepts_ExpectSelectable_ZeroCount_For_Truthful_Empty_Selector_Contracts() =>
+ AssertValidationSuccess(
+ """
+ firmament:
+ version: 1
+
+ model:
+ name: demo
+ units: mm
+
+ ops[2]:
+ -
+ op: cone
+ id: pointed
+ bottom_radius: 8
+ top_radius: 0
+ height: 20
+
+ -
+ op: expect_selectable
+ target: pointed.top_face
+ count: 0
+ """);
+
+ [Fact]
+ public void Compiler_Rejects_ExpectSelectable_NegativeCount() =>
AssertValidationFailure(
"""
firmament:
@@ -205,10 +230,10 @@ public sealed class FirmamentValidationRequiredFieldValidationTests
-
op: expect_selectable
target: base
- count: 0
+ count: -1
""",
FirmamentDiagnosticCodes.ValidationInvalidFieldValue,
- "Validation op 'expect_selectable' at index 0 has invalid field 'count' value; expected an integer-valued number greater than 0.");
+ "Validation op 'expect_selectable' at index 0 has invalid field 'count' value; expected an integer-valued number greater than or equal to 0.");
[Fact]
public void Compiler_Rejects_ExpectSelectable_MissingCount_Deterministically()
diff --git a/Aetheris.Kernel.Firmament/Execution/FirmamentPlacementResolver.cs b/Aetheris.Kernel.Firmament/Execution/FirmamentPlacementResolver.cs
index c7640e1a..12752342 100644
--- a/Aetheris.Kernel.Firmament/Execution/FirmamentPlacementResolver.cs
+++ b/Aetheris.Kernel.Firmament/Execution/FirmamentPlacementResolver.cs
@@ -66,20 +66,30 @@ internal static class FirmamentPlacementResolver
private static KernelResult<Point3D> ResolveFaceAnchor(BrepBody body, string port)
{
var facePoints = body.Topology.Faces
- .Select(f => new { Face = f, Point = GetFaceRepresentativePoint(body, f.Id) })
- .Where(x => x.Point is not null)
- .Select(x => (x.Face, x.Point!.Value))
+ .Select(f => new { Face = f, Surface = body.TryGetFaceSurfaceGeometry(f.Id, out var surface) ? surface : null, Point = GetFaceRepresentativePoint(body, f.Id) })
+ .Where(x => x.Surface is not null && x.Point is not null)
+ .Select(x => (x.Face, Surface: x.Surface!, Point: x.Point!.Value))
.ToList();
if (facePoints.Count == 0) return Failure("Placement selector resolved empty face set at runtime.");
IEnumerable<Point3D> selected = port switch
{
- "top_face" => [facePoints.OrderByDescending(x => x.Item2.Z).First().Item2],
- "bottom_face" => [facePoints.OrderBy(x => x.Item2.Z).First().Item2],
- "side_face" => [facePoints.OrderBy(x => Math.Abs(x.Item2.Z)).First().Item2],
- "side_faces" => facePoints.OrderByDescending(x => Math.Abs(x.Item2.Z)).Skip(2).Select(x => x.Item2),
- "surface" => [facePoints.First().Item2],
- _ => facePoints.Select(x => x.Item2)
+ "top_face" => facePoints
+ .Where(x => x.Surface.Kind == SurfaceGeometryKind.Plane && x.Surface.Plane!.Value.Normal.ToVector().Z > 0.5d)
+ .Select(x => x.Point),
+ "bottom_face" => facePoints
+ .Where(x => x.Surface.Kind == SurfaceGeometryKind.Plane && x.Surface.Plane!.Value.Normal.ToVector().Z < -0.5d)
+ .Select(x => x.Point),
+ "side_face" => facePoints
+ .Where(x => x.Surface.Kind is SurfaceGeometryKind.Cylinder or SurfaceGeometryKind.Cone)
+ .Select(x => x.Point),
+ "side_faces" => facePoints
+ .Where(x => x.Surface.Kind == SurfaceGeometryKind.Plane && Math.Abs(x.Surface.Plane!.Value.Normal.ToVector().Z) <= 0.5d)
+ .Select(x => x.Point),
+ "surface" => facePoints
+ .Where(x => x.Surface.Kind == SurfaceGeometryKind.Sphere)
+ .Select(x => x.Point),
+ _ => facePoints.Select(x => x.Point)
};
var pts = selected.ToArray();
@@ -185,7 +195,7 @@ 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)
+ if (f is 2 or 3)
{
foreach (var face in body.Topology.Faces)
{
diff --git a/Aetheris.Kernel.Firmament/Execution/FirmamentSelectorResolver.cs b/Aetheris.Kernel.Firmament/Execution/FirmamentSelectorResolver.cs
index a24cd6b8..f44c88ee 100644
--- a/Aetheris.Kernel.Firmament/Execution/FirmamentSelectorResolver.cs
+++ b/Aetheris.Kernel.Firmament/Execution/FirmamentSelectorResolver.cs
@@ -127,7 +127,9 @@ internal static class FirmamentSelectorResolver
private static bool LooksLikeCone(BrepBody body)
{
- if (body.Topology.Faces.Count() != 3 || body.Topology.Edges.Count() != 3)
+ var faceCount = body.Topology.Faces.Count();
+ var edgeCount = body.Topology.Edges.Count();
+ if ((faceCount != 3 || edgeCount != 3) && (faceCount != 2 || edgeCount != 2))
{
return false;
}
@@ -155,7 +157,7 @@ internal static class FirmamentSelectorResolver
}
}
- return conicalFaces == 1 && planarFaces == 2;
+ return conicalFaces == 1 && (planarFaces == 1 || planarFaces == 2);
}
private static int CountFaces(BrepBody body, Func<SurfaceGeometry, bool> predicate)
diff --git a/Aetheris.Kernel.Firmament/Validation/FirmamentPrimitiveRequiredFieldValidator.cs b/Aetheris.Kernel.Firmament/Validation/FirmamentPrimitiveRequiredFieldValidator.cs
index 9ae90a52..90fcc208 100644
--- a/Aetheris.Kernel.Firmament/Validation/FirmamentPrimitiveRequiredFieldValidator.cs
+++ b/Aetheris.Kernel.Firmament/Validation/FirmamentPrimitiveRequiredFieldValidator.cs
@@ -136,13 +136,13 @@ internal static class FirmamentPrimitiveRequiredFieldValidator
return KernelResult<bool>.Failure([missingOrTypeDiagnostic!]);
}
- var bottomRadiusResult = ValidatePositiveNumericField(entry, "bottom_radius", opIndex);
+ var bottomRadiusResult = ValidateNonNegativeNumericField(entry, "bottom_radius", opIndex);
if (!bottomRadiusResult.IsSuccess)
{
return bottomRadiusResult;
}
- var topRadiusResult = ValidatePositiveNumericField(entry, "top_radius", opIndex);
+ var topRadiusResult = ValidateNonNegativeNumericField(entry, "top_radius", opIndex);
if (!topRadiusResult.IsSuccess)
{
return topRadiusResult;
@@ -156,9 +156,14 @@ internal static class FirmamentPrimitiveRequiredFieldValidator
var bottomRadius = ParseRequiredNumeric(entry.RawFields["bottom_radius"]);
var topRadius = ParseRequiredNumeric(entry.RawFields["top_radius"]);
- if (double.Abs(bottomRadius - topRadius) <= 1e-12d)
+ if (bottomRadius <= 1e-12d && topRadius <= 1e-12d)
{
- return InvalidFieldValue("top_radius", opIndex, entry.OpName, "expected a numeric value different from 'bottom_radius'");
+ return InvalidFieldValue("top_radius", opIndex, entry.OpName, "expected at least one of 'bottom_radius' or 'top_radius' to be greater than 0");
+ }
+
+ if (bottomRadius > 1e-12d && topRadius > 1e-12d && double.Abs(bottomRadius - topRadius) <= 1e-12d)
+ {
+ return InvalidFieldValue("top_radius", opIndex, entry.OpName, "expected a numeric value different from 'bottom_radius' when both cone radii are greater than 0");
}
var placementResult = ValidatePlacement(entry, opIndex);
@@ -337,6 +342,26 @@ internal static class FirmamentPrimitiveRequiredFieldValidator
return KernelResult<bool>.Success(true);
}
+ private static KernelResult<bool> ValidateNonNegativeNumericField(FirmamentParsedOpEntry entry, string fieldName, int opIndex)
+ {
+ if (!entry.RawFields.TryGetValue(fieldName, out var raw) || string.IsNullOrWhiteSpace(raw))
+ {
+ return MissingField(fieldName, opIndex, entry.OpName);
+ }
+
+ if (!TryParseNumeric(raw, out var value))
+ {
+ return InvalidFieldType(fieldName, opIndex, entry.OpName, "expected a numeric scalar value");
+ }
+
+ if (value < 0)
+ {
+ return InvalidFieldValue(fieldName, opIndex, entry.OpName, "expected a numeric value greater than or equal to 0");
+ }
+
+ return KernelResult<bool>.Success(true);
+ }
+
private static bool LooksLikeStructuredValue(string raw)
{
var trimmed = raw.Trim();
diff --git a/Aetheris.Kernel.Firmament/Validation/FirmamentValidationRequiredFieldValidator.cs b/Aetheris.Kernel.Firmament/Validation/FirmamentValidationRequiredFieldValidator.cs
index 68bdaf96..faa40adf 100644
--- a/Aetheris.Kernel.Firmament/Validation/FirmamentValidationRequiredFieldValidator.cs
+++ b/Aetheris.Kernel.Firmament/Validation/FirmamentValidationRequiredFieldValidator.cs
@@ -76,12 +76,12 @@ internal static class FirmamentValidationRequiredFieldValidator
if (Math.Abs(countValue - Math.Round(countValue)) > 0)
{
- return InvalidFieldValue("count", opIndex, entry.OpName, "expected an integer-valued number greater than 0");
+ return InvalidFieldValue("count", opIndex, entry.OpName, "expected an integer-valued number greater than or equal to 0");
}
- if (countValue <= 0)
+ if (countValue < 0)
{
- return InvalidFieldValue("count", opIndex, entry.OpName, "expected an integer-valued number greater than 0");
+ return InvalidFieldValue("count", opIndex, entry.OpName, "expected an integer-valued number greater than or equal to 0");
}
return KernelResult<bool>.Success(true);
diff --git a/docs/firmament-selectors.md b/docs/firmament-selectors.md
index 9ce856a6..9777dd81 100644
--- a/docs/firmament-selectors.md
+++ b/docs/firmament-selectors.md
@@ -41,6 +41,43 @@ Current verified primitive-body topology for `cylinder` is:
- `edges` = 3 total edges (2 circular + 1 seam)
- `vertices` = 4 total vertices
+#### `cone`
+
+Implemented selector surface for the v1 `cone` primitive remains:
+
+- `top_face` → `Face`, `One`
+- `bottom_face` → `Face`, `One`
+- `side_face` → `Face`, `One`
+- `circular_edges` → `EdgeSet`, `Many`
+- `edges` → `EdgeSet`, `Many`
+- `vertices` → `VertexSet`, `Many`
+
+Current verified primitive-body topology for `cone` is conditional on the radii:
+
+- frustum cone (`bottom_radius > 0`, `top_radius > 0`, unequal)
+ - `top_face` = 1 planar cap face
+ - `bottom_face` = 1 planar cap face
+ - `side_face` = 1 conical face
+ - `circular_edges` = 2 circular cap edges
+ - `edges` = 3 total edges (2 circular + 1 seam)
+ - `vertices` = 4 total vertices
+- pointed cone with `top_radius = 0`
+ - `top_face` = 0
+ - `bottom_face` = 1 planar cap face
+ - `side_face` = 1 conical face
+ - `circular_edges` = 1 circular base edge
+ - `edges` = 2 total edges (1 circular + 1 seam)
+ - `vertices` = 3 total vertices
+- pointed cone with `bottom_radius = 0`
+ - `top_face` = 1 planar cap face
+ - `bottom_face` = 0
+ - `side_face` = 1 conical face
+ - `circular_edges` = 1 circular base edge
+ - `edges` = 2 total edges (1 circular + 1 seam)
+ - `vertices` = 3 total vertices
+
+Selectors on the missing cap remain legal source ports for `cone`, but truthfully resolve to zero runtime topology elements in the pointed case.
+
#### `sphere`
- `surface` → `Face`, `One`
diff --git a/testdata/firmament/examples/README.md b/testdata/firmament/examples/README.md
index 33c1eb58..1b820316 100644
--- a/testdata/firmament/examples/README.md
+++ b/testdata/firmament/examples/README.md
@@ -5,6 +5,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`.
+- `cone_pointed_top_zero.firmament` — minimal single pointed-cone export example using the same v1 `cone` primitive with `top_radius: 0`; helper export path: `testdata/firmament/exports/cone_pointed_top_zero.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_pointed_top_zero.firmament b/testdata/firmament/examples/cone_pointed_top_zero.firmament
new file mode 100644
index 00000000..dc85da84
--- /dev/null
+++ b/testdata/firmament/examples/cone_pointed_top_zero.firmament
@@ -0,0 +1,14 @@
+firmament:
+ version: 1
+
+model:
+ name: cone_pointed_top_zero
+ units: mm
+
+ops[1]:
+ -
+ op: cone
+ id: pointed1
+ bottom_radius: 8
+ top_radius: 0
+ height: 20
diff --git a/testdata/firmament/exports/cone_frustum_basic.step b/testdata/firmament/exports/cone_frustum_basic.step
index 6c4ebe7e..23e4d2b7 100644
--- a/testdata/firmament/exports/cone_frustum_basic.step
+++ b/testdata/firmament/exports/cone_frustum_basic.step
@@ -5,62 +5,62 @@ FILE_NAME('aetheris_export.step','1970-01-01T00:00:00',('Aetheris'),('Aetheris')
FILE_SCHEMA(('AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF'));
ENDSEC;
DATA;
-#1=CARTESIAN_POINT($,(0,0,32));
+#1=CARTESIAN_POINT($,(0,0,0));
#2=DIRECTION($,(-0,-0,-1));
#3=DIRECTION($,(1,0,0));
#4=AXIS2_PLACEMENT_3D($,#1,#2,#3);
-#5=CONICAL_SURFACE($,#4,0,0.244978663126864);
+#5=PLANE($,#4);
#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);
+#8=CARTESIAN_POINT($,(0,0,0));
+#9=DIRECTION($,(0,0,1));
+#10=DIRECTION($,(1,0,0));
+#11=AXIS2_PLACEMENT_3D($,#8,#9,#10);
+#12=CIRCLE($,#11,8);
+#13=EDGE_CURVE($,#7,#7,#12,.T.);
+#14=ORIENTED_EDGE($,$,$,#13,.T.);
+#15=EDGE_LOOP($,(#14));
+#16=FACE_OUTER_BOUND('',#15,.T.);
+#17=ADVANCED_FACE('',(#16),#5,.T.);
#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));
+#22=PLANE($,#21);
+#23=CARTESIAN_POINT($,(3,0,20));
+#24=VERTEX_POINT($,#23);
+#25=CARTESIAN_POINT($,(0,0,20));
+#26=DIRECTION($,(0,0,1));
+#27=DIRECTION($,(1,0,0));
+#28=AXIS2_PLACEMENT_3D($,#25,#26,#27);
+#29=CIRCLE($,#28,3);
+#30=EDGE_CURVE($,#24,#24,#29,.T.);
+#31=ORIENTED_EDGE($,$,$,#30,.F.);
+#32=EDGE_LOOP($,(#31));
+#33=FACE_OUTER_BOUND('',#32,.T.);
+#34=ADVANCED_FACE('',(#33),#22,.T.);
+#35=CARTESIAN_POINT($,(0,0,32));
+#36=DIRECTION($,(-0,-0,-1));
+#37=DIRECTION($,(1,0,0));
+#38=AXIS2_PLACEMENT_3D($,#35,#36,#37);
+#39=CONICAL_SURFACE($,#38,0,0.244978663126864);
+#40=CARTESIAN_POINT($,(8,0,0));
+#41=VERTEX_POINT($,#40);
+#42=CARTESIAN_POINT($,(3,0,20));
+#43=VERTEX_POINT($,#42);
+#44=CARTESIAN_POINT($,(8,0,0));
+#45=DIRECTION($,(-0.242535625036333,0,0.970142500145332));
+#46=VECTOR($,#45,1);
+#47=LINE($,#44,#46);
+#48=EDGE_CURVE($,#41,#43,#47,.T.);
+#49=ORIENTED_EDGE($,$,$,#48,.T.);
+#50=ORIENTED_EDGE($,$,$,#30,.T.);
+#51=ORIENTED_EDGE($,$,$,#48,.F.);
+#52=ORIENTED_EDGE($,$,$,#13,.F.);
+#53=EDGE_LOOP($,(#49,#50,#51,#52));
#54=FACE_OUTER_BOUND('',#53,.T.);
-#55=ADVANCED_FACE('',(#54),#51,.T.);
-#56=CLOSED_SHELL($,(#37,#46,#55));
+#55=ADVANCED_FACE('',(#54),#39,.T.);
+#56=CLOSED_SHELL($,(#17,#34,#55));
#57=MANIFOLD_SOLID_BREP('AetherisBody',#56);
#58=APPLICATION_CONTEXT('mechanical design');
#59=PRODUCT_CONTEXT('',#58,'mechanical');
diff --git a/testdata/firmament/exports/cone_pointed_top_zero.step b/testdata/firmament/exports/cone_pointed_top_zero.step
new file mode 100644
index 00000000..cf09e755
--- /dev/null
+++ b/testdata/firmament/exports/cone_pointed_top_zero.step
@@ -0,0 +1,61 @@
+ISO-10303-21;
+HEADER;
+FILE_DESCRIPTION(('Aetheris AP242 subset export'),'2;1');
+FILE_NAME('aetheris_export.step','1970-01-01T00:00:00',('Aetheris'),('Aetheris'),'Aetheris.Kernel','Aetheris.Kernel','');
+FILE_SCHEMA(('AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF'));
+ENDSEC;
+DATA;
+#1=CARTESIAN_POINT($,(0,0,0));
+#2=DIRECTION($,(-0,-0,-1));
+#3=DIRECTION($,(1,0,0));
+#4=AXIS2_PLACEMENT_3D($,#1,#2,#3);
+#5=PLANE($,#4);
+#6=CARTESIAN_POINT($,(8,0,0));
+#7=VERTEX_POINT($,#6);
+#8=CARTESIAN_POINT($,(0,0,0));
+#9=DIRECTION($,(0,0,1));
+#10=DIRECTION($,(1,0,0));
+#11=AXIS2_PLACEMENT_3D($,#8,#9,#10);
+#12=CIRCLE($,#11,8);
+#13=EDGE_CURVE($,#7,#7,#12,.T.);
+#14=ORIENTED_EDGE($,$,$,#13,.T.);
+#15=EDGE_LOOP($,(#14));
+#16=FACE_OUTER_BOUND('',#15,.T.);
+#17=ADVANCED_FACE('',(#16),#5,.T.);
+#18=CARTESIAN_POINT($,(0,0,20));
+#19=DIRECTION($,(-0,-0,-1));
+#20=DIRECTION($,(1,0,0));
+#21=AXIS2_PLACEMENT_3D($,#18,#19,#20);
+#22=CONICAL_SURFACE($,#21,0,0.380506377112365);
+#23=CARTESIAN_POINT($,(8,0,0));
+#24=VERTEX_POINT($,#23);
+#25=CARTESIAN_POINT($,(0.000000000000001,0,20));
+#26=VERTEX_POINT($,#25);
+#27=CARTESIAN_POINT($,(8,0,0));
+#28=DIRECTION($,(-0.371390676354104,0,0.928476690885259));
+#29=VECTOR($,#28,1);
+#30=LINE($,#27,#29);
+#31=EDGE_CURVE($,#24,#26,#30,.T.);
+#32=ORIENTED_EDGE($,$,$,#31,.T.);
+#33=ORIENTED_EDGE($,$,$,#31,.F.);
+#34=ORIENTED_EDGE($,$,$,#13,.F.);
+#35=EDGE_LOOP($,(#32,#33,#34));
+#36=FACE_OUTER_BOUND('',#35,.T.);
+#37=ADVANCED_FACE('',(#36),#22,.T.);
+#38=CLOSED_SHELL($,(#17,#37));
+#39=MANIFOLD_SOLID_BREP('AetherisBody',#38);
+#40=APPLICATION_CONTEXT('mechanical design');
+#41=PRODUCT_CONTEXT('',#40,'mechanical');
+#42=PRODUCT('AETHERIS','AetherisBody','',(#41));
+#43=PRODUCT_DEFINITION_FORMATION('','',#42);
+#44=PRODUCT_DEFINITION_CONTEXT('design',#40,'design');
+#45=PRODUCT_DEFINITION('','',#43,#44);
+#46=PRODUCT_DEFINITION_SHAPE('','',#45);
+#47=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.));
+#48=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
+#49=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT());
+#50=(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNIT_ASSIGNED_CONTEXT((#47,#48,#49))REPRESENTATION_CONTEXT('3','3D'));
+#51=SHAPE_REPRESENTATION('AetherisBody',(#39),#50);
+#52=SHAPE_DEFINITION_REPRESENTATION(#46,#51);
+ENDSEC;
+END-ISO-10303-21;
diff --git a/testdata/firmament/exports/m10e-cone.step b/testdata/firmament/exports/m10e-cone.step
index 6c4ebe7e..23e4d2b7 100644
--- a/testdata/firmament/exports/m10e-cone.step
+++ b/testdata/firmament/exports/m10e-cone.step
@@ -5,62 +5,62 @@ FILE_NAME('aetheris_export.step','1970-01-01T00:00:00',('Aetheris'),('Aetheris')
FILE_SCHEMA(('AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF'));
ENDSEC;
DATA;
-#1=CARTESIAN_POINT($,(0,0,32));
+#1=CARTESIAN_POINT($,(0,0,0));
#2=DIRECTION($,(-0,-0,-1));
#3=DIRECTION($,(1,0,0));
#4=AXIS2_PLACEMENT_3D($,#1,#2,#3);
-#5=CONICAL_SURFACE($,#4,0,0.244978663126864);
+#5=PLANE($,#4);
#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);
+#8=CARTESIAN_POINT($,(0,0,0));
+#9=DIRECTION($,(0,0,1));
+#10=DIRECTION($,(1,0,0));
+#11=AXIS2_PLACEMENT_3D($,#8,#9,#10);
+#12=CIRCLE($,#11,8);
+#13=EDGE_CURVE($,#7,#7,#12,.T.);
+#14=ORIENTED_EDGE($,$,$,#13,.T.);
+#15=EDGE_LOOP($,(#14));
+#16=FACE_OUTER_BOUND('',#15,.T.);
+#17=ADVANCED_FACE('',(#16),#5,.T.);
#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));
+#22=PLANE($,#21);
+#23=CARTESIAN_POINT($,(3,0,20));
+#24=VERTEX_POINT($,#23);
+#25=CARTESIAN_POINT($,(0,0,20));
+#26=DIRECTION($,(0,0,1));
+#27=DIRECTION($,(1,0,0));
+#28=AXIS2_PLACEMENT_3D($,#25,#26,#27);
+#29=CIRCLE($,#28,3);
+#30=EDGE_CURVE($,#24,#24,#29,.T.);
+#31=ORIENTED_EDGE($,$,$,#30,.F.);
+#32=EDGE_LOOP($,(#31));
+#33=FACE_OUTER_BOUND('',#32,.T.);
+#34=ADVANCED_FACE('',(#33),#22,.T.);
+#35=CARTESIAN_POINT($,(0,0,32));
+#36=DIRECTION($,(-0,-0,-1));
+#37=DIRECTION($,(1,0,0));
+#38=AXIS2_PLACEMENT_3D($,#35,#36,#37);
+#39=CONICAL_SURFACE($,#38,0,0.244978663126864);
+#40=CARTESIAN_POINT($,(8,0,0));
+#41=VERTEX_POINT($,#40);
+#42=CARTESIAN_POINT($,(3,0,20));
+#43=VERTEX_POINT($,#42);
+#44=CARTESIAN_POINT($,(8,0,0));
+#45=DIRECTION($,(-0.242535625036333,0,0.970142500145332));
+#46=VECTOR($,#45,1);
+#47=LINE($,#44,#46);
+#48=EDGE_CURVE($,#41,#43,#47,.T.);
+#49=ORIENTED_EDGE($,$,$,#48,.T.);
+#50=ORIENTED_EDGE($,$,$,#30,.T.);
+#51=ORIENTED_EDGE($,$,$,#48,.F.);
+#52=ORIENTED_EDGE($,$,$,#13,.F.);
+#53=EDGE_LOOP($,(#49,#50,#51,#52));
#54=FACE_OUTER_BOUND('',#53,.T.);
-#55=ADVANCED_FACE('',(#54),#51,.T.);
-#56=CLOSED_SHELL($,(#37,#46,#55));
+#55=ADVANCED_FACE('',(#54),#39,.T.);
+#56=CLOSED_SHELL($,(#17,#34,#55));
#57=MANIFOLD_SOLID_BREP('AetherisBody',#56);
#58=APPLICATION_CONTEXT('mechanical design');
#59=PRODUCT_CONTEXT('',#58,'mechanical');
diff --git a/testdata/firmament/exports/m10f2-pointed-cone.step b/testdata/firmament/exports/m10f2-pointed-cone.step
new file mode 100644
index 00000000..cf09e755
--- /dev/null
+++ b/testdata/firmament/exports/m10f2-pointed-cone.step
@@ -0,0 +1,61 @@
+ISO-10303-21;
+HEADER;
+FILE_DESCRIPTION(('Aetheris AP242 subset export'),'2;1');
+FILE_NAME('aetheris_export.step','1970-01-01T00:00:00',('Aetheris'),('Aetheris'),'Aetheris.Kernel','Aetheris.Kernel','');
+FILE_SCHEMA(('AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF'));
+ENDSEC;
+DATA;
+#1=CARTESIAN_POINT($,(0,0,0));
+#2=DIRECTION($,(-0,-0,-1));
+#3=DIRECTION($,(1,0,0));
+#4=AXIS2_PLACEMENT_3D($,#1,#2,#3);
+#5=PLANE($,#4);
+#6=CARTESIAN_POINT($,(8,0,0));
+#7=VERTEX_POINT($,#6);
+#8=CARTESIAN_POINT($,(0,0,0));
+#9=DIRECTION($,(0,0,1));
+#10=DIRECTION($,(1,0,0));
+#11=AXIS2_PLACEMENT_3D($,#8,#9,#10);
+#12=CIRCLE($,#11,8);
+#13=EDGE_CURVE($,#7,#7,#12,.T.);
+#14=ORIENTED_EDGE($,$,$,#13,.T.);
+#15=EDGE_LOOP($,(#14));
+#16=FACE_OUTER_BOUND('',#15,.T.);
+#17=ADVANCED_FACE('',(#16),#5,.T.);
+#18=CARTESIAN_POINT($,(0,0,20));
+#19=DIRECTION($,(-0,-0,-1));
+#20=DIRECTION($,(1,0,0));
+#21=AXIS2_PLACEMENT_3D($,#18,#19,#20);
+#22=CONICAL_SURFACE($,#21,0,0.380506377112365);
+#23=CARTESIAN_POINT($,(8,0,0));
+#24=VERTEX_POINT($,#23);
+#25=CARTESIAN_POINT($,(0.000000000000001,0,20));
+#26=VERTEX_POINT($,#25);
+#27=CARTESIAN_POINT($,(8,0,0));
+#28=DIRECTION($,(-0.371390676354104,0,0.928476690885259));
+#29=VECTOR($,#28,1);
+#30=LINE($,#27,#29);
+#31=EDGE_CURVE($,#24,#26,#30,.T.);
+#32=ORIENTED_EDGE($,$,$,#31,.T.);
+#33=ORIENTED_EDGE($,$,$,#31,.F.);
+#34=ORIENTED_EDGE($,$,$,#13,.F.);
+#35=EDGE_LOOP($,(#32,#33,#34));
+#36=FACE_OUTER_BOUND('',#35,.T.);
+#37=ADVANCED_FACE('',(#36),#22,.T.);
+#38=CLOSED_SHELL($,(#17,#37));
+#39=MANIFOLD_SOLID_BREP('AetherisBody',#38);
+#40=APPLICATION_CONTEXT('mechanical design');
+#41=PRODUCT_CONTEXT('',#40,'mechanical');
+#42=PRODUCT('AETHERIS','AetherisBody','',(#41));
+#43=PRODUCT_DEFINITION_FORMATION('','',#42);
+#44=PRODUCT_DEFINITION_CONTEXT('design',#40,'design');
+#45=PRODUCT_DEFINITION('','',#43,#44);
+#46=PRODUCT_DEFINITION_SHAPE('','',#45);
+#47=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.));
+#48=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
+#49=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT());
+#50=(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNIT_ASSIGNED_CONTEXT((#47,#48,#49))REPRESENTATION_CONTEXT('3','3D'));
+#51=SHAPE_REPRESENTATION('AetherisBody',(#39),#50);
+#52=SHAPE_DEFINITION_REPRESENTATION(#46,#51);
+ENDSEC;
+END-ISO-10303-21;
diff --git a/testdata/firmament/fixtures/m10f2-invalid-cone-both-radii-zero.firmament b/testdata/firmament/fixtures/m10f2-invalid-cone-both-radii-zero.firmament
new file mode 100644
index 00000000..ecff5e67
--- /dev/null
+++ b/testdata/firmament/fixtures/m10f2-invalid-cone-both-radii-zero.firmament
@@ -0,0 +1,14 @@
+firmament:
+ version: 1
+
+model:
+ name: cone_invalid_both_radii_zero
+ units: mm
+
+ops[1]:
+ -
+ op: cone
+ id: invalid1
+ bottom_radius: 0
+ top_radius: 0
+ height: 20
diff --git a/testdata/firmament/fixtures/m10f2-invalid-cone-bottom-radius-negative.firmament b/testdata/firmament/fixtures/m10f2-invalid-cone-bottom-radius-negative.firmament
new file mode 100644
index 00000000..832029db
--- /dev/null
+++ b/testdata/firmament/fixtures/m10f2-invalid-cone-bottom-radius-negative.firmament
@@ -0,0 +1,14 @@
+firmament:
+ version: 1
+
+model:
+ name: cone_invalid_bottom_radius_negative
+ units: mm
+
+ops[1]:
+ -
+ op: cone
+ id: frustum1
+ bottom_radius: -1
+ top_radius: 3
+ height: 20
diff --git a/testdata/firmament/fixtures/m10f2-invalid-cone-top-radius-negative.firmament b/testdata/firmament/fixtures/m10f2-invalid-cone-top-radius-negative.firmament
new file mode 100644
index 00000000..49f80ba0
--- /dev/null
+++ b/testdata/firmament/fixtures/m10f2-invalid-cone-top-radius-negative.firmament
@@ -0,0 +1,14 @@
+firmament:
+ version: 1
+
+model:
+ name: cone_invalid_top_radius_negative
+ units: mm
+
+ops[1]:
+ -
+ op: cone
+ id: frustum1
+ bottom_radius: 8
+ top_radius: -1
+ height: 20
diff --git a/testdata/firmament/fixtures/m10f2-valid-cone-pointed-bottom-zero-exec.firmament b/testdata/firmament/fixtures/m10f2-valid-cone-pointed-bottom-zero-exec.firmament
new file mode 100644
index 00000000..1e3ba41d
--- /dev/null
+++ b/testdata/firmament/fixtures/m10f2-valid-cone-pointed-bottom-zero-exec.firmament
@@ -0,0 +1,14 @@
+firmament:
+ version: 1
+
+model:
+ name: cone_pointed_bottom_zero_exec
+ units: mm
+
+ops[1]:
+ -
+ op: cone
+ id: pointed_bottom
+ bottom_radius: 0
+ top_radius: 8
+ height: 20
diff --git a/testdata/firmament/fixtures/m10f2-valid-cone-pointed-bottom-zero-selector-contract.firmament b/testdata/firmament/fixtures/m10f2-valid-cone-pointed-bottom-zero-selector-contract.firmament
new file mode 100644
index 00000000..6a39ef68
--- /dev/null
+++ b/testdata/firmament/fixtures/m10f2-valid-cone-pointed-bottom-zero-selector-contract.firmament
@@ -0,0 +1,44 @@
+firmament:
+ version: 1
+
+model:
+ name: cone_pointed_bottom_zero_selector_contract
+ units: mm
+
+ops[7]:
+ -
+ op: cone
+ id: pointed_bottom
+ bottom_radius: 0
+ top_radius: 8
+ height: 20
+
+ -
+ op: expect_selectable
+ target: pointed_bottom.bottom_face
+ count: 0
+
+ -
+ op: expect_selectable
+ target: pointed_bottom.top_face
+ count: 1
+
+ -
+ op: expect_selectable
+ target: pointed_bottom.side_face
+ count: 1
+
+ -
+ op: expect_selectable
+ target: pointed_bottom.circular_edges
+ count: 1
+
+ -
+ op: expect_selectable
+ target: pointed_bottom.edges
+ count: 2
+
+ -
+ op: expect_selectable
+ target: pointed_bottom.vertices
+ count: 3
diff --git a/testdata/firmament/fixtures/m10f2-valid-cone-pointed-top-zero-exec.firmament b/testdata/firmament/fixtures/m10f2-valid-cone-pointed-top-zero-exec.firmament
new file mode 100644
index 00000000..e4737b21
--- /dev/null
+++ b/testdata/firmament/fixtures/m10f2-valid-cone-pointed-top-zero-exec.firmament
@@ -0,0 +1,14 @@
+firmament:
+ version: 1
+
+model:
+ name: cone_pointed_top_zero_exec
+ units: mm
+
+ops[1]:
+ -
+ op: cone
+ id: pointed_top
+ bottom_radius: 8
+ top_radius: 0
+ height: 20
diff --git a/testdata/firmament/fixtures/m10f2-valid-cone-pointed-top-zero-selector-contract.firmament b/testdata/firmament/fixtures/m10f2-valid-cone-pointed-top-zero-selector-contract.firmament
new file mode 100644
index 00000000..423d63a5
--- /dev/null
+++ b/testdata/firmament/fixtures/m10f2-valid-cone-pointed-top-zero-selector-contract.firmament
@@ -0,0 +1,44 @@
+firmament:
+ version: 1
+
+model:
+ name: cone_pointed_top_zero_selector_contract
+ units: mm
+
+ops[7]:
+ -
+ op: cone
+ id: pointed_top
+ bottom_radius: 8
+ top_radius: 0
+ height: 20
+
+ -
+ op: expect_selectable
+ target: pointed_top.bottom_face
+ count: 1
+
+ -
+ op: expect_selectable
+ target: pointed_top.top_face
+ count: 0
+
+ -
+ op: expect_selectable
+ target: pointed_top.side_face
+ count: 1
+
+ -
+ op: expect_selectable
+ target: pointed_top.circular_edges
+ count: 1
+
+ -
+ op: expect_selectable
+ target: pointed_top.edges
+ count: 2
+
+ -
+ op: expect_selectable
+ target: pointed_top.vertices
+ count: 3
diff --git a/testdata/firmament/fixtures/m1c-invalid-expect-selectable-non-positive-count.firmament b/testdata/firmament/fixtures/m1c-invalid-expect-selectable-non-positive-count.firmament
index 8ff1c240..06305944 100644
--- a/testdata/firmament/fixtures/m1c-invalid-expect-selectable-non-positive-count.firmament
+++ b/testdata/firmament/fixtures/m1c-invalid-expect-selectable-non-positive-count.firmament
@@ -5,8 +5,15 @@ model:
name: demo
units: mm
-ops[1]:
+ops[2]:
+ -
+ op: cone
+ id: pointed
+ bottom_radius: 8
+ top_radius: 0
+ height: 20
+
-
op: expect_selectable
- target: base
+ target: pointed.top_face
count: 0
diff --git a/testdata/firmament/manifests/firmament.corpus.json b/testdata/firmament/manifests/firmament.corpus.json
index 3005d376..2f8b0510 100644
--- a/testdata/firmament/manifests/firmament.corpus.json
+++ b/testdata/firmament/manifests/firmament.corpus.json
@@ -426,14 +426,9 @@
},
{
"id": "m1c-invalid-expect-selectable-non-positive-count",
- "name": "Invalid expect_selectable non-positive count",
+ "name": "Valid expect_selectable zero count for truthful empty selectors",
"fixturePath": "testdata/firmament/fixtures/m1c-invalid-expect-selectable-non-positive-count.firmament",
- "expectedOutcome": "failure",
- "expectedDiagnostic": {
- "source": "firmament",
- "kernelCode": "ValidationFailed",
- "firmamentCode": "FIRM-STRUCT-0016"
- }
+ "expectedOutcome": "success"
},
{
"id": "m1c-valid-expect-exists",