- 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>
48 lines
2.2 KiB
Python
48 lines
2.2 KiB
Python
import sys, json, re, math, collections
|
|
sys.path.insert(0,'pylib')
|
|
import rhino3dm
|
|
M = r"D:\★Pier 자료\심수석님 검토 파일\검토_옥성교P1\옥성교P1_G5.3dm"
|
|
m3 = rhino3dm.File3dm.Read(M)
|
|
def V(p): return (p.X,p.Y,p.Z)
|
|
def sub(a,b): return (a[0]-b[0],a[1]-b[1],a[2]-b[2])
|
|
def dot(a,b): return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]
|
|
def nrm(a): return math.sqrt(dot(a,a))
|
|
def addv(a,b,t): return (a[0]+b[0]*t,a[1]+b[1]*t,a[2]+b[2]*t)
|
|
def isect(p1,d1,p2,d2):
|
|
w=sub(p1,p2); a=dot(d1,d1); b=dot(d1,d2); c=dot(d2,d2); d=dot(d1,w); e=dot(d2,w)
|
|
den=a*c-b*b
|
|
if abs(den)<1e-9: return None
|
|
return addv(p1,d1,(b*e-c*d)/den)
|
|
def segs_of(g):
|
|
if isinstance(g, rhino3dm.PolyCurve): return [g.SegmentCurve(i) for i in range(g.SegmentCount)]
|
|
return [g]
|
|
def is_line(s): return type(s).__name__ in ("LineCurve","PolylineCurve")
|
|
def cseq(g):
|
|
lines=[(V(s.PointAtStart),V(s.PointAtEnd)) for s in segs_of(g) if is_line(s)]
|
|
if len(lines)<2: return [nrm(sub(l[1],l[0])) for l in lines]
|
|
pts=[]
|
|
for i in range(len(lines)-1):
|
|
p1,q1=lines[i]; p2,q2=lines[i+1]
|
|
pts.append(isect(p1,sub(q1,p1),p2,sub(q2,p2)))
|
|
seq=[lines[0][0]]+pts+[lines[-1][1]]
|
|
return [nrm(sub(seq[i+1],seq[i])) for i in range(len(seq)-1)]
|
|
bars=collections.defaultdict(dict)
|
|
lay={l.Index:l.FullPath for l in m3.Layers}
|
|
for o in m3.Objects:
|
|
g=o.Geometry; nm=o.Attributes.Name or ""
|
|
if isinstance(g,rhino3dm.Brep):
|
|
us=dict(o.Attributes.GetUserStrings())
|
|
if us.get('mark'): bars[us['mark']].setdefault(us.get('occurrence'),{}).update(us=us)
|
|
elif nm.startswith("P1-RC-"):
|
|
p=nm.split("-"); bars[p[2]].setdefault("-".join(p[3:]),{})["g"]=g
|
|
out={}
|
|
for mk,dd in bars.items():
|
|
items=[b for b in dd.values() if 'us' in b and 'g' in b]
|
|
seqs=[[round(x) for x in cseq(b['g'])] for b in items]
|
|
allv=sorted(set(v for s in seqs for v in s))
|
|
out[mk]={'n':len(items),'dl':[float(b['us']['design_length'])+float(b['us']['coupler_length'] or 0) for b in items],
|
|
'seqs':seqs,'values':allv,'shape':items[0]['us']['shape'],'dia':items[0]['us']['dia'],
|
|
'cl':[0]*0}
|
|
json.dump(out,open('ok_model_dims.json','w',encoding='utf-8'),ensure_ascii=False)
|
|
print('ok',len(out))
|