forked from mcneel/MOVED-rhinoscript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CopyRotate.rvb
39 lines (29 loc) · 1.17 KB
/
CopyRotate.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
36
37
38
39
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' CopyRotate.rvb -- November 2004
' 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 CopyRotate
Dim arrObjects
arrObjects = Rhino.GetObjects( "Select objects to copy and rotate", , True, True )
If Not IsArray( arrObjects ) Then Exit Sub
Dim arrFrom
arrFrom = Rhino.GetPoint( "Point to copy from" )
If Not IsArray( arrFrom ) Then Exit Sub
Dim arrTo
arrTo = Rhino.GetPoint( "Point to copy to", arrFrom )
If Not IsArray( arrTo ) Then Exit Sub
Dim arrCopy
arrCopy = Rhino.CopyObjects( arrObjects, arrFrom, arrTo )
If Not IsArray( arrCopy ) Then Exit Sub
If UBound( arrCopy ) <> UBound( arrObjects ) Then Exit Sub
Dim arrRef1
arrRef1 = Rhino.GetPoint("First reference point", arrTo)
If Not IsArray( arrRef1 ) Then Exit Sub
Dim dblAngle
dblAngle = Rhino.GetAngle( arrTo, arrRef1, , "Second reference point" )
If Not IsNumeric( dblAngle ) Then Exit Sub
Rhino.RotateObjects arrCopy, arrTo, dblAngle
End Sub