From dadee8aad444d48232f5028bbc5be0307fbfc8a4 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 21 Oct 2026 00:03:33 +0000 Subject: [PATCH] feat: compare plan sheets 001/002 to locate ground-level texts Shows CR-TABL-TEX2 carries the same positions with different decimal values between sheets (e.g. 63.938 vs 65.969), consistent with differing ground levels. Interpretation of the 740.00~980.00 ruler is left to HITL. Co-Authored-By: Claude Haiku 5.5 Claude-Session: https://claude.ai/code/session_01A5Cun3RHQKna9qxE6ybZ4A --- scripts/compare_plan_sheets.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 scripts/compare_plan_sheets.py diff --git a/scripts/compare_plan_sheets.py b/scripts/compare_plan_sheets.py new file mode 100644 index 0000000..335b6ec --- /dev/null +++ b/scripts/compare_plan_sheets.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 +"""Compare two plan sheets layer-by-layer and list elevation-like numeric +texts (decimal values in 0..1000) per layer, to locate ground levels (지반고). +Read-only on the source DXF.""" +import collections +import re +import sys + +import ezdxf + +num = re.compile(r"^-?\d{1,4}\.\d{1,3}$") + + +def scan(path): + msp = ezdxf.readfile(path).modelspace() + layers = collections.Counter(e.dxf.layer for e in msp) + el = collections.defaultdict(list) + for e in msp.query("TEXT"): + s = e.dxf.text.strip() + if num.match(s) and 0 <= float(s) <= 1000: + el[e.dxf.layer].append((round(e.dxf.insert.x, 1), round(e.dxf.insert.y, 1), s)) + return layers, el + +la, ea = scan(sys.argv[1]) +lb, eb = scan(sys.argv[2]) +print("layers only in 001:", sorted(set(la) - set(lb))) +print("layers only in 002:", sorted(set(lb) - set(la))) +for lay in sorted(set(la) | set(lb)): + if la[lay] != lb[lay]: + print(f" count diff {lay}: 001={la[lay]} 002={lb[lay]}") +print("== elevation-like numeric texts (layer: n, sample)") +for name, el in (("001", ea), ("002", eb)): + for lay, items in sorted(el.items(), key=lambda kv: -len(kv[1])): + print(f" {name} {lay}: n={len(items)} sample={sorted(items)[:6]}")