SOLIDWORKS CAD Add-In Development is a development Claude Skill built by Zach. Best for: CAD developers and automation engineers build SOLIDWORKS add-ins that extend the native application with custom commands, toolbars, and task panes..
Create COM-registered SOLIDWORKS desktop add-ins using ISwAddin, CommandManager UI, lifecycle callbacks, and toolbar integration with C#/VB.NET.
name: solidworks-cad-addin-iswaddin description: Create a SOLIDWORKS (CAD) desktop add-in using the SOLIDWORKS API SDK templates or by implementing ISwAddin/SwAddin manually; includes COM/registry registration, ConnectToSW/DisconnectFromSW lifecycle, CommandManager UI, callbacks, icons, and toolbar considerations. version: 1.0.0 tags:
Use when you need to create a SOLIDWORKS desktop add-in (loaded by SOLIDWORKS itself; not a PDM vault add-in), implemented as a COM-visible DLL that SOLIDWORKS loads via ISwAddin.
SolidWorks.Interop.swpublished.ISwAddin (ConnectToSW, DisconnectFromSW)Follow the “Create Task Pane View Add-in Example (C#)” prerequisites:
SOLIDWORKS API SDK.msi from the SOLIDWORKS installation’s apisdk folder):Use the SOLIDWORKS API SDK add-in template:
SwCSharpAddin (C#) or SwVBAddin (VB.NET) per:In your main add-in class (commonly SwAddin):
[ComVisible(true)][Guid("...")] (new GUID per add-in)[SwAddin(Description=..., Title=..., LoadAtStartup=...)] is present (as shown in the C# TaskPaneView example):SOLIDWORKS add-ins must be registered as COM servers and then listed under the SOLIDWORKS add-in registry key (see “Using SwAddin to Create a SOLIDWORKS Add-In”):
Regsvr32.exe (unmanaged C++ and managed C++/CLI add-ins)RegAsm.exe (C# and VB.NET add-ins)For .NET add-ins, use [ComRegisterFunction] / [ComUnregisterFunction] to create/remove the keys (the TaskPaneView example shows exactly what SOLIDWORKS expects):
HKEY_LOCAL_MACHINE\SOFTWARE\SolidWorks\Addins\{GUID}
0 (or 1 to enable in Add-in Manager per SwAddin doc)Description: string (shown in Add-in Manager)Title: string (shown in Add-in Manager)HKEY_CURRENT_USER\Software\SolidWorks\AddInsStartup\{GUID}
0/1 controlling load-at-startup (LoadAtStartup)Reference code pattern (from the TaskPaneView add-in example): https://help.solidworks.com/2025/english/api/sldworksapi/Create_TaskPaneView_Add-in_Example_CSharp.htm
Important: writing HKLM requires elevated permissions on Windows; plan your install story accordingly (admin install or installer writes keys).
Implement:
bool ConnectToSW(object ThisSW, int Cookie) (called when the add-in is loaded)bool DisconnectFromSW() (called when SOLIDWORKS is closing or the add-in is disabled)In ConnectToSW, the SwAddin manual notes you can call:
ISldWorks::SetAddinCallbackInfo (SOLIDWORKS “holds onto this object and makes callbacks”)ISldWorks::AddMenuItem3ISldWorks::AddToolbar4The C# TaskPaneView example shows calling:
iSwApp.SetAddinCallbackInfo(0, this, addinID);Use:
ISldWorks::GetCommandManager to get the one ICommandManager instanceICommandGroups via ICommandManager::CreateCommandGroupICommandGroup::AddCommandItem2ICommandGroup::ActivateThis is covered in: https://help.solidworks.com/2025/English/api/sldworksapiprogguide/Overview/CommandManager_and_CommandGroups.htm?id=e695b1d69d874993be07528d907b2e75
Your menu/toolbar command callbacks and enable methods must use one of the supported signatures:
string parameter (supported in SOLIDWORKS 2012 SP0+)SOLIDWORKS Add-in Manager shows an icon next to your add-in name, and supports scaled icons (as of SOLIDWORKS 2022). The docs describe:
The Add-in Icons doc references scaled sizes (example set): 16, 20, 32, 40, 64, 96, 128 (e.g., MySwAddin_20.png, MySwAddin_40.png, etc.).
If you don’t place icons beside the DLL, the doc describes setting an Icon value under the add-in registry key (e.g., HKEY_LOCAL_MACHINE\SOFTWARE\SOLIDWORKS\AddIns\{CLSID}\Icon), with version-specific variants:
https://help.solidworks.com/2025/English/api/sldworksapiprogguide/Overview/Add-in_Icons.htm
The toolbar docs explain:
The CommandManager doc calls out where toolbar definitions live and how to remove them, e.g.:
HKEY_CURRENT_USER\Software\SOLIDWORKS\SOLIDWORKS <version>\User Interface\Custom API Toolbars\<index>HKEY_CURRENT_USER\Software\SOLIDWORKS\SOLIDWORKS <version>\User Interface\Toolbars\...If you need a deployable installer, follow: https://help.solidworks.com/2025/english/api/sldworksapiprogguide/Miscellaneous/Create_Setup_Project_to_Distribute_SolidWorks_Add-in.htm?format=P&value=
regasm /codebase-style workflows or installer; for unmanaged, regsvr32).HKLM\SOFTWARE\SolidWorks\Addins\{GUID}HKCU\Software\SolidWorks\AddInsStartup\{GUID}sldworks.exe, set breakpoints in ConnectToSW and your command callbacks./plugin install solidworks-cad-add-in-development@kilwizacRequires Claude Code CLI.
CAD developers and automation engineers build SOLIDWORKS add-ins that extend the native application with custom commands, toolbars, and task panes.
No reviews yet. Be the first to review this skill.