Record a Basic SOLIDWORKS Macro

Article by Chris Geringer on Jan 17, 2022

Macros are scripts that automate tasks inside of SOLIDWORKS. If you're new to SOLIDWORKS Macros, you may be wondering if you need to understand scripts or know how to write code - the answer is no! There is a handy tool you can use that captures mouse clicks, menu choices, and keystrokes and records them - much like a video. 

How do SOLIDWORKS Macros Work?

To obtain a SOLIDWORKS Macro, all you have to do is click the record button, complete the task you would like to automate in SOLIDWORKS, then click the stop recording button. When you are done recording, the script will automatically be written for you. Save the script file, and you are ready to start using your new macro.

Let’s look at a simple example. We will add the hole in the top of a candlestick.

How to Record a Macro in SOLIDWORKS

Steps for recording a macro:

  1. Click the Record / Pause button on the Macro toolbar.
  2. Perform the tasks in SOLIDWORKS as you would normally.
  3. Click the Stop button on the Macro toolbar.
  4. Save the macro to a location of your choosing.

The Macro toolbar can be accessed from the Tools menu. 

Another quick way to find it is to use the Command search.

Accessing SOLIDWORKS Macro Toolbar

Learn more about Command Search and other tech tips below.

Suggested Article >> Favorite SOLIDWORKS Tips from Tech Support

In this example, the top face of the candlestick was selected before clicking the Record button from the Macro toolbar.

Basic SOLIDWORKS Macro Tutorial

A 30mm circle is sketched on the top of the candlestick and an extrude cut is added. The cut is 25mm deep with a 15° draft.

How to Record a Basic Macro in SOLIDWORKS

After exiting the extrude cut, the Stop Macro button is selected. Select a location to save your new macro, and give it a meaningful name. 

In this example, it was named 30mm Tapered Hole.

Save Recorded Macro in SOLIDWORKS

To see it in action, the bottom of the candlestick is selected, the Run Macro button is picked, and the 30mm Tapered Hole macro is opened from the popup dialog.

Run a SOLIDWORKS Macro

SOLIDWORKS Micro on Candlestick Model

Just that easy, a hole was added to the bottom of the candlestick.

Assign SOLIDWORKS Macro to a button

How to assign a Macro to a button in SOLIDWORKS:

  1. From the Tools menu, select Customize.
  2. Select the Shortcut Bars tab.
  3. Select Macro from the list of Toolbars.
  4. Click and drag the New Macro button from the Customize dialog to the CommandManager or any other toolbar.
  5. Select the three dots on the Macro line of the Customize Macro Button dialog.
  6. Navigate to the saved macro script file
  7. Fill in the Tooltip, Prompt, and Method fields. (All optional)
  8. Assign the icon an image (also optional).

Below is a step-by-step tutorial of these instructions.

From the Tools menu, select Customize.

Assign a Macro Button in SOLIDWORKS

Select the Shortcut Bars tab. Select Macro from the list of toolbars, then click and drag the New Macro button from the customize dialog to the CommandManager or any other toolbar.

Shortcuts Bar Tab in SOLIDWORKS to Add Macro

The Customize Macro Button dialog will pop up. Select the three dots in the Macro line of the dialog to navigate to the script file that was saved.  

Customize Macro Button in SOLIDWORKS

Optionally:  Information can be added to the Method, Tooltip, and Prompt fields of the Customize Macro Button dialog. An image can also be assigned to the button if you choose.

Add Method, Tooltip, and Prompt Fields to Custom SOLIDWORKS Micro Button

Want to learn more about SOLIDWORKS? Check out more tips and tricks below. 

More SOLIDWORKS Tutorials

SOLIDWORKS Weldment Profiles & Weldment Tools Guide

Top 10 SOLIDWORKS Tutorials of 2021

SOLIDWORKS Dialog Box Off Screen Solutions

SOLIDWORKS Mold Tools: Split Line & Parting Line Explained

How to Use Layers in SOLIDWORKS Drawings

VIEW ALL SOLIDWORKS TUTORIALS

 

About Chris Geringer

Chris is a Technical Support Engineer at GoEngineer. When Chris isn't assisting customers, he enjoys biking and volunteering with a group that preserves vintage aircraft.

View all posts by Chris Geringer