import sys; sys.path.insert(0,".") import json, collections, io from swdots import dots B=json.load(open('swpos.json',encoding='utf-8')) o=io.open('swfinal.txt','w',encoding='utf-8') def pos(ms,ax): return sorted(set(round((b['bb'][ax]+b['bb'][ax+3])/2,1) for m in ms for b in B[m])) for nm,(x0,x1,cx,lvl,ms,ax) in (('정면 하면 B2+B3 x',(6700,14250,10473.9,-285125.8,['B2','B3'],0)),('정면 상면 B1 x',(6700,14250,10473.9,-282830.8,['B1'],0)),('측면 하면 B5+B6 y',(20850,28400,24604.3,-285080.8,['B5','B6'],1)),('측면 상면 B4 y',(20850,28400,24604.3,-282875.8,['B4'],1))): D=sorted(round(d[0]-cx,1) for d in dots(x0,x1,-285300,-282700) if d[2]==22.5 and abs(d[1]-lvl)<1) M=pos(ms,ax) o.write(u'%s: 도면 점 %d / 모델 %d 위치\n'%(nm,len(D),len(M))) if len(D)==len(M): o.write(u' 최대 위치차 %.1f\n'%max(abs(a-b) for a,b in zip(D,M))) else: o.write(u' 도면 %s\n 모델 %s\n'%(D,M)) # 코핑 y 패턴 for nm,ms in (('C1+C3',['C1','C3']),('C2+C4',['C2','C4']),('C5+C6',['C5','C6'])): P=pos(ms,1); o.write(u'코핑 %s y %d개: %s .. %s 간격 %s\n'%(nm,len(P),P[0],P[-1],sorted(set(round(b-a,1) for a,b in zip(P[:-1],P[1:])))))