SelCommand

Command
public abstract class SelCommand : Command
For adding nestable whole object and subobject selection commands, derive your command from SelCommand and override the abstract SelFilter and virtual SelSubObjectFilter functions.

Properties

BeQuiet

#Since v5.0
public bool BeQuiet { get; set; }

CommandContextHelpUrl

protected virtual string CommandContextHelpUrl { get; }
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.

inherited fromCommand

EnglishName

public abstract string EnglishName { get; }
Gets the name of the command. This method is abstract.
inherited fromCommand

HistoryReplayOnObjectAttributeChange

public bool HistoryReplayOnObjectAttributeChange { get; set; }
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.
inherited fromCommand

Id

public virtual Guid Id { get; }
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
inherited fromCommand

LocalName

public virtual string LocalName { get; }
Gets the local name of the command.
inherited fromCommand

PlugIn

public PlugIn PlugIn { get; }
Gets the plug-in where this commands is placed.
inherited fromCommand

Settings

public PersistentSettings Settings { get; }
Gets the settings of the command.
inherited fromCommand

TestGrips

#Since v5.0
public bool TestGrips { get; set; }

TestLights

#Since v5.0
public bool TestLights { get; set; }

Methods

OnHelp

protected virtual void OnHelp()
Is called when the user needs assistance with this command.
inherited fromCommand

ReplayHistory

protected virtual bool ReplayHistory(ReplayHistoryData replayData)
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.

inherited fromCommand
replayData (ReplayHistoryData)The replay history information.
true if the operation succeeded.

The default implementation always returns false.

RunCommand

#
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
doc (RhinoDoc)
mode (RunMode)

SelFilter

#
protected abstract bool SelFilter(RhinoObject rhObj)
Override this abstract function and return true if object should be selected.
rhObj (RhinoObject)The object to check regarding selection status.
true if the object should be selected; false otherwise.

SelSubObjectFilter

#Since v7.9
protected virtual bool SelSubObjectFilter(RhinoObject rhObj, List<ComponentIndex> indicesToSelect)
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.
rhObj (RhinoObject)The object to check regarding selection status.
indicesToSelect (List<ComponentIndex>)The component indices of the subobjects to select.
true if components added to indicesToSelect should get selected.