|
本帖最后由 urdiafa 于 2014-5-14 17:42 编辑
我寫下面code,要把Function subdividepolyline(ByRef arrv)計算好的點集合,傳到
strNewPolyline = Rhino.AddPolyline(arrNewVertices)去形成polyline,但出現錯誤訊息
arrNewVertices不是array的形式,我是自我學習,練習寫出類似萬花筒的圖,卡在此點,無法解決請高手指點
.----------------------------------------------------
Option Explicit
Call Main()
Sub Main()
Dim a
a = rhino.GetObject("select a polyline") '選取一個封閉polyline
Dim b
b = rhino.PolylineVertices(a)
Dim arrNewVertices
arrNewVertices = SubDividePolyline(b)
Dim strNewPolyline
strNewPolyline = Rhino.AddPolyline(arrNewVertices) '到此行出現錯誤訊息
End Sub
'-----------------------------------------
Function subdividepolyline(ByRef arrv)
ReDim arrsubd(ubound(arrv))
ReDim allPt(ubound(arrv))
ReDim vetix(ubound(arrv))
Dim i,temp,pangle,plength,sp,ep,b
Dim counter : counter = 0
For i=0 To ubound(arrv) - 1
sp = (arrv(i))
ep = (arrv(i + 1))
temp = Rhino.Angle(sp, ep)
pangle = temp(0)
plength = Rhino.Distance(sp, ep)
arrsubd(i) = Rhino.Polar(sp, pangle, (plength / 3))
Next
subdividepolyline = arrsubd
End Function
|
|