-
Notifications
You must be signed in to change notification settings - Fork 335
/
Copy pathCurveLength.rvb
34 lines (30 loc) · 1.16 KB
/
CurveLength.rvb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' CurveLength.rvb -- May 2012
' If this code works, it was written by Dale Fugier.
' If not, I don't know who wrote it.
' Works with Rhino 4.0.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Subroutine: CurveLength
' Purpose: Calculate the length of one or more curves.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub CurveLength
Dim arrObjects, strObject, dblLength, intCount
dblLength = 0.0 : intCount = 0
' Get the curve objects
arrObjects = Rhino.GetObjects("Select Objects", 4, True, True)
If IsArray(arrObjects) Then
Rhino.UnselectObjects arrObjects
For Each strObject In arrObjects
If Rhino.IsCurve(strObject) Then
' Get the curve length
dblLength = dblLength + Rhino.CurveLength(strObject)
intCount = intCount + 1
End If
Next
If intCount > 0 Then
Rhino.Print "Curves selected: " & CStr(intCount) & ", Total length: " & CStr(dblLength)
End If
End If
End Sub