Managing SOLIDWORKS Macros Library: Best Practices

Follow the Creating Macro Buttons link to see how to enhance the SOLIDWORKS experience by adding your macro library into the SOLIDWORKS toolbars.

It also introduces new free and open source add-in called MyToolbar which allows adding new customised toolbar into SOLIDWORKS.

Tracking Objects

When developing application which interacts with SOLIDWORKS entities in some cases it is required to reference certain objects and track them during different actions. For example it is required to find the specific feature in the template model or identify the user selected face after the face got modified (split or merged).

There multiple different ways to handle this requirement. The most common approaches are:

  • Persistent Reference Ids
  • Internal Ids
  • Tracking Ids
  • Names
  • Attributes

Refer Tracking Objects article for detailed explanation of all of the above approaches and reference code examples.

Ultimate Guide For Getting Started With Document Manager

Document Manager is powerful stand-alone library supplied by SOLIDWORKS which allows to read and write metadata directly from SOLIDWORKS files stream.


  • Free for customers or SOLIDWORKS partners (research, solution or gold) on subscription
  • Lightweight - library is about 13 MB in size
  • Stand-alone - doesn't require SOLIDWORKS to be installed in order to access the files
  • Quick - data is accessed directly from the stream without the need to load the full file into the memory

Macros Troubleshooting: Issues And Resolutions

SOLIDWORKS macro is the most common way to automate and extended the functionality of SOLIDWORKS via its APIs. Macros can be developed in-house or downloaded from the different web-sites including SOLIDWORKS forum, 3D Content Central, Code Stack etc. or even recorded from SOLIDWORKS.

But in some cases the macro doesn't work as expected. This is usually one of the following scenarios:
  • Macro which used to work correctly before stopped working.
  • Macro works on some of the workstations but not on the others.
  • Macro works correctly for some models but not the others.
In this article I will go through the most common symptoms of the errors in the macros. Click View Solution link to get the detailed description of the issues, its cause and the steps to resolve the problem.

Pass Parameters To VBA Macro

SOLIDWORKS VBA macros do not accept custom parameters as an input so it is not possible to pass user argument to ISldWorks::RunMacro2 method.

This could be a handy feature in cases where the macro is used as the part of bigger automation where multiple macros need to share the same argument (e.g. output location, time stamp, etc.). Or process is started from the server application or via scheduling software which generates the input which needs to be passed to the macro.

Customizing SOLIDWORKS PDM Convert Task

SOLIDWORKS PDM Task is a powerful built-in feature which allows to run custom functionality directly from the context menu in PDM vault or from the workflow state change trigger. The actual work can be performed either on the local machine or on the delegated remote task server.

There are several out-of-the-box tasks provided by SOLIDWORKS PDM

Debugging SOLIDWORKS PDM Add-In - Best Practices

When it comes to debugging of SOLIDWORKS PDM add-ins a lot of developers find this process cumbersome and complicated. This especially applies if you have been developing desktop or SOLIDWORKS applications before and now need to develop PDM add-in.

The main complexity comes from the fact that SOLIDWORKS PDM is a server-client system fully integrated into the Windows explorer process on the client machines. That means that the add-ins (as in-process extensions) are loaded into explorer.exe process. It is important to understand that explorer.exe is not only the process for Windows File Explorer, rather it also manages the start menu, taskbar, desktop, etc. So it is not enough to simply close the Windows File Explorer to unlock the add-in dlls.