Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Add V2-X5 profile boolean-to-extrude chained lab pipeline

Yuechen Li9743ee9c5f91
diff --git a/Aetheris.Firmament.FrictionLab/CIRLab/ProfileBooleanExtrudePipelineLab.cs b/Aetheris.Firmament.FrictionLab/CIRLab/ProfileBooleanExtrudePipelineLab.cs
new file mode 100644
index 00000000..38852dc0
--- /dev/null
+++ b/Aetheris.Firmament.FrictionLab/CIRLab/ProfileBooleanExtrudePipelineLab.cs
@@ -0,0 +1,115 @@
+using Aetheris.Kernel.Core.Brep;
+using Aetheris.Kernel.Core.Step242;
+using Aetheris.Kernel.Firmament.Materializer;
+
+namespace Aetheris.Firmament.FrictionLab.CIRLab;
+
+public sealed record ProfileBooleanExtrudePipelineRow(string CaseName, ProfileBooleanExpr2D Expression, double Height);
+public sealed record ProfileBooleanExtrudePipelineResult(
+ string CaseName,
+ LabProfileStatus Status,
+ int OuterLoopCount,
+ int HoleCount,
+ int PlanarFaceCount,
+ int CylindricalFaceCount,
+ bool StepSmokePassed,
+ IReadOnlyList<string> Diagnostics,
+ ProfileBooleanRecommendation Recommendation);
+
+public static class ProfileBooleanExtrudePipelineLab
+{
+ private static readonly string[] Required = ["ISO-10303-21","MANIFOLD_SOLID_BREP","ADVANCED_FACE","PLANE","CYLINDRICAL_SURFACE"];
+
+ public static IReadOnlyList<ProfileBooleanExtrudePipelineResult> RunAll() =>
+ [
+ Evaluate(new("success-centered", new ProfileBooleanDifference(new ProfileBooleanRectangle(0,0,20,20), [new ProfileBooleanCircle(0,0,3)]), 10)),
+ Evaluate(new("success-offcenter", new ProfileBooleanDifference(new ProfileBooleanRectangle(0,0,30,20), [new ProfileBooleanCircle(5,2,2)]), 8)),
+ Evaluate(new("success-two-holes", new ProfileBooleanDifference(new ProfileBooleanRectangle(0,0,30,20), [new ProfileBooleanCircle(-5,0,2), new ProfileBooleanCircle(5,0,2)]), 8)),
+ Evaluate(new("invalid-circle-outside", new ProfileBooleanDifference(new ProfileBooleanRectangle(0,0,20,20), [new ProfileBooleanCircle(20,20,2)]), 10)),
+ Evaluate(new("invalid-height", new ProfileBooleanDifference(new ProfileBooleanRectangle(0,0,20,20), [new ProfileBooleanCircle(0,0,2)]), 0)),
+ Evaluate(new("deferred-capsule", new ProfileBooleanDifference(new ProfileBooleanRectangle(0,0,20,20), [new ProfileBooleanCapsule(0,0,10,2)]), 10)),
+ Evaluate(new("deferred-disjoint-union", new ProfileBooleanUnion([new ProfileBooleanRectangle(-20,0,10,10), new ProfileBooleanRectangle(20,0,10,10)]), 10))
+ ];
+
+ public static ProfileBooleanExtrudePipelineResult Evaluate(ProfileBooleanExtrudePipelineRow row)
+ {
+ var diagnostics = new List<string> { "v2-x5-profile-boolean-extrude-pipeline-started", "v2-x5-profile-expression-normalization-attempted" };
+ var normalized = ProfileBooleanNormalizationLab.Normalize(row.Expression);
+ diagnostics.AddRange(normalized.Diagnostics);
+
+ if (normalized.Status != LabProfileStatus.Succeeded || normalized.Profile is null)
+ {
+ diagnostics.Add(normalized.Status == LabProfileStatus.Deferred
+ ? $"v2-x5-profile-expression-deferred:{string.Join(",", normalized.Diagnostics)}"
+ : $"v2-x5-profile-expression-rejected:{string.Join(",", normalized.Diagnostics)}");
+ var rec = normalized.Status == LabProfileStatus.Deferred
+ ? ProfileBooleanRecommendation.profile_boolean_extrude_deferred_topology
+ : ProfileBooleanRecommendation.profile_boolean_extrude_normalization_rejected;
+ return Build(row.CaseName, normalized.Status, 0, 0, 0, 0, false, diagnostics, rec);
+ }
+
+ diagnostics.Add("v2-x5-profile-expression-normalized");
+ if (!TryAdapt(normalized.Profile, row.Height, out var req, out var reason))
+ {
+ diagnostics.Add($"v2-x5-profile-hole-extrude-failed:{reason}");
+ return Build(row.CaseName, LabProfileStatus.Failed, 1, Math.Max(0, normalized.Profile.Loops.Count-1), 0, 0, false, diagnostics, ProfileBooleanRecommendation.profile_boolean_extrude_emitter_blocked);
+ }
+
+ diagnostics.Add("v2-x5-resolved-profile-adapted-to-emitter");
+ diagnostics.Add("v2-x5-profile-hole-extrude-attempted");
+ var emit = ProfileHoleExtrudeEmitter.TryEmit(req!);
+ diagnostics.AddRange(emit.Diagnostics);
+ if (emit.Status != ProfileHoleExtrudeStatus.Succeeded || emit.Body is null)
+ {
+ diagnostics.Add("v2-x5-profile-hole-extrude-failed:emitter-rejected-or-failed");
+ return Build(row.CaseName, LabProfileStatus.Failed, 1, normalized.Profile.Loops.Count-1, 0, 0, false, diagnostics, ProfileBooleanRecommendation.profile_boolean_extrude_emitter_blocked);
+ }
+
+ diagnostics.Add("v2-x5-profile-hole-extrude-succeeded");
+ diagnostics.Add("v2-x5-no-3d-boolean-used");
+ diagnostics.Add("v2-v3-no-3d-boolean-used");
+ var topo = CountFaces(emit.Body);
+ var stepOk = StepOk(emit.Body, diagnostics);
+ return Build(row.CaseName, LabProfileStatus.Succeeded, 1, normalized.Profile.Loops.Count-1, topo.Planar, topo.Cyl, stepOk, diagnostics, ProfileBooleanRecommendation.profile_boolean_extrude_ready_for_production_evaluation);
+ }
+
+ private static bool TryAdapt(LabResolvedProfile2D p, double height, out ProfileHoleExtrudeRequest? req, out string reason)
+ {
+ req = null; reason = string.Empty;
+ if (height <= 1e-9) { reason = "invalid-height"; return false; }
+ if (p.Loops.Count < 1) { reason = "no-outer-loop"; return false; }
+ var outer = p.Loops[0];
+ if (outer.Curves.Count != 4 || outer.Curves.Any(c => c is not LabAirLineSegment2D)) { reason = "outer-not-rectangle"; return false; }
+ var pts = outer.Curves.Cast<LabAirLineSegment2D>().SelectMany(x => new[] { x.Start, x.End }).ToArray();
+ var minX = pts.Min(x => x.X); var maxX = pts.Max(x => x.X); var minY = pts.Min(x => x.Y); var maxY = pts.Max(x => x.Y);
+ var holes = new List<ProfileHoleLoop2D>();
+ foreach (var loop in p.Loops.Skip(1))
+ {
+ if (loop.Curves.Count != 1 || loop.Curves[0] is not LabAirFullCircle2D c) { reason = "hole-not-full-circle"; return false; }
+ holes.Add(new(c.Center.X, c.Center.Y, c.Radius));
+ }
+ req = new(maxX-minX, maxY-minY, height, holes);
+ return true;
+ }
+
+ private static (int Planar, int Cyl) CountFaces(BrepBody b)
+ {
+ var planar = b.Geometry.Surfaces.Count(x => x.Value.Kind == Aetheris.Kernel.Core.Geometry.SurfaceGeometryKind.Plane);
+ var cyl = b.Geometry.Surfaces.Count(x => x.Value.Kind == Aetheris.Kernel.Core.Geometry.SurfaceGeometryKind.Cylinder);
+ return (planar, cyl);
+ }
+
+ private static bool StepOk(BrepBody b, List<string> d)
+ {
+ var step = Step242Exporter.ExportBody(b);
+ if (!step.IsSuccess || step.Value is null) { d.Add("v2-x5-step-smoke-failed:export-failed"); return false; }
+ var text = step.Value;
+ if (Required.Any(m => !text.Contains(m, StringComparison.Ordinal)) || text.Contains("BREP_WITH_VOIDS", StringComparison.Ordinal))
+ { d.Add("v2-x5-step-smoke-failed:markers"); return false; }
+ d.Add("v2-x5-step-smoke-succeeded");
+ return true;
+ }
+
+ private static ProfileBooleanExtrudePipelineResult Build(string caseName, LabProfileStatus status, int outer, int holes, int planar, int cyl, bool step, List<string> d, ProfileBooleanRecommendation r)
+ => new(caseName, status, outer, holes, planar, cyl, step, d.Distinct().OrderBy(x => x).ToArray(), r);
+}
diff --git a/Aetheris.Firmament.FrictionLab/CIRLab/ProfileBooleanNormalizationLab.cs b/Aetheris.Firmament.FrictionLab/CIRLab/ProfileBooleanNormalizationLab.cs
index f2ed9445..af3db0a1 100644
--- a/Aetheris.Firmament.FrictionLab/CIRLab/ProfileBooleanNormalizationLab.cs
+++ b/Aetheris.Firmament.FrictionLab/CIRLab/ProfileBooleanNormalizationLab.cs
@@ -5,7 +5,12 @@ public enum ProfileBooleanRecommendation
profile_boolean_normalized,
profile_boolean_invalid_rejected,
profile_boolean_deferred_topology,
- profile_boolean_needs_bounded_clipping_lab
+ profile_boolean_needs_bounded_clipping_lab,
+ profile_boolean_extrude_ready_for_production_evaluation,
+ profile_boolean_extrude_normalization_rejected,
+ profile_boolean_extrude_deferred_topology,
+ profile_boolean_extrude_emitter_blocked,
+ profile_boolean_extrude_needs_production_profile_adapter
}
public abstract record ProfileBooleanExpr2D;
diff --git a/Aetheris.FrictionLab.Tests/CIRLab/ProfileBooleanExtrudePipelineLabTests.cs b/Aetheris.FrictionLab.Tests/CIRLab/ProfileBooleanExtrudePipelineLabTests.cs
new file mode 100644
index 00000000..c8f54d2a
--- /dev/null
+++ b/Aetheris.FrictionLab.Tests/CIRLab/ProfileBooleanExtrudePipelineLabTests.cs
@@ -0,0 +1,57 @@
+using Aetheris.Firmament.FrictionLab.CIRLab;
+
+namespace Aetheris.FrictionLab.Tests.CIRLab;
+
+public class ProfileBooleanExtrudePipelineLabTests
+{
+ [Fact]
+ public void RunAll_is_deterministic()
+ {
+ var a = ProfileBooleanExtrudePipelineLab.RunAll().Select(x => (x.CaseName, x.Status, x.HoleCount, x.PlanarFaceCount, x.CylindricalFaceCount, string.Join("|", x.Diagnostics), x.Recommendation));
+ var b = ProfileBooleanExtrudePipelineLab.RunAll().Select(x => (x.CaseName, x.Status, x.HoleCount, x.PlanarFaceCount, x.CylindricalFaceCount, string.Join("|", x.Diagnostics), x.Recommendation));
+ Assert.Equal(a, b);
+ }
+
+ [Theory]
+ [InlineData("success-centered", 1)]
+ [InlineData("success-offcenter", 1)]
+ [InlineData("success-two-holes", 2)]
+ public void Success_cases_emit_step_valid_body(string caseName, int expectedHoles)
+ {
+ var row = ProfileBooleanExtrudePipelineLab.RunAll().Single(x => x.CaseName == caseName);
+ Assert.Equal(LabProfileStatus.Succeeded, row.Status);
+ Assert.Equal(expectedHoles, row.HoleCount);
+ Assert.Equal(6, row.PlanarFaceCount);
+ Assert.Equal(expectedHoles, row.CylindricalFaceCount);
+ Assert.True(row.StepSmokePassed);
+ Assert.Contains("v2-x5-no-3d-boolean-used", row.Diagnostics);
+ Assert.Contains("v2-v3-no-3d-boolean-used", row.Diagnostics);
+ Assert.DoesNotContain(row.Diagnostics, d => d.Contains("BREP_WITH_VOIDS", StringComparison.Ordinal));
+ }
+
+ [Theory]
+ [InlineData("invalid-circle-outside")]
+ [InlineData("invalid-height")]
+ [InlineData("deferred-capsule")]
+ [InlineData("deferred-disjoint-union")]
+ public void Invalid_or_deferred_stop_before_emission(string caseName)
+ {
+ var row = ProfileBooleanExtrudePipelineLab.RunAll().Single(x => x.CaseName == caseName);
+ Assert.NotEqual(LabProfileStatus.Succeeded, row.Status);
+ Assert.DoesNotContain("v2-x5-profile-hole-extrude-succeeded", row.Diagnostics);
+ }
+
+ [Fact]
+ public void Recommendation_set_is_bounded()
+ {
+ var allowed = new[]
+ {
+ ProfileBooleanRecommendation.profile_boolean_extrude_ready_for_production_evaluation,
+ ProfileBooleanRecommendation.profile_boolean_extrude_normalization_rejected,
+ ProfileBooleanRecommendation.profile_boolean_extrude_deferred_topology,
+ ProfileBooleanRecommendation.profile_boolean_extrude_emitter_blocked,
+ ProfileBooleanRecommendation.profile_boolean_extrude_needs_production_profile_adapter
+ }.ToHashSet();
+ foreach (var row in ProfileBooleanExtrudePipelineLab.RunAll()) Assert.Contains(row.Recommendation, allowed);
+ }
+}
diff --git a/Aetheris.Kernel.Firmament/Properties/InternalsVisibleTo.cs b/Aetheris.Kernel.Firmament/Properties/InternalsVisibleTo.cs
index a9cd135d..030e3073 100644
--- a/Aetheris.Kernel.Firmament/Properties/InternalsVisibleTo.cs
+++ b/Aetheris.Kernel.Firmament/Properties/InternalsVisibleTo.cs
@@ -1,3 +1,4 @@
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Aetheris.Kernel.Firmament.Tests")]
+[assembly: InternalsVisibleTo("Aetheris.Firmament.FrictionLab")]
diff --git a/docs/frictionlab/v2-v3-profile-boolean-to-extrude-pipeline.md b/docs/frictionlab/v2-v3-profile-boolean-to-extrude-pipeline.md
new file mode 100644
index 00000000..d4d9b4f9
--- /dev/null
+++ b/docs/frictionlab/v2-v3-profile-boolean-to-extrude-pipeline.md
@@ -0,0 +1,36 @@
+# V2-V3 — Profile Boolean expression to ProfileHoleExtrude chained pipeline
+
+## Purpose and scope
+Lab-only chained evaluation proving: `ProfileBooleanExpr2D -> ResolvedProfile2D -> ProfileHoleExtrudeEmitter -> BRep/STEP` for the bounded V2-X4 subset, without any 3D Boolean operation.
+
+## References
+- `docs/aetheris-v2-sweep-first-architecture.md`
+- `docs/aetheris-v2-a1-resolved-profile2d-contract.md`
+- `docs/frictionlab/v2-x1-resolved-profile2d-lab.md`
+- `docs/frictionlab/v2-x3-profile-with-hole-extrude-lab.md`
+- `docs/frictionlab/v2-x4-profile-boolean-normalization-lab.md`
+- `docs/v2-v1-profile-hole-extrude-production-evaluation.md`
+- `docs/v2-v2-profile-hole-extrude-through-hole-integration.md`
+
+## Supported subset
+- `Difference(Rectangle, CircleInside...)` (single or multiple circles).
+- Deferred/rejected behavior preserved from V2-X4 for unsupported/deferred shapes.
+
+## Candidate and adapter
+`ProfileBooleanExtrudePipelineLab` normalizes via `ProfileBooleanNormalizationLab.Normalize`, then adapts `LabResolvedProfile2D` loops to `ProfileHoleExtrudeRequest` (rectangle width/depth + circular hole loops) and emits through `ProfileHoleExtrudeEmitter`.
+
+## Findings
+- Success: centered, off-center, and two-hole rectangle-minus-circle cases emit STEP-smoke-valid BRep.
+- Invalid and deferred normalization cases stop before emission with deterministic diagnostics.
+- Topology in success cases: planar faces = 6, cylindrical faces = hole count.
+- STEP smoke markers present: `ISO-10303-21`, `MANIFOLD_SOLID_BREP`, `ADVANCED_FACE`, `PLANE`, `CYLINDRICAL_SURFACE`; `BREP_WITH_VOIDS` absent.
+- No-3D-Boolean diagnostics emitted (`v2-x5-no-3d-boolean-used`, compatibility `v2-v3-no-3d-boolean-used`).
+
+## Non-goals reaffirmed
+No production routing expansion, no full clipping engine, no sketch solver, no blind/counterbore/stepped/cross-axis hole support, no STEP exporter change, and no Boolean core change.
+
+## Production-evaluation posture
+Current result is lab-only evidence and is ready for bounded production-evaluation discussion for profile-expression front door routing.
+
+## Recommended next step
+Productionize bounded profile-expression front door (rectangle-minus-contained-circles), then run slot/capsule lab and/or bounded clipping lab based on deferred evidence.
diff --git a/docs/frictionlab/v2-x4-profile-boolean-normalization-lab.md b/docs/frictionlab/v2-x4-profile-boolean-normalization-lab.md
index a704d56c..21c1318e 100644
--- a/docs/frictionlab/v2-x4-profile-boolean-normalization-lab.md
+++ b/docs/frictionlab/v2-x4-profile-boolean-normalization-lab.md
@@ -67,3 +67,7 @@ Not implemented in this milestone. Chaining into V2-X3 profile-hole extrude rema
## Recommended next step
Run a bounded clipping lab for rectangle-rectangle overlap normalization, or a dedicated slot/capsule profile normalization+extrusion lab before any production expression-routing decisions.
+
+
+## V2-V3 chaining note
+V2-V3 now chains accepted V2-X4 normalized outputs into `ProfileHoleExtrudeEmitter` through a lab adapter (`ProfileBooleanExtrudePipelineLab`), preserving deferred/rejected stops before any BRep emission.
diff --git a/docs/v2-v2-profile-hole-extrude-through-hole-integration.md b/docs/v2-v2-profile-hole-extrude-through-hole-integration.md
index a5eb8325..5e06f7de 100644
--- a/docs/v2-v2-profile-hole-extrude-through-hole-integration.md
+++ b/docs/v2-v2-profile-hole-extrude-through-hole-integration.md
@@ -65,3 +65,7 @@ See milestone run commands and focused `ProfileStackExtrudeHoleFamilyMigrationTe
## Next recommended milestone
Extend semantic planning/adapter contracts to represent bounded multi-hole through plans in a single admissible executable plan, then reuse this route without broadening emitter geometry scope.
+
+
+## V2-V3 chaining note
+A lab-only V2-V3 pipeline now demonstrates compile-time profile Boolean expression normalization feeding bounded emitter input (rectangle minus circles) and STEP smoke validation, with no 3D Boolean in the candidate path.