Ever thought “I wish there was quicker way of doing this”? Well, SolidWorks has a great capability to create custom macros. SolidWorks macros can add value to your CAD implementation by automating workflows, removing repetitive tasks, combining commands, or even creating new functionality.
There are a number of great resources for SolidWorks macros. Whether you are new to macro writing, or an experienced coder, the user forums https://forum.solidworks.com are invaluable for sharing experiences; user-run websites such as www.cadsharp.com are an excellent resource for learning the SolidWorks API; and www.3dcontentcentral.com which has an area for downloading macros shared by other SolidWorks users. Don’t forget, Solid Applications also provide consultancy services for macro writing, or training services for the SolidWorks API course.
I recently created a simple macro for a customer. He was selecting components in a long assembly tree and need to know how many items were selected. After creating a simple macro that gave a count of the number of selected components, I wanted to make this quickly accessible in the SolidWorks user interface. This is easily done using the Customize dialog; here’s how.
Go to Tools > Customize…; select the Commands tab on the Customize window, and then select Macros from the Categories list.
Drag and drop the ‘New Macro Button’ on to your tool bar.
The customize macro button box will appear. Click on the browse button (…) and locate the macro (xxxx.swp) in the folder it was saved to. Select it and click Open.
To change the icon, click on the Choose Image… button and select the Bitmap file if provided. You can change the tool tip text to something more useful. Click OK to finish, and click OK on the Customize window.
Run the macro to test it.
Hope you found this tip useful. More tips next time from the SolidApps team.