Table of Contents

CadCommandAttribute

from OpenCAD2D.Plugins import CadCommandAttribute

class CadCommandAttribute(System.Attribute) ยท CadCommandAttribute in the .NET reference

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 CadCommandContext.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.

Constructors

__init__

.NET

def __init__(self, name: str) -> None

Marks a method as the command of a name.

Properties and fields

Alias

.NET

@property
def Alias(self) -> str | None
@Alias.setter
def Alias(self, value: str | None) -> None

Gets or sets the alias that runs it too, as NC for NUMCIRCLES; null for none.

Description

.NET

@property
def Description(self) -> str
@Description.setter
def Description(self, value: str | None) -> None

Gets or sets what the command does, in a few words, as the Plugin manager and the ribbon show it.

Name

.NET

@property
def Name(self) -> str

Gets the name typed to run the command.

UsesSelection

.NET

@property
def UsesSelection(self) -> bool
@UsesSelection.setter
def UsesSelection(self, value: bool) -> None

Gets or sets whether the command takes the objects selected before it was started, as MOVE does, so that CadCommandContext.SelectObjects gives them without asking "Select objects:". False until set.