''' Transforms objects in scale and orientation
''' —-

Function transformEach(objects)
transformEach = Null
Dim arrItems, arrValues, arrReturns
arrItems = array("rotate_X","rotate_Y","rotate_Z","scale_X","scale_Y","scale_Z")
arrValues= array(0,0,0,1,1,1)
arrReturns = Rhino.PropertyListBox (arrItems, arrValues ,,"Transform Parameters")
If isNull(arrReturns) Then Exit Function
Dim i,count
Dim bBox,tempLn,origin,world
count = uBound(objects)
For i = 0 To count Step 1
'determine each objects center
bBox = Rhino.BoundingBox(objects(i))
world = Rhino.WorldXYPlane()
'if scale values have been changed scale each object according to each of the three independent world axis
If arrReturns(3) <> 0 Or arrReturns(4) <> 0 Or arrReturns(5) <> 0 Then
Call Rhino.ScaleObject(objects(i),origin,array(CDbl(arrReturns(3)),CDbl(arrReturns(4)),CDbl(arrReturns(5))))
End If
'if rotation values have been changed rotate each object about its local world based axis
If arrReturns(0) <> 0 Then
Call Rhino.RotateObject(objects(i),origin,CDbl(arrReturns(0)),world(1))
End If
If arrReturns(1) <> 0 Then
Call Rhino.RotateObject(objects(i),origin,CDbl(arrReturns(1)),world(2))
End If
If arrReturns(2) <> 0 Then
Call Rhino.RotateObject(objects(i),origin,CDbl(arrReturns(2)),world(3))
End If

Call Rhino.DeleteObject(tempLn)
End Function

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License