CadPluginHost
from OpenCAD2D.Plugins import CadPluginHost
class CadPluginHost(System.Object) ยท CadPluginHost in the .NET reference
What a plugin adds to the window in ICadPluginApplication.Initialize: ribbon tabs and panels, Properties rows, DRAWINGS buttons and menu items, canvas menu items and object snaps. It is a registrar and not a window: it keeps the descriptions, and the window reads them from CadPlugin.Host when a plugin is loaded or unloaded and draws them, so a test reads the same lists headless. The Add methods take additions only while Initialize runs.
Properties and fields
CanvasMenus
@property
def CanvasMenus(self) -> System.Collections.Generic.IReadOnlyList[CadCanvasMenuProvider]
Gets the canvas menu providers added, in the order added.
DrawingsButtons
@property
def DrawingsButtons(self) -> System.Collections.Generic.IReadOnlyList[CadPluginButton]
Gets the DRAWINGS buttons added, in the order added.
DrawingsMenus
@property
def DrawingsMenus(self) -> System.Collections.Generic.IReadOnlyList[CadDrawingsMenuProvider]
Gets the DRAWINGS menu providers added, in the order added.
Folder
@property
def Folder(self) -> str | None
Gets the folder the plugin was loaded from, as given and not its shadow copy, where files beside it can be read (Path.Combine(host.Folder, "circle16.png")); the folder of a package the plugin's files were unpacked into; null for a plugin made with CadPlugin.FromAssemblies from assemblies that have no location.
IsEmpty
@property
def IsEmpty(self) -> bool
Gets whether nothing was added.
ObjectSnaps
@property
def ObjectSnaps(self) -> System.Collections.Generic.IReadOnlyList[CadCustomSnap]
Gets the object snaps added, in the order added.
PluginName
@property
def PluginName(self) -> str
Gets the plugin's name.
PropertyProviders
@property
def PropertyProviders(self) -> System.Collections.Generic.IReadOnlyList[CadPropertyProvider]
Gets the Properties providers added, in the order added.
RibbonPanels
@property
def RibbonPanels(self) -> System.Collections.Generic.IReadOnlyList[CadRibbonPanel]
Gets the panels added to the Plugins tab, which shows while a plugin has added a panel, in the order added.
RibbonTabs
@property
def RibbonTabs(self) -> System.Collections.Generic.IReadOnlyList[CadRibbonTab]
Gets the tabs added, in the order added.
ShowsCommandButtons
@property
def ShowsCommandButtons(self) -> bool
@ShowsCommandButtons.setter
def ShowsCommandButtons(self, value: bool) -> None
Gets or sets whether the plugin's commands get a button each: true until set. The presenter no longer has a "Command plugins" panel, so the value changes nothing in it; it is kept for plugins written against it.
Methods
AddCanvasMenu
def AddCanvasMenu(self, provider: CadCanvasMenuProvider) -> None
Adds items to the right-click menu of the canvas for the objects selected, after the extensions' items and before the presenter's own.
AddDrawingsButton
def AddDrawingsButton(self, button: CadPluginButton) -> None
Adds a button to the DRAWINGS header, left of the extensions' buttons and the presenter's Refresh and Open.
AddDrawingsMenu
def AddDrawingsMenu(self, provider: CadDrawingsMenuProvider) -> None
Adds items to the right-click menu of a DRAWINGS row, after a separator, asked each time the menu opens.
AddObjectSnap
def AddObjectSnap(self, snap: CadCustomSnap) -> None
Adds an object snap. A keyword another loaded plugin, or an earlier snap of this one, uses leaves the snap out, with a line in CadPlugin.Problems.
AddProperties
def AddProperties(self, provider: CadPropertyProvider) -> None
Adds a provider of Properties rows, run after the extensions' for every selection, as AutoCAD's dynamic properties are.
AddRibbonPanel
def AddRibbonPanel(self, panel: CadRibbonPanel) -> None
Adds a panel to the Plugins tab, which shows only while a plugin has added a panel.
AddRibbonTab
def AddRibbonTab(self, tab: CadRibbonTab) -> None
Adds a ribbon tab: after the Plugins tab and before Settings, in the order the plugins were loaded. Its panels are read when Initialize returns, so they may be added to it afterwards here. A tab whose id another loaded plugin, or an earlier tab of this one, uses is left out, with a line in CadPlugin.Problems.