wiki.ksteinfe.net
Personal tools
 

Rhinoscript:rhinoscript development using notepad

From ksteinfeWiki

Running your first script

  • Download this hello_world.rvb file, and place it on your desktop. (you may need to right-click on this link, and select 'save as', be sure the extension is correct).
  • Launch Rhino, and go to Tools->Rhinoscript->Load
  • A dialog box will appear listing scripts you have recently loaded. If this is your first time running a script, this list will be empty.
  • On the right of this dialog box, click the “Add” button, then browse to and select the hello_world.rvb file you just downloaded. Notice that now, you’ve added a script to your list.
  • Double click on the name of the script in this dialog box to run it. A popup box should appear saying hello!

Editing your first script

Launch Notepad from the start menu (in the accessories subfolder). From within Notepad, goto file->open, and select the hello_world.rvb file from your desktop. This is the entirety of the script you just ran. You’ll see now that it's exceedingly simple and consists of just one line, shown below:

Rhino.MessageBox("hello world!")

Remember, rhinoscript is simply a set of instructions for the Rhino program to follow. In this case, it’s telling Rhino to open a message box, and to put a little greeting in it. Edit the text in notepad so that it reads as follows, and save the file:

Rhino.MessageBox("hello <<your name>>!")

Notice how I prompted you to replace some of what I’ve written with whatever you want by surrounding that stuff with “<<” and “>>”. This is a common convention.

Now, go back into rhino, and repeat the same process above for loading and running the hello_world.rvb script. Notice that you don’t need to browse for and add the script to the list, as it’s already in there. See how the results changed?

Congratulations, you’ve hacked your first script!

Linking to a script from a button

TODO: describe

Shift+RightClick on the button.

!-_LoadScript “G:\_dev\_rvbdev\lines.rvb”
or
!-_RunScript (
MsgBox("hello")
)