Editing Scripts

Any simple plain-text editor, such as Notepad, can be used to create and/or edit script files.  When saving your script file, make sure to give the file the default file extension for RhinoScript-specific VBScript files, which is RVB.

You can also create and edit script file from within Rhino by using the EditScript command.  The EditScript command can be accessed from either Rhino's Tools menu, or by entering EditScript on Rhino's command line.

Note, there is no scriptable version of the EditScript command.

The RhinoScript Editor

The RhinoScript Editor can be used to edit, run, and debug scripts. It contains standard source code editing feature, such as find and replace (with regular expressions), multiple-document interface, method browser, and an integrated help file.

editor_all.png

The Code Editor

The most important item on the RhinoScript Editor is the code editor. It is here that you make your scripts. As you can see, the editor is much more than a simple text editor. It performs automatic syntax parsing meaning you get properly colored keywords, collapsible code groups which encapsulate Sub and Function blocks, automatic indenting, auto-completion and error highlighting.

editor_editor.png

Auto-completion and parameter tips are grouped under the catch-phrase Intellisense. Since VBScript is not a strongly typed language. Thus, Intellisense in the RhinoScript Editor is limited to RhinoScript methods and script scope procedures.

The auto-completion list pops up as soon as Rhino. is typed. The list updates when you keep typing to reflect the best possible match with your current text. Once the desired method is highlighted in the pop up list, press [Enter] and the complete method name will be inserted into the script. Once the method name is in place, we have to supply the arguments. Intellisense displays a tooltip showing us the required arguments and which one we are currently setting.

Above the code editor you will find the document tab. The RhinoScript Editor is multiple-document capable and you can switch between documents by clicking on the appropriate tab. You can also add existing files quickly by dragging them onto the file tab.

The Method Browser

The method browser displays a categorized view of all RhinoScript methods. Use the plus and minus tree icons to expand and collapse each category. You can search for methods by typing the method name in the search field and then pressing [Enter]. If you double-click on a method, in the method browser, help on the method will appear. To use the method in your script, just drag the method into the code editor.

editor_browser.png

The Status Bar

The status bar provides feedback on the location of the insertion caret in the currently active script. It provides both line and column coordinates, as well as procedure scope coordinate. You can jump to a specific line in your script by using the Go To Line dialog box. But you can also scroll the line index field in the status bar. Just click + drag up and down and the currently selected line will be scrolled.

The status bar exposes another quick navigation tool. If you click on the procedure scope field (the last field on the status bar) you will pop up a menu listing all defined Sub and Function procedures. Click on one of the names to jump to that procedure. If the caret is not inside any procedure body, the status bar will read "Global scope".

editor_statusbar.png

The Toolbar

The toolbar exposes standard functionality, which can also be found in the menus.

editor_toolbar.png

 

Button

Shortcut

Description

New

Ctrl + N

Create a new script file with a custom header.

Open

Ctrl + O

Open an existing script file.

Save

Ctrl + S

Save the currently active script.

Save All

 

Save all changes to all loaded scripts.

Save As

Ctrl + Shift + S

Save the active script under another file name.

Run Script

F5

Run the active script.

Debug Script

Ctrl + F5

Run the active script with breakpoints enabled.

Toggle Breakpoint

F9

Toggle breakpoint flag on the active line in the active script.

Find

Ctrl + F

Search the active script for a specific string.

Replace  

Ctrl + R

Replace one string with another in the active script.

Go To Line

Ctrl + G

Display the "Go To Line" dialog for the active script.

Google Groups

 

Perform a Google search for the specified keywords.

The Menu

The menu provides access to all the RhinoScript Editor features.

editor_menu.png