Easiest way to automate SolidWorks is with SolidWorks Macro Feature. Macro toolbar can record steps in SolidWorks and save Macro file in different file format based on Supported programming languages by SolidWorks API. You can quickly run these saved recorded Macro files and perform recorded steps.
# Macro Toolbar:
When you open SolidWorks , Go to Tools > Macro.
Here you will find Macro Toolbar options.
You can also turn on Macro Toolbar by right clicking on command manager or menu section inside SolidWorks and then select ‘Macro’ Toolbar option
#How to Record SolidWorks Macro?
Click on record button on Macro Toolbar. Now every action and click will be recorded as macro code in Macro file.
We will create simple macro which will open Part file in SolidWorks.
Follow these steps:
1. Click on Record button on Macro Toolbar
2. Go to File > New > Select Part template > Ok
3. Click on ‘Stop Macro’ button
4. on ‘Save As’ file dialog > Save as type ‘SW VBA Macros (.swp)’ > click ‘Save’
.swp file format is for SolidWorks Macro saved with VBA language. We will see other save as types in later posts.
# Run Macro:
Before running macro close Part file created while recording macro.
1. Click on Run button on Macro Toolbar.
2. Select saved macro file, Change file type to ‘SW VBA Macros (.swp)’ >click Open
A Part file will open in SolidWorks.
Hence, We have successfully Recorded and Run Macro file which will open part file in SolidWorks.
Simple, isn’t it?