Skip to content

Draw a pipe with coil: true as a coil of six passes - #9

Merged
XDGFX merged 1 commit into
mainfrom
coil-pipes
Oct 13, 2026
Merged

XDGFX merged 1 commit into
mainfrom
coil-pipes

Conversation

@XDGFX

@XDGFX XDGFX commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Summary

A pipe can set coil: true to show it is one long looped length, such as an underfloor heating loop. Each of its runs draws as six passes back and forth, label above.

 pipes:
   pex_16mm_underfloor:
     label: 16MM PEX UNDERFLOOR HEATING LOOP
     size: 16mm
+    coil: true        # anything but true or false is an error
layoutElk
  turnNode(w)            # pipe^: node sized for the passes, legs one coil span apart
    coilTurn             # six level passes in place of the plain turn
  slot(w)                # straight run: inline label slot, tall enough for the coil
    coilInline           # coil let into the level stretch through the slot,
                         # or undefined -> the run draws plain

The coil is only extra points on the route, so render.ts is untouched: corners are filleted, and colour and weight are the pipe's own. A run with an open end is a card and never coils.

Evidence

  • Before: pex_16mm_underfloor^ in a real heating plan drew as a plain U-turn with its label beside the bend.
    After: the same plan with coil: true draws six orange passes east of the two PEX adapters, label above the first pass. A straight coiled run, labelled and unlabelled, was rendered and checked by eye as well.
  • Sheets without coil are byte-identical: all 14 SVGs and 10 Markdown tables of the project that uses ferrule (4 plumbing plans, 10 looms) were rendered from this branch and compared with cmp against the committed ones, 0 differ.
  • npm run typecheck, npm test (85 pass, 4 new) and npm run build pass.
test/coil.test.ts
  a coiled turn runs out and back in evenly spaced passes, east of both its ends
  a coiled straight run crosses its own line in passes, between ends that stay where they were
  a coiled pipe with no label still coils, and draws no label
test/pipeviz.test.ts
  a pipe is coiled only when it asks, and any other coil value is an error

Not covered by a test: the plain-line fallback on a straight run, which no small plan could be made to trigger.

Merge Danger

Door: two-way

Opt-in key; reverting removes it and nothing else.

Blast Radius: none-unless-opted-in

A plan that already carries a stray non-boolean coil on a pipe now fails to render.

🤖 Generated with Claude Code

A pipe that is really one long looped length, such as an underfloor heating
loop, can set `coil: true`. Each of its runs is then drawn as six passes back
and forth in the pipe's own colour and weight, with the label above the coil.

On `pipe^` the turn node grows to hold the passes and its two legs enter one
coil span apart, so the coil takes the place of the plain turn. On a straight
run the label slot is made inline and tall enough for the coil, which is let
into the level stretch through it; with no such stretch the run draws plain.
The coil is only extra route points, so corners are filleted as on any route.

Any `coil` value other than true or false is an error. A sheet with no coiled
pipe lays out exactly as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@XDGFX
XDGFX merged commit 04945a3 into main Oct 13, 2026
1 check passed
@XDGFX
XDGFX deleted the coil-pipes branch October 13, 2026 10:47
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.

1 participant