Deepak Gupta

Macro: Export all open drawings as PDF and DWG

Discussion created by Deepak Gupta on Jan 30, 2019
Latest reply on Feb 7, 2019 by Rubén Rodolfo Balderrama

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).

 

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.

 

If macro found a drawing then it would prompt user if he/she wants to export PDF & DWG both or only DWG.

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.

If there is no model view found in a drawing, macro would skip that drawing and prompt the user.

 

The exported PDF/DWG file name would be based on PartNumber, 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.

 

 

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.

Outcomes