From 9af3f9d8cf3e8398b0d53c46ae2f18ad1926e20c Mon Sep 17 00:00:00 2001 From: Bruno Postle Date: Thu, 12 Mar 2026 20:47:32 +0000 Subject: [PATCH] Update CLAUDE.md: wall mitre recipe for sloped walls --- CLAUDE.md | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index 4baf400..c08731f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -221,6 +221,65 @@ ifc_edit("geometry.assign_representation", '{"product": "", "represe Note: the `polyline` parameter must be passed as a **JSON string** (not a bare array). +### Wall mitre connections + +`geometry.connect_wall` + `geometry.regenerate_wall_representation` produce properly mitered wall ends where walls meet at corners. The workflow: + +``` +# 1. Add an Axis/Curve2D representation to each wall (context 23 = Plan/GRAPH_VIEW) +# axis is a list of 2D points [[x0,y0],[x1,y1]] in the wall's LOCAL frame +ifc_edit("geometry.add_axis_representation", '{"context": "23", "axis": "[[0,0],[4.0,0]]"}') +ifc_edit("geometry.assign_representation", '{"product": "", "representation": ""}') + +# 2. Connect the walls (creates IfcRelConnectsPathElements) +ifc_edit("geometry.connect_wall", '{"wall1": "", "wall2": ""}') + +# 3. Regenerate to compute miter cuts +ifc_edit("geometry.regenerate_wall_representation", '{"wall": "", "length": "4.0", "height": "2.5"}') +``` + +`connect_wall` must be called for both orientations (A→B and B→A) for a two-wall corner. All connected walls must be regenerated. + +**CRITICAL: `regenerate_wall_representation` removes slope clippings.** Do not use it on walls with top-clipped (sloped) geometry. + +**For sloped walls needing a mitre**, use `ifc_shape` to bake the 45° cut into the 2D profile as a trapezoid, then apply the slope as a single `IfcHalfSpaceSolid` via `geometry.add_boolean`: + +``` +# South porch wall: mitre cuts from (1.9,0) to (1.57,0.33) at east end +# → trapezoid profile: (0,0)→(1.9,0)→(1.57,0.33)→(0,0.33) +ifc_shape("polyline", {"points": [[0,0],[1.9,0],[1.57,0.33],[0,0.33]], "closed": true}) +# → polyline_id +ifc_shape("profile", {"outer_curve": }) # → profile_id +ifc_shape("extrude", {"profile_or_curve": , "magnitude": 3.5, "position": [0,0,0]}) +# → extrusion_id +ifc_shape("get_representation", {"context": 11, "items": []}) # → rep_id (SweptSolid) + +# Create the slope half-space (normal points INTO the kept region below the slope) +ifc_shape("plane", {"location": [0,0,3.26], "normal": [-0.419, 0, -0.908]}) # → plane_id +ifc_shape("half_space_solid", {"plane": , "agreement_flag": false}) # → hss_id + +# Apply slope as boolean — moves extrusion out of rep top-level, adds BCR in its place +ifc_edit("geometry.add_boolean", '{"first_item": "", "second_items": ""}') +ifc_edit("attribute.edit_attributes", '{"product": "", "attributes": "{\"RepresentationType\": \"Clipping\"}"}') + +# Swap body rep +ifc_edit("geometry.unassign_representation", '{"product": "", "representation": ""}') +ifc_edit("geometry.remove_representation", '{"representation": ""}') +ifc_edit("geometry.assign_representation", '{"product": "", "representation": ""}') +``` + +**Mitre trapezoid geometry** — for a wall with thickness `t=0.33`, mitre at the east end (local x=L): +- `t_at_mitre = t` (both walls same thickness → 45°) +- East-end mitre: profile points `(0,0)→(L,0)→(L−t, t)→(0,t)` (removes NE inner corner) +- West-end mitre: profile points `(0,0)→(L,0)→(L,t)→(t,t)` (removes NW inner corner, closing from `(t,t)` to `(0,0)`) +- For walls with origin at the mitre end: profile points `(0,0)→(L,0)→(L,t)→(t,t)` where x=0 is the mitre end + +**Slope normal** must point INTO the kept region (below slope = negative Z component): +- Slope rising west→east: normal `[+0.419, 0, −0.908]` at location `[0, 0, z_at_x0]` +- Slope falling west→east: normal `[−0.419, 0, −0.908]` at location `[0, 0, z_at_x0]` + +**Do NOT use dual `add_wall_representation` clippings** (two half-spaces: slope + mitre) — this produces incorrect geometry in viewers even though the IFC math is sound. + ### Tracing geometry chains Walk entity references to find extrusion depths, clipping planes, etc.: