Skip to content

[Maintainer] wall: add endHeightOffset for a sloped top edge - #1248

Merged
Aymericr merged 21 commits into
mainfrom
cursor/wall-end-height-offset-11c1
Nov 10, 2026
Merged

Aymericr merged 21 commits into
mainfrom
cursor/wall-end-height-offset-11c1

Conversation

@Aymericr

@Aymericr Aymericr commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Maintainer port of #640 by @vducasse, merged with current main, with review fixes on top. Vincent's commits keep their authorship.

From #640: a wall gets an optional endHeightOffset, and its top slopes linearly from height at the start to height + endHeightOffset at the end. This covers knee walls, lean-to and attic partitions.

  • Geometry and openings: the viewer extrudes the slope and clamps opening cuts to the sloped top, on straight and curved walls.
  • Doors and windows must fit under the top over their whole span.
  • Trims slope their crowns.
  • Print preflight rejects sloped walls with unsupported_wall_print_slope.
  • Inspector: the full and compact panels get an end-height-offset row with no static max. The minimum keeps the low end standing.
  • Old scenes: the field is optional, so they load unchanged (E-003).

Maintainer changes:

  • Merge with main: opening clamps moved to core/building/wall-openings with a fits result, and main's removed face bands dropped from the PR. New call sites on main choose a sample point along the wall:
    • opening fit: the lowest top over the opening's span;
    • envelope checks (roof bearing, clash checks, usage fields): the higher end;
    • handles: the midpoint;
    • reported and seeded heights: the start.
  • Split: each piece gets the parent's top at its start as its height and the parent's rise over its span as its offset, so drafting across a sloped wall no longer leaves a sawtooth top.
  • Merge and auto-heal: sloped walls merge only when their tops meet at the joint and rise at the same rate; the offsets add up. reverseWallDirection flips the slope.
  • Flat walls place doors and windows exactly as on main. The new fits gate applies only to sloped walls.
  • Curved walls: arc length is converted to chord position, so the fit and the drawn top agree.
  • API: the t parameter is the last argument of resolveWallTop and resolveWallEffectiveHeight, with a default, so existing four-argument calls keep their meaning.
  • IFC export: a sloped wall is exported as a body clipped by an inclined half-space, so its top is 3 m to 2 m rather than a flat box. Openings still cut through it.
  • Agents (Bugbot finding): add_door, add_window and move_node refuse with wall_too_low an opening that fits nowhere under a sloped wall's top (bcace739).
  • Agents (Codex P2): a door asked for over a sloped wall's low end is first slid to where it fits, then refused only if no stretch of the wall takes it, matching the editor path (bc3b712a).
  • Viewer (Codex P1): where a mitre extends past the wall's end, the sloped top is clamped so top vertices never drop below the base (449d83e5).
  • Usage field (Codex P2): a sloped wall's full-height prism, and its crown trim, are labelled approximate rather than exact, so clash findings over the low end are softened (509b34f7).
  • Merged current main again after [Maintainer] Typed wall length and angle, and typed cabinet coordinates #1249 (fefd5cab). Only the compiled en and en-XA catalogs conflicted; they were regenerated with i18n:extract.

How to test

  1. Run bun dev, select a wall, and set "End height offset" to −1.5 m: the top slopes down toward the wall's end.
  2. Draw a new wall that T-joins the sloped wall. The two pieces continue the same top line, with no step.
  3. Add a door near the low end: it's refused where it doesn't fit under the top, and allowed further along.
  4. Put a window taller than a flat 1 m wall: it's placed and clamped as on main.
  5. Export IFC with a sloped wall and open it in a viewer: the top follows the slope.
  6. Give a wall that meets another at an acute corner a steep offset: the top stays above the base at the mitre.
  7. Focused tests: bun test packages/core/src/systems/wall packages/core/src/building packages/core/src/spatial/usage-field packages/viewer/src/systems/wall packages/ifc-converter.

Screenshots / screen recording

Sloped walls in a demo scene from this branch: the east walls rise from 1 m to 4 m and the west walls fall from 4 m to 1 m.

Sloped walls

The inspector field and the original captures are in #640.

Checklist

  • I've tested this locally with bun dev
  • My code follows the existing code style (run bun check to verify)
  • I've updated relevant documentation (if applicable)
  • This PR targets the main branch

Local bun run ci passed on 509b34f7 (exit 0). An earlier quality failure on 4a951beb, in the ifc-converter test "scaling > grows linearly with the number of rooms", was a timing flake:

  • The test scene has no walls.
  • The rerun on the same head passed.
  • The same test has failed on main's CI with ratios of 6.3–11.5.

P3 follow-ups from the earlier review:

  • Split pieces of curved sloped walls slope along their own chord, so the top drifts slightly inside a piece.
  • reverseWallDirection only flips the offset on storey-bound walls.
  • Heal resolves bases through the global spatial grid.
  • Door sidelights are ignored in the fit check.
  • MCP and point-ask report only the start height.

Supersedes #640. Credit: @vducasse.

Co-authored-by: vducasse [email protected]

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

Note

Medium Risk
Touches core wall-top resolution, opening placement, and merge/split topology across core, editor, and IFC; mitigated by broad tests and an optional backward-compatible field.

Reviewed by Cursor Bugbot for commit 509b34f. Bugbot is set up for automated code reviews on this repo. Configure here.

Ducasse, Vincent (external) and others added 16 commits September 1, 2026 13:58
- **Schema & Core Systems**:
  - Add endHeightOffset property to WallNode schema with default 0.
  - Update resolveWallTop and resolveWallOpeningCeiling to support
    parametric height sampling along sloped top edges.
  - Update getWallFaceBandConfig and getWallFaceBandForHeight to
    scale with maximum sloped wall height.
  - Update spatial grid synchronization, space detection, and level
    height calculations for sloped walls.

- **3D Geometry & Viewer Systems**:
  - Add applyWallEndHeightSlope in wall-system to evaluate planar slope
    continuously across miter extensions without creases.
  - Update getWallBandSplitPlanes to split horizontal face bands across
    the full sloped wall envelope.
  - Update treatments to clamp slope offsets against minimum height,
    omit trims on low walls, and make cutouts slope-aware.

- **Openings & Floorplan Tools**:
  - Update door and window ceiling clearance math, floorplan move
    handlers, and 3D move tools to respect sloped wall height.
  - Fix resolveWallRole in paint to resolve face bands by elevation Y,
    ensuring 1:1 parity with 3D mesh horizontal band splits.
  - Update 3D opening head clearance guides to sample minimum ceiling
    across the opening width.
  - Update elevation guides, measurement features with chord-projected
    t for curved walls, side move handles, and snap beacons.
Non-trivial resolutions:
- wall-top: kept main's storey/railing semantics; `t` is required after
  `electedBase`, before main's optional `authoredStoreyHeight`. getWallTop
  takes `t`; new getWallTopOver gives the lowest top across a span.
- Opening clamps moved to core/building/wall-openings with main's refactor:
  clampDoorToWall/clampWindowToWall return `fits` from the sloped ceiling
  over the opening's span (new wallOpeningCeilingOver); nodes door/window
  math stay re-exports. Door/window tools, move tools and floorplan moves
  gate on `fits`, including main's corner-snap path.
- Face bands were removed on main: dropped the PR's band-plane and band
  slider changes. Trims now slope crowns through main's per-run slope and
  cut casings with the same slope-aware overlap.
- Viewer: slope applied in main's extrusion; opening cut tops clamp to the
  sloped top on straight and curved (band) cuts.
- scene-query.ts deleted on main; its height read lives in level-reads (t=0).
- Main's new call sites: span minimum for opening fit, max of both ends for
  envelopes (roof bearing, usage field, IFC, clash checks), 0.5 for handles
  and overlays, 0 for reported/seeded heights.
- Compact wall panel (panel-model) gets the end-height-offset row, mirroring
  the full panel's slider.
… a sloped top

Plugins pinned to the public API (bath-space, landscape, webxr) call it
without `t`, which failed the app typecheck after the merge. Omitting `t`
now answers the height the whole wall clears.
fr/es/ja/zh-CN entries are fuzzy drafts awaiting human review.

Co-authored-by: vducasse <[email protected]>
`t` moves after main's optional `authoredStoreyHeight` and defaults to the
start, so an existing four-argument call keeps its meaning instead of
reading the storey height as a position.
…ach station

Openings are placed by arc length but the top slopes along the chord. New
getWallChordFractionAt / getWallStationAtChordFraction map between the two;
getWallTopOver, the opening fit range, the build-json opening check, the
whole-wall ceiling and the side-handle width cap use them.
A flat wall keeps main's behaviour: an opening taller or wider than the
wall clamps and stays placeable, matching what the agent path checks.
Each piece starts at the original top where it begins and carries its
share of the end offset; pieces after a storey-bound start take explicit
heights.
…one line

Reversing a wall turns its slope around. A merge or delete heal needs the
tops to meet at the joint with the same rise per metre, and the merged
wall carries the summed end offset; flat walls compare as before.
Each wall prism rises to the higher end and an inclined half-space through
both end tops cuts it down, so the IFC body matches the drawn wall and
openings still void it.
Offsets get no static bounds; the floor that keeps the lower end standing
stays.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T23:01:20.935132Z 4a951be PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Aymericr Aymericr added the bot:maintainer label Nov 9, 2026 — with Cursor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4a951beb8a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4a951be. Configure here.

cursoragent and others added 5 commits November 9, 2026 23:08
…s top

Placing or moving a door or window through the agent plans now honours
the wall clamps' fit, as the editor does, with wall_too_low. Flat walls
always fit, so they place exactly as before.

Co-authored-by: vducasse <[email protected]>
Brings in #1249 (typed wall length/angle, shared usePlacementTyping store,
floorplan typing keys/HUD, typed cabinet coordinates). No source file was
changed on both sides; the textual conflicts were limited to generated
catalogs.

Resolutions:
- packages/editor/src/i18n/locales/{en,en-XA}/messages.ts: compiled
  catalogs conflicted; took main's copy and regenerated with
  `bun run i18n:extract`, which re-adds this branch's end height offset
  strings alongside #1249's typing strings. The PO catalogs auto-merged and
  extraction left them unchanged; `bun run i18n:check` passes.

Co-authored-by: vducasse <[email protected]>
The sloped top was evaluated as `height + slope * x` at every top vertex,
including miter vertices outside [0, L]. The offset clamp only guarantees
the centreline endpoints stay MIN_WALL_END_HEIGHT high, so a steep fall at
an end miter (or a steep rise at a start miter) put top vertices below the
wall base and inverted the body. `wallTopYAt` floors the sampled top at
MIN_WALL_END_HEIGHT and is shared by the top tilt, the band cutter and the
opening cutter tops.

Co-authored-by: vducasse <[email protected]>
add_door and move_node checked the door's height against the wall top at
the requested position before clampDoorToWall could slide it. A door asked
for near the low end of a wall rising toward its other end was refused
with wall_too_low, although the editor (and the clamp's centresUnderCeiling
interval) moves it to a stretch where it fits. Both plans now clamp first,
refuse through the clamp's `fits` when no stretch takes the door, and run
the height check at the clamped centre, so a flat wall that is too low
still refuses as before.

Co-authored-by: vducasse <[email protected]>
A wall with a nonzero endHeightOffset is modelled as a prism standing to
its taller end over the whole footprint, which claims solid volume above
the lower stretch of the top, yet it was labelled `shape: 'exact'`, so
clash and clearance findings near the low end read as exact collisions.
Wall body pieces of a sloped wall, and its crown trim (seated under the
taller top), are now `approx` with a `why`, as the module labels other
conservative shapes; flat walls and other trims stay exact.

Co-authored-by: vducasse <[email protected]>
@Aymericr
Aymericr merged commit 37be915 into main Nov 10, 2026
5 checks passed
@Aymericr
Aymericr deleted the cursor/wall-end-height-offset-11c1 branch November 10, 2026 00:02
cursor Bot pushed a commit that referenced this pull request Nov 10, 2026
…ments

Conflicts:
- packages/editor/src/i18n/locales/{en,en-XA}/messages.ts: compiled
  catalogs conflicted on both branches' new messages; regenerated with
  `bun run i18n:extract` rather than hand-merged. `bun run i18n:check`
  passes.

Everything else auto-merged; `bun run ci` covers the files both sides
touched (core/index.ts, floating-action-menu.tsx, en/messages.po).

Co-authored-by: sudhir <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants