Python程序:
import rhinoscriptsyntax as rs
mesh=mesh #导入外部程序的Mesh面;
meshes=rs.ExplodeMeshes(mesh) #分解单一Mesh面为多个;
xymeshes=[]
for i in range(len(meshes)):
if i ==0: #处理分解后第一个Mesh面的展平位置;
mesh0point=rs.MeshVertices(meshes)
mesh0points=[]
for r in mesh0point:
mesh0points.append([r[0],r[1],r[2]])
vertices2lst=[]
vertices1lst=[]
for q in vertices2:
vertices2lst.append([q[0],q[1],q[2]])
for p in vertices1:
vertices1lst.append([p[0],p[1],p[2]])
#找到相邻两个面的共同顶点;
ver=[m for m in vertices1lst for n in vertices2lst if m==n]
a=ver[0]
b=ver[1]
#找到相邻两个面共同顶点的索引;
indexa=vertices1lst.index(a)
indexb=vertices1lst.index(b)
#找到相邻两个面不共边的顶点;
cref=[m for m in vertices1lst if m not in ver][0]
cv=[m for m in vertices2lst if m not in ver][0]
#定义面的延展方向;
refvertice=rs.MeshVertices(xymeshes[i-1])
refvertices=[]
for x in refvertice:
refvertices.append([x[0],x[1],x[2]])
indexc=[c for c in range(0,3) if c !=indexa and c!=indexb]
print(indexc)
refverticespoint=rs.MirrorObject(rs.AddPoint(refvertices[indexc[0]]),refvertices[indexa],refvertices[indexb])
mirrorpoint=[rs.PointCoordinates(refverticespoint)]
for z in mirrorpoint:
mirrorpoint=[z[0],z[1],z[2]]