# Macro Library

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

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

**Page:** 2

---

## [Creating Icons for macros](https://forum.cadmunity.com/t/creating-icons-for-macros/3450)

<div class="topic-metadata">

**Author:** [@doobes](https://forum.cadmunity.com/u/doobes)\
**Replies:** 2\
**Last updated:** [February 13, 2025, 2:09pm UTC](https://forum.cadmunity.com/t/creating-icons-for-macros/3450 "2025-02-13T14:09:13Z")

</div>

Greetings, I’ve just built a nice little VBA application for exporting all the 3D printable parts in an assembly (or an individual part) to a folder. I would like to put it on the taskbar with an icon. Is there a magi…

---

## [Assembly Sort](https://forum.cadmunity.com/t/assembly-sort/3406)

<div class="topic-metadata">

**Author:** [@Bryan\_O](https://forum.cadmunity.com/u/Bryan_O)\
**Replies:** 6\
**Last updated:** [January 11, 2025, 5:37am UTC](https://forum.cadmunity.com/t/assembly-sort/3406 "2025-01-11T05:37:58Z")

</div>

Anyone have a macro that will sort the components of a feature manager tree of an assembly alphanumeric?

---

## [Multiline Sketch Text Formatter](https://forum.cadmunity.com/t/multiline-sketch-text-formatter/3400)

<div class="topic-metadata">

**Author:** [@josh](https://forum.cadmunity.com/u/josh)\
**Replies:** 0\
**Last updated:** [January 8, 2025, 3:07pm UTC](https://forum.cadmunity.com/t/multiline-sketch-text-formatter/3400 "2025-01-08T15:07:49Z")

</div>

It’s difficult to control the vertical alignment/centering of sketch text because when the text is attached to a line it’s always attached at the base of the first line. Additionally, I can’t find a way to specify the l…

---

## [Read filename and folder](https://forum.cadmunity.com/t/read-filename-and-folder/2917)

<div class="topic-metadata">

**Author:** [@sloworks](https://forum.cadmunity.com/u/sloworks)\
**Replies:** 6\
**Last updated:** [January 2, 2025, 5:18pm UTC](https://forum.cadmunity.com/t/read-filename-and-folder/2917 "2025-01-02T17:18:52Z")

</div>

Hi, small addition to my macros/add-ins This one reads active documents folder, filename and both and you can copy them to clipboard. I use it often for example with “save as to not native format” or when I have to emai…

---

## [Access to Component "File Properties" Through Assembly & Drawing Without Opening the Component](https://forum.cadmunity.com/t/access-to-component-file-properties-through-assembly-drawing-without-opening-the-component/2936)

<div class="topic-metadata">

**Author:** [@Slasher](https://forum.cadmunity.com/u/Slasher)\
**Replies:** 2\
**Last updated:** [December 13, 2024, 3:03am UTC](https://forum.cadmunity.com/t/access-to-component-file-properties-through-assembly-drawing-without-opening-the-component/2936 "2024-12-13T03:03:22Z")

</div>

Hello everyone, Basically a macro for the subject says. I searched the forum library but could not find something similar. I have Custom Properties setup which is great but it does not work in drawings environment . …

---

## [Macro help to display part of filename](https://forum.cadmunity.com/t/macro-help-to-display-part-of-filename/3337)

<div class="topic-metadata">

**Author:** [@chancegarrison](https://forum.cadmunity.com/u/chancegarrison)\
**Replies:** 9\
**Last updated:** [December 11, 2024, 4:41am UTC](https://forum.cadmunity.com/t/macro-help-to-display-part-of-filename/3337 "2024-12-11T04:41:44Z")

</div>

I am looking for help to display part of a file name that is after a certain number of characters or a dash symbol. For example, I have a part with file name 1-123456-001 I want to be able to display only the 001 from …

---

## [Coordinate Table for 3D Points to create tube routing w/ bend rad.](https://forum.cadmunity.com/t/coordinate-table-for-3d-points-to-create-tube-routing-w-bend-rad/3357)

<div class="topic-metadata">

**Author:** [@Intrikit](https://forum.cadmunity.com/u/Intrikit)\
**Replies:** 3\
**Last updated:** [December 8, 2024, 7:18pm UTC](https://forum.cadmunity.com/t/coordinate-table-for-3d-points-to-create-tube-routing-w-bend-rad/3357 "2024-12-08T19:18:40Z")

</div>

Apologies if this has been posted but hopefully my request is a little more specific. I’m back to SW after 7 yrs in Creo and work for a global automotive company. My task is to take customer models with specific coordi…

---

## [Batch file renaming with filters (Pack and Go)](https://forum.cadmunity.com/t/batch-file-renaming-with-filters-pack-and-go/3336)

<div class="topic-metadata">

**Author:** [@chancegarrison](https://forum.cadmunity.com/u/chancegarrison)\
**Replies:** 2\
**Last updated:** [November 25, 2024, 9:38pm UTC](https://forum.cadmunity.com/t/batch-file-renaming-with-filters-pack-and-go/3336 "2024-11-25T21:38:48Z")

</div>

Hi Guys, I recently had the need to rename a bunch of files and have always used pack-and-go for this type of work, but it left me with something to desire. Does anyone have a macro that can filter out the renaming fun…

---

## [XYZ Coordinate Annnotation Macro for Drawings](https://forum.cadmunity.com/t/xyz-coordinate-annnotation-macro-for-drawings/3321)

<div class="topic-metadata">

**Author:** [@DeanD](https://forum.cadmunity.com/u/DeanD)\
**Replies:** 2\
**Last updated:** [November 18, 2024, 6:42pm UTC](https://forum.cadmunity.com/t/xyz-coordinate-annnotation-macro-for-drawings/3321 "2024-11-18T18:42:35Z")

</div>

In search of resource for writing custom macro for SolidWorks. Have basic code now that could be modified if it would be of use. Screen snippet is from an AutoCad drawing and the basic example of what needs to be able to…

---

## [Automated part numbering](https://forum.cadmunity.com/t/automated-part-numbering/3317)

<div class="topic-metadata">

**Author:** [@chancegarrison](https://forum.cadmunity.com/u/chancegarrison)\
**Replies:** 6\
**Last updated:** [November 14, 2024, 8:10pm UTC](https://forum.cadmunity.com/t/automated-part-numbering/3317 "2024-11-14T20:10:38Z")

</div>

Hello friends, Does anyone know of a macro that automates part numbering? It would be awesome to have a macro that selects the next available part number that you could input on the fly that also stores the previous in…

---

## [Macro to delete tree features](https://forum.cadmunity.com/t/macro-to-delete-tree-features/3290)

<div class="topic-metadata">

**Author:** [@Dwight](https://forum.cadmunity.com/u/Dwight)\
**Replies:** 12\
**Last updated:** [October 28, 2024, 10:58am UTC](https://forum.cadmunity.com/t/macro-to-delete-tree-features/3290 "2024-10-28T10:58:55Z")

</div>

I’d like a macro I can use to select tree features and delete them. I do not want it to guess which ones I really want to delete, I would like it to go ahead and delete them without making a fuss. And it would be extra s…

---

## [Auto workshop drawing creation from Assembly of sheetmetal parts.](https://forum.cadmunity.com/t/auto-workshop-drawing-creation-from-assembly-of-sheetmetal-parts/3264)

<div class="topic-metadata">

**Author:** [@user6](https://forum.cadmunity.com/u/user6)\
**Replies:** 2\
**Last updated:** [October 17, 2024, 11:10am UTC](https://forum.cadmunity.com/t/auto-workshop-drawing-creation-from-assembly-of-sheetmetal-parts/3264 "2024-10-17T11:10:48Z")

</div>

Hello Everyone, I am currently working in the production of sheet metal parts and have several assembly models that include both sheet metal and solid components. I am looking for a MAcro that would generate detailed dr…

---

## [Macro: Batch Add Bounding Box](https://forum.cadmunity.com/t/macro-batch-add-bounding-box/2421)

<div class="topic-metadata">

**Author:** [@gupta9665](https://forum.cadmunity.com/u/gupta9665)\
**Replies:** 4\
**Last updated:** [September 30, 2024, 10:34pm UTC](https://forum.cadmunity.com/t/macro-batch-add-bounding-box/2421 "2024-09-30T22:34:33Z")

</div>

Here is another quick SOLIDWORKS macro to add “Bounding Box” feature found under “Reference Geometry” to all the model files (parts and assemblies) in the selected folder. There is option to hide the bounding box as well…

---

## [New or exsisting macro](https://forum.cadmunity.com/t/new-or-exsisting-macro/3253)

<div class="topic-metadata">

**Author:** [@Bryan\_O](https://forum.cadmunity.com/u/Bryan_O)\
**Replies:** 4\
**Last updated:** [September 23, 2024, 7:45pm UTC](https://forum.cadmunity.com/t/new-or-exsisting-macro/3253 "2024-09-23T19:45:13Z")

</div>

There are a lot of pet peeves that my coworkers do that annoy me. Here is a short list LOL!: • Saving a model zoomed in so when you open it, you’re looking at the side of a surface. • Leaving unused features in part t…

---

## [Solidworks Sketch \> Custom GTOL Symbol Convertor](https://forum.cadmunity.com/t/solidworks-sketch-custom-gtol-symbol-convertor/113)

<div class="topic-metadata">

**Author:** [@Rob](https://forum.cadmunity.com/u/Rob)\
**Replies:** 10\
**Last updated:** [September 18, 2024, 8:07pm UTC](https://forum.cadmunity.com/t/solidworks-sketch-custom-gtol-symbol-convertor/113 "2024-09-18T20:07:18Z")

</div>

This project was inspired by this passage from matt in his excellent 2013 Bible image.png It will analyse sketches and copy the code to the clipboard ready for you to paste into a text document or your gtol.sym file. F…

---

## [Sheet-metal export tool for batch exporting Parts/Assemblies. Supports Multi-Body export. Batch configs/files.](https://forum.cadmunity.com/t/sheet-metal-export-tool-for-batch-exporting-parts-assemblies-supports-multi-body-export-batch-configs-files/1206)

<div class="topic-metadata">

**Author:** [@SashaSkolnik](https://forum.cadmunity.com/u/SashaSkolnik)\
**Replies:** 5\
**Last updated:** [September 17, 2024, 2:56am UTC](https://forum.cadmunity.com/t/sheet-metal-export-tool-for-batch-exporting-parts-assemblies-supports-multi-body-export-batch-configs-files/1206 "2024-09-17T02:56:42Z")

</div>

For those who do a lot of sheet-metal, you probably know exporting large quantities of flat patterns can take time. Before trying a paid service, I decided I would take a stab at writing a macro to handle batch exporting…

---

## [Panel Nesting](https://forum.cadmunity.com/t/panel-nesting/3229)

<div class="topic-metadata">

**Author:** [@Bryan\_O](https://forum.cadmunity.com/u/Bryan_O)\
**Replies:** 7\
**Last updated:** [September 16, 2024, 11:52am UTC](https://forum.cadmunity.com/t/panel-nesting/3229 "2024-09-16T11:52:54Z")

</div>

Our company produces case goods (panels and boxes) Our assemblies are configured with multiple sizes. The parts contain multiple configurations. Our CNC programmers are looking into programs that will nest the panels f…

---

## [Macro request](https://forum.cadmunity.com/t/macro-request/3241)

<div class="topic-metadata">

**Author:** [@BarryH](https://forum.cadmunity.com/u/BarryH)\
**Replies:** 2\
**Last updated:** [September 15, 2024, 7:22am UTC](https://forum.cadmunity.com/t/macro-request/3241 "2024-09-15T07:22:06Z")

</div>

Can anybody help with a small macro? I am currently working on a project which involves laser cut plates with holes in, some are hole wizard holes such as dowel holes and threaded holes, others are cut extrudes. We laser…

---

## [Macro to save bodies into individual SOLIDWORKS part documents using a custom property as file name](https://forum.cadmunity.com/t/macro-to-save-bodies-into-individual-solidworks-part-documents-using-a-custom-property-as-file-name/2077)

<div class="topic-metadata">

**Author:** [@GinoMF](https://forum.cadmunity.com/u/GinoMF)\
**Replies:** 3\
**Last updated:** [September 4, 2024, 12:46pm UTC](https://forum.cadmunity.com/t/macro-to-save-bodies-into-individual-solidworks-part-documents-using-a-custom-property-as-file-name/2077 "2024-09-04T12:46:24Z")

</div>

Hi guys First time posting on here. I’m trying to find a macro that does the SOLIDWORKS “Save Bodies” feature for all sheet metal bodies but instead of using the feature name as the file name, I would like it to be a c…

---

## [Macro saving bodies into individual parts not closing "part" window if the file type is changed](https://forum.cadmunity.com/t/macro-saving-bodies-into-individual-parts-not-closing-part-window-if-the-file-type-is-changed/2208)

<div class="topic-metadata">

**Author:** [@jetlius](https://forum.cadmunity.com/u/jetlius)\
**Replies:** 3\
**Last updated:** [September 2, 2024, 5:35am UTC](https://forum.cadmunity.com/t/macro-saving-bodies-into-individual-parts-not-closing-part-window-if-the-file-type-is-changed/2208 "2024-09-02T05:35:21Z")

</div>

Hello! I am using the macro found in the following link: https://www.codestack.net/solidworks-api/geometry/insert-bodies-to-part/ It does exactly what I need, however, if I change the file type to .stl, it does NOT cl…

---

## [Custom mass calculations (release)](https://forum.cadmunity.com/t/custom-mass-calculations-release/3214)

<div class="topic-metadata">

**Author:** [@laukejas](https://forum.cadmunity.com/u/laukejas)\
**Replies:** 1\
**Last updated:** [August 27, 2024, 5:36pm UTC](https://forum.cadmunity.com/t/custom-mass-calculations-release/3214 "2024-08-27T17:36:52Z")

</div>

Hi, Since SW lacks an option to override mass properties with an equation, I wrote a macro that does just that. If you set it to run on rebuild, it will seamlessly integrate into your model, and recalculate mass based o…

---

## [Save PDF to PDM](https://forum.cadmunity.com/t/save-pdf-to-pdm/2852)

<div class="topic-metadata">

**Author:** [@arild80](https://forum.cadmunity.com/u/arild80)\
**Replies:** 16\
**Last updated:** [August 19, 2024, 2:51pm UTC](https://forum.cadmunity.com/t/save-pdf-to-pdm/2852 "2024-08-19T14:51:18Z")

</div>

Hi I am realy bad at macro since i dont know VB. I have a code that save PDF into folder in PDM (if folder is created) I want to tweak this code a bit. To get the 8 first letters\\numbers of the file name it looks into…

---

## [VBA to add text to a specific drawing View.](https://forum.cadmunity.com/t/vba-to-add-text-to-a-specific-drawing-view/3170)

<div class="topic-metadata">

**Author:** [@Jacomuller](https://forum.cadmunity.com/u/Jacomuller)\
**Replies:** 4\
**Last updated:** [July 30, 2024, 4:08am UTC](https://forum.cadmunity.com/t/vba-to-add-text-to-a-specific-drawing-view/3170 "2024-07-30T04:08:20Z")

</div>

I have a create a macro to add 15 empty views to a drawing. Each view represent a part from a BOM for an assembly. This is for our production team on the shop floor. I have created an array text strings, build-up from a …

---

## [pdf & dxf export adding sheet name to filename for multi-sheet](https://forum.cadmunity.com/t/pdf-dxf-export-adding-sheet-name-to-filename-for-multi-sheet/3138)

<div class="topic-metadata">

**Author:** [@Martin\_Abbott\_Design](https://forum.cadmunity.com/u/Martin_Abbott_Design)\
**Replies:** 6\
**Last updated:** [July 4, 2024, 8:30am UTC](https://forum.cadmunity.com/t/pdf-dxf-export-adding-sheet-name-to-filename-for-multi-sheet/3138 "2024-07-04T08:30:52Z")

</div>

Hello, For years I’ve been using a macro to export a SW drawing file as in pdf and dxf format in one go. I use it daily and it’s saved me so much time over the years. I’d love to add an extra level of function to it, …

---

## [Feature History (Whodunnut?)](https://forum.cadmunity.com/t/feature-history-whodunnut/3132)

<div class="topic-metadata">

**Author:** [@josh](https://forum.cadmunity.com/u/josh)\
**Replies:** 3\
**Last updated:** [July 2, 2024, 6:32am UTC](https://forum.cadmunity.com/t/feature-history-whodunnut/3132 "2024-07-02T06:32:41Z")

</div>

In case you ever wonder who did something in this particular SolidWorks file, I present the “History” macro. It will output to Excel the feature properties of each feature in the tree. Name, username of creator, date c…

---

## [DXF/DWG Model View Export](https://forum.cadmunity.com/t/dxf-dwg-model-view-export/2986)

<div class="topic-metadata">

**Author:** [@MacroEnjoyer](https://forum.cadmunity.com/u/MacroEnjoyer)\
**Replies:** 16\
**Last updated:** [June 17, 2024, 1:24pm UTC](https://forum.cadmunity.com/t/dxf-dwg-model-view-export/2986 "2024-06-17T13:24:05Z")

</div>

Hi Everyone, I’ve been setting up my macros for my new job and encountered an issue. I can’t seem to find a macro that exports either dwg or dxf files from the model. I managed to find one that exports the top view, bu…

---

## [Help needed on 3D sketch macro](https://forum.cadmunity.com/t/help-needed-on-3d-sketch-macro/3089)

<div class="topic-metadata">

**Author:** [@MattW](https://forum.cadmunity.com/u/MattW)\
**Replies:** 4\
**Last updated:** [June 13, 2024, 3:43pm UTC](https://forum.cadmunity.com/t/help-needed-on-3d-sketch-macro/3089 "2024-06-13T15:43:21Z")

</div>

Greetings all- I am working on a macro that draws a series of circles in a 3d sketch. Right now, I am just working out how to handle variables to draw circles of varying centerpoints and diameters. The problem I am ru…

---

## [Macro idea](https://forum.cadmunity.com/t/macro-idea/3084)

<div class="topic-metadata">

**Author:** [@Monstrum\_Mathias](https://forum.cadmunity.com/u/Monstrum_Mathias)\
**Replies:** 4\
**Last updated:** [June 4, 2024, 7:38am UTC](https://forum.cadmunity.com/t/macro-idea/3084 "2024-06-04T07:38:51Z")

</div>

A macro that collects all dangling relations and dimensions in a sketch and deletes them, would be a neat button to have. Often there are multiple dangling relations in a sketch and for some reason newer versions of SW t…

---

## [Pull Component Configs to Assembly](https://forum.cadmunity.com/t/pull-component-configs-to-assembly/151)

<div class="topic-metadata">

**Author:** [@Rob](https://forum.cadmunity.com/u/Rob)\
**Replies:** 3\
**Last updated:** [May 8, 2024, 6:46pm UTC](https://forum.cadmunity.com/t/pull-component-configs-to-assembly/151 "2024-05-08T18:46:52Z")

</div>

From one of the most valuable pages in the Solidworks help Best practice is to have a one-to-one (1:1) relationship between configurations of the assembly and the configurations of the part. https://help.solidworks.c…

---

## [Creating a Macro in SolidWorks (2023 SP5) for Managing Global Variables and Equations](https://forum.cadmunity.com/t/creating-a-macro-in-solidworks-2023-sp5-for-managing-global-variables-and-equations/3023)

<div class="topic-metadata">

**Author:** [@HugonTribunes](https://forum.cadmunity.com/u/HugonTribunes)\
**Replies:** 1\
**Last updated:** [May 8, 2024, 3:13am UTC](https://forum.cadmunity.com/t/creating-a-macro-in-solidworks-2023-sp5-for-managing-global-variables-and-equations/3023 "2024-05-08T03:13:52Z")

</div>

Hello everyone, I’m looking to create a macro in SW (2023 SP5) for a simple dialog box that displays my global variables used in my equations. I also want to be able to change these variables from this dialog box, rathe…

[Previous page](https://forum.cadmunity.com/c/solidworks/macro-library/15.md)

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