fix(pid): signal lines carry no fabricated number; a bubble exits towards the first waypoint
An ISA-5.1 signal line has no pipe line number, yet every pneumatic / electric line got the bare sequence as its number and a label, and ate a process sequence number. Signal classes now leave line_number None (a verbatim one is still honoured), seq None, no label. A radial port aimed at the far end even with waypoints, so the first segment cut through the bubble; aim_points (lines.py) aims at the first/last waypoint for both draw_line and the dry run. Merge note: benchmarks/adapters/autocad_mcp_pro.py (final group's file) had its two _task_pid_roundtrip assertion lines moved to the new truth — the signal row is unnumbered, the connector row is 3. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FKFStjEFzpGyLq5bMpWxTd
This commit is contained in:
co-authored by
Claude Opus 5
parent
2e101b95e2
commit
3c0babfef1
@@ -13,7 +13,7 @@ from .critique import PID_FOCUSES, issues_for
|
||||
from .drawlines import draw_line
|
||||
from .graph import build_graph
|
||||
from .insert import place_symbol
|
||||
from .lines import AXIS, LINE_CLASSES, count_crossings, route, snap_axis
|
||||
from .lines import AXIS, LINE_CLASSES, aim_points, count_crossings, route, snap_axis
|
||||
from .symbols import resolve, transform_port
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -311,9 +311,9 @@ def _plan_lines(norm: dict) -> list[dict]:
|
||||
raise ValueError(f"{ref}: no port {port!r}; ports: {', '.join(entry['ports'])}")
|
||||
return entry["ports"][port]
|
||||
|
||||
def anchor(ep: dict, other: dict):
|
||||
def anchor(ep: dict, aim):
|
||||
if ep["radius"] > 0:
|
||||
axis = snap_axis(other["x"] - ep["x"], other["y"] - ep["y"])
|
||||
axis = snap_axis(aim[0] - ep["x"], aim[1] - ep["y"])
|
||||
ux, uy = AXIS[axis]
|
||||
return (ep["x"] + ux * ep["radius"], ep["y"] + uy * ep["radius"]), axis
|
||||
return (ep["x"], ep["y"]), ep["direction_deg"]
|
||||
@@ -322,11 +322,11 @@ def _plan_lines(norm: dict) -> list[dict]:
|
||||
for index, (where, line) in enumerate(_all_lines(norm)):
|
||||
try:
|
||||
start, end = endpoint(line["from"]), endpoint(line["to"])
|
||||
s, sd = anchor(start, end)
|
||||
e, ed = anchor(end, start)
|
||||
vertices = route(
|
||||
s, sd, e, ed, stub=float(line.get("stub", 5.0)), mode=line.get("route", "auto")
|
||||
)
|
||||
mode = line.get("route", "auto")
|
||||
s_aim, e_aim = aim_points((start["x"], start["y"]), (end["x"], end["y"]), mode)
|
||||
s, sd = anchor(start, s_aim)
|
||||
e, ed = anchor(end, e_aim)
|
||||
vertices = route(s, sd, e, ed, stub=float(line.get("stub", 5.0)), mode=mode)
|
||||
except ValueError as exc:
|
||||
raise ValueError(f"{where}: {exc}") from exc
|
||||
crossings = count_crossings(vertices, [p["vertices"] for p in planned])
|
||||
|
||||
Reference in New Issue
Block a user