SelCommand
CommandFor adding nestable whole object and subobject selection commands, derive your command from SelCommand and override the abstract SelFilter and virtual SelSubObjectFilter functions.
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.
EnglishName
Gets the name of the command. This method is abstract.
HistoryReplayOnObjectAttributeChange
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.
Id
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
Methods
OnHelp
protected virtual void OnHelp()
Is called when the user needs assistance with this command.
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
#Overrides: Command.RunCommand
SelFilter
#Override this abstract function and return true if object should be selected.
Parameters:
| rhObj (RhinoObject) | The object to check regarding selection status. |
Returns: true if the object should be selected; false otherwise.
To select subobjects, override this virtual function, add component indices of the subobjects that should get selected to indicesToSelect list and return true. This is called only if the SelFilter returns false and the whole object does not get selected.
Parameters:
| rhObj (RhinoObject) | The object to check regarding selection status. |
| indicesToSelect (List<ComponentIndex>) | The component indices of the subobjects to select. |
Returns: true if components added to indicesToSelect should get selected.