|
不知道這是不是你要解決的問題。利用當前的vertex與下一個vertex兩點取中點來達到等分。Call Main()
Sub Main()
Dim a
a=rhino.GetObject("select a polyline")
Dim b
b=rhino.PolylineVertices(a)
Call subdividepolyline(b)
End Sub
Function subdividepolyline(arrv)
ReDim arrsubd(ubound(arrv))
ReDim allPt(ubound(arrv))
ReDim vetix(ubound(arrv))
Dim i
For i=0 To ubound(arrv)-1
arrsubd(i)=array((arrv(i)(0)+arrv(i+1)(0))/2.0,(arrv(i)(1)+arrv(i+1)(1))/2.0,(arrv(i)(2)+arrv(i+1)(2))/2.0)
allPt(i)= rhino.AddPoint(arrsubd(i))
Next
For i = 0 To ubound(arrv)
vetix(i)= rhino.AddPoint(arrv(i))
Call rhino.ObjectColor(vetix(i),rgb(200,0,0))
Next
subdividepolyline=allPt
End Function |
|