Command

Runs a Rhino command script.  All Rhino commands can be used in command scripts.  The command can be a built-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 function 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:

rhinoscriptsyntax.Command("_Line _SelLast _Invert")

 

CORRECT:

rhinoscriptsyntax.Command("_Line")

rhinoscriptsyntax.Command("_SelLast")

rhinoscriptsyntax.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:

rhinoscriptsyntax.Command("! _Line _Pause _Pause")

 

CORRECT:

rhinoscriptsyntax.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

rhinoscriptsyntax.Command (commandString, echo=True)

rhinoscript.application.Command (commandString, echo=True)

Parameters

commandString

Required.  String.  A Rhino command including any arguments.

echo

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

Returns

Boolean

True or False indicating success or failure.

Example

import rhinoscriptsyntax as rs

rs.Command("_Line 0,0,0 2,2,2")

rs.Command("_Line _Pause _Pause")

Also See

IsCommand

LastCommandName

LastCommandResult

LastCreatedObjects

Print

Prompt