Repository navigation
Add connected duct and pipe editing with shared build controls - #1115
sudhir9297 wants to merge 3 commits into
Conversation
Aymericr
left a comment
There was a problem hiding this comment.
Thanks @sudhir9297, this is a big step for MEP editing, and the refusal paths plus atomic undo coverage look solid. A few things before this can go in:
- Screenshots or a screen recording. This adds a lot of visible behavior (new build palette options, numeric inputs, duct/pipe edit inspectors, connection feedback in 2D and 3D). Please add a short recording covering drawing with the remembered settings, connect vs. cross-without-joining, a connected resize with a reducer/transition, a pipe offset, and a grade edit plus undo. The template section still says "Not added yet".
- Local
bun devcheck. The checklist item is unticked. Please confirm you've run it through the editor, not only the test suite. - CI and Bugbot.
quality,cli-smokeand Bugbot were still running when I looked. Please address anything they flag.
Non-blocking, but worth a look: pipe_grade.point and pipe_connect.end take bare metre tuples, while the rest of the new tools use measurement() for lengths. If that's deliberate because they're level-local coordinates, a short note in the tool descriptions would help agents use them correctly.
I'll take another pass once the recording is up and checks are green.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9c916aa. Configure here.
| adapter.connectCrossings === false ? null : adapter.findBody(candidate, drawingTarget) | ||
| if ( | ||
| body && | ||
| (!explicitRoute || Math.abs(body.point[1] - point[1]) < 1e-4) && |
There was a problem hiding this comment.
Plan-route slope blocks connections
High Severity
In horizontal routing, port and body snaps keep only collars at the start elevation, and that check runs before resolveFreeEnd applies waste grade. A sloped plan-route end sits at a different height, so same-height snaps fail the later grade check and grade-correct collars are filtered out. Plan-route drawing therefore cannot join existing pipe collars or trunks.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 9c916aa. Configure here.
| const finalPath = previewPathRef.current | ||
| const gradeUpdates = connectivity?.commitUpdates({ path: finalPath }) ?? [] | ||
| if (!pipeUpdatesPreserveGrades(useScene.getState().nodes, gradeUpdates)) return | ||
| committed = true |
There was a problem hiding this comment.
Rejected pipe move pauses history
High Severity
A connected pipe move that would change another run’s grade now returns before committed = true and before useScene.temporal.resume(). History is already paused for the drag, so a refused move never resumes undo/redo and the gesture fails with no message.
Reviewed by Cursor Bugbot for commit 9c916aa. Configure here.
* Improve shared MEP build tools and connected duct and pipe editing (cherry picked from commit f4aa29c) * Keep MEP agent operations headless and synchronize inspector drafts (cherry picked from commit 8feed8e) * Fix duct offset attachments and drafts; add MEP walkthrough evidence [maintainer: ported from #1115 without the wiki/assets/pr-1115 screenshots, which are review evidence linked from the original pull request and are not referenced by any document in the repository.] (cherry picked from commit 9c916aa) * Use the split MCP SDK packages in the MEP operation tests main moved to @modelcontextprotocol/client and @modelcontextprotocol/server after #1115 branched, so these tests failed to resolve the removed @modelcontextprotocol/sdk paths. * Snap sloped horizontal routes at the height their fall reaches Horizontal routing kept only ports and run bodies at the leg's start height, while the free end still takes the pipe fall. A sloped waste run therefore could not snap to a collar or run at the height it actually reaches, and the same-height candidates it did offer were then refused by the grade check on commit. Candidates are now compared with the height the route reaches above their plan position, using the adapter's free-end rule, and run bodies are looked up at that height. * Show and absorb pipe moves that would regrade a connected run A pipe move whose followers would change another run's grade was refused on click with no feedback, and the click was left to propagate. The ghost now turns red with a status notice while the preview would regrade a connected run, and a refused click is consumed. The drag stays live (history paused until placed or cancelled), so Esc or a valid spot ends it as before. The follower preview now returns the patches it shows, so the grade check reuses them instead of resolving the graph twice per frame. * Localize the MEP inspector and tool copy added for connected editing The new pipe grade, offset and resize inspectors, the duct edit inspector, the collar connection buttons, the route preview label and the distribution cursor hint rendered hardcoded English, which the literal guard rejects. They now go through Lingui as whole messages: split fragments are merged, counts use plurals, and numbers use the locale's formatting. The pipe description and the new grade-blocked move notice are included. zh-CN, fr, es and ja get fuzzy drafts awaiting review, so releases keep showing English for these until a reviewer approves them. * Settle connected edits on closed MEP loops instead of hanging Moving or raising a leg of a closed duct or pipe loop could freeze the editor. Each fitting re-broadcasts its averaged delta through both collars, and a run held at both ends bounces it straight back, so when two legs split a push differently (a sloped leg, or an oblique move) the walk queued every stale push and the queue doubled each round. The resolver now keeps only the newest pending push per joint edge and caps the walk at 64 steps per edge. Open chains, trees and loops the old walk could finish resolve exactly as before; loops it could not finish now settle with every joint welded (a leg moved along its axis carries the loop rigidly). On this branch the grade inspector's "Move elevation" action and the pipe_grade agent tool reach the resolver too, so a sloped vent loop now refuses that edit with the grade notice rather than locking up. * Keep elbow re-aim in plan-view pipe endpoint drags The grade-preserving floor-plan affordance replaced main's generic path-point drag, which swings the elbow at a straight run's far end to follow the drag. Without it, every turned endpoint was refused and nothing was committed. Plan-view endpoint drags now try the elbow re-aim first, with the same grade and connected-collar checks as the 3D handles. A refused frame keeps the last valid preview and shows a localized floor-plan notice. The 3D handles use the same localized message. * Preview the vertical riser as soon as its start is placed After the first click of a vertical route, the cursor and last resolved point still held the start. The ghost and the Target elevation label showed the start height. The next click then committed a riser the preview never showed, and Enter committed the zero-length start, which did nothing. Resolve the vertical target right away so click and Enter both place what the preview shows. * Refuse duct offsets whose bends cannot be formed Match the pipe offset: if an elbow cannot be planned at an offset corner, refuse with a structured reason. Previously a non-null assertion turned that case into a TypeError. * Keep pipe grade notices from capturing the pointer drei's Html applies its style to the wrapper around a label. A pointer-events-none class on the label alone still left the wrapper catching events. The move tool's notice follows the moved run and could sit under the cursor, stalling the preview and swallowing clicks. The selection notice covers the run's center arrows. Pass pointer-events: none to Html, as the measurement labels do. Also clear the endpoint drag's notice on release, so it no longer stays over the arrows after a refused drag. * Make a selected pipe's arrow move commit what it previews The center-arrow move checked grades only when publishing a frame. A refused frame silently froze the preview while the drag offset kept following the cursor. Release then recomputed from that unseen offset: a plain stretch was dropped without a message, and a move past the offset threshold committed offset fittings that were never shown. Vertical frames kept a valid tint even when the preview was dropped. Each frame is now planned as release would commit it: a vertical offset, a translation offset with its new fittings ghosted, or a plain move. That plan goes through the grade guard. A refused frame keeps the shown frame and explains why, like the endpoint handles, and release commits the frame on screen. Live previews also drop overrides left by earlier frames. * Select MEP operation reads with queryNodes instead of enumerating the scene On a detached scene, enumerating the nodes record counts as reading every node, so a grade, offset, resize, connect or duct edit drafted there was refused whenever anything was created or deleted meanwhile. Port connectivity now selects the run and following-fitting kinds, the operations select their level, and the end-cap and auto-offset helpers select the kinds they own. The raw-scene-enumeration rule now covers these modules. * State defaults and refusal codes in the MEP agent tool contracts Each description now opens with a sentence that stands alone, states the defaults of scope, alignment, flow, anchor, detach and the duct sizes, and lists the refusal codes its operation can return. The nodes README documents the five tools next to the kitchen ones. * Format MEP collar and grade labels in the active locale Pipe collars are named (inlet, outlet, branch, or a numbered collar) instead of showing their port id, duct collar sizes use the locale's digits, and the grade label shared by the plan view, the grade inspector and the drawing readout is a catalog message with locale numbers. Drafts for fr, es, ja and zh-CN await review. * Follow the snap modes in duct fitting handle drags Moving, turning and resizing a selected duct fitting read the grid and angle snap modes, as the duct segment handles already do, instead of treating Shift as a snap bypass. The interaction-scope inventory now lists the handles that still use the legacy bypass. * Tint a refused pipe move's footprint box with its ghost A pipe move that would regrade a connected run turned its ghost red but kept the footprint box in the placeable green. The box now follows the ghost, as the generic move tool's box does for an invalid placement. --------- Co-authored-by: sudhir <sudhir9297@gmail.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
|
Thank you @sudhir9297, this landed. We ported your three commits onto current |


What does this PR do?
Add remembered duct and pipe build settings for profiles, materials, routing elevations and crossing behavior, with nonblocking connection feedback shared by 2D and 3D. Duct editing supports connected resizing, transitions, offsets and registered equipment/terminal collars. Pipe editing adds grade and downhill flow, grade-preserving endpoint edits, connected resizing with reducers, offsets and registered fixture/trap collars.
The same edit operations power the inspectors and five agent tools, with atomic undo and refusals for incompatible connections or insufficient fitting space. Profile math is separated from rendering so agent operations remain headless; agent contracts advance to revision 1.1.0, and inspector drafts refresh after committed edits or undo. Offsets are geometric routing and do not validate obstacle clearance or drainage compliance. Catalog objects need authored ports to connect.
How to test
bun test packages/nodes/src(5,082 passed, one skipped),bun run check-types(13 tasks successful), Biome checks on all 38 review-fix files, andgit diff --check. The pre-push hook also passed repository-wide lint with warnings and repeated the type checks. The earlier shared-distribution run tests also passed. A headless bundle regression test rejects editor/viewer dependencies in agent operations.Manual checks covered connection and crossing cases in both views, including tees, size transitions, vertical equipment collars, undo, occupied collars and invalid-connection refusals.
Screenshots / screen recording
Captured screenshots from the local
bun dev --filter=editorrun on 21 October 2026. These are screenshot walkthroughs, not a continuous recording. An isolated local fixture was used.Checklist
bun devbun checkto verify)mainbranchNote
High Risk
Large changes to distribution run tooling, scene graph mutations (resize/offset/split), and new agent operations that must keep collars and grades consistent; mistakes could break MEP connectivity or partial-edit safety.
Overview
This PR extends duct and pipe drafting with remembered build settings (profile, routing mode, elevations, connect-vs-cross) exposed in the build tab via
ToolOptionsPanel, including numeric fields for elevations.useDistributionRunToolgains explicit horizontal / vertical / surface routing so plan-view runs and vertical legs can follow typed elevations without pointer movement, while distribution tools no longer wipe defaults on palette activation.Scene editing adds shared resize, offset, grade, and collar-connect operations for ducts and DWV pipes, wired to selection inspectors and five new agent/MCP tools (
duct_edit,pipe_grade,pipe_resize,pipe_offset,pipe_connect) with unit-aware inputs and atomic undo. Drawing and continuation now honor registered equipment/fixture collars (straight first section, system match, occupied-port refusal) and optional cross without joining trunks.Supporting changes extract duct profile math into
profile.tsfor headless agent bundles, add plan grade affordances and floorplan grade annotations for pipes, and replace some parametric size fields with the new edit UIs.Reviewed by Cursor Bugbot for commit 9c916aa. Bugbot is set up for automated code reviews on this repo. Configure here.
Review follow-up
pipe_grade.pointandpipe_connect.endas numeric[x, y, z]coordinates in level-local metres; advanced contract revision to 1.1.1.bun run check-typespassed, changed-file Biome andgit diff --checkpassed. Manual inspector apply/undo and the workflows above ran through the local editor.