CadPluginIcon
from OpenCAD2D.Plugins import CadPluginIcon
class CadPluginIcon(System.Object) ยท CadPluginIcon in the .NET reference
The picture of a ribbon button or a DRAWINGS button, described without WPF: path data, or the bytes of an image. The bytes are copied in when the icon is made, so that it keeps no stream, no file lock and no reference to the plugin's assembly, which unloading the plugin needs. The window draws it fitted into 32 pixels on a large button and 16 on a standard one; a raster icon of 16 by 16 is drawn as it is on a standard button.
Properties and fields
Image
@property
def Image(self) -> System.Collections.Generic.IReadOnlyList[int] | None
Gets the bytes of an icon made from an image, as they were given; null for path data.
PathData
@property
def PathData(self) -> str | None
Gets the path data of an icon drawn as a path, as WPF writes it ("M5 12 L19 12"), on a square of 24 drawn 2 wide like the presenter's own icons; null for an image.
Methods
FromFile
@staticmethod
def FromFile(path: str) -> CadPluginIcon
Makes an icon from an image file, its bytes read and copied at once, so that the file is not held open and can be deleted or replaced. A plugin names a file beside it with Path.Combine(host.Folder, "circle16.png").
FromImage
@staticmethod
def FromImage(image: Sequence[int] | System.Array[int]) -> CadPluginIcon
Makes an icon from the bytes of an image file: PNG, BMP, JPEG, GIF or ICO. The bytes are copied.
FromPathData
@staticmethod
def FromPathData(pathData: str) -> CadPluginIcon
Makes an icon from path data on a square of 24, drawn 2 wide: FromPathData("M4 12 H20 M12 4 V20") is a plus.
FromResource
@staticmethod
def FromResource(assembly: System.Reflection.Assembly, resourceName: str) -> CadPluginIcon
Makes an icon from an image the assembly embeds, its bytes read and copied at once. The name is the resource's full name, "MyPlugin.circle16.png" for circle16.png of a project whose root namespace is MyPlugin.