Command

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:

Rhino.Command "_Line _SelLast _Invert"

 

CORRECT:

Rhino.Command "_Line"

Rhino.Command "_SelLast"

Rhino.Command "_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:

Rhino.Command "! _Line _Pause _Pause"

 

CORRECT:

Rhino.Command "_Line _Pause _Pause"

 

After the command script has run, you can obtain the identifiers of most recently created or changed object by calling LastCreatedObjects.

Syntax

Rhino.Command (strCommand [, blnEcho])

Parameters

strCommand

Required.  String.  A Rhino command including any arguments.

blnEcho

Optional.  Boolean. The command echo mode.  If omitted, command prompts are echoed (True).

Returns

Boolean

True or False indicating success or failure.

Null

On error.

Example

Rhino.Command "_Line 0,0,0 2,2,2"

Rhino.Command "_Line _Pause _Pause"

Also See

IsCommand

LastCommandName

LastCommandResult

LastCreatedObjects

Print

Prompt