Skip to content

feat(editor): streamline connected pipe and duct drafting - #827

Merged
wass08 merged 58 commits into
pascalorg:mainfrom
sudhir9297:work/inline-insertion-foundation
Sep 10, 2026
Merged

feat(editor): streamline connected pipe and duct drafting#827
wass08 merged 58 commits into
pascalorg:mainfrom
sudhir9297:work/inline-insertion-foundation

Conversation

@sudhir9297

@sudhir9297 sudhir9297 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

  • Pipe and duct connection snapping

    • Issue: Drawing a run near an existing socket still required manual alignment, especially in the floor plan.
    • Fixed: Run tools now snap to visible connection points in both 2D and 3D using a consistent screen-distance threshold.
  • Run direction controls

    • Issue: Angled and vertical routes were difficult to choose from the cursor alone.
    • Fixed: Direction guides support horizontal, diagonal, wall-plane, and vertical choices, with pointer selection and keyboard cycling.
  • Inline pipe fittings

    • Issue: Adding a fitting to an existing straight pipe required rebuilding the run around it.
    • Fixed: Hovering a compatible fitting over a pipe previews the insertion, and clicking splits the pipe and inserts the fitting as one undoable change.
  • Automatic run end caps

    • Issue: New pipe and duct runs could be left with visually open ends, and caps did not follow later endpoint edits.
    • Fixed: Free ends receive matching caps automatically, while connected caps are removed and remaining caps follow endpoint moves.
  • Pool plumbing workflows

    • Issue: Pool inlets, skimmers, and drains required repeated manual pipe construction and overlapping routes were hard to manage.
    • Fixed: The editor now loads the pool plugin build with automatic connection routes, route status and removal controls, shape support, and separated pipe elevations.
    • The plugin release artifact is stored in the repository so installs do not depend on a developer's local filesystem.
  • Portable CLI runtime size

    • Issue: The standalone build copied the pool plugin's vendored installation archive into the published CLI after the plugin code was already bundled, pushing cli-smoke over its compressed-size limit.
    • Fixed: Runtime staging removes vendored source archives, and the compressed budget now accommodates the pool plugin's shipped client code while retaining the unpacked-size and file-count limits.
  • Run selection and hanger controls

    • Issue: Marquee selection could miss path-based runs, and automatic hanger controls used extra panel text.
    • Fixed: Pipe and duct footprints participate in box selection, and hanger generation uses a compact mode control while drafting.
  • System checks panel

    • Issue: Distribution-system findings were dense and difficult to scan or locate in the scene.
    • Fixed: The panel now groups findings, shows error and warning totals, filters categories, and provides direct locate actions.
  • WebGPU handle stability

    • Issue: Recreating and disposing shared handle geometry could leave WebGPU render pipelines with missing vertex buffers.
    • Fixed: Handle geometry and materials are cached by their stable visual variants and reused safely.
  • Plugin-facing tool boundaries

    • Issue: Run planning and floor-plan projection data crossed package boundaries through global scene reads and core view-specific state.
    • Fixed: Planners receive scene snapshots through the registry API, while screen projection metadata stays in the editor layer.

How to test

  1. Run bun install --frozen-lockfile, then run bun dev and open the editor at http://localhost:3002.

    • The editor should load successfully with the pool plugin available.
  2. Draw a DWV pipe or duct near an existing open socket in both 3D and floor-plan views.

    • The endpoint should snap to the nearby socket, including sockets above or below the current drawing plane.
  3. Start a run and choose diagonal, wall-plane, or vertical directions with the guides and keyboard controls.

    • The preview and committed run should follow the selected direction without floating status badges.
  4. Choose a compatible pipe fitting, hover it over the middle of a straight pipe, and click.

    • The preview should show the insertion, and the committed result should contain two pipe sections joined through the fitting. Undo and redo should treat it as one change.
  5. Draw a free pipe and duct, then drag either endpoint.

    • Matching end caps should be created automatically and should remain aligned after the endpoint moves.
  6. Create pools with different supported outlines and automatically connect inlets, skimmers, and drains.

    • Each group should produce one extendable outlet, avoid overlapping other generated routes, show a connected state, and allow its generated connection to be deleted.
  7. Box-select across pipe and duct runs, then open System checks from a selected distribution item.

    • Path runs should be selected, and findings should be filterable with working locate buttons.
  8. Repeatedly select, resize, and draw items while using WebGPU rendering.

    • Handle arrows should remain visible without vertex-buffer or post-processing errors.
  9. Run the automated checks.

    • bun run lint, bun run check-types, and bun run build should pass.
    • The exact cli-smoke workflow should pass with a 107.6 MB compressed artifact.
    • The focused run, fitting, snapping, end-cap, and floor-plan tests should report 69 passing tests.

Screenshots / screen recording

Not added yet.

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

Note

Medium Risk
Touches scene mutation paths (atomic applyChanges, end caps, inline pipe splits) and cross-package drafting APIs; regressions could affect MEP editing and portable CLI size gates.

Overview
Wires the pool plugin into the editor (discovery, host panel, transpile, vendored tarball) and hardens builtin plugin loading so HMR cannot re-register duplicate node kinds against the persistent registry.

Pipe and duct drafting gets screen-space port snapping (including floor-plan screenProjection on grid events), length grid snapping, Tab direction cycling, H for hanger mode via shared run-hanger state, and leaner run cursors (no inline hanger/preset HUD). Planners commit through registry SceneApi with explicit scene snapshots instead of global useScene reads. Automatic end caps are added on free ends, removed when extending through them, and follow endpoint drags in 3D and floor-plan affordances.

