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
+29
View File
@@ -17,6 +17,7 @@ from engineering.understand.vocab import (
classify_layer,
equipment_kind,
fold,
is_network_layer,
room_label,
supply_return,
)
@@ -232,3 +233,31 @@ def test_block_names_say_their_kind(block, kind, language):
def test_an_anonymous_block_has_no_kind():
assert equipment_kind("*U12") is None
assert equipment_kind(None) is None
@pytest.mark.parametrize(
("name", "network"),
[
("P_product piping", True),
("P_cipsupplyline", True),
("E_power", True),
# symbols, not lines: the layer names the equipment drawn on it
("KLEPPEN", False),
("Valve_ball valves", False),
("PRODUCT PUMPS", False),
("CIP return pumps", False),
("Storage tanks", False),
("E_panel connections", False),
# annotation on a piping layer: sizes, materials, numbers, hatching
("P_pipe diameters", False),
("PIPESIZES", False),
("piping materials", False),
("valve numbers", False),
("PIPE TEXT", False),
# not piping or electrical at all
("WALLS", False),
("0", False),
],
)
def test_a_network_layer_holds_lines_not_symbols_or_annotation(name, network):
assert is_network_layer(name) is network