From c9de6f0ef3b9060aae14dd82ceecc3ce914c856d Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 21 Oct 2026 02:48:54 +0000 Subject: [PATCH] feat: scan pattern drawings for station ranges and pattern names (Task 5) No station range is written next to pattern names in 03-003..008; the pattern names appear only in file names. 04-006..008 name WL/RP zones at the portals without stations. Pattern-to-station mapping is left open, not inferred. Co-Authored-By: Claude Haiku 5.5 Claude-Session: https://claude.ai/code/session_01A5Cun3RHQKna9qxE6ybZ4A --- scripts/extract_pattern_stations.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 scripts/extract_pattern_stations.py diff --git a/scripts/extract_pattern_stations.py b/scripts/extract_pattern_stations.py new file mode 100644 index 0000000..9593a20 --- /dev/null +++ b/scripts/extract_pattern_stations.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 +"""Task 5: support-pattern (지보패턴) station ranges from drawings 03-003..008. +Collects every TEXT that names a station (STA. / N+mmm / N+mmm.mm) and every +pattern name (NP-...) with its layer and position, without interpreting ranges.""" +import glob +import os +import re +import sys + +import ezdxf + +RAG = sys.argv[1] +pat_re = re.compile(r"NP-\d[A-Z0-9-]*|WL-\d") +sta_re = re.compile(r"(STA\.?\s*)?\d{1,2}\+\d{2,3}(\.\d{2})?") +files = sorted(glob.glob(os.path.join(RAG, "03_본선터널굴착", "C0060303-00[3-8]*.dxf"))) +for f in files: + msp = ezdxf.readfile(f).modelspace() + stas, pats = [], set() + for e in msp.query("TEXT MTEXT"): + s = e.dxf.text if e.dxftype() == "TEXT" else e.plain_text() + for m in sta_re.finditer(s): + stas.append((round(e.dxf.insert.x), round(e.dxf.insert.y), m.group(0).strip())) + for m in pat_re.finditer(s): + pats.add(m.group(0)) + print(os.path.basename(f)[:28], "| patterns:", sorted(pats)) + for x, y, t in sorted(stas, key=lambda r: (r[0], r[1]))[:12]: + print(f" ({x},{y}) {t}") + print(f" station-like texts: {len(stas)}")