SOLIDWORKS allows for the automation of most actions that a user can perform using its open API. These macros can be written in a number of languages, including VBA, VB.Net, and C#. They can then be compiled as a macro file (.swp) or as dll files. There are some great resources in the SOLIDWORKS forums for macro examples. There are also websites dedicated to the teaching of writing them. They are the simplest way to get started with automating SOLIDWORKS. They are generally written to perform a specific action, with minimal error checking logic, assuming the macro user understands the required input, and desired output of the macro.
Macros can be assigned their own toolbar button, or run from the Tools->Macros menu. Generally speaking, they are always run inside the SOLIDWORKS session. Here are some examples of macros the HawkWare team has written:
Automatically Triggering Macros
While macros are generally executed using a macro button or through the menu commands, the HawkWare team created a way to automatically trigger these macros on certain events in SOLIDWORKS, like Open, Save, and Rebuild. These triggers can greatly enhance the usefulness of macros. You can try these triggers out for yourself by downloading our free HawkWare Tools for SOLIDWORKS add-in.
If you need to run a macro against a large number of files, and don’t wish to open each one individually yourself, you can employ the SOLIDWORKS Task Scheduler to perform an “Update” on a group of files. This operation opens each on in SOLIDWORKS and saves. It is intended for upgrading between major released. If your macros are triggered on Open or Save they will be performed automatically.
Our customers have had great success using these together to save significant amounts of time performing repetitive actions.
Do you need a SOLIDWORKS macro written? Contact us to discuss your requirements.