Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Preserve unsupported volume analyze exits

Yuechen Lic5c54eb080ea
diff --git a/Aetheris.CLI.Tests/CliBaselineTests.cs b/Aetheris.CLI.Tests/CliBaselineTests.cs
index 4ca7529c..f80e1102 100644
--- a/Aetheris.CLI.Tests/CliBaselineTests.cs
+++ b/Aetheris.CLI.Tests/CliBaselineTests.cs
@@ -144,6 +144,88 @@ public sealed class CliBaselineTests
}
}
+
+ [Fact]
+ public void Analyze_Command_Reports_LinearExtrusion_SurfaceFamily()
+ {
+ var stepPath = Path.Combine(RepoRoot, "testdata/step242/generated/ruled-a2/ellipse-linear-extrusion-production.step");
+ var stdout = new StringWriter();
+ var stderr = new StringWriter();
+
+ var exitCode = Aetheris.CLI.CliRunner.Run(["analyze", stepPath, "--json"], stdout, stderr);
+
+ Assert.Equal(0, exitCode);
+ using var doc = JsonDocument.Parse(stdout.ToString());
+ var families = doc.RootElement.GetProperty("summary").GetProperty("surfaceFamilies");
+ Assert.True(families.GetProperty("linear-extrusion").GetInt32() >= 1);
+ }
+
+ [Fact]
+ public void AnalyzeVolume_LinearExtrusion_ReturnsFriendlyUnsupportedDiagnostic()
+ {
+ var stepPath = Path.Combine(RepoRoot, "testdata/step242/generated/ruled-a2/ellipse-linear-extrusion-production.step");
+ var stdout = new StringWriter();
+ var stderr = new StringWriter();
+
+ var exitCode = Aetheris.CLI.CliRunner.Run(["analyze", "volume", stepPath, "--json"], stdout, stderr);
+
+ Assert.Equal(1, exitCode);
+ using var doc = JsonDocument.Parse(stdout.ToString());
+ Assert.False(doc.RootElement.GetProperty("success").GetBoolean());
+ var error = doc.RootElement.GetProperty("error").GetString();
+ Assert.Contains("Exact volume is not supported", error, StringComparison.OrdinalIgnoreCase);
+ Assert.Contains("linear-extrusion", error, StringComparison.OrdinalIgnoreCase);
+ Assert.DoesNotContain("given key", error, StringComparison.OrdinalIgnoreCase);
+ }
+
+ [Fact]
+ public void Analyze_Command_Reports_SurfaceOfRevolution_SurfaceFamily()
+ {
+ var stepPath = Path.Combine(RepoRoot, "testdata/step242/probes/surface-of-revolution-line.step");
+ var stdout = new StringWriter();
+ var stderr = new StringWriter();
+
+ var exitCode = Aetheris.CLI.CliRunner.Run(["analyze", stepPath, "--json"], stdout, stderr);
+
+ Assert.Equal(0, exitCode);
+ using var doc = JsonDocument.Parse(stdout.ToString());
+ var families = doc.RootElement.GetProperty("summary").GetProperty("surfaceFamilies");
+ Assert.True(families.GetProperty("surface-of-revolution").GetInt32() >= 1);
+ }
+
+ [Fact]
+ public void AnalyzeVolume_SurfaceOfRevolution_ReturnsFriendlyUnsupportedDiagnostic()
+ {
+ var stepPath = Path.Combine(RepoRoot, "testdata/step242/probes/surface-of-revolution-line.step");
+ var stdout = new StringWriter();
+ var stderr = new StringWriter();
+
+ var exitCode = Aetheris.CLI.CliRunner.Run(["analyze", "volume", stepPath, "--json"], stdout, stderr);
+
+ Assert.Equal(1, exitCode);
+ using var doc = JsonDocument.Parse(stdout.ToString());
+ Assert.False(doc.RootElement.GetProperty("success").GetBoolean());
+ var error = doc.RootElement.GetProperty("error").GetString();
+ Assert.Contains("Exact volume is not supported", error, StringComparison.OrdinalIgnoreCase);
+ Assert.Contains("surface-of-revolution", error, StringComparison.OrdinalIgnoreCase);
+ Assert.DoesNotContain("given key", error, StringComparison.OrdinalIgnoreCase);
+ }
+
+ [Fact]
+ public void Analyze_Command_Accepts_DegreeOneOneBsplineBilinearProbe()
+ {
+ var stepPath = Path.Combine(RepoRoot, "testdata/step242/probes/bspline-degree-1-1-bilinear.step");
+ var stdout = new StringWriter();
+ var stderr = new StringWriter();
+
+ var exitCode = Aetheris.CLI.CliRunner.Run(["analyze", stepPath, "--json"], stdout, stderr);
+
+ Assert.Equal(0, exitCode);
+ using var doc = JsonDocument.Parse(stdout.ToString());
+ var families = doc.RootElement.GetProperty("summary").GetProperty("surfaceFamilies");
+ Assert.True(families.GetProperty("bspline").GetInt32() >= 1);
+ }
+
[Fact]
public void Analyze_Command_Reports_Summary_Facts_And_Discoverability()
{
@@ -785,7 +867,7 @@ public sealed class CliBaselineTests
[Fact]
public void AnalyzeVolume_MixedCurvedTrimmedBody_FailsClearly()
{
- var stepPath = Path.Combine(RepoRoot, "testdata/firmament/exports/boolean_box_cylinder_hole.step");
+ var stepPath = Path.Combine(RepoRoot, "testdata/firmament/exports/boolean_box_sphere_cavity_basic.step");
var stdout = new StringWriter(); var stderr = new StringWriter();
var exitCode = Aetheris.CLI.CliRunner.Run(["analyze", "volume", stepPath, "--json"], stdout, stderr);
Assert.Equal(1, exitCode);
diff --git a/Aetheris.CLI/StepAnalyzer.cs b/Aetheris.CLI/StepAnalyzer.cs
index 3a4a0426..c4d4e7ea 100644
--- a/Aetheris.CLI/StepAnalyzer.cs
+++ b/Aetheris.CLI/StepAnalyzer.cs
@@ -164,6 +164,19 @@ public sealed record VolumeAnalysisResult(
return new VolumeAnalysisResult(stepPath, true, planarVolume, "model-unit", "model-unit^3", new VolumeBoundingBox(bbox.Min, bbox.Max), "planar-closed-shell", true, false, null, null, null, null, null, null, null, notes);
}
+ var unsupportedSweptSurfaceKind = body.Topology.Faces
+ .Select(face => body.TryGetFaceSurface(face.Id, out var surface) ? surface : null)
+ .Where(surface => surface is not null)
+ .Select(surface => surface!.Kind)
+ .FirstOrDefault(kind => kind is SurfaceGeometryKind.LinearExtrusion or SurfaceGeometryKind.SurfaceOfRevolution);
+ if (unsupportedSweptSurfaceKind is SurfaceGeometryKind.LinearExtrusion or SurfaceGeometryKind.SurfaceOfRevolution)
+ {
+ var surfaceKindName = ToSurfaceFamilyName(unsupportedSweptSurfaceKind);
+ var structural = BuildSummary(body, notes).StructuralAssessment;
+ var bodyDescription = structural == "enclosed-manifold" ? "body" : "open or non-solid body";
+ throw new InvalidOperationException($"Exact volume is not supported for {bodyDescription} containing {surfaceKindName} surfaces.");
+ }
+
throw new InvalidOperationException(planarFailureReason ?? "Volume analysis currently supports canonical sphere, single-lateral-face cylinder, and enclosed planar closed-shell bodies only.");
}
@@ -925,6 +938,8 @@ public sealed record VolumeAnalysisResult(
["sphere"] = 0,
["torus"] = 0,
["bspline"] = 0,
+ ["linear-extrusion"] = 0,
+ ["surface-of-revolution"] = 0,
["other"] = 0
};
@@ -938,15 +953,15 @@ public sealed record VolumeAnalysisResult(
switch (surface.Kind)
{
- case SurfaceGeometryKind.Plane: surfaceFamilies["plane"]++; break;
- case SurfaceGeometryKind.Cylinder: surfaceFamilies["cylinder"]++; break;
- case SurfaceGeometryKind.Cone: surfaceFamilies["cone"]++; break;
- case SurfaceGeometryKind.Sphere: surfaceFamilies["sphere"]++; break;
- case SurfaceGeometryKind.Torus: surfaceFamilies["torus"]++; break;
- case SurfaceGeometryKind.LinearExtrusion: surfaceFamilies["linear-extrusion"]++; break;
- case SurfaceGeometryKind.SurfaceOfRevolution: surfaceFamilies["surface-of-revolution"]++; break;
- case SurfaceGeometryKind.BSplineSurfaceWithKnots: surfaceFamilies["bspline"]++; break;
- default: surfaceFamilies["other"]++; break;
+ case SurfaceGeometryKind.Plane: IncrementSurfaceFamily(surfaceFamilies, "plane"); break;
+ case SurfaceGeometryKind.Cylinder: IncrementSurfaceFamily(surfaceFamilies, "cylinder"); break;
+ case SurfaceGeometryKind.Cone: IncrementSurfaceFamily(surfaceFamilies, "cone"); break;
+ case SurfaceGeometryKind.Sphere: IncrementSurfaceFamily(surfaceFamilies, "sphere"); break;
+ case SurfaceGeometryKind.Torus: IncrementSurfaceFamily(surfaceFamilies, "torus"); break;
+ case SurfaceGeometryKind.LinearExtrusion: IncrementSurfaceFamily(surfaceFamilies, "linear-extrusion"); break;
+ case SurfaceGeometryKind.SurfaceOfRevolution: IncrementSurfaceFamily(surfaceFamilies, "surface-of-revolution"); break;
+ case SurfaceGeometryKind.BSplineSurfaceWithKnots: IncrementSurfaceFamily(surfaceFamilies, "bspline"); break;
+ default: IncrementSurfaceFamily(surfaceFamilies, "other"); break;
}
}
@@ -1282,6 +1297,27 @@ public sealed record VolumeAnalysisResult(
return edgeCounts;
}
+
+ private static void IncrementSurfaceFamily(IDictionary<string, int> surfaceFamilies, string family)
+ {
+ surfaceFamilies.TryGetValue(family, out var count);
+ surfaceFamilies[family] = count + 1;
+ }
+
+ private static string ToSurfaceFamilyName(SurfaceGeometryKind kind)
+ => kind switch
+ {
+ SurfaceGeometryKind.Plane => "plane",
+ SurfaceGeometryKind.Cylinder => "cylinder",
+ SurfaceGeometryKind.Cone => "cone",
+ SurfaceGeometryKind.Sphere => "sphere",
+ SurfaceGeometryKind.Torus => "torus",
+ SurfaceGeometryKind.LinearExtrusion => "linear-extrusion",
+ SurfaceGeometryKind.SurfaceOfRevolution => "surface-of-revolution",
+ SurfaceGeometryKind.BSplineSurfaceWithKnots => "bspline",
+ _ => "other"
+ };
+
private static Dictionary<int, string> BuildFaceSurfaceKinds(BrepBody body)
{
var result = new Dictionary<int, string>();
diff --git a/docs/implementation/ruled-tooling-a0-inline-step-probe-harness.md b/docs/implementation/ruled-tooling-a0-inline-step-probe-harness.md
new file mode 100644
index 00000000..788d38a9
--- /dev/null
+++ b/docs/implementation/ruled-tooling-a0-inline-step-probe-harness.md
@@ -0,0 +1,5 @@
+# RULED-TOOLING-A0 Inline STEP probe harness
+
+RULED-ANALYZE-A0 updated analyze/reporting so exact swept surface kinds are recognized in analyzer summaries. `SURFACE_OF_LINEAR_EXTRUSION` imports now appear as `linear-extrusion`, and `SURFACE_OF_REVOLUTION` imports now appear as `surface-of-revolution`.
+
+Open ruled/swept surface bodies still do not have exact volume integration. `aetheris analyze volume` reports that state as unsupported instead of throwing a dictionary-key exception; this milestone did not add ruled-surface area or volume integration.
diff --git a/tools/Run-RuledStepProbe.ps1 b/tools/Run-RuledStepProbe.ps1
new file mode 100644
index 00000000..8f6bb253
--- /dev/null
+++ b/tools/Run-RuledStepProbe.ps1
@@ -0,0 +1,49 @@
+param(
+ [Parameter(Mandatory = $true)] [string] $Probe,
+ [Parameter(Mandatory = $true)] [string] $Name
+)
+
+$ErrorActionPreference = 'Stop'
+$repoRoot = Split-Path -Parent $PSScriptRoot
+$probePath = Resolve-Path -Path $Probe
+
+Write-Host "probe: $Name"
+Write-Host "file: $probePath"
+
+$analyze = & dotnet run --project (Join-Path $repoRoot 'Aetheris.CLI') -- analyze $probePath --json 2>&1
+if ($LASTEXITCODE -ne 0) {
+ Write-Host "analyze: failed"
+ Write-Host $analyze
+ exit $LASTEXITCODE
+}
+
+$volume = & dotnet run --project (Join-Path $repoRoot 'Aetheris.CLI') -- analyze volume $probePath --json 2>&1
+$volumeExit = $LASTEXITCODE
+if ($volumeExit -eq 0) {
+ Write-Host "analyze: volume supported"
+ Write-Host $volume
+ exit 0
+}
+
+$message = ($volume | Out-String)
+if ($message -match 'given key') {
+ Write-Host 'analyze: unexpected dictionary-key failure'
+ Write-Host $message
+ exit $volumeExit
+}
+
+if ($message -match 'Exact volume is not supported' -and $message -match 'linear-extrusion') {
+ Write-Host 'analyze: expected unsupported-volume nonzero for open linear-extrusion body'
+ Write-Host $message
+ exit 0
+}
+
+if ($message -match 'Exact volume is not supported' -or $message -match 'unsupported non-planar face') {
+ Write-Host 'analyze: expected unsupported-volume nonzero'
+ Write-Host $message
+ exit 0
+}
+
+Write-Host 'analyze: unexpected failure'
+Write-Host $message
+exit $volumeExit