import ezdxf, sys, math from collections import defaultdict sys.stdout.reconfigure(encoding='utf-8') d=ezdxf.readfile(r'D:\★Pier 자료\심수석님 검토 파일\철근 모델랑 운곡교P1_바이브코딩\1.dxf'); ms=d.modelspace() for name,(cx,cy) in (('C-C',(23572.5,26567.1)),('D-D',(29792.0,26567.1)),('E-E',(35702.8,26567.1))): print('=== 단면',name) K=defaultdict(list) for e in ms: t=e.dxftype() if t=='CIRCLE': c=e.dxf.center dist=math.hypot(c.x-cx,c.y-cy) if dist<1100: K[(e.dxf.layer,round(e.dxf.radius,1))].append((round(dist,1),round(math.degrees(math.atan2(c.y-cy,c.x-cx))%360,3))) elif t=='ARC': c=e.dxf.center if math.hypot(c.x-cx,c.y-cy)<1 and e.dxf.layer=='CS-RBAR-MAJR': K[('ARC',round(e.dxf.radius,1))].append((round(e.dxf.start_angle,2),round(e.dxf.end_angle,2))) elif t=='LINE' and e.dxf.layer=='CS-RBAR-MAJR': a,b=e.dxf.start,e.dxf.end if math.hypot(a.x-cx,a.y-cy)<1050 and math.hypot(b.x-cx,b.y-cy)<1050: K[('LINE',round(math.degrees(math.atan2(b.y-a.y,b.x-a.x))%180,1))].append((round(math.hypot(b.x-a.x,b.y-a.y),1),)) for k,v in sorted(K.items(),key=str): if k[0]=='ARC': print(' ARC R',k[1],v); continue if k[0]=='LINE': print(' LINE angle',k[1],'len',v[:3],len(v)); continue ds=sorted({a for a,b in v}); angs=sorted(b for a,b in v) print(' ',k,'n',len(v),'dist',ds[:5],'angles',angs[:4],'..',angs[-3:]) if len(angs)>3 and len(angs)<=60: diffs=sorted({round(angs[i+1]-angs[i],3) for i in range(len(angs)-1)}); print(' angle steps',diffs[:6])