Sunday, December 31, 2006

Area Script

















Here's a small script I wrote for calculating the area of panels in 3d. In the end I'd like to be able to send the information to a spreadsheet that will also flatten the panels and dimension them automatically.

Option Explicit

main()

Sub main()

Dim arrObjects

arrObjects = Rhino.GetObjects ("select a objects", 8)

Dim i
For i = 0 To UBound(arrObjects)
If Rhino.IsSurface(arrObjects(i)) Then
Dim arrArea : arrArea = Rhino.SurfaceArea(arrObjects(i))
Dim arrPoints : arrPoints = Rhino.SurfacePoints(arrObjects(i))
Rhino.AddText "Panel "& i+1 & " Area: " & CStr (arrArea(0)), arrPoints(0)
End If

Next

End Sub