Class AddinUserInterface
- Namespace
- Hymma.Solidworks.Addins
- Assembly
- Hymma.Solidworks.Addins.dll
Represents the complete user interface definition for a SolidWorks add-in, including command tabs, property manager pages, and icon storage configuration.
public class AddinUserInterface
- Inheritance
-
AddinUserInterface
- Derived
- Inherited Members
Examples
Creating an AddinUserInterface:
public override AddinUserInterface GetUserInterFace()
{
var iconsPath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
"MyAddinIcons");
return new AddinUserInterface
{
IconsRootDir = new DirectoryInfo(iconsPath),
CommandTabs = new List<AddinCommandTab>
{
new MyCommandTab()
},
PropertyManagerPages = new List<PropertyManagerPageX64>
{
new MyPropertyManagerPage(_solidworks)
}
};
}
Remarks
This class serves as a container for all UI elements that your add-in will register with SolidWorks. It is returned by GetUserInterFace() and processed during add-in initialization.
The IconsRootDir property is required and must point to a writable directory where the framework will store processed icon files.
Properties
CommandTabs
Gets or sets the list of command tabs for this add-in.
public List<AddinCommandTab> CommandTabs { get; set; }
Property Value
- List<AddinCommandTab>
A list of AddinCommandTab instances. Defaults to an empty list.
Examples
CommandTabs = new List<AddinCommandTab>
{
new AddinCommandTab
{
Title = "My Tools",
DocTypes = new[] { swDocumentTypes_e.swDocPART, swDocumentTypes_e.swDocASSEMBLY },
CommandGroup = new MyCommandGroup()
}
};
Remarks
Command tabs appear in the SolidWorks ribbon/toolbar area. Each tab contains one or more command groups, which in turn contain individual command buttons.
Tabs can be configured to appear only in specific document types (parts, assemblies, drawings).
- See Also
IconsRootDir
Gets or sets the root directory where add-in icons will be stored.
public DirectoryInfo IconsRootDir { get; set; }
Property Value
- DirectoryInfo
A DirectoryInfo pointing to a writable directory.
Examples
IconsRootDir = new DirectoryInfo(
Path.Combine(Environment.GetFolderPath(
Environment.SpecialFolder.LocalApplicationData), "MyAddinIcons"));
Remarks
This directory is used by the framework to store processed icon files in various sizes required by SolidWorks. The directory will be created if it doesn't exist.
Recommended location: Use Environment.SpecialFolder.LocalApplicationData
to ensure the add-in has write permissions.
Id
Gets the unique identifier (cookie) assigned to this add-in by SolidWorks.
public int Id { get; }
Property Value
- int
An integer cookie that uniquely identifies this add-in instance within SolidWorks.
Remarks
This value is assigned by SolidWorks during the ConnectToSW call and is used
internally by the framework. You typically don't need to access this directly.
PropertyManagerPages
Gets or sets the list of property manager pages for this add-in.
public List<PropertyManagerPageX64> PropertyManagerPages { get; set; }
Property Value
- List<PropertyManagerPageX64>
A list of PropertyManagerPageX64 instances. Defaults to an empty list.
Examples
PropertyManagerPages = new List<PropertyManagerPageX64>
{
new MyPropertyManagerPage(_solidworks)
};
Remarks
Property manager pages are custom panels that appear in the SolidWorks property manager area (left side panel). They provide a standard way to collect user input and display options for your add-in's features.
- See Also