Files
Pier_v1/Code/review_pipeline/dots_method/okfoot.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

60 lines
3.4 KiB
Python

import sys; sys.path.insert(0,"."); sys.path.insert(0,"pylib")
import pickle, collections, io, math, json
import rhino3dm, swdots
segs,texts=pickle.load(open('cache_옥성교P1.dxf.pkl','rb')); swdots.segs=segs
m3=rhino3dm.File3dm.Read(r"D:\★Pier 자료\심수석님 검토 파일\검토_옥성교P1\옥성교P1_G5.3dm")
OFF=309179.8
S=[] # (mark, p0, p1)
for ob in m3.Objects:
g=ob.Geometry
if isinstance(g,rhino3dm.Brep) or not hasattr(g,'SegmentCount'): continue
us=dict(ob.Attributes.GetUserStrings()); mk=us.get('mark')
if not mk or not mk.startswith('B'): continue
for i in range(g.SegmentCount):
c=g.SegmentCurve(i); a=c.PointAtStart; b=c.PointAtEnd
if type(c).__name__.startswith('Line') or abs((a.X-b.X))+abs(a.Y-b.Y)+abs(a.Z-b.Z)>0:
S.append((mk,(a.X,a.Y,a.Z),(b.X,b.Y,b.Z)))
o=io.open('okfoot.txt','w',encoding='utf-8')
o.write(u'B 선분 %d, 마크 %s\n'%(len(S),sorted(set(s[0] for s in S))))
for nm,(x0,x1,cx,axis) in (('정면(y 방향으로 보는 철근 끝)',(568500,578600,573552,1)),('측면(x 방향)',(587500,597600,592541,0))):
D=[d for d in swdots.dots(x0,x1,321300,324000) if d[2]==22.5 and d[3]==22.5]
P=collections.defaultdict(set)
other=1-axis if axis==1 else 1
for mk,a,b in S:
# 보는 축과 평행한 직선 (다른 두 축 변화 < 1)
d=[abs(b[i]-a[i]) for i in range(3)]
if d[axis]>800 and sum(d)-d[axis]<2:
pc=0 if axis==1 else 1
P[(round(a[pc],1),round(a[2]+OFF,1))].add(mk)
# 부호 시험
best=None
for sg in (1,-1):
mp={(round(sg*k[0],1),k[1]):v for k,v in P.items()}
hit=0
for dd in D:
if any(abs(dd[0]-cx-px)<3 and abs(dd[1]-py)<3 for (px,py) in mp): hit+=1
if best is None or hit>best[0]: best=(hit,sg)
sg=best[1]; mp={(round(sg*k[0],1),k[1]):v for k,v in P.items()}
o.write(u'== %s: 도면 점 %d, 모델 끝이 보이는 직선 %d, 부호 %d, 도면 점 중 모델 일치 %d\n'%(nm,len(D),len(mp),sg,best[0]))
un=[(round(dd[0]-cx,1),dd[1]) for dd in D if not any(abs(dd[0]-cx-px)<3 and abs(dd[1]-py)<3 for (px,py) in mp)]
c=collections.Counter(y for x,y in un); o.write(u' 모델과 안 맞는 도면 점 %d: 높이별 %s\n'%(len(un),sorted(c.items())))
dp=set((round(dd[0]-cx,1),dd[1]) for dd in D)
um=[(k,v) for k,v in mp.items() if not any(abs(k[0]-x)<3 and abs(k[1]-y)<3 for x,y in dp)]
c2=collections.Counter((tuple(sorted(v)),k[1]) for k,v in um); o.write(u' 도면 점 없는 모델 위치 %d: %s\n'%(len(um),sorted(c2.items())[:12]))
o.write(u'\n=== 상세 ===\n')
for nm,(x0,x1,cx,axis) in (('정면',(568500,578600,573552,1)),('측면',(587500,597600,592541,0))):
D=[d for d in swdots.dots(x0,x1,321300,324000) if d[2]==22.5 and d[3]==22.5]
lev=collections.defaultdict(list)
for d in D: lev[d[1]].append(round(d[0]-cx,1))
o.write(u'%s 도면 점: \n'%nm)
for y,xs in sorted(lev.items()): o.write(u' z %.1f n=%d x %s..%s\n'%(y,len(xs),min(xs),max(xs)))
G=collections.defaultdict(list)
for mk,a,b in S:
d=[abs(b[i]-a[i]) for i in range(3)]
if d[axis]>800 and sum(d)-d[axis]<2:
pc=0 if axis==1 else 1
G[(mk,round(a[2]+OFF,1))].append(round(a[pc],1))
o.write(u'%s 모델 끝 보이는 직선:\n'%nm)
for k,v in sorted(G.items()): o.write(u' %s z %.1f n=%d x %s..%s\n'%(k[0],k[1],len(v),min(v),max(v)))
o.close()