Macro Library

All macros have been stored in zip files due to file extension conflicts inside web browsers with Flash.

View All Macros in a list page

Part Macros

CG - Creates a 3D sketch point at the center of gravity of a part. (Chen Gingold, edited by Matt Lombard)

Close Feature Manager - Toggles the Feature Manager open and closed. (Eric Franco, John Gigl of SolidWorks)

reset ALL configs.swp - In this macro, I attack an annoyance that SW created recently where configuration names include the Document Name in brackets by default behind the actual configuration name. This macro processes all configurations within a part or assy to turn off the setting that shows [Document Name]. (Steve Lauer)

Delete Planes - Traverses your part and deletes any planes that have no dependent features (Chen Gingold)

eqcurve - input an equation (quadratic or periodic functions) and SW creates a spline curve (Matt Lombard)

Face Color - Removes all face colors and changes them back to the model color. Great for use with "moldability" macro. (Joe Jones of NH CAD)

Feature Color - Removes all feature colors and changes them back to the model color. (Joe Jones of NH CAD, adapted by Matt Lombard)

HLR Search - Changes the HLR setting of all the parts in a selected directory to "HLR Same Color as Shaded".  This is a Zip file which includes VB6 source code and executable. (Matt Lombard)

IsoViews - Creates 3 additional Isometric views in parts and assemblies. (Mark Reimer)

make_4new_ISOs.zip & make_8new_ISOs.zip - As their names suggest, these macros create new ISO views - either 4 top ISO's or 4 top & 4 bottom ISO's. These macros are unique from others I have tried in that they will not give poor results if the default views have been changed. Also, I have not seen any macros like this that would give an ISO from below (bottom ISO).  (Steve Lauer)

Point Cloud - Takes a list of XYZ data and makes points in a 3D sketch.  Includes a sample data file. (Jim Sculley, edited by Matt Lombard)

Random Color - Assigns a random color to the current part.

Split Feature Manager - Toggles the Feature Manager as 1 or 2 panes. (Matt Lombard)

Toggle Centerpoint Display - Toggles centerpoint display for sketches.  (Heikki Leiko)

Zoom 1 to 1 - Edit a constant in the macro to size your monitor in pixels, and this will show the part 1:1 on your screen. (Joe Jones of NH CAD)

Sketch Relation Macros: Preselect appropriate sketch entities and hit a hot key.

Coincident    Concentric         Colinear
Horizontal   Vertical             Tangent

Parallel        Perpendicular    Midpoint

Symmetric    Equal

 
 

Assembly Macros

Colorize - Traverses one level deep into assembly and turns parts random colors. (Kevin Silbert)

Fix and colorize - Fixes all parts in an assembly plus function of Colorize above. Great for use with imported assemblies. (Kevin Silbert)

Transparency On Macro - Executable - Select a part in the assembly and run the macro. Sets the transparency to a value you can change in the macro. For this one, a macro is provided to run an executable. Please download both files. No source code is available for the exe, however the macro shows you how to launch an executable from a macro. You will need to edit the macro to point to the path of the executable. (John Gigl of SolidWorks)

Transparency Off Macro - Executable - You need these two to turn the transparency off. For some reason it is not just a toggle with one macro.

Assembly Mate Macros: Preselect appropriate faces in an assembly and hit a hot key.

Coincident   Concentric
Parallel       Perpendicular    Tangent

Distance     Angle

Note: Angle defaults to 60 deg and Distance defaults to 1" (both defaults can be set within the macro, but remember to use radians and meters!)
 

Drawing Macros

1 Less Place - Removes one decimal place from the currently selected dimension (Jim Sculley)

1 More Place - Adds one decimal place to the currently selected dimension (Jim Sculley)

1_place - Changes selected dim to one decimal place (single or multiple dim preselected) (Sean Adams of Burleigh Instruments)

2_place - You figure it out...

3_place - Got it yet?

4_place - works nicely.

All Caps - Changes either all notes or selected notes on a drawing to all caps.

BomBalloon - Creates a note which includes Item #, Qty, Part Number and Description. Requires preselected component and a BOM on the active sheet. Has some limitations regarding active assembly configurations. (Matt Lombard, Sean Adams, Dave Clapper, Jim Sculley, Malcolm Stevens, SW API Tech Support, my Third Grade teacher Ms. Sorensen and Aunt Millie.)

Date - Will update a custom property called "date" in a drawing to the current date. (Joe Jones of NH CAD)
 
 

How to link macros to hotkeys:

Macros should be put in a folder called "Macros" directly under your SolidWorks installation directory. If SW is running when you move the macros, shut down and restart SW. Go to Tools/Customize/Keyboard, scroll to the bottom of the Categories window and select Macros. All the macros in the Macros directory will show up in the window on the right. You can now assign hotkeys to the macros just like other functions in SW.

As a hint, you may find it is useful to create an Excel spreadsheet of all the hotkeys. If you forget what is assigned to what, it may be tedious to recover that information.
 
 

How to start an executable with a macro:

Create a macro using the following code, substituting the path of your executable.

Sub main()
retval = Shell("c:\macros\executable.exe", 1)

End Sub