Monday 13 July 2009

Including scripts and plugins in Rhino

There are several ways to expand the possibilities that Rhino has to offer. In this article we show how you can include scripts in the form of toolbars, rvb-script files and as rhino plugin files (.rhp)

Including a script that has been posted as a .tb file:

Copy the file first to a location where you can find it back. By default, Rhino Stores its toolbar files in this location:

C:\ProgramData\McNeel\Rhinoceros\4.0\

After you have saved it to the right location, drag it into an open Rhino session.

Here is an example to practice that with:
RandLayerColor.tb (a toolbar that includes scripts to make a new layer with a random color, and to randomize existing layers)
Rhino Scatter.tb (a toolbar that can put random points on objects and copy objects to points)

Including a rvb-script in Rhino for later access


The easies way to include a script in Rhino for immediate access, is to make a button for it:
Make a new toolbar or make a new button into an existing toolbar.
Edit the button by SHIFT-rightclicking on the button.
Open the rvb file in a text editor like notepad
copy the contents of the rvb file to the area of left mouse button command
Almost finished!
All you need to do now is tell Rhino to run this script. This means you need to place the following text before the code you just pasted:
!-_Runscript (

and at the end of the script text, close it with:

)

Save the changes by clicking ok, and make sure to save the toolbar (tools--> toolbar layout --> file --> save)

Some nice scripts to practice this with:
SharpenUp.rvb (to remove fillets from filleted polylines)
GripRandomize.rvb (to make noise-like transformations to surfaces)

Including a RHP-file for later access

To include a rhp-file (rhino plugin), the best you can do is to copy the file first to C:\program files\rhinoceros 4.0\plugins\ and preferably in its own subfolder, so that you can separate the scripts you download from the native Rhino plugins.
Now when you have the file sit in its right location, drag it into the viewport of an open Rhino session. That's all you need to do. In most cases, the script is now accessible with a new command that resembles the name of the script. For example, if the file was called RandomizeColors.rhp, most likely the person who wrote the script has assigned RandomizeColors as a command to that script.