When defining a command, you use the CommandMethod attribute. The CommandMethod attribute expects a string value to use as the global name of the command that is being defined. Along with a global command name, the CommandMethod attribute can accept the following values:
The following table lists the available flags that can be used to define the behavior of a command.
| Enum Value | Description |
|---|---|
| ActionMacro | Command can be recorded as an action with the Action Recorder. |
| DocReadLock | Document will be read locked when command is invoked. |
| Interruptible | The command may be interrupted when prompting for user input. |
| Modal | Command cannot be invoked while another command is active. |
| NoActionRecording | Command cannot be recorded as action with the Action Recorder. |
| NoBlockEditor | Command cannot be used from the Block Editor. |
| NoHistory | Command is not added to the repeat-last-command history list. |
| NoPaperSpace | Command cannot be used from Paper space. |
| NoTileMode | Command cannot be used when TILEMODE is set to 1. |
| NoUndoMarker | Command does not support undo markers. This is intended for commands that do not modify the database, and therefore should not show up in the undo file. |
| Redraw | When the pickfirst set or grip set are retrieved, they are not cleared. |
| Session | Command is executed in the context of the application rather than the current document context. |
| Transparent | Command can be used while another command is active. |
| Undefined | Command can only be used via its Global Name. |
| UsePickSet | When the pickfirst set is retrieved, it is cleared. |
The following demonstrates the creation of a CommandMethod attribute that defines a command named CheckForPickfirstSelection. The attribute also uses the command flag UsePickSet to indicate that the command is allowed to use the objects that are selected before the command is started.
<CommandMethod("CheckForPickfirstSelection", CommandFlags.UsePickSet)> _Public Sub CheckForPickfirstSelection()
. . .
End Sub
[CommandMethod("CheckForPickfirstSelection", CommandFlags.UsePickSet)]public static void CheckForPickfirstSelection()
{. . .
}
You can specify the use of more than one flag by using the + operator in VB.NET and the | operator in C#.