CadPluginManifest
from OpenCAD2D.Plugins import CadPluginManifest
class CadPluginManifest(System.Object) ยท CadPluginManifest in the .NET reference
What a plugin says of itself in its plugin.json, read without loading its code (D18 of the plan): { "id": "number-circles", "name": "Number circles", "version": "1.0.0", "author": "Nguyen Thang", "kind": "command", "minimumApiVersion": "1.0", "commands": [ "NUMCIRCLES" ], "icon": "icon.png" } Only the name is needed; the id is the name where not given, the kind "command", the API version 1.0. A command is a name or an object, { "name": "NUMCIRCLES", "alias": "NC", "description": "Numbers the circles", "usesSelection": true } (CadPluginManifest.CommandEntries); a Python tool, whose process the app starts only when a command is used, also declares what it adds to the ribbon: "ribbon": [ { "id": "tools", "title": "Tools", "panels": [ { "title": "Draw", "buttons": [ { "text": "Number", "command": "NUMCIRCLES", "icon": "number.png", "size": "large", "tooltip": "Numbers the circles" } ] } ] } ] (CadPluginManifest.Ribbon), the object snaps it adds, "snaps": [ { "keyword": "CTOP", "name": "Circle top", "entityTypes": [ "CIRCLE" ], "glyph": "quadrant", "onByDefault": true } ] (CadPluginManifest.Snaps), and the settings the user may change, "settings": [ { "name": "textHeight", "label": "Text height", "kind": "number", "default": 2.5, "minimum": 0.1, "maximum": 1000 } ] (CadPluginManifest.Settings).
Properties and fields
CommandKind
CommandKind: ClassVar[str]
The kind of a command plugin, the only kind this presenter loads: "command".
FileName
FileName: ClassVar[str]
The name of the manifest's file: plugin.json.
Author
@property
def Author(self) -> str
Gets the author; empty where not given.
CommandEntries
@property
def CommandEntries(self) -> System.Collections.Generic.IReadOnlyList[CadPluginCommandEntry]
Gets the commands as declared, in the order written: the names of CadPluginManifest.Commands with the alias, the description and whether the command takes the selection, where the manifest gives them.
Commands
@property
def Commands(self) -> System.Collections.Generic.IReadOnlyList[str]
Gets the names of the commands, in capitals, in the order written.
Icon
@property
def Icon(self) -> str | None
Gets the path of the icon, relative to the manifest; null where not given.
Id
@property
def Id(self) -> str
Gets the id, a short name for the plugin; the name where not given.
Kind
@property
def Kind(self) -> str
Gets the kind, in small letters: "command" for a command plugin.
MinimumApiVersion
@property
def MinimumApiVersion(self) -> System.Version
Gets the least version of the plugin API the plugin needs; 1.0 where not given.
Name
@property
def Name(self) -> str
Gets the name, which the Plugin manager shows and PLUGINUNLOAD and PLUGINRELOAD are given.
Ribbon
@property
def Ribbon(self) -> System.Collections.Generic.IReadOnlyList[CadPluginRibbonTabEntry]
Gets the tabs, panels and buttons the plugin declares for the ribbon, in the order written; none where it declares none.
Settings
@property
def Settings(self) -> System.Collections.Generic.IReadOnlyList[CadPluginSettingEntry]
Gets the settings a Python tool declares, in the order written; none where it declares none. A C# plugin's settings are declared in its code with CadSettingAttribute, and this list is ignored for it.
Snaps
@property
def Snaps(self) -> System.Collections.Generic.IReadOnlyList[CadPluginSnapEntry]
Gets the object snaps a Python tool declares, in the order written; none where it declares none. A snap with no keyword or no name is passed over.
Version
@property
def Version(self) -> str
Gets the plugin's version, as written; empty where not given.
Methods
Parse
@staticmethod
def Parse(json: str) -> CadPluginManifest
Reads a manifest from its JSON text.
Read
@staticmethod
def Read(path: str) -> CadPluginManifest
Reads a manifest from a plugin.json file, without loading any code.
Refusal
def Refusal(self) -> str
Says why the presenter does not load the plugin, or null where it may: a kind other than "command", or a newer version of the plugin API than CadPlugin.ApiVersion.
ToString
def ToString(self) -> str