Skip to content
solidworks-cad-addin-iswaddin logo

Solidworks Cad Addin Iswaddin

solidworks-cad-addin-iswaddin

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.

SKILL.md

Full skill instructions

SOLIDWORKS CAD add-in (ISwAddin) — create, register, and wire UI

When to use this skill

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.

What you should produce (outputs)

  • A C# (or VB.NET / C++/​CLI / C++) add-in project that:
    • Implements SolidWorks.Interop.swpublished.ISwAddin (ConnectToSW, DisconnectFromSW)
    • Registers itself so it appears in Tools > Add-ins...
    • Adds at least one command (menu/​toolbar/​CommandManager) with correct callback/​enable signatures
    • Has proper icons (including scaled icons if using .NET templates)

Authoritative documentation (SOLIDWORKS 2025)


Step-by-step: create the project (recommended: .NET template)

0) Install the SOLIDWORKS API SDK templates

Follow the “Create Task Pane View Add-in Example (C#)” prerequisites:

1) Create a new add-in project in Visual Studio

Use the SOLIDWORKS API SDK add-in template:

2) Ensure COM visibility + identity

In your main add-in class (commonly SwAddin):

3) Implement COM registration that SOLIDWORKS uses to find your add-in

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”):

For .NET add-ins, use [ComRegisterFunction] / [ComUnregisterFunction] to create/​remove the keys (the TaskPaneView example shows exactly what SOLIDWORKS expects):

  • HKLM: HKEY_LOCAL_MACHINE\SOFTWARE\SolidWorks\Addins\{GUID}
    • Default value: 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)
  • HKCU: HKEY_CURRENT_USER\Software\SolidWorks\AddInsStartup\{GUID}
    • Default value: DWORD 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).

4) Implement ISwAddin lifecycle correctly

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:

The C# TaskPaneView example shows calling:

5) Add UI: CommandManager + CommandGroups (recommended pattern)

Use:

  • ISldWorks::GetCommandManager to get the one ICommandManager instance
  • Create one or more ICommandGroups via ICommandManager::CreateCommandGroup
  • Add commands via ICommandGroup::AddCommandItem2
  • Activate via ICommandGroup::Activate

This is covered in: https://help.solidworks.com/2025/English/api/sldworksapiprogguide/Overview/CommandManager_and_CommandGroups.htm?id=e695b1d69d874993be07528d907b2e75

Callback + enable method signatures (critical)

Your menu/​toolbar command callbacks and enable methods must use one of the supported signatures:

6) Icons: provide scaled icons (especially for .NET templates)

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

7) Toolbars: handle toolbar IDs during development vs release

The toolbar docs explain:

The CommandManager doc calls out where toolbar definitions live and how to remove them, e.g.:


Packaging/​deployment (Windows Installer)

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=


Debug checklist (pragmatic)

  1. Confirm COM registration succeeds (for .NET, regasm /​codebase-style workflows or installer; for unmanaged, regsvr32).
  2. Confirm registry keys exist:
    • HKLM\SOFTWARE\SolidWorks\Addins\{GUID}
    • HKCU\Software\SolidWorks\AddInsStartup\{GUID}
  3. Start SOLIDWORKS → Tools > Add-ins... and confirm:
    • Add-in appears with correct Title/​Description
    • Load-at-startup behavior matches expectation
  4. Attach debugger to sldworks.exe, set breakpoints in ConnectToSW and your command callbacks.
  5. If UI commands don’t show, verify CommandGroup IDs/​activation logic per CommandManager guide, and reset toolbar registry entries during development as needed.

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View