# Macro Library

**URL:** https://forum.cadmunity.com/c/solidworks/macro-library/15.md

[Latest](https://forum.cadmunity.com/latest.md) · [Categories](https://forum.cadmunity.com/categories.md) · [Tags](https://forum.cadmunity.com/tags.md)

---

## [About the Macro Library category](https://forum.cadmunity.com/t/about-the-macro-library-category/18)

<div class="topic-metadata">

**Author:** [@system](https://forum.cadmunity.com/u/system)\
**Replies:** 0\
**Last updated:** [March 12, 2021, 11:35pm UTC](https://forum.cadmunity.com/t/about-the-macro-library-category/18 "2021-03-12T23:35:55Z")

</div>

Library for macros

---

## [ComponentTree Macro for generate consolidated Bill of Materials (BOM)](https://forum.cadmunity.com/t/componenttree-macro-for-generate-consolidated-bill-of-materials-bom/6424)

<div class="topic-metadata">

**Author:** [@Jtok](https://forum.cadmunity.com/u/Jtok)\
**Replies:** 2\
**Last updated:** [September 11, 2026, 8:52am UTC](https://forum.cadmunity.com/t/componenttree-macro-for-generate-consolidated-bill-of-materials-bom/6424 "2026-09-11T08:52:04Z")

</div>

Generates a consolidated Bill of Materials (BOM) in Excel based on the currently open assembly. Weldment and sheet metal parts that contain cut lists and consist of multiple bodies are treated as assemblies. Data is po…

---

## [Macro pair to toggle from selecting template to using default template](https://forum.cadmunity.com/t/macro-pair-to-toggle-from-selecting-template-to-using-default-template/6310)

<div class="topic-metadata">

**Author:** [@CarrieIves](https://forum.cadmunity.com/u/CarrieIves)\
**Replies:** 0\
**Last updated:** [June 3, 2026, 3:09pm UTC](https://forum.cadmunity.com/t/macro-pair-to-toggle-from-selecting-template-to-using-default-template/6310 "2026-06-03T15:09:40Z")

</div>

DefaultTemplates.swp sets your preferences to use default templates when creating new files. SelectTemplate.swp sets your preferences to ask which template to use when creating new files. There is no feedback that the …

---

## [SolidWorks Description Macros](https://forum.cadmunity.com/t/solidworks-description-macros/6307)

<div class="topic-metadata">

**Author:** [@DavidWS](https://forum.cadmunity.com/u/DavidWS)\
**Replies:** 2\
**Last updated:** [June 1, 2026, 8:51pm UTC](https://forum.cadmunity.com/t/solidworks-description-macros/6307 "2026-06-01T20:51:17Z")

</div>

I (coded by ChatGPT) made a couple macros that help people understand what the models/drawings are from Windows explorer: SaveAs PDF2 saves the drawing as a PDF as the filename of the drawing, concatenates revision to…

---

## [Clean up macro idea](https://forum.cadmunity.com/t/clean-up-macro-idea/6236)

<div class="topic-metadata">

**Author:** [@Monstrum\_Mathias](https://forum.cadmunity.com/u/Monstrum_Mathias)\
**Replies:** 5\
**Last updated:** [April 29, 2026, 1:33pm UTC](https://forum.cadmunity.com/t/clean-up-macro-idea/6236 "2026-04-29T13:33:25Z")

</div>

Hi you brilliant folks. I’m wondering if there perhaps exists a macro out there that could help in cleaning up multi body parts. In our workflow before exporting to CNC it would be helpful to eliminate small bodies that…

---

## [Revision control app macro (release)](https://forum.cadmunity.com/t/revision-control-app-macro-release/1557)

<div class="topic-metadata">

**Author:** [@laukejas](https://forum.cadmunity.com/u/laukejas)\
**Replies:** 90\
**Last updated:** [March 9, 2026, 1:04pm UTC](https://forum.cadmunity.com/t/revision-control-app-macro-release/1557 "2026-03-09T13:04:05Z")

</div>

Hi, Like many of you, I use SOLIDWORKS at home for my personal projects. Since I don’t have PDM, and 3DEXPERIENCE is still a mess, I decided to throw together a very simple revision control app (macro). Took me a grand …

---

## [Macro: Process Drawing](https://forum.cadmunity.com/t/macro-process-drawing/6173)

<div class="topic-metadata">

**Author:** [@SPerman](https://forum.cadmunity.com/u/SPerman)\
**Replies:** 2\
**Last updated:** [February 11, 2026, 6:32pm UTC](https://forum.cadmunity.com/t/macro-process-drawing/6173 "2026-02-11T18:32:24Z")

</div>

This macro creates a PDF of any sheets that don’t have “DXF” in the name. It then produces a DXF of a sheet with “DXF” in the name. (If you have multiple DXF sheets, it will overwrite all but the last. My drawings onl…

---

## [Sequential ID Tags](https://forum.cadmunity.com/t/sequential-id-tags/6147)

<div class="topic-metadata">

**Author:** [@ddemar5651](https://forum.cadmunity.com/u/ddemar5651)\
**Replies:** 5\
**Last updated:** [January 29, 2026, 2:43pm UTC](https://forum.cadmunity.com/t/sequential-id-tags/6147 "2026-01-29T14:43:52Z")

</div>

Hello all, The company I work for places ID tags on one of the components in our product. In the past ID tags have been purchased from a vendor that would stamp numbers on a .5” x 1” piece of 18ga (.047”) sheet metal. T…

---

## [Select and Count Dangling Annotations](https://forum.cadmunity.com/t/select-and-count-dangling-annotations/6042)

<div class="topic-metadata">

**Author:** [@gupta9665](https://forum.cadmunity.com/u/gupta9665)\
**Replies:** 15\
**Last updated:** [December 18, 2025, 4:53pm UTC](https://forum.cadmunity.com/t/select-and-count-dangling-annotations/6042 "2025-12-18T16:53:28Z")

</div>

This macro quickly check all the annotations on the active drawing sheet, automatically identifies the dangling ones, selects them, and provides a count of how many of them were found. This small macro can be a big time-…

---

## [Fillet Feature Description (macro request)](https://forum.cadmunity.com/t/fillet-feature-description-macro-request/3169)

<div class="topic-metadata">

**Author:** [@dave.laban](https://forum.cadmunity.com/u/dave.laban)\
**Replies:** 4\
**Last updated:** [December 17, 2025, 8:22am UTC](https://forum.cadmunity.com/t/fillet-feature-description-macro-request/3169 "2025-12-17T08:22:50Z")

</div>

Hi all, Tried searching all the usual places for a macro that does this but no luck. I’d like a macro please that scans through a Part feature tree, identifies all Fillet features (only needs to be constant radius fill…

---

## [Delete ghost cutlist folders that prevent renaming](https://forum.cadmunity.com/t/delete-ghost-cutlist-folders-that-prevent-renaming/6023)

<div class="topic-metadata">

**Author:** [@mp3-250](https://forum.cadmunity.com/u/mp3-250)\
**Replies:** 2\
**Last updated:** [November 10, 2025, 2:47pm UTC](https://forum.cadmunity.com/t/delete-ghost-cutlist-folders-that-prevent-renaming/6023 "2025-11-10T14:47:44Z")

</div>

Sometimes editing weldments cutlists causes some deleted folder to become invisible and their folder name cannot be used to rename the other cutlist folders, since it is already in use. One reddit user posted the macro …

---

## [Macro: Delete Empty Sheet(s)](https://forum.cadmunity.com/t/macro-delete-empty-sheet-s/3280)

<div class="topic-metadata">

**Author:** [@gupta9665](https://forum.cadmunity.com/u/gupta9665)\
**Replies:** 3\
**Last updated:** [November 6, 2025, 3:56pm UTC](https://forum.cadmunity.com/t/macro-delete-empty-sheet-s/3280 "2025-11-06T15:56:25Z")

</div>

Here’s another SOLIDWORKS #macro requested by the #community. This macro deletes empty sheets from the currently active drawing. There are two versions available: V1 deletes all sheets that have no views but keeps she…

---

## [Batch Export as STEP (Parts Only)](https://forum.cadmunity.com/t/batch-export-as-step-parts-only/554)

<div class="topic-metadata">

**Author:** [@gupta9665](https://forum.cadmunity.com/u/gupta9665)\
**Replies:** 8\
**Last updated:** [October 14, 2025, 1:12pm UTC](https://forum.cadmunity.com/t/batch-export-as-step-parts-only/554 "2025-10-14T13:12:35Z")

</div>

Here is a macro to batch export all parts in selected folder as STEP file which will be saved in the same folder. UU Batch Export STEP File (Parts)-2019.zip (10.8 KB) Macro libraries are set to SW2019 version. In c…

---

## [Macro for calc all components count in assembly](https://forum.cadmunity.com/t/macro-for-calc-all-components-count-in-assembly/5940)

<div class="topic-metadata">

**Author:** [@Jtok](https://forum.cadmunity.com/u/Jtok)\
**Replies:** 5\
**Last updated:** [October 6, 2025, 5:55pm UTC](https://forum.cadmunity.com/t/macro-for-calc-all-components-count-in-assembly/5940 "2025-10-06T17:55:29Z")

</div>

Hi all This macro for calc quantity all component count (in all assembly and subassembly of current assembly) and write count value in User defined Custom Property part or assembly. User can export list in Not…

---

## [SaveAsPDF](https://forum.cadmunity.com/t/saveaspdf/5921)

<div class="topic-metadata">

**Author:** [@Jtok](https://forum.cadmunity.com/u/Jtok)\
**Replies:** 1\
**Last updated:** [September 26, 2025, 2:43pm UTC](https://forum.cadmunity.com/t/saveaspdf/5921 "2025-09-26T14:43:19Z")

</div>

Hi all Upload my macro for export all drawings from slddrw to one pdf as same folder and name. I use this macro every day, its very good tools for me. SaveAsPDF.zip (26.6 KB)

---

## [Create temporary "ghosts" in parts](https://forum.cadmunity.com/t/create-temporary-ghosts-in-parts/5893)

<div class="topic-metadata">

**Author:** [@josh](https://forum.cadmunity.com/u/josh)\
**Replies:** 16\
**Last updated:** [September 25, 2025, 5:40pm UTC](https://forum.cadmunity.com/t/create-temporary-ghosts-in-parts/5893 "2025-09-25T17:40:34Z")

</div>

Inspired by a Top Ten post from @RickB , here’s a neat little macro that will create a transparent copy of all the bodies as currently shown in a part model, at any time. These copies persist until you hit “Destroy gho…

---

## [Qr code generator for solidworks drawing](https://forum.cadmunity.com/t/qr-code-generator-for-solidworks-drawing/2665)

<div class="topic-metadata">

**Author:** [@Omur\_Tokman](https://forum.cadmunity.com/u/Omur_Tokman)\
**Replies:** 48\
**Last updated:** [September 25, 2025, 3:01pm UTC](https://forum.cadmunity.com/t/qr-code-generator-for-solidworks-drawing/2665 "2025-09-25T15:01:17Z")

</div>

Hello everybody, This is the macro I’ve been wanting to make for a while. First of all, I would like to remind you! I am not a programmer, the macro I made is to meet my needs. And it works well enough to meet my needs…

---

## [John Stoltzfus Macro Collection](https://forum.cadmunity.com/t/john-stoltzfus-macro-collection/5892)

<div class="topic-metadata">

**Author:** [@SPerman](https://forum.cadmunity.com/u/SPerman)\
**Replies:** 2\
**Last updated:** [September 14, 2025, 5:15pm UTC](https://forum.cadmunity.com/t/john-stoltzfus-macro-collection/5892 "2025-09-14T17:15:31Z")

</div>

This is a bunch of macros I’ve collected. The majority of them was shared with me by John Stoltzfus. It isn’t well organized, and I’m sure there’s a good bit of junk in there. I think some of the macros were written b…

---

## [Cut Plan Macro](https://forum.cadmunity.com/t/cut-plan-macro/5827)

<div class="topic-metadata">

**Author:** [@Bryan\_O](https://forum.cadmunity.com/u/Bryan_O)\
**Replies:** 19\
**Last updated:** [September 14, 2025, 3:27am UTC](https://forum.cadmunity.com/t/cut-plan-macro/5827 "2025-09-14T03:27:55Z")

</div>

We build cabinets. Our Assemblies are NOT weldments. Our CNC programmers make spread sheets their cut plans manually. They were wondering if there was a macro that could be run on a cabinet assembly that would: List …

---

## [Macro for group (grid view) editing Custom Properties in assembly](https://forum.cadmunity.com/t/macro-for-group-grid-view-editing-custom-properties-in-assembly/5837)

<div class="topic-metadata">

**Author:** [@Jtok](https://forum.cadmunity.com/u/Jtok)\
**Replies:** 3\
**Last updated:** [August 18, 2025, 2:00pm UTC](https://forum.cadmunity.com/t/macro-for-group-grid-view-editing-custom-properties-in-assembly/5837 "2025-08-18T14:00:58Z")

</div>

Hi I wrote macro for group editing of user properties. I was trying to find some free custom property editor that would display a grid and allow editing all the custom properties of each file in the assembly tree. So …

---

## [Split macro](https://forum.cadmunity.com/t/split-macro/3296)

<div class="topic-metadata">

**Author:** [@Monstrum\_Mathias](https://forum.cadmunity.com/u/Monstrum_Mathias)\
**Replies:** 14\
**Last updated:** [August 14, 2025, 8:10am UTC](https://forum.cadmunity.com/t/split-macro/3296 "2025-08-14T08:10:49Z")

</div>

Hi all. I’ve been struggling with a library feature for some time now that can split 80mm, 120mm, 160mm, 200mm etc shapes in to 40mm thick bodies we feed to a router. They need to be precisely 40mm for the nesting progr…

---

## [SW variable to turn off display of configuration name](https://forum.cadmunity.com/t/sw-variable-to-turn-off-display-of-configuration-name/5793)

<div class="topic-metadata">

**Author:** [@Uncle\_Hairball](https://forum.cadmunity.com/u/Uncle_Hairball)\
**Replies:** 4\
**Last updated:** [August 7, 2025, 5:06pm UTC](https://forum.cadmunity.com/t/sw-variable-to-turn-off-display-of-configuration-name/5793 "2025-08-07T17:06:28Z")

</div>

I’ve got a macro using the variable swFeatMgr.ShowDisplayStateNames, that I use to turn off display of display states in the Feature Manager and it works perfectly. Is there a similar variable that I could use to turn o…

---

## [Adding quantity and thickness to the name while saving the file](https://forum.cadmunity.com/t/adding-quantity-and-thickness-to-the-name-while-saving-the-file/817)

<div class="topic-metadata">

**Author:** [@Omur\_Tokman](https://forum.cadmunity.com/u/Omur_Tokman)\
**Replies:** 23\
**Last updated:** [August 6, 2025, 4:24pm UTC](https://forum.cadmunity.com/t/adding-quantity-and-thickness-to-the-name-while-saving-the-file/817 "2025-08-06T16:24:36Z")

</div>

Hello there, The macro below is artem’s This macro saves the sheet metal products in the assembly flat in a folder. I want to add sheet thickness and quantity to the file name you saved, I’ve been trying for about 4 d…

---

## [Reset Light Sources](https://forum.cadmunity.com/t/reset-light-sources/2768)

<div class="topic-metadata">

**Author:** [@Stefan\_Sterk](https://forum.cadmunity.com/u/Stefan_Sterk)\
**Replies:** 23\
**Last updated:** [June 5, 2025, 6:29pm UTC](https://forum.cadmunity.com/t/reset-light-sources/2768 "2025-06-05T18:29:13Z")

</div>

Here is a simple macro which gives you the power to easily reset your light sources within a SOLIDWORKS Part or Assembly model by deleting the current light sources and adding back the ‘default’ (user specified) light so…

---

## [My Macros](https://forum.cadmunity.com/t/my-macros/137)

<div class="topic-metadata">

**Author:** [@mattpeneguy](https://forum.cadmunity.com/u/mattpeneguy)\
**Replies:** 21\
**Last updated:** [June 3, 2025, 8:02am UTC](https://forum.cadmunity.com/t/my-macros/137 "2025-06-03T08:02:26Z")

</div>

Before anyone tries any of my macros, have a look over at https://www.codestack.net/solidworks-tools/ and see if there’s a similar macro, if so use the one from the above site before you try mine. Those macros were made…

---

## [Creat a Macro to Add colors to each feature in a a part](https://forum.cadmunity.com/t/creat-a-macro-to-add-colors-to-each-feature-in-a-a-part/2769)

<div class="topic-metadata">

**Author:** [@Craig\_Makarowski](https://forum.cadmunity.com/u/Craig_Makarowski)\
**Replies:** 5\
**Last updated:** [May 13, 2025, 9:16pm UTC](https://forum.cadmunity.com/t/creat-a-macro-to-add-colors-to-each-feature-in-a-a-part/2769 "2025-05-13T21:16:10Z")

</div>

Hi All I 'm not sure where to look on how to Add a unique color to each Feature in a part, the reason is that when i export the part to Unreal it would then allow me to assign Unreal texture a lot more easier, This would…

---

## [Using SOLIDWORKS APIs with SOLIDWORKS Connected/3D Experience](https://forum.cadmunity.com/t/using-solidworks-apis-with-solidworks-connected-3d-experience/5439)

<div class="topic-metadata">

**Author:** [@dhruvbppmfg](https://forum.cadmunity.com/u/dhruvbppmfg)\
**Replies:** 1\
**Last updated:** [May 9, 2025, 9:14pm UTC](https://forum.cadmunity.com/t/using-solidworks-apis-with-solidworks-connected-3d-experience/5439 "2025-05-09T21:14:33Z")

</div>

Hello everyone, This is my second post. Thank you all for guiding me to learn more about SolidWorks macros. After multiple research, I found the following codes for 3D Experience. SOLIDWORKS Connected macros Example …

---

## [(re)Sharing my macros](https://forum.cadmunity.com/t/re-sharing-my-macros/3352)

<div class="topic-metadata">

**Author:** [@Monstrum\_Mathias](https://forum.cadmunity.com/u/Monstrum_Mathias)\
**Replies:** 0\
**Last updated:** [December 4, 2024, 9:14am UTC](https://forum.cadmunity.com/t/re-sharing-my-macros/3352 "2024-12-04T09:14:19Z")

</div>

Here’s a bunch of macros I found really useful in my daily work. It started with the “save drawing as PDF” that I got a lot of help with from Alex Burnett (AlexB ?) in the 3D experience SOLIDWORKS User Forum, since I un…

---

## [Request: Macro to Export Hole Table from SolidWorks Drawing to CSV/Excel](https://forum.cadmunity.com/t/request-macro-to-export-hole-table-from-solidworks-drawing-to-csv-excel/3493)

<div class="topic-metadata">

**Author:** [@dhruvbppmfg](https://forum.cadmunity.com/u/dhruvbppmfg)\
**Replies:** 13\
**Last updated:** [March 19, 2025, 5:31pm UTC](https://forum.cadmunity.com/t/request-macro-to-export-hole-table-from-solidworks-drawing-to-csv-excel/3493 "2025-03-19T17:31:26Z")

</div>

Hello everyone, I need help with a SolidWorks macro to export the hole table from a drawing sheet into a CSV or Excel file. The exported file name should be based on the configuration-specific property of the associated…

---

## [Convert .DWG to .PDF](https://forum.cadmunity.com/t/convert-dwg-to-pdf/3462)

<div class="topic-metadata">

**Author:** [@chancegarrison](https://forum.cadmunity.com/u/chancegarrison)\
**Replies:** 7\
**Last updated:** [March 11, 2025, 7:43pm UTC](https://forum.cadmunity.com/t/convert-dwg-to-pdf/3462 "2025-03-11T19:43:59Z")

</div>

Does anyone have a macro or method to convert a large number of .DWG files to .PDF file while maintaining the same file name? It would be nice to be able to change the default drawing template used during the conversion…

[Next page](https://forum.cadmunity.com/c/solidworks/macro-library/15.md?page=1)
