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,28 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Task 5: support-pattern (지보패턴) station ranges from drawings 03-003..008.
|
||||
Collects every TEXT that names a station (STA. / N+mmm / N+mmm.mm) and every
|
||||
pattern name (NP-...) with its layer and position, without interpreting ranges."""
|
||||
import glob
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
import ezdxf
|
||||
|
||||
RAG = sys.argv[1]
|
||||
pat_re = re.compile(r"NP-\d[A-Z0-9-]*|WL-\d")
|
||||
sta_re = re.compile(r"(STA\.?\s*)?\d{1,2}\+\d{2,3}(\.\d{2})?")
|
||||
files = sorted(glob.glob(os.path.join(RAG, "03_본선터널굴착", "C0060303-00[3-8]*.dxf")))
|
||||
for f in files:
|
||||
msp = ezdxf.readfile(f).modelspace()
|
||||
stas, pats = [], set()
|
||||
for e in msp.query("TEXT MTEXT"):
|
||||
s = e.dxf.text if e.dxftype() == "TEXT" else e.plain_text()
|
||||
for m in sta_re.finditer(s):
|
||||
stas.append((round(e.dxf.insert.x), round(e.dxf.insert.y), m.group(0).strip()))
|
||||
for m in pat_re.finditer(s):
|
||||
pats.add(m.group(0))
|
||||
print(os.path.basename(f)[:28], "| patterns:", sorted(pats))
|
||||
for x, y, t in sorted(stas, key=lambda r: (r[0], r[1]))[:12]:
|
||||
print(f" ({x},{y}) {t}")
|
||||
print(f" station-like texts: {len(stas)}")
|
||||
Reference in new issue
Block a user