# 옥성교 재료표 처음부터: DXF 재판독 → ok2_table.json, ok2_shapes.json import sys, re, json, collections sys.path.insert(0,'pylib') import ezdxf F=r"D:\★Pier 자료\심수석님 검토 파일\검토_옥성교P1\옥성교P1.dxf" d=ezdxf.readfile(F); m=d.modelspace() FONT=re.compile(chr(92)*2+'f[^;]*;') texts=[]; tags=[] def walk(ents,depth=0): for e in ents: t=e.dxftype() if t=='TEXT': texts.append((e.dxf.insert.x,e.dxf.insert.y,FONT.sub('',e.dxf.text).replace('{','').replace('}','').strip(),e.dxf.layer)) elif t=='MTEXT': s=FONT.sub('',e.text).replace('{','').replace('}','').replace(chr(92)+'P',' / ') texts.append((e.dxf.insert.x,e.dxf.insert.y,s.strip(),e.dxf.layer)) elif t=='INSERT': if e.dxf.name.startswith('CSBNUM1'): tags.append((e.dxf.insert.x,e.dxf.insert.y,dict((a.dxf.tag,a.dxf.text.strip()) for a in e.attribs))) walk(m) print('texts',len(texts),'tags',len(tags)) # ---- 재료표 rows=collections.defaultdict(dict) for x,y,t,l in texts: if l=='CS-TABL-TEX2' and x>=715000 and 324000