Scripting in Rhino
Programs and scripts are instructions that tell a computer what to do. RhinoScript is a scripting language that lets us automate procedures inside Rhinoceros without having to recur to the graphic user interface, thus helping us take advantage of the computer's speed to produce and evaluate all sorts of geometry and data. RhinoScripting can be a powerful design technique, as well a way to think differently about the activity of design itself. Before jumping right into coding in RhinoScript its useful to get familiar with some basic concepts of computation.
Computer Programs and Scripts
As mentioned above, programming and scripting languages are formal languages used to tell a computer, or a computer application, what to do. A key difference between both is that natural languages can be ambiguous and redundant while formal languages need to be more concise. This is the case because whereas humans are good at dealing with ambiguity and at interpreting ill-formed statements in natural languages (e.g. I've got a huge J-Lo from eating all of these doughnuts), computers generally require us to enforce strict rules to form syntactically correct statements.
As its name indicates, RhinoScript is not a full-fledged programming language but a scripting language. Scripts are different from computer programs in that they cannot run as stand alone applications. They generally work in association with programs, like Rhinoceros, as a way to give the user flexible access to the automation and control of the software’s functions. In brief, RhinoScript is a scripting language we use for telling the CAD software Rhinoceros what to do.
A toolbar in Rhino's graphic user interface
A simple script in the command line
RhinoScript as a "High level" language
You may have heard of "high" and "low" level languages. High level languages are easier for a human to read and write, while low level languages, also called machine code, are harder for humans to understand. Conversely, while machine code is directly executed by a computer's processing unit, programs written in high level -or interpreted- languages need to be translated by another program (called the compiler) in order to a computer's processing unit to understand it and execute it. This makes high level languages relatively slower but much more convenient for people to use. RhinoScript is a very high level language: it can be easily understood by humans.
As an example here is a program written in machine code looks more or less like this:
6 5 5 5 5 6 bits
[ op | rs | rt | rd |shamt| funct] R-type
[ op | rs | rt | address/immediate] I-type
[ op | target address ] J-type
While (myVariable < 0) do
print myVariable
myVariable = myVariable - 1
As you can see machine code is pretty abstract while RhinoScript is kind of similar to English.
See wikipedia's entry on machine code.
What can be done with it?
Like most other programming or scripting languages, RhinoScript allows us to perform the following kinds of operations:
Input
Get data from the keyboard or from a file.
Output
Display data on the screen or send data to another file.
Math
Perform basic mathematical and geometric operations like addition and multiplication.
Conditional Execution
Check for certain conditions and execute the appropriate sequence of statements.
Repetition
Perform some action repeatedly, usually with some variation.
Some scripting languages are -besides RhinoScript- ActionScript (Adobe Flash), MELScript (AutoDesk Maya), MAXScript (AutoDesk 3DMax), and AutoLISP (AutoCAD).
Programming Languages include JAVA, C, Python, etc.
References
Sections of this entry borrow from How to think like a computer scientist