You’ve just opened the third edition of the RhinoScript primer. This booklet was originally written as a workshop handout for the students at the Architecture faculty of the Universität für Angewandte Kunst in Vienna. The aim of the workshop was to teach them how to program Rhino in no more than four days and, counter all my expectations, they did. Most of them had never programmed before so I had to make sure the text was suitable for absolute beginners. I did not expect at the time that this proved to be the most successful aspect of the primer. After the workshop, a slightly reworked version was made available to the public and it has helped many non-programmers getting rid of the “non” since. Incidentally, if you do not succeed in learning RhinoScript within a time-span of four days, do not feel bad about yourself. Remember that those students received additional lectures and intensive support from someone who took two months to reach the same level.
This new edition essentially caters for two major demands; the release of Rhinoceros 4.0 and the superficiality of the old edition. RhinoScript has existed for many years, but has recently taken a big leap forward with the development of Rhino4. Scripters of course want to take advantage of all the new functionality offered by this release and new programmers don’t want to start learning an outdated language. I have tried to combine the original aims of the primer with the requests for more in-depth articles, but it is always hard to judge the clarity of a text when one is highly familiar with its subject matter to begin with. You will have to be the judge. But always remember that learning programming -though fun- is no laughing matter so to speak. The ancient Greeks already understood that hubris is a party spoiler and the best way to prevent this learning experience turning into a classic tragedy, is to take it slow. Do not continue reading if you’re uncomfortable with past paragraphs. Re-read when in doubt. Ask questions if necessary. Programming is not difficult, but it requires a certain frame of mind which some beginners find hard to acquire. I know I did.
The one advantage I enjoy over authors of other programming books, is that I shall be teaching you to program Rhino. Writing scripts for Rhino means you have an exceptionally powerful geometry kernel at your disposal which enables you to achieve the most outrageous results with a minimum of code. Instead of boring you with days-of-the-week and employee-salary-classes examples, I get to bore you with freeform surfaces, evolving curves and inflating meshes.
Hopefully, this third edition of the RhinoScript primer will help existing scripters get the most out of Rhino4, while teaching regular human beings how to become scripters in the first place.
Good luck!
David Rutten Robert McNeel & Associates
Download the RhinoScript 101 Primer as a single PDF
Table of Contents
1. What’s it all about?
1.1 Macros
1.2 Scripts
1.3 Running Scripts
2. VBscript Essentials
2.1 Language Origin
2.2 Flow Control
2.3 Variable Data
2.3.1 Integers and Doubles
2.3.2 Booleans
2.3.3 Strings
2.3.4 None Variable
2.3.5 Using Variables
3. Script Anatomy
3.1 Programming in Rhino
3.2 The Bones
3.3 The Guts
3.4 The Skin
4. Operators and Functions
4.1 What on Earth are they and why should I care?
4.2 Careful…
4.3 Logical Operators
4.4 Functions and Procedures
4.4.1 A Simple Function Example
4.4.2 Advanced Function Syntax
5. Conditional Execution
5.1 What if?
5.2 Select Case
5.3 Looping
5.4 Conditional Loops
5.5 Alternate Syntax
5.6 Incremental Loops
6. Arrays
6.1 My Favorite Things
6.2 Points and Vectors
6.3 An AddVector() Example
6.4 Nested Lists
7. Geometry
7.1 The openNURBS™ Kernel
7.2 Objects in Rhino
7.3 Points and Pointclouds
7.4 Lines and Polylines
7.5 Planes
7.6 Circles, Ellipses, and Arcs
7.6.1 Ellipses
7.6.2 Arcs
7.7 NURBS Curves
7.7.1 Control-Point Curves
7.7.2 Interpolated Curves
7.7.3 Geometric Curve Properties
7.8 Meshes
7.8.1 Geometry vs. Topology
7.8.1 Shape vs. Image
7.9 Surfaces
7.9.1 NURBS Surfaces
7.9.2 Surface Curvature
7.9.3 Vector And Tensor Spaces