Think of each command in Rhinoceros as a small commandscript.
Every command in Rhinoceros has an official "command name".
The command name does not necessarily match the command's label
that you see in a menu or an icon's tooltip. Only official command
names can be used within a commandscript or when typing commands
from the keyboard into Rhinoceros. For example, the command labeled
"Change layer" in a menu must be typed Changelayer,
without a space in a commandscript. Changelayer is the official
command name for this function.
Avoid errors by always using the official command name when
you type a command. To guarantee accuracy, you can copy the official
command names from the help files, and paste them directly into
your scripts. You can also type the word "commands"
at the command prompt and Rhinoceros will send all its command
names to the command history or to the Windows clipboard. You
can then view the entire list of Rhinoceros command names in the
command history by pressing the F2 hotkey on your keyboard or
you can paste it into a text file.
- Type the commands in your script just as you would at the
command prompt in Rhinoceros.
- A space between characters or a new line in your script mimics
the user pressing the Enter key at the command prompt. The spaces
between the entries are the same places you would press Enter
when typing the command by hand.
- The word enter, ! enter, or ! can end a script or a script
- An exclamation point ! and a space after it (remember to
put a space after the ! symbol) are usually used to begin a script
. The exclamation point ! symbol cancels any previous command.
The exclamation point can also be used at the end of the script
it is similar to ending a script with the enter key.
- Three-dimensional spatial coordinates that are used to locate
a point in space in Rhinoceros must not have spaces in between
the numbers and commas.
A point located at cplane 12units X axis,10 units Y axis, and
8 units Z axis in Rhinoceros would be written in a script:
12,10,8 not 12, 10, 8
- Commandscripts are viewport sensitive this means that scripts
work differently depending on which viewport is active before
you process the commandscript.
- Commandscripts are generally not written as one line of text
with spaces only, although they can be.
Here is an example:
! Polyline 0 10,0,0 10<60 0 enter
This will work but it makes it harder for the user to read. Notice
that it is very hard to sort out the spatial coordinates.
Commandscripts should generally be written with line breaks between
the commands and three-dimensional spatial coordinates to make
it easier to script, debug and understand at a glance. Below
in the left hand column is the same script with line breaks
in between commands and three-dimensional spatial coordinate
points. Notice how much easier it is to read.
Protocol for Running a Comandscript
This command tells Rhinoceros to create a polyline
Coordinate point to begin creating polyline
Coordinate point for polyline
Polar Coordinate point for polyline
Ending XYZ coordinate point for polyline
Tells Rhinoceros to end the script
- Make sure the viewport that the script is to be performed
in is active
- Drag the Toolbars/icons that execute a commandscript to the
top of the workspace off of the viewport areas.
- After clicking an icon that executes a commandscript do not
touch the mouse.
- Do not move the mouse cursor while a commandsrcript is active
- Always wait for a commandscript to end completely before
you touch the mouse or resume modeling. It is easy to make sure
the script is complete because Rhinoceros will display a
blinking cursor on the command line when a script or modeling
operation is done. Always make sure the blinking cursor appears
in the command line before you touch or move the mouse, resume
modeling or scripting.
- Sometimes because of an improperly placed "enter"
command in a script the script might loop forever. If this happens
hit crt-alt-delete to exit Rhinoceros.