看到别人介绍的内容,觉得很好。试验后发现缺少代码。大家讨论一下。
把未完的也发在这里:
以下是源代码:
option Explicit
'Script written by [ ]
'Script copyrighted by [ ]
'Script version 2009年3月26日 12:00:00
Call Main()
Sub Main()
Dim ArrObjects, arrReference, arrTarget, arrPoints, mubiao, abc
abc=Rhino.GetObjects("Select Objects to orient")
mubiao=rhino.GetPoint("point")
arrObjects=Rhino.copyObjects( abc, array(0,0,0), array(1,0,0))
Dim i
For i=0 To ubound(arrObjects)
Dim n:n=160
Dim z1:z1=5
Dim xx:xx=10+i*n
Dim arr:arr=array(array(mubiao(0)+xx,mubiao(1),0),_
array(mubiao(0)+xx+n,mubiao(1),0),array(mubiao(0)+xx,mubiao(1)+xx+n,0))
Dim arrmp:arrMP = Rhino.SurfaceAreaCentroid(arrobjects(i))
Rhino.addtext "NO.="&I ,arrMP(0),zi
Dim b
b=paiping (arrobjects(i),arr,i,zi)
Next
End Sub
Function Paiping(wuti,arr,i,zi)
Dim arrReference, arrTarget, arrPoints
arrPoints = Rhino.SurfacePoints(wuti)
arrReference = array(arrPoints(0),arrPoints(2),arrPoints(1))
arrTarget = arr
Dim wuti2:wuti2=Rhino.OrientObject (wuti,arrReference,arrTarget)
Dim arrmp:arrMP = Rhino.SurfaceAreaCentroid(wuti2)
Dim t:t=Rhino.addtext( "NO.="&i ,arrMP(0),zi)
Rhino.ObjectColor wuti2, RGB(rnd*255,rnd*255,rnd*255)
End Function
原截图中是用Monkey for Rhino合成的,所以格式很规范。 |