CommandAttribute

Namespace: Digi21.DigiNG.Plugin.Command
Assembly: Digi21.DigiNG.Plugin

Marks a class as a Digi3D.AI command and assigns the name used to execute it.

[AttributeUsage(AttributeTargets.Class)]
public class CommandAttribute : Attribute

Digi3D.AI registers each public extension class with this attribute or a derived attribute, such as LocalizableCommandAttribute, as a command. The class must derive from Command and have a public parameterless constructor.

The command name is Name converted to lowercase: command execution in Digi3D.AI is case-insensitive. If a .NET command is already registered with that name, Digi3D.AI keeps the registered command and does not register the new one; LOAD_ASSEMBLY indicates in the results window that the name is already registered. If Name is null, Digi3D.AI does not register the class.

Constructors

public CommandAttribute()

Creates the attribute with all three properties set to null. Assign properties using named argument syntax: [Command(Name = "MI_ORDEN")].

Properties

Property Description
string Name { get; set; } Command name.
string Description { get; set; } Command description. The Search command dialog displays the description when the command is selected and also searches for the entered text in the description.
string HelpUrl { get; set; } Command help page URL. Digi3D.AI does not use it in version 26.0.0.

Example

using Digi21.DigiNG.Plugin.Command;

namespace MideDistancia;

[Command(
    Name = "MIDE_DISTANCIA_2D",
    Description = "Mide la distancia en planta entre dos puntos.",
    HelpUrl = "https://ejemplo.com/ayuda/mide_distancia_2d")]
[RelatedCommand(Name = "MIDE_DISTANCIA")]
public class OrdenMideDistancia2D : Command
{
    public OrdenMideDistancia2D()
    {
        Initialize += (sender, e) => Dispose();
    }
}

The complete command in Command uses [Command(Name = "MIDE_DISTANCIA")].