Inline pipe fittings (coupling/reducer/inline cleanout) can split a run on body snap with atomic create/update. Box/marquee selection transforms position-based footprints (marqueePolygon) so moved pools select correctly.

Editor UX fixes: handle hit areas respect placementDragMode without per-frame raycast swaps; geometries/materials are cached for WebGPU stability; R/T rotation is not stolen when the item tool is armed without a catalog selection; continuation handles hide while a pipe vertex cluster is open.

CLI packaging drops staged apps/editor/vendor after bundle and raises the compressed smoke budget to 110 MB.

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

sudhir9297 and others added 30 commits May 19, 2026 02:59
Items (e.g. solar panels) can now be placed on sloped roof surfaces.
The placement system computes euler rotation from the roof surface
normal so items sit flush on the slope instead of going inside.

- Add roofStrategy to placement-strategies with enter/move/click/leave
- Wire roof:enter/move/click/leave events in the placement coordinator
- Add calculateRoofRotation in placement-math using surface normals
- Support full 3D cursor rotation for sloped surfaces
- Items on roofs are parented to the level with world-space rotation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
# Conflicts:
#	packages/editor/src/components/editor/handles/handle-arrow.tsx
#	packages/editor/src/components/editor/index.tsx
- Split pipe runs around inline fittings with preserved connections
- Improve run snapping, marquee selection, and rotation shortcut ownership
- Add screen-space projection data for cross-view snapping
- Use registry scene APIs for atomic node changes and selection
- Update mated duct and pipe end caps as endpoints move
- Cache shared handle geometry and materials
- Remove redundant connection and snap labels
- Preserve ray and arrow dimensions while using unit-sized shared geometry
@pascal

pascal Bot commented Sep 10, 2026

Copy link
Copy Markdown

I hit an error while handling your request (Model unavailable on AI Gateway free tier: Free tier users do not have access to this model. Upgrade to paid credits at https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%3Fmodal%3Dtop-up for unrestricted…).

Please try again, rephrase, or reach out if it keeps failing.

Error id: 5fb60cef-242c-4154-953c-ef3bb7058e8b

@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.

Stale Bugbot comment from a previous run.

Comment thread INLINE-INSERTION-TRACKER.md Outdated
Comment thread packages/nodes/src/shared/automatic-run-end-cap.ts

@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.

Stale Bugbot comment from a previous run.

Comment thread packages/nodes/src/pipe-fitting/inline-insertion.ts
Comment thread packages/nodes/src/shared/distribution-run-tool.tsx
Comment thread packages/editor/src/components/tools/select/marquee-footprint.ts
Comment thread packages/editor/src/components/editor/handles/handle-arrow.tsx
Comment thread packages/nodes/src/pipe-segment/selection.tsx
@sudhir9297

Copy link
Copy Markdown
Contributor Author

Addressed all Cursor Bugbot findings in 4cdd7da7:

  • Removed INLINE-INSERTION-TRACKER.md, which contained local workspace paths, branch names, and checkpoint details that should not land on main.
  • Replaced proximity-based automatic end-cap matching with explicit run ID and endpoint ownership. Coincident pipe or duct endpoints can no longer delete or move another run's cap.
  • Added a regression test covering two pipes whose capped endpoints occupy the same position.
  • Resolved both Bugbot review threads.

Validation:

  • bun test packages/nodes/src/shared/automatic-run-end-cap.test.ts packages/nodes/src/pipe-segment/continuation.test.ts packages/nodes/src/duct-segment/continuation.test.ts — 20 passed
  • bun run checks — passed
  • bun run build — passed
  • GitHub ci, quality, and cli-smoke — passed

Cursor Bugbot's follow-up check completed as skipped and reported no additional findings.

…-foundation

# Conflicts:
#	bun.lock
#	packages/nodes/package.json

@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 3 potential issues.

Fix All in Cursor

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

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 45e353f. Configure here.

{ node: fitting, parentId },
{ node: runTail, parentId },
],
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Inline split orphans run end caps

High Severity

Inserting a fitting splits the run into a shortened original and a new tail, but automatic end-cap metadata still names the original run and its end. The cap stays on the tail visually, so later endpoint drags, connections, or cap cleanup act on the wrong node.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 45e353f. Configure here.

)
return [euler.x, euler.y, euler.z] as Point
})(),
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Inserted coupling keeps wrong outlet

Medium Severity

Inline placement copies the run’s diameter onto the fitting but leaves diameter2 at the catalog template size. A coupling or inline cleanout on a different-sized pipe becomes a tapered fitting while the tail stays the original diameter.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 45e353f. Configure here.

)
const capUpdates = endCapUpdates(nextPath)
const capIds = new Set(capUpdates.map((update) => update.id))
return [...updates.filter((update) => !capIds.has(update.id)), ...capUpdates]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Floor-plan drag skips end-cap undo

Medium Severity

The 2D path-point session snapshots only the run and declared connectivity IDs, and followUpdates returns no cap writes when connectivity is null. End-cap follow can run without being snapshotted, so cancel and undo restore the pipe but leave the cap at the dragged pose.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 45e353f. Configure here.

@wass08
wass08 merged commit 7ec084f into pascalorg:main Sep 10, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants