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
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
#!/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]}")
|