Files
CMPlanning/scripts/dump_std_table.py
T
Claude 6d44386fc2 feat: dump standard-section variable table as coordinate grid (Task 4)
Table 1 (R1..R3', phi1/phi2) and table 2 (A..K, 라이닝 두께 300) are parsed by
S(%) rows +3..-3. R1=6982, R3'=4699, R2'=3910 match the arc list; lining
thickness 300 mm matches the concrete arc band. Units of a..f and the
cross-slope station ranges need HITL confirmation.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A5Cun3RHQKna9qxE6ybZ4A
2026-10-21 00:22:40 +00:00

25 lines
1.0 KiB
Python

#!/usr/bin/env python3
"""Task 4: dump the variable table of the standard section (C0060303-001) as a
coordinate grid. Rows = cross slope (S, 편경사) per user answer 2026-10-21; the
first row = variable names. Every TEXT on the table layers is kept (no regex
filter), so that the S column and the header row can be checked."""
import csv
import sys
from collections import defaultdict
import ezdxf
SRC, OUT = sys.argv[1], sys.argv[2]
msp = ezdxf.readfile(SRC).modelspace()
cells = [(round(e.dxf.insert.x, 1), round(e.dxf.insert.y, 1), e.dxf.text.strip())
for e in msp.query("TEXT") if e.dxf.layer in ("CS-TABL-TEX1", "CS-TABL-TEX2")]
rows = defaultdict(list)
for x, y, s in cells:
rows[round(y / 50) * 50].append((x, s)) # bucket by ~50 mm
with open(OUT, "w", newline="", encoding="utf-8") as fh:
w = csv.writer(fh)
for y in sorted(rows, reverse=True):
line = [s for x, s in sorted(rows[y])]
w.writerow([y] + line)
print(f"Y{y:>7}: " + " | ".join(f"{x:.0f}:{s}" for x, s in sorted(rows[y])))