Option Explicit 'Script written by Russell Loveridge 'Script copyrighted by ' This script uses a random number to "flip" the direction that the object moves in ' The value of a random number determins if it moves in the positive direction or the negative direction.... Call Main() Sub Main() 'declare the variables for the script. Dim strObject, dblSize, intDir, dblMove, dblDist 'user input - identify the object to move strObject = Rhino.GetObject( "Select an object to move" ) If IsNull(strObject) Then Exit Sub ' user input (a "double" is a real number ex: 3.1459) dblSize = Rhino.GetReal("enter distance to move the box", 10) ' user input (an "integer" is a whole number ex: 4 - no decimal fraction) intDir = Rhino.GetInteger("direction to move the box: X=0, Y=1, Z=2", 0, 0, 2) ' the numbers at the end of this statement are limiters, this means: ' ask the user for a number, Default num=0, min num=0, max num = 2 ' dblMove is a random SWITCH half the time it will make the move in the +'ve, the other half in -'ve 'dblMove is a random number that is evaluated to determin if the move will be -'ve or +'ve dblMove = (rnd) ' we use the print command to tell us what the random number was - it prints the message to the command line. Rhino.print "random number: "& dblMove ' The random number will be between 0 and 1... so it has a 50/50 chance to be bigger than 0.5 If 0.5 > dblMove Then dblDist = (-1* dblSize) ' this will move the object in the -'ve direction Else dblDist = dblSize ' this will move the object in the +'ve direction End If Rhino.print "the distance to move the object is: "& dblDist ' this tells the user how the direction of the move.... ' This is a conditional statement: It allows for multiple choices. If intDir = 0 Then ' move in X Rhino.MoveObject strObject, Array(0,0,0), Array(dblDist,0,0) ' this is the move if the user inputs 0 - for an X move ElseIf intDir = 1 Then ' move in Y Rhino.MoveObject strObject, Array(0,0,0), Array(0,dblDist,0) ' this is the move if the user inputs 1 - for an Y move Else ' move in Z Rhino.MoveObject strObject, Array(0,0,0), Array(0,0,dblDist) ' this is the move if the user inputs 2 - for an Z move End If End Sub