Files
Pier_v1/Code/review_pipeline/dots_method/okab.py
T
ahnyongjooandClaude Sonnet 5.5 964a841de1 chore(rebar): Pier_T_rebar 작업 폴더 초기 구성 및 외부 의존 파일 통합
- Code\rebar_pipeline, review_pipeline, pier-program을 정션에서 실제 폴더로 전환
- Code\rhino_mcp 및 CLAUDE_rhino배경.md 추가, .mcp.json은 PYTHONPATH로 새 위치 사용
- pier-program 내부 .git 제거(이력은 backup\pier-program_20261028.bundle에 보관)
- worktree 가이드 반영(CLAUDE.local.md, HANDOFF.md)
- D:\Rhino-MCP 경로 참조를 새 위치로 치환

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-28 11:20:18 +09:00

58 lines
3.3 KiB
Python

import sys; sys.path.insert(0,"."); sys.path.insert(0,"pylib")
import pickle, collections, swdots, io, rhino3dm
segs,texts=pickle.load(open('cache_옥성교P1.dxf.pkl','rb')); swdots.segs=segs
m3=rhino3dm.File3dm.Read(r"D:\★Pier 자료\심수석님 검토 파일\검토_옥성교P1\옥성교P1_G5.3dm")
S=[]
for ob in m3.Objects:
g=ob.Geometry
if isinstance(g,rhino3dm.Brep) or not hasattr(g,'PointAtStart'): continue
us=dict(ob.Attributes.GetUserStrings()); mk=us.get('mark')
if not mk or mk[0] not in 'CS': continue
cs=[g.SegmentCurve(i) for i in range(g.SegmentCount)] if hasattr(g,'SegmentCount') else [g]
for c in cs:
a=c.PointAtStart; b=c.PointAtEnd
if abs(b.Y-a.Y)<1 and abs(b.Z-a.Z)<1 and abs(b.X-a.X)>300: S.append((mk,round(a.Y,1),round(a.Z,1),ob.Attributes.Name))
o=io.open('okab.txt','w',encoding='utf-8')
o.write(u'모델 x방향 직선 %d: %s\n'%(len(S),collections.Counter(s[0] for s in S)))
for nm,(x0,x1,y0,y1) in (('A-A',(604500,612900,332000,339500)),('B-B',(611500,621000,332000,340000))):
D=[d for d in swdots.dots(x0,x1,y0,y1,maxlen=60)]
sz=collections.Counter((d[2],d[3]) for d in D); o.write(u'%s 점 크기 %s\n'%(nm,sz.most_common(8)))
P=[d for d in D if d[2]==d[3] and d[2] in (22.5,)]
o.write(u' 22.5 점 %d\n'%len(P))
best=None
for sg in (1,-1):
votes=collections.Counter()
for d in P:
for mk,y,z,n in S:
votes[(round((d[0]-sg*y)),round(d[1]-z))]+=1
(ox,oz),n=votes.most_common(1)[0]
o.write(u' 부호 %d 최다 득표 오프셋 (%d,%d) 득표 %d\n'%(sg,ox,oz,n))
if best is None or n>best[0]: best=(n,sg,ox,oz)
n,sg,ox,oz=best
o.write(u' → 부호 %d 오프셋 (%d, %d)\n'%(sg,ox,oz))
hit=0; un=[]
for d in P:
ok=[s for s in S if abs(d[0]-(ox+sg*s[1]))<3 and abs(d[1]-(oz+s[2]))<3]
if ok: hit+=1
else: un.append((round(d[0]-ox,1),round(d[1]-oz,1)))
o.write(u' 도면 점 %d 중 모델 일치 %d, 불일치 %d\n'%(len(P),hit,len(un)))
c=collections.Counter(z for y,z in un); o.write(u' 불일치 도면 점 높이별(z) %s\n'%sorted(c.items())[:30])
pts=set((round(d[0]-ox,1),round(d[1]-oz,1)) for d in P)
miss=[s for s in S if not any(abs(sg*s[1]-px)<3 and abs(s[2]-pz)<3 for px,pz in pts)]
o.write(u' 모델 직선 중 도면 점 없음 %d: %s\n'%(len(miss),sorted(collections.Counter((m[0],round(m[2],1)) for m in miss).items())[:30]))
o.write(u'\n=== 불일치 상세 ===\n')
M14=collections.defaultdict(list)
for mk,y,z,n in S:
if mk in ('C14','C16'): M14[(mk,round(z,1))].append(y)
for k,v in sorted(M14.items()): o.write(u'모델 %s z %.1f y %s\n'%(k[0],k[1],sorted(v)))
for nm,(x0,x1,y0,y1,ox,oz) in (('A-A',(604500,612900,332000,339500,608643,314067)),('B-B',(611500,621000,332000,340000,616068,314815))):
D=[d for d in swdots.dots(x0,x1,y0,y1,maxlen=60) if d[2]==22.5 and d[3]==22.5]
U=[]
for d in D:
if not any(abs(d[0]-(ox+s[1]))<3 and abs(d[1]-(oz+s[2]))<3 for s in S): U.append((round(d[1]-oz,1),round(d[0]-ox,1)))
byz=collections.defaultdict(list)
for z,y in U: byz[z].append(y)
o.write(u'%s 불일치 점: \n'%nm)
for z,ys in sorted(byz.items()): o.write(u' z %.1f y %s\n'%(z,sorted(ys)))
o.close()