Page 1 of 1

Macro: Export all open drawings as PDF and DWG

Posted: Wed Jun 09, 2021 7:59 am
by gupta9665
Attached is a macro to export all open drawings as PDF and DWG in the same location as the drawing file. The macro has been made on SW 2019 version but should work on earlier versions as well. Changing the macro reference to your installed as suggested here Fix-Update SOLIDWORKS Macro References? (don't worry on the fact that video is for fixing missing library error but check the process to update your macro library).
Export Open Drawings as PDF_DWG (SW2019).zip
(12.85 KiB) Downloaded 1256 times
The macro would check for all open files and would process only drawing files. In case there is no file or no drawing file (will check only the drawings which has been saved), it would prompt the user.
1.jpg
4.jpg
If macro found a drawing then it would prompt user if he/she wants to export PDF & DWG both or only DWG.
3.jpg
If a drawing has not been saved ever, macro would skip that drawing and prompt the user. This would happen in case there is more than one open drawing and some of them have not been saved.
2.jpg
If there is no model view found in a drawing, macro would skip that drawing and prompt the user.
5.jpg
The exported PDF/DWG file name would be based on Part Number, Revision and Description custom properties values from the model. So make sure your model has these custom properties with values.

If you want to keep the same file name, then comment out the highlighted line and use the other line.
6.jpg

I'll be updating macro later to ask for a save location. Let me know what else you would like to get updated/added in the macro.

Re: Macro: Export all open drawings as PDF and DWG

Posted: Wed Jun 09, 2021 10:03 am
by Ömür Tokman
Big Master, you are perfect.
Thanks a lot

Re: Macro: Export all open drawings as PDF and DWG

Posted: Thu Sep 16, 2021 12:31 pm
by Conklin
Great Job

Please look at the attached "Batch_Save_As_DWG_Seprate_Shts.text"

It is perhaps not the best written/pieced together Macro
But
it works for me...


But, particularly look at the bit that: ( that I think is a good idea )
Saves all sheets of all the Files in a specified directory as DWG files. with " - SHT 01", " - SHT 02" etc....
' NOTE: If there is only one sheet it will leave off the " - SHT 01"

This is to get rid of the 00... 01... 02... 03... prefix
SW would assign when saving a multi sheet SW drawing to DWG as separate sheets
and will put a suffix in stead of " ...- SHT 01", " ...- SHT 02" etc..
only if there is more than one sheet.

And it also saves all the DWGs in an "AutoCad Batch Saved" folder


The last bit in the macro is just to WAKE me up when it is done!

Re: Macro: Export all open drawings as PDF and DWG

Posted: Thu May 18, 2023 11:40 pm
by ghkdwkd007
The post you posted helped me a lot. Thank you.
However, I am inquiring because there is a part that cannot be modified.
I couldn't find the part number in the part where I found the part number, so I went to the description and got the conversion name. I don't know how to solve this.

Re: Macro: Export all open drawings as PDF and DWG

Posted: Sat May 20, 2023 9:26 am
by gupta9665
ghkdwkd007 wrote: Thu May 18, 2023 11:40 pm The post you posted helped me a lot. Thank you.
However, I am inquiring because there is a part that cannot be modified.
I couldn't find the part number in the part where I found the part number, so I went to the description and got the conversion name. I don't know how to solve this.
I'm not able to understand your issue. Can you share your file and some images explaining the issue in more detail.