fix(understand): the pipe network's tolerance follows the P&ID's unit, and a dropped stub is said

pipe_takeoff merged line ends closer than tol = 1.0 drawing units and
silently dropped any segment shorter than that. On a millimetre P&ID that is
1 mm. On a metre drawing it is a metre: ends a metre apart were merged and
every pipe under a metre disappeared from the totals, with no warning. The
review of the network engine found this.

- tol now defaults to 1 mm in the unit the P&ID's geometry implies: 1.0 on
  a millimetre drawing, 0.001 on a metre one. A tol the caller gives is
  used as given.
- build_network counts the segments that collapse to a point
  (stats.segments_below_tol), and pipe_rows turns a non-zero count into a
  warning naming the tolerance.

A new wire test builds a metre P&ID with a 0.6 m pipe and a 5 m pipe. Before
this change the takeoff said 5.0 m; now it says 5.6 m. The network test
checks that a sub-tolerance stub is counted. Registry, packs, aliases and
every track H suite: 472 passed. The inventory matches the live surface.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FKFStjEFzpGyLq5bMpWxTd
This commit is contained in:
Umut CAN
2026-09-24 12:51:10 +03:00
co-authored by Claude Opus 5.5
parent fb2953c324
commit c4759e696d
6 changed files with 51 additions and 7 deletions
+6 -4
View File
@@ -11124,13 +11124,15 @@ async def pipe_takeoff(
),
] = None,
tol: Annotated[
float,
float | None,
Field(
default=1.0,
default=None,
gt=0.0,
description="Line ends closer than this (P&ID drawing units) are one junction.",
description="Line ends closer than this (P&ID drawing units) are one junction; "
"default 1 mm in the unit the P&ID's geometry implies (1.0 on a millimetre "
"drawing, 0.001 on a metre one).",
),
] = 1.0,
] = None,
ctx: Context = None,
) -> dict:
"""A pipe takeoff: topology from the P&ID, lengths from the layout, rows by room x service x diameter.