Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Add CIR-F10.4 planar inner-loop emission policy diagnostics

Yuechen Li6e537677ba56
diff --git a/Aetheris.Kernel.Firmament.Tests/SurfacePatchDescriptorScaffoldTests.cs b/Aetheris.Kernel.Firmament.Tests/SurfacePatchDescriptorScaffoldTests.cs
index a6e93eff..45e5020b 100644
--- a/Aetheris.Kernel.Firmament.Tests/SurfacePatchDescriptorScaffoldTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/SurfacePatchDescriptorScaffoldTests.cs
@@ -131,6 +131,49 @@ public sealed class SurfacePatchDescriptorScaffoldTests
Assert.Contains(result.Diagnostics, d => d.Contains("supports only rectangular untrimmed", StringComparison.OrdinalIgnoreCase));
}
+ [Fact]
+ public void PlanarSurfaceMaterializer_ReportsInnerCircularLoopPolicy()
+ {
+ var policy = PlanarSurfaceMaterializer.GetLoopEmissionPolicy();
+ Assert.True(policy.SupportsOuterRectangle);
+ Assert.True(policy.SupportsOuterCircle);
+ Assert.False(policy.SupportsInnerCircle);
+ Assert.False(policy.SupportsMultipleInnerLoops);
+ Assert.Equal(PlanarSurfaceMaterializer.PlanarLoopSupportStatus.Deferred, policy.Status);
+ Assert.Contains("inner circular loop emission deferred", policy.Diagnostic, StringComparison.OrdinalIgnoreCase);
+ }
+
+ [Fact]
+ public void PlanarSurfaceMaterializer_TrimmedCircularInnerLoop_RespectsPolicy()
+ {
+ var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, "rect3d:-2,-2,0;2,-2,0;2,2,0;-2,2,0", null, Transform3D.Identity, "cir:box:face", nameof(CirBoxNode), 0, FacePatchOrientationRole.Forward);
+ var inner = new TrimCurveDescriptor(TrimCurveFamily.Circle, "inner-circle", "inner", 1, new ParameterInterval(0, 2 * double.Pi), TrimCurveCapability.ExactSupported);
+ var patch = new FacePatchDescriptor(source, [], [[inner]], FacePatchOrientationRole.Forward, "outer", []);
+ var readiness = new MaterializationReadinessReport(true, EmissionReadiness.EvidenceReadyForEmission, [], [], 1, 1, 1, 0, 0, 0, 0, [], false);
+
+ var result = new PlanarSurfaceMaterializer().Emit(patch, readiness);
+
+ Assert.False(result.Success);
+ Assert.Null(result.Body);
+ Assert.Contains(result.Diagnostics, d => d.Contains("inner circular loop emission deferred", StringComparison.OrdinalIgnoreCase));
+ }
+
+ [Fact]
+ public void PlanarSurfaceMaterializer_RejectsMultipleInnerLoops()
+ {
+ var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, "rect3d:-2,-2,0;2,-2,0;2,2,0;-2,2,0", null, Transform3D.Identity, "cir:box:face", nameof(CirBoxNode), 0, FacePatchOrientationRole.Forward);
+ var innerA = new TrimCurveDescriptor(TrimCurveFamily.Circle, "inner-circle-a", "inner", 1, new ParameterInterval(0, 2 * double.Pi), TrimCurveCapability.ExactSupported);
+ var innerB = new TrimCurveDescriptor(TrimCurveFamily.Circle, "inner-circle-b", "inner", 2, new ParameterInterval(0, 2 * double.Pi), TrimCurveCapability.ExactSupported);
+ var patch = new FacePatchDescriptor(source, [], [[innerA], [innerB]], FacePatchOrientationRole.Forward, "outer", []);
+ var readiness = new MaterializationReadinessReport(true, EmissionReadiness.EvidenceReadyForEmission, [], [], 1, 1, 1, 0, 0, 0, 0, [], false);
+
+ var result = new PlanarSurfaceMaterializer().Emit(patch, readiness);
+
+ Assert.False(result.Success);
+ Assert.Null(result.Body);
+ Assert.Contains(result.Diagnostics, d => d.Contains("multiple inner loops", StringComparison.OrdinalIgnoreCase));
+ }
+
[Fact]
public void PlanarPayloadBuilder_RejectsNonPlanarSource()
{
diff --git a/Aetheris.Kernel.Firmament/Execution/SurfacePatchDescriptorScaffold.cs b/Aetheris.Kernel.Firmament/Execution/SurfacePatchDescriptorScaffold.cs
index abb0f1f6..82799d02 100644
--- a/Aetheris.Kernel.Firmament/Execution/SurfacePatchDescriptorScaffold.cs
+++ b/Aetheris.Kernel.Firmament/Execution/SurfacePatchDescriptorScaffold.cs
@@ -151,9 +151,40 @@ internal sealed record SurfaceFamilyMaterializerEvaluation(
internal sealed class PlanarSurfaceMaterializer : ISurfaceFamilyMaterializer
{
+ internal enum PlanarLoopSupportStatus
+ {
+ Supported,
+ Deferred
+ }
+
+ internal enum InnerLoopOrientationPolicy
+ {
+ FollowFaceBoundConvention,
+ Deferred
+ }
+
+ internal sealed record PlanarLoopEmissionPolicy(
+ bool SupportsOuterRectangle,
+ bool SupportsOuterCircle,
+ bool SupportsInnerCircle,
+ bool SupportsMultipleInnerLoops,
+ InnerLoopOrientationPolicy InnerLoopOrientation,
+ PlanarLoopSupportStatus Status,
+ string Diagnostic);
+
public SurfacePatchFamily Family => SurfacePatchFamily.Planar;
public string Name => "surface_family_planar";
+ internal static PlanarLoopEmissionPolicy GetLoopEmissionPolicy()
+ => new(
+ SupportsOuterRectangle: true,
+ SupportsOuterCircle: true,
+ SupportsInnerCircle: false,
+ SupportsMultipleInnerLoops: false,
+ InnerLoopOrientation: InnerLoopOrientationPolicy.Deferred,
+ Status: PlanarLoopSupportStatus.Deferred,
+ Diagnostic: "PlanarSurfaceMaterializer inner circular loop emission deferred: trim-loop geometry descriptors do not yet carry canonical circle/topology bindings for safe inner-loop BRep emission.");
+
public SurfaceMaterializerAdmissibility Evaluate(FacePatchDescriptor patch)
{
if (patch.SourceSurface.Family != SurfacePatchFamily.Planar) return new(false, "Source surface family mismatch.", 0d);
@@ -177,7 +208,26 @@ internal sealed class PlanarSurfaceMaterializer : ISurfaceFamilyMaterializer
return new(false, null, SurfacePatchFamily.Planar, false, ["readiness-gate-rejected: no readiness, no emission."]);
}
- if (patch.InnerLoops.Count > 0 || patch.OuterLoop.Count > 0)
+ if (patch.InnerLoops.Count > 0)
+ {
+ if (patch.InnerLoops.Count > 1)
+ {
+ return new(false, null, SurfacePatchFamily.Planar, false,
+ [
+ "planar-trimmed-loop-rejected: multiple inner loops are unsupported in CIR-F10.4 scope.",
+ "PlanarSurfaceMaterializer inner circular loop emission deferred: multiple inner loops are explicitly out of scope for bounded planar policy milestone."
+ ]);
+ }
+
+ var policy = GetLoopEmissionPolicy();
+ return new(false, null, SurfacePatchFamily.Planar, false,
+ [
+ "planar-trimmed-loop-rejected: one outer loop + one inner circular loop requested.",
+ policy.Diagnostic
+ ]);
+ }
+
+ if (patch.OuterLoop.Count > 0)
{
return new(false, null, SurfacePatchFamily.Planar, false, ["planar-f9-limited-scope: supports only rectangular untrimmed planar patches."]);
}
diff --git a/docs/cir-f104-planar-inner-loop-policy.md b/docs/cir-f104-planar-inner-loop-policy.md
new file mode 100644
index 00000000..3df25f0a
--- /dev/null
+++ b/docs/cir-f104-planar-inner-loop-policy.md
@@ -0,0 +1,51 @@
+# CIR-F10.4: bounded annular / trimmed planar loop policy for `PlanarSurfaceMaterializer`
+
+## Investigation summary
+
+Inspected current implementation and topology/export conventions before adding policy:
+
+- `PlanarSurfaceMaterializer` currently emits only untrimmed rectangle and untrimmed circle planar faces.
+- Core topology model supports multiple loops per face (`Face.LoopIds`) and STEP exporter maps first loop to `FACE_OUTER_BOUND` and subsequent loops to `FACE_BOUND`.
+- Existing `boolean_box_cylinder_hole` and boolean builders already construct planar faces with outer+inner loops for holes.
+- However, F10 surface-patch trim descriptors do not currently carry canonical geometric bindings for inner circular loops that can be safely converted into explicit BRep inner loop edges in this scoped materializer path.
+
+Result: policy and diagnostics landed; trimmed inner-circle emission remains explicitly deferred.
+
+## Policy status (CIR-F10.4)
+
+`PlanarSurfaceMaterializer` now exposes explicit loop-emission policy:
+
+- Outer rectangle: supported
+- Outer circle: supported
+- One inner circle: **deferred**
+- Multiple inner loops: **unsupported (explicitly rejected)**
+- Inner-loop orientation policy: deferred until canonical trim-loop geometry/topology binding is available
+
+## Behavior
+
+- Readiness gate remains mandatory (`no readiness, no emission`).
+- Untrimmed rectangle and untrimmed circle emission paths remain unchanged.
+- Trimmed planar patch requests with inner loops are rejected with precise diagnostics:
+ - one inner loop: deferred with blocker reason
+ - multiple inner loops: rejected as out of CIR-F10.4 scope
+
+No partial topology is emitted for deferred/unsupported trimmed cases.
+
+## SEM-A0 guardrails
+
+Preserved:
+
+- no generated topology naming
+- no selector identity expansion
+- no STEP production-path behavior change
+
+## Rejected/deferred cases (explicit)
+
+- multiple inner loops
+- non-circular inner loops
+- nested holes
+- arbitrary trimmed planar faces
+
+## Next milestone
+
+Add canonical retained-loop geometric binding for inner circular trims (center/normal/radius + edge-use orientation contract) so `PlanarSurfaceMaterializer` can safely emit one outer + one inner loop annular planar topology in this path.