2009年2月18日 星期三

Rhino Script Excise08




Option Explicit
'Script written by
'Script copyrighted by
'Script version 2009年2月18日 上午 11:14:27
'Script function 選取隨意繪製的polyline,電腦回饋長度。'

Call CalPolylineLength
Sub CalPolylineLength
Dim strPolyline
strPolyline = Rhino.GetObject("select a polyline sample", 4, True, True)

Dim arrPolyVertices
arrPolyVertices = Rhino.PolylineVertices(strPolyline)

Dim dblPolylineLength
dblPolylineLength = PolylineLength(arrPolyVertices)
Call Rhino.print("PolylineLength = " & dblPolylineLength)
End Sub

Function PolylineLength(ByRef arrVertices)
PolylineLength = 0.0
Dim i
For i = 0 To UBound(arrVertices) - 1
PolylineLength = PolylineLength + Rhino.Distance(arrVertices(i), arrVertices(i+1))
Next
End Function

沒有留言: