Command
ReferencesDefines a base class for all commands. This class is abstract.
Constructors
Command
#protected Command()
Default protected constructor. It only allows instantiation through sub-classing.
Properties
CommandContextHelpUrl
#Gets the URL of the command contextual help. This is usually a location of a local CHM file.
The default implementation return an empty string.
Gets the name of the command. This method is abstract.
By default, object attribute changes do not trigger history replay. Set this property to true, typically in the command's constructor, if you want objects created with this command to trigger history replay when their attributes change.
Gets the unique ID of this command. It is best to use a Guid attribute for each custom derived command class since this will keep the id consistent between sessions of Rhino GuidAttribute
Gets the result code of the last command.
Methods
Displays help for a command.
Parameters:
| commandId (Guid) | A command ID. |
Returns a command's context help url.
Parameters:
| commandId (Guid) | A command ID. |
Returns: The command's context url if provided.
Gets list of command names in Rhino. This list does not include Test, Alpha, or System commands.
Parameters:
| english (bool) | if true, retrieve the English name for every command. if false, retrieve the local name for every command. |
| loaded (bool) | if true, only get names of currently loaded commands. if false, get names of all registered (may not be currently loaded) commands. |
Returns: An array instance with command names. This array could be empty, but not null.
Determines if Rhino is currently running a command. Because Rhino allow for transparent commands (commands that can be run from inside of other commands), this method returns the total ids of active commands.
Returns: Ids of running commands or null if no commands are currently running. The "active" command is at the end of this list.
Returns a command's style flags.
Parameters:
| commandId (Guid) | A command ID. |
Returns: The command's style flags, or Style.None if the command is not found.
Gets an array of most recent command descriptions.
Returns: An array of command descriptions.
Determines if Rhino is currently running a command.
Returns: true if a command is currently running, false if no commands are currently running.
This is a low level tool to determine if Rhino is currently running a script running command like "ReadCommandFile" or the RhinoScript plug-in's "RunScript".
Returns: true if a script running command is active.
Determines is a string is a command.
Parameters:
| name (string) | A string. |
Returns: true if the string is a command.
Determines if a string is a valid command name.
Parameters:
| name (string) | A string. |
Returns: true if the string is a valid command name.
Returns the ID of a command.
Parameters:
| name (string) | The name of the command. |
| searchForEnglishName (bool) | true if the name is to searched in English. This ensures that a '_' is prepended to the name. |
Returns: An of the command, or Guid.Empty on error.
Returns the command name given a command ID.
ReplayHistory
#Repeats an operation of a command.
In order to make this function work, you will likely need to grab the Result property that gives the list of input objects. Then, you will be able to replace these inputs by using one of the UpdateToX() methods of the ReplayHistoryResult.
You should NOT use any document AddX() or ReplaceX() functions, as they will break history.
Parameters:
| replayData (ReplayHistoryData) | The replay history information. |
Returns: true if the operation succeeded.
The default implementation always returns false.
RunCommand
#Executes the command.
Execute some code as if it were running in a command
Parameters:
| commandCallback (Command.RunCommandDelegate) | |
| doc (RhinoDoc) | |
| data (object) | optional extra data to pass to callback |
Events
Called just before command.RunCommand().
Called immediately after command.RunCommand().
Used to monitor Rhino's built in undo/redo support.