RunScript

Runs a Rhino command script.  All Rhino commands can be used in command scripts.  The command can be a build-in Rhino command or a command that is provided by a 3rd party plug-in.

Write command scripts just as you would type the command sequence at the command line. A space between characters or a new line act like pressing <Enter> at the command line.  For more information on writing command scripts, see "Scripting" in the Rhino help file.

Note, this method is designed to run one command and one command only.  Do not combine multiple Rhino commands into a single call to this method.  For example:

 

WRONG:

RunScript"_Line _SelLast _Invert"

 

CORRECT:

RunScript "_Line"

RunScript "_SelLast"

RunScript "_Invert"

 

Also, the exclamation point and space character ( ! ) combination used by button macros and batch-driven scripts to cancel the previous command is not valid.  For example:

 

WRONG:

RunScript "! _Line _Pause _Pause"

 

CORRECT:

RunScript "_Line _Pause _Pause"

Syntax

RunScript (strCommand [, blnEcho])

Parameters

strCommand

Required.  String.  A Rhino command including any arguments.

intEcho

Optional.  Number. The command echo mode, where 0 = no echo, 1 = echo..

Returns

Number

0 failure, 1 success.

Example

Dim objRhino

On Error Resume Next

Set objRhino = CreateObject("Rhino.Application")

If Err.Number == 0 Then

  If 1 = objRhino.IsInitalized Then

    objPlugIn.RunScript "_Line 0,0,0 2,2,2"

  End If

End If