forked from mcneel/MOVED-rhinoscript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ArrayPolar.rvb
35 lines (25 loc) · 997 Bytes
/
ArrayPolar.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
35
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' ArrayPolar.rvb -- October 2008
' 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
Sub ArrayPolar
Dim arrObjects, arrCenter, nCount
Dim dAngle, arrAxis, arrXform, i
arrObjects = Rhino.GetObjects("Select objects to array")
If IsNull(arrObjects) Then Exit Sub
arrCenter = Rhino.GetPoint("Center of polar array")
If IsNull(arrCenter) Then Exit Sub
nCount = Rhino.GetInteger("Number of items",,2)
If IsNull(nCount) Then Exit Sub
dAngle = 360.0 / nCount
Rhino.EnableRedraw False
For i = 1 To nCount - 1
arrAxis = Array(0,0,1) ' world z-axis
arrXform = Rhino.XformRotation(dAngle * i, arrAxis, arrCenter)
Rhino.TransformObjects arrObjects, arrXform, True
Next
Rhino.EnableRedraw True
End Sub