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

29 lines
1.3 KiB
Python

import pickle, math, collections, json, sys
segs,texts=pickle.load(open('cache_교각배근도(울산P1)_2016.10.28.dxf.pkl','rb'))
def dots(x0,x1,y0,y1,maxlen=40,lay=None):
S=[s for s in segs if x0<=s[0][0]<=x1 and y0<=s[0][1]<=y1 and x0<=s[1][0]<=x1 and y0<=s[1][1]<=y1 and math.hypot(s[0][0]-s[1][0],s[0][1]-s[1][1])<maxlen and (lay is None or s[3] in lay)]
# grid-hash union-find on endpoints
key=lambda p:(round(p[0]/0.5),round(p[1]/0.5))
par={}
def f(a):
while par.setdefault(a,a)!=a:
par[a]=par[par[a]]; a=par[a]
return a
for a,b,c,l in S:
ka,kb=key(a),key(b)
par[f(ka)]=f(kb)
comp=collections.defaultdict(list)
for a,b,c,l in S:
comp[f(key(a))].append((a,b,l))
out=[]
for k,L in comp.items():
xs=[p[0] for a,b,l in L for p in (a,b)]; ys=[p[1] for a,b,l in L for p in (a,b)]
w=max(xs)-min(xs); h=max(ys)-min(ys)
out.append((round((max(xs)+min(xs))/2,1),round((max(ys)+min(ys))/2,1),round(w,1),round(h,1),len(L),L[0][2]))
return out
if __name__=='__main__':
D=dots(6700,14250,-285300,-282700)
print(len(D));
c=collections.Counter((d[2],d[3],d[4]) for d in D); print(c.most_common(10))
for d in sorted(D,key=lambda d:(d[1],d[0]))[:10]: print(d)