fix(understand): a network layer holds lines — valve, pump and annotation layers are no pipes

The field test ran the takeoffs on a real P&ID pair, kept outside the
repository. It showed that the default network layers took every layer the
vocabulary files under piping or electrical. That included the valve layers
(KLEPPEN, Valve_*), the pump layers (a "product pumps" layer reads as
product), and annotation layers such as pipe sizes, materials and valve
numbers. Symbol outlines and leader lines became pipe runs.

vocab.is_network_layer is now the one rule. A layer is a network layer when
it is piping or electrical at 0.9, its name names no equipment
(equipment_kind: valve, pump, tank, motor, panel, reducer), and it names no
annotation (sizes, materials, numbers, hatching, or an annotation word).
build_network's default layers, drawing_topology_check and the topo_*
focuses all use it, so they agree on which lines are the network.

Sixteen parametrized cases pin it, across symbol, annotation, pipe and cable
layers.

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 15:57:17 +03:00
co-authored by Claude Opus 5.5
parent ba41428c88
commit 307ccc799f
5 changed files with 79 additions and 22 deletions
+2 -10
View File
@@ -34,12 +34,10 @@ from engineering.layers import PID_LAYERS
from engineering.pid.lines import PID_LINE_LAYERS
from engineering.plan_spec import Issue
from engineering.understand.topology import (
NETWORK_CONFIDENCE,
NETWORK_DISCIPLINES,
network_layers,
topology_findings,
)
from engineering.understand.vocab import classify_layer
from engineering.understand.vocab import is_network_layer
if TYPE_CHECKING:
from backends.base import AutoCADBackend
@@ -66,13 +64,7 @@ SEMANTIC_LAYERS: frozenset[str] = frozenset(
def _is_candidate(name: str) -> bool:
if name in SEMANTIC_LAYERS:
return False
meaning = classify_layer(name)
return (
meaning.get("discipline") in NETWORK_DISCIPLINES
and float(meaning.get("confidence") or 0.0) >= NETWORK_CONFIDENCE
)
return name not in SEMANTIC_LAYERS and is_network_layer(name)
def focus_layers(snap) -> list[str]: