Steve Takata

PDF Export Macro from Workgroup PDM

Discussion created by Steve Takata on Nov 17, 2011
Latest reply on Jan 13, 2015 by Michael Jonquiere

A while back I participated in a thread that addressed issues with SolidWorks Task Scheduler and some limitations with their "Export Workgroup PDM Files" function.  I was trying to use it to export the vault-generated PDF copies of all the drawings to a shared network location in our organization so our manufacturing group could have access to them, but not need SolidWorks to look at the actual drawing file and have the possibility of changing documentation.

 

I could never get the Task Scheduler to run the "Export to local folder" option with PDFs correctly.  And I think when I got it to run once it put all the project files in a single folder.  So I wrote a macro to do a little better job with a few more options.  It is still a work in progress so make sure you watch it the first few times to make sure it behaves the way you expect.  I've tried to add plenty of comments, but please feel free to post questions or concerns here.

 

So a quick summary of the macro:

  1. Log into the vault
  2. Iterate through all projects in the vault
  3. For each child project it will create a nested folder inside its parent, thereby recreating the whole project/folder structure
  4. Optionally check for custom properties of document as a condition of export
  5. Export the vaulted PDF drawing copies to the project specific folder
  6. Rename the PDF to be "filename_Revision.PDF"

 

A couple of things I do not handle with this macro are old revisions and duplicate file names.  My practice right now is to periodically delete the entire directory structure and re-run the macro.  I was nervous to implement a large directory delete operation from the macro.  And if the macro encounters a PDF that already exists, then that file is skipped.  This should only be an issue if you have "Allow latest revision overwrite" enabled in your vault.  Attached here are the macro file and a text file of the same thing.  You will have to change the username, password, vault server and destination directory for the drawings for it to work on your system.

 

One powerful tool is number 4 above.  I've made a duplicate of this macro to export "sales" drawings.  Once we as engineering review and approve a top-level drawing for release to customers, we add the custom property "PublicRelease" and set it to "Yes".  These property options could also be used to check lifecycle status before exporting.

 

I need to give credit to Stephen Burke at http://solidworks.burkesys.com/category/macro/ for the core code of this macro for interfacing with the Workgroup PDM API.

 

Good luck and let me know how it goes.

Outcomes