chore: import 3d-drawing history from local Code/3d-drawing (subfolder, history preserved)

This commit is contained in:
SeanJo committed 2026-10-27 13:30:09 +09:00
commit 7b754e810b
51 files changed
+20300

No files matched your search

@@ -0,0 +1,48 @@
#!/usr/bin/env python3
"""Extract the 당진방향 station pattern table from 참고_지보패턴현황 (read-only).
Rows 55..96 of the sheet: C=start STA, G=end STA, J=length, M=lining pattern
(지보패턴), O=실시설계 excavation class (blank = continues the row above),
Q=굴착공법, T=비고. Also extracts the 대산방향 table (rows 13..49) for reference.
Usage: extract_pattern_table.py <xlsx> <out_dir>"""
import csv, os, sys
import openpyxl
SRC, OUT = sys.argv[1], sys.argv[2]
wb = openpyxl.load_workbook(SRC, read_only=True, data_only=True)
ws = wb["참고_지보패턴현황"]
rows = {r: row for r, row in enumerate(ws.iter_rows(min_row=1, max_row=114, max_col=33, values_only=True), start=1)}
def table(r0, r1, tag):
out, last_o = [], None
for r in range(r0, r1 + 1):
row = rows[r]
try:
a, b = float(row[2]), float(row[6])
except (TypeError, ValueError):
continue
m = (row[12] or "").strip() if isinstance(row[12], str) else row[12]
o_raw = row[14]
o = o_raw if o_raw not in (None, "") else last_o
last_o = o
remark = (row[19] or "") if isinstance(row[19], str) else ""
out.append({"direction": tag, "source_row": r, "sta_from": a, "sta_to": b,
"length_m": row[9], "lining_pattern": m or ("개착부" if "개착" in remark else ""),
"excavation": o or "", "excavation_inherited": o_raw in (None, ""),
"method": (row[16] or "") if isinstance(row[16], str) else "",
"remark": remark})
return out
south = table(55, 96, "당진")
north = table(13, 49, "대산")
os.makedirs(OUT, exist_ok=True)
cols = list(south[0].keys())
for name, data in [("pattern_stations_dangjin.csv", south), ("pattern_stations_daesan_ref.csv", north)]:
with open(os.path.join(OUT, name), "w", encoding="utf-8", newline="") as fh:
w = csv.DictWriter(fh, fieldnames=cols)
w.writeheader()
w.writerows(data)
print("dangjin rows", len(south), "range", south[0]["sta_from"], "->", south[-1]["sta_to"])
print("daesan rows", len(north), "range", north[0]["sta_from"], "->", north[-1]["sta_to"])
print("blank lining pattern rows (dangjin):", [(d["source_row"], d["remark"]) for d in south if not d["lining_pattern"]])