Skip to content

fix(layout): reserve clear nozzle exits and recover blocked routing projections - #562

Merged
Alpha9463 merged 3 commits into
mainfrom
fix/355-reserve-clear-nozzles
Sep 30, 2026
Merged

Alpha9463 merged 3 commits into
mainfrom
fix/355-reserve-clear-nozzles

Conversation

@Alpha9463

Copy link
Copy Markdown
Owner

Summary

Stops automatic layouts from drawing a stream through equipment when a nozzle's exit is blocked. The router now recovers a reachable exit, default routing undoes the row alignment that seals one, and vertical reactors can discharge from a shell wall.

Related Issues

Closes #355
Refs: #547

Changes

  • Recover a reachable nozzle exit by default: a blocked stand-off retreats along its outward ray to the nearest clear lane. A fully sealed nozzle still draws the fallback and reports route-crosses-unit.
  • Add refine_exits to default routing: when a blocked-exit conflict remains, re-lay the sheet with the two units left unaligned and keep the result only if hard conflicts fall. At most three rounds; pinned units never move.
  • Give the default and plain reactor bodies east and west outlet placements beside the floor outlet.
  • On process equipment, skip a face whose stub crosses another unit, and take an alternate face only when it needs no more bends than the symbol's own.
  • Close a Tk preview window after running its idle tasks, which stops Tk 9 on macOS from aborting the process.
  • Pair path searches with streams by nozzle position in scripts/route_quality.py, since a sealed stream is drawn without a search.
  • Regenerate docs/gallery/ for 01, 10 and 18 and tests/golden/18_fixed_bed_recycle.svg: in each, a reactor outlet moves from the floor to a shell wall.
  • Rewrite docstrings and comments in the touched files to NumPy style.

Not included: side outlets on the jacketed and mixing reactor bodies, and exit repair on sheets placed equipment-first (free valve stations).

How to Test

  1. Run the focused tests:

    python3 -m pytest -q tests/test_routing.py tests/test_faces.py tests/test_layout_refinement.py tests/test_show.py tests/test_golden.py
  2. Run the complete suite and static checks:

    python3 -m pytest -q
    python3 -m ruff check .
    python3 -m ruff format --check tests
    python3 -m mypy pandid
    python3 -m pyright pandid
  3. Measure the corpus with pins stripped and confirm no stream is listed as drawn by the fallback:

    python3 scripts/layout_quality.py --worst 10

Evidence

Measured on 46 drawings: the 21 shipped sheets as authored and with pins stripped, plus the four biodiesel variants in tests/_layout_cases.py.

main at 17d32b3 This branch
Fallback routes 4 0
route-crosses-unit 8 0
Hard conflicts 18 0
Crossings 257 260
Bends 1117 1118
  • Local suite: 11473 passed, 188 skipped. Ruff, mypy and git diff --check are clean; pyright reports 0 errors and the existing __all__ warning.
  • Pins-stripped 21_alumina_refinery gains four crossings (65 → 69) in exchange for two fallback routes and four route-crosses-unit findings.
  • Pinned biodiesel gains one run-off-elevation warning: R-101's east outlet sits 2.3 px off S-101's feed.
  • scripts/layout_compare.py has no review file for this change, so its release gate is not evaluated here.
  • Before/after drawings: biodiesel (pins stripped), 21_alumina_refinery (pins stripped), 01_ammonia_loop, 10_ethanol_pfd, 18_fixed_bed_recycle.

Checklist

  • Base branch is main and the branch is mergeable
  • Commit subjects follow Conventional Commits; tracked work links its issue
  • Self-reviewed the full diff on the Files changed tab
  • Relevant local checks pass; all CI jobs pass before merge
  • Documentation and examples updated if behaviour changed
  • Before/after drawings included if rendered output changed
  • Blocking review feedback resolved, if review was requested

…ction

Regenerates the gallery for 01, 10 and 18 and the 18 golden: in each, a reactor outlet moves from the floor to a shell wall.

Refs: #355
@Alpha9463 Alpha9463 self-assigned this Sep 30, 2026
@Alpha9463
Alpha9463 merged commit 3e88e38 into main Sep 30, 2026
7 checks passed
@Alpha9463
Alpha9463 deleted the fix/355-reserve-clear-nozzles branch September 30, 2026 09:50
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.

Reserve clear nozzle exits and recover blocked routing projections

1 participant