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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A5Cun3RHQKna9qxE6ybZ4A
This commit is contained in:
1 parent
f144d53f79
commit
dadee8aad4
1 file changed
+34
@@ -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]}")
|
||||
Reference in new issue
Block a user