Class CadCommandAttribute
Marks a method of a plugin as a command, as AutoCAD's [CommandMethod] does: [CadCommand("NUMCIRCLES",
Alias = "NC")] on public IEnumerable<CadPrompt> NumberCircles(CadCommandContext c). The method is an
iterator, as the presenter's own commands are: it yields each prompt and reads the answer from
Input when it is resumed, so that it runs inside the command line with no thread of
its own. It may be static, or an instance method of a public class with a public constructor that takes nothing, of
which the plugin makes one when it is loaded.
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
public sealed class CadCommandAttribute : Attribute
- Inheritance
-
CadCommandAttribute
- Inherited Members
Remarks
A method that returns void and blocks on its prompts, as AutoCAD's do, is refused: it would have to run on a
thread of its own while the window waits, and every edit it made would then reach the canvas and the panels from
that thread, which WPF does not allow.
Constructors
- CadCommandAttribute(string)
Marks a method as the command of a name.
Properties
- Alias
Gets or sets the alias that runs it too, as NC for NUMCIRCLES; null for none.
- Description
Gets or sets what the command does, in a few words, as the Plugin manager and the ribbon show it.
- Name
Gets the name typed to run the command.
- UsesSelection
Gets or sets whether the command takes the objects selected before it was started, as MOVE does, so that SelectObjects() gives them without asking "Select objects:". False until set.