Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Support independent rectangle placement and tracing
Yuechen Li8a997cf9d07a
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentIntelliDraftTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentIntelliDraftTests.csindex 18714d18..99a3ca2c 100644--- a/Aetheris.Kernel.Firmament.Tests/FirmamentIntelliDraftTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentIntelliDraftTests.cs@@ -67,6 +67,40 @@ public class FirmamentIntelliDraftTestsAssert.True(FirmamentBuildAndExport.CompileSource(draft.Source).IsSuccess);}+ [Fact]+ public void IndependentRectanglePlacementDoesNotCreateRelationshipsAndCanTraceTheSameL()+ {+ var draft = new Draft(); draft.Add(new("layout", Name: "layout"));+ draft.Add(new("rectangle", draft.Id("layout"), "outer", Width: 60, Height: 40));+ draft.Add(new("rectangle", draft.Id("layout"), "notch", X: -12, Y: -7, Width: 52, Height: 32));+ void Change(string name, string label, double value)+ {+ var control = draft.View.Shapes.Single(s => s.Name == name).Controls.Single(c => c.Label == label);+ draft.Source = FirmamentSketchService.Edit(draft.Source, "draft.firmament", "0", new("constructionDimensions", Changes: [new(control.Id, value)])).Text;+ }+ Change("notch", "Center X", 4); Change("notch", "Center Y", 4);+ Change("outer", "Center X", 10);+ Assert.Equal([4d, 4], draft.View.Shapes.Single(s => s.Name == "notch").Center);+ Change("outer", "Center X", 0);+ Change("outer", "Width", 80);+ Assert.Equal(52, draft.View.Shapes.Single(s => s.Name == "notch").Controls.Single(c => c.Label == "Width").Value);+ Change("outer", "Width", 60);+ Assert.DoesNotContain("Wall", draft.Source);+ Assert.Contains("Static notchCenterX: Length = 4mm", draft.Source);+ draft.Add(new("trace", draft.Id("layout"), "section", Trace: [+ new("outer.Bottom", "outer.BottomLeft", "outer.BottomRight", Connect: true),+ new("outer.Right", "outer.BottomRight", "notch.BottomRight", Connect: true),+ new("notch.Bottom", "notch.BottomLeft", "notch.BottomRight", Connect: true),+ new("notch.Left", "notch.TopLeft", "notch.BottomLeft", Connect: true),+ new("outer.Top", "notch.TopLeft", "outer.TopLeft", Connect: true),+ new("outer.Left", "outer.TopLeft", "outer.BottomLeft", Connect: true)]));+ draft.Add(new("extrude", draft.Id("section"), "body", Length: 6));+ GeometryMatches(draft.Source, "independent-rectangles-l.firmament");+ var before = draft.Source;+ Assert.Throws<FirmamentLanguageEditException>(() => Change("notch", "Center X", 14));+ Assert.Equal(before, draft.Source); // A broken Profile is refused, never repaired by moving its neighbors.+ }+[Fact]public void WholeRectangleTracingRetainsTheShapeAndDoesNotInventPoints(){diff --git a/docs/development/reports/2026-10/intellidraft-independent-placement.md b/docs/development/reports/2026-10/intellidraft-independent-placement.mdnew file mode 100644index 00000000..94a0aedf--- /dev/null+++ b/docs/development/reports/2026-10/intellidraft-independent-placement.md@@ -0,0 +1,88 @@+# IntelliDraft: independent drawing and soft alignment++## Change++The primary workflow is now **draw rectangle → enter exact dimensions → drag+to place → repeat → trace → extrude**. Each rectangle retains its own placement+and dimension inputs. A rectangle's intrinsic geometry supplies its right angles+and parallel, equal opposite sides. Different rectangles do not automatically+acquire persistent relationships.++The canvas offers temporary edge/center alignment guides within seven screen+pixels, on both axes. This permits all four corner alignments and center+alignment. Releasing a drag submits the selected shape's center coordinates to+the existing compiler dimension-edit operation. Alt bypasses alignment. Escape+and pointer cancellation abandon the preview. Undo/Redo use the existing staged+source history. Fit, zoom buttons and middle-drag control the view without editing+source; the camera stays stable during placement.++Independent drawing and unsnapped dragging use 0.1 mm authoring increments.+Alignment uses projected target coordinates, and numeric fields admit finer+precision. This is an authoring resolution, not a manufacturing tolerance or a+change to kernel mathematics.++Explicit dimension-driven inset relationships remain under **Advanced** for+legitimate existing parametric source. They are never introduced by snapping.+Expression-driven placements remain protected against literal replacement.++## Ownership and limits++Production compiler, SDK transport and engineering geometry code are unchanged.+The browser samples already resolved construction for display and hit testing;+its alignment helper chooses a disposable coordinate offset, not an engineering+constraint. It does not evaluate Firmament expressions. Draw and drag commit+through the existing compiler-owned source transactions and preflight checks.++An edit that breaks an existing traced Profile is refused, preserving the last+accepted candidate and reporting the compiler diagnostic. No neighboring shape+is moved and no missing boundary is manufactured. The open construction stage+remains free to position shapes before tracing.++Direct pointer drawing currently creates rectangles. Existing point/line/circle+guides and ordered line/arc Paths remain available under Advanced. Movement+requires independently writable projected center controls. Alignment considers+projected bounds of shapes in the same layout. This pass does not add arbitrary+intersection creation, curve editing, simultaneous constraints or inverse+expression solving.++## Qualification++- Manual production-browser dogfood: drew two rectangles, sized them to+ 60 × 40 and 52 × 32 mm, dragged the second into alignment, confirmed center+ (4,4) mm through the visible fields, selected six spans and built a 6 mm+ extrusion. The UI showed **Ready / No problems** without opening Source.+- Added `fixtures/Regression/IntelliDraft/independent-rectangles-l.firmament`.+ The UI-generated source retains two Rect2s and separate center/size parameters,+ with no Point2/Line2 outline or implicit expression relationship.+- Production browser tests exercise drawing, exact sizing, dragging to every+ corner alignment, disappearing guides, Alt bypass, Escape cancellation and+ Undo. Moving the envelope to (7,3) mm leaves the notch at (4,4) mm. Its restored+ source then traces and builds normally.+- Exported STEP matches the independently built reference: one enclosed+ manifold body, 8 faces / 18 edges / 12 vertices, bounds+ (-30,-20,0)..(30,20,6) mm, planar surfaces and analytic curves. CLI validation+ reports `valid`. Compiler tests compare resolved geometry and prove that+ moving/resizing one independent rectangle does not change the other. An+ invalid later Profile placement is rejected without source mutation.+- Focused IntelliDraft compiler tests: **8 passed**. Release solution build:+ succeeded. Fast Core tests: **1110 passed**. Full serial solution regression:+ **6047 passed, 2 existing Drawing Notes skips** across 20 projects.+- Frontend unit suite: **159 passed**. Production frontend build succeeded;+ **6 production browser workflows passed**, including the existing explicit+ relationship, point, arc/chord, whole-rectangle and ordered-Path workflows.++Code review confirmed no new parser route, schema, source-expression evaluator,+global mutable geometry state or hidden persistent snapping relationship. Public+IntelliDraft/profile documentation now leads with independent placement and+distinguishes optional explicit expressions from UI alignment.++Logs: ignored `Aetheris/artifacts/local/intellidraft-placement-*` and+`HeliosCAD/artifacts/local/intellidraft-placement-*`. Generated source, STEP,+comparison JSON and screenshots: `HeliosCAD/artifacts/local/intellidraft/`,+including `soft-alignment-guides.png` and `independent-rectangles-l-built.png`.++## Verdict++**Success for independent rectangle drawing, exact sizing, soft placement and+tracing.** The top-right dependency preset is no longer the primary construction+model. The full kernel suite and actual browser/export path remain qualified.diff --git a/docs/public/firmament/sketcher.md b/docs/public/firmament/sketcher.mdindex abf7bfad..9b5b0cd7 100644--- a/docs/public/firmament/sketcher.md+++ b/docs/public/firmament/sketcher.md@@ -11,20 +11,31 @@ then dimensioned construction shapes. `Rect2` supplies right angles and equal,parallel opposite sides. Its type and dimensions remain authoritative whenTrace selects material boundary spans from its named edges and corners.-For an L, add a 60 × 40 mm rectangle at the origin, then **Add related rectangle**.-Keep the top-right inset relationship and one shared 8 mm wall input. The second-rectangle is driven by the first: 52 × 32 mm at center (4,4) mm. Choose **Trace**-and select the envelope's bottom and lower-right spans, the inset's bottom and-left edges, and the envelope's upper-left top span and left edge. **Trace Profile**-checks the resulting closed boundary; neither rectangle is replaced by a point-list or a mesh. **Use whole rectangle outline** traces a single full rectangle.--**Shapes** edits independent dimensions. Derived values show their driving-expressions and remain read-only; **Relationship dimensions** edits shared inputs.-Apply or discard pending fields before leaving their editor or building. Resizing-the envelope or changing the wall input updates both the construction and its-trace. The source contains normal Rect2 declarations, Static inputs and explicit-expressions, with no separate saved constraint model.+For an L, draw a rectangle, then enter its exact 60 × 40 mm size and center+(0,0) mm. Draw a second independent rectangle and size it to 52 × 32 mm. Drag it+to align its top and right edges with the first: its center is then (4,4) mm.+Temporary alignment guides help placement; they do not link the shapes. Other+edges and centers can align in the same way. Hold Alt to bypass alignment.+Moving or resizing one rectangle later does not move the other.++Choose **Trace** and select the envelope's bottom and lower-right spans, the+second rectangle's bottom and left edges, and the envelope's upper-left top+span and left edge. **Trace Profile** checks the resulting boundary. Rectangles+remain typed constructions, not authored point lists or meshes. **Use whole+rectangle outline** traces a single full rectangle.++**Shapes** edits exact dimensions. Apply or discard pending fields before+switching tools or building. Draw/drag previews commit on release; Escape+cancels an active gesture. Fit, zoom buttons and middle-drag navigate the canvas.+The direct drawing tool currently creates rectangles. Alignment uses projected+bounds of shapes in the same Concept Struct. It writes independent placement+values, without persistent constraint metadata.++Explicit dimension-driven relationships remain optional under **Advanced**.+The top-right inset preset intentionally creates expressions and shared inputs;+it is not the default placement behavior. Existing expressions remain read-only+at their derived controls and are edited through their inputs, never flattened+by a drag.Named **Point**, **Line**, **Circle** guides and Paths remain under **Advanced**.They support outlines that closed shapes do not express well. Circle spans select@@ -37,7 +48,8 @@ closing line. **Trace this Path** resolves that boundary to a Profile. Trace'sComplete examples:-- [L plate from retained rectangles](../../../fixtures/Regression/IntelliDraft/rectangles-l.firmament)+- [L plate from independently placed rectangles](../../../fixtures/Regression/IntelliDraft/independent-rectangles-l.firmament).+- [L plate from explicitly related rectangles](../../../fixtures/Regression/IntelliDraft/rectangles-l.firmament)and [its dimension-driven revision](../../../fixtures/Regression/IntelliDraft/rectangles-l-revised.firmament).- [Low-level L plate from named points and lines](../../../fixtures/Regression/IntelliDraft/named-lines-l.firmament).- [D plate from a circle span and chord](../../../fixtures/Regression/IntelliDraft/arc-chord-d.firmament).@@ -45,7 +57,7 @@ Complete examples:Choose an extrusion depth, **Extrude Profile**, then **Build and use part**.Incomplete construction is staged source, not a valid engineering part. Compiler-rejection retains the preceding candidate and the current built model. Undo and+rejection, including a move that breaks an existing Profile, retains the preceding candidate and the current built model. Undo andRedo navigate staged edits; Cancel discards them. A complete candidate must passthe normal build before replacing the current document. Updating constructionin an existing part is one normal undoable source transaction.@@ -161,11 +173,11 @@ document; edits do not reach into included files.IntelliDraft currently authors one unambiguous Model, retained Rect2 construction,named Point2/Line2/Circle2 guides, line/arc Paths, one outer trace and a positive-extrusion. The related-rectangle preset shares a top-right corner with an-unrotated rectangle in the same Concept Struct. Its wall/inset values and the+extrusion. The optional Advanced related-rectangle preset shares a top-right corner with+an unrotated rectangle in the same Concept Struct. Its wall/inset values and therectangle dimensions remain compile-time source expressions. Trace selectionuses named landmarks on the compiler's bounded guides; it does not invent-arbitrary intersection points. General cursor-snaps, arbitrary one-way geometric references, boundary-edit tools, arbitrary+arbitrary intersection points. Soft alignment currently uses shape bounds in+the same layout. General intersection/point snaps, arbitrary one-way geometric references, boundary-edit tools, arbitrarytrim/extend and simultaneous constraint solving are not implemented. Existing code-authored geometrycontinues to use its normal compiler owners.diff --git a/docs/public/reference/language/profiles.md b/docs/public/reference/language/profiles.mdindex dfbe3f53..ac13eeab 100644--- a/docs/public/reference/language/profiles.md+++ b/docs/public/reference/language/profiles.md@@ -39,7 +39,13 @@ line and arc cuts).Use the loop form when a Profile has inner loops, combines several guides, orneeds named edges:-For a shape-driven example, [this L plate](../../../../fixtures/Regression/IntelliDraft/rectangles-l.firmament)+For a shape-driven example, [this independently placed L plate](../../../../fixtures/Regression/IntelliDraft/independent-rectangles-l.firmament)+retains two `Rect2` declarations with their own centers and dimensions. Their+placement makes named corners available for tracing; it does not impose a+persistent relationship between the rectangles. A closed Profile still requires+the selected spans to meet.++For optional explicit dependencies, [this L plate](../../../../fixtures/Regression/IntelliDraft/rectangles-l.firmament)retains two `Rect2` declarations: an envelope and an inset rectangle whose topand right edges follow it through shared dimensions. The Profile traces selectededge spans between their named corners. Changing the envelope or shared walldiff --git a/fixtures/Regression/IntelliDraft/independent-rectangles-l.firmament b/fixtures/Regression/IntelliDraft/independent-rectangles-l.firmamentnew file mode 100644index 00000000..c953b940--- /dev/null+++ b/fixtures/Regression/IntelliDraft/independent-rectangles-l.firmament@@ -0,0 +1,19 @@+Model IndependentRectanglePlate {+ units: mm+ Concept Struct layout on XY {+ Rect2 outer { center: [0mm, 0mm]; size: [60mm, 40mm] }+ Rect2 notch { center: [4mm, 4mm]; size: [52mm, 32mm] }+ }+ Profile section using layout {+ Loop Outer {+ outer.Bottom from outer.BottomLeft to outer.BottomRight as bottom+ |> outer.Right from outer.BottomRight to notch.BottomRight as right+ |> notch.Bottom from notch.BottomRight to notch.BottomLeft as ledge+ |> notch.Left from notch.BottomLeft to notch.TopLeft as upright+ |> outer.Top from notch.TopLeft to outer.TopLeft as top+ |> outer.Left from outer.TopLeft to outer.BottomLeft as left+ |> Close+ }+ }+ Extrude body { profile: section; from: 0mm; to: 6mm }+}