Skip to content

Wrap a long sheet into rows when its diagram asks - #7

Merged
XDGFX merged 2 commits into
mainfrom
wrap-rows
Oct 8, 2026
Merged

XDGFX merged 2 commits into
mainfrom
wrap-rows

Conversation

@XDGFX

@XDGFX XDGFX commented Oct 8, 2026

Copy link
Copy Markdown
Owner

Adds an opt-in diagram.wrap option that folds a long sheet into rows. It is off by default.

diagram:
  wrap: true            # aim for 1.6:1
  # wrap: { aspect: 4 } # name the ratio; higher folds less

What it does

  • Both readers take wrap from diagram, so it works for looms, for plumbing plans and in a prepended file. A bad value is an error.
  • The layout adds elk.layered.wrapping.strategy: MULTI_EDGE, elk.aspectRatio, multiEdge.distancePenalty: 0.5, and additionalEdgeSpacing equal to the sheet's edge spacing.
    • SINGLE_EDGE throws NoSuchElementException on any plan with a tee.
    • With ELK's default penalty of 2, the cut runs through a fan of four or five pipes. Below 1, ELK moves each cut to the boundary that the fewest lines cross.
    • The correction factor and the cutting and validify strategies made no difference once the penalty was below 1.
  • The "No wrapping" comment is replaced, and the README documents the option.

Tuning on hailey

  • supply: one row is 13572×1586. wrap: { aspect: 4 } gives two clean rows at 8048×2014, folded through the single pipe ahead of the first tee. wrap: true gives three rows, but the last row holds only the filtered water faucet.
  • shower: wrap: true reads well. Each fold crosses at most two hoses.
  • tanks and heating: these already have a short enough sheet. Wrapping only puts their last part on a row of its own.
  • Looms (water_systems, lighting_systems, main_electrical): wrapping makes them worse. The cuts fall through multi-core cables and leave ribbons of 3–4 cores, or the loom doesn't wrap at all. For now this is plumbing only.

Default output unchanged

I copied every hailey loom and plan, rendered them as svg, png and md with main and with this branch, and ran diff -r. All 42 files are identical.

Open

  • Nothing stops a fold from leaving a lone part on the last row. The workaround is a higher aspect.

🤖 Generated with Claude Code

XDGFX and others added 2 commits October 8, 2026 15:52
`diagram: { wrap: true }`, or `wrap: { aspect: N }`, turns on ELK's
MULTI_EDGE wrapping, with cuts moved to the boundary the fewest lines
cross. Off by default, so a sheet without it lays out exactly as before.
Read from looms and plumbing plans alike, and from prepended files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@XDGFX
XDGFX merged commit 9a32971 into main Oct 8, 2026
1 check passed
@XDGFX
XDGFX deleted the wrap-rows branch October 8, 2026 05:56
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