chore: import 3d-drawing history from local Code/3d-drawing (subfolder, history preserved)
This commit is contained in:
commit
7b754e810b
51 files changed
+20300
No files matched your search
@@ -0,0 +1,24 @@
|
||||
#!/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])))
|
||||
Reference in new issue
Block a user