import ezdxf, sys from collections import defaultdict sys.stdout.reconfigure(encoding='utf-8') d=ezdxf.readfile(r'D:\★Pier 자료\심수석님 검토 파일\철근 모델랑 운곡교P1_바이브코딩\1.dxf'); ms=d.modelspace() CXe=12159.4 def EL(y): return 26.208+(y-8115.6)/1000.0 # footing bottom 8115.6 = EL 26.208 x0,x1,y0,y1=11000,13400,10320,16520 V=defaultdict(list);H=defaultdict(list);C=defaultdict(list) for e in ms: t=e.dxftype() if t=='LINE' and e.dxf.layer in('CS-RBAR-MAJR','CS-CONC-MAJR','CS-RBAR-EREC'): a,b=e.dxf.start,e.dxf.end if x0500: V[(e.dxf.layer[3:7],round(a.x-CXe,1))].append((round(min(a.y,b.y),1),round(max(a.y,b.y),1))) elif abs(a.y-b.y)<0.6 and abs(a.x-b.x)>200: H[(e.dxf.layer[3:7],round(a.y,1))].append((round(min(a.x,b.x)-CXe),round(max(a.x,b.x)-CXe))) elif t=='CIRCLE': c=e.dxf.center if x0200 long:') for k in sorted(H,reverse=True)[:25]: print(' ',k,sorted(H[k])[:2],'EL %.3f'%EL(k[1])) print('circle columns (x offset: count, y min..max -> EL):') for k in sorted(C): ys=sorted(C[k]); print(' ',k,len(ys),ys[0],ys[-1],'EL %.3f..%.3f'%(EL(ys[0]),EL(ys[-1])))