Colin Heshmat

Help with "AddExternalDocuments" SW API Function

Discussion created by Colin Heshmat on Jun 18, 2020

Hello,

 

I am attempting to write a macro that creates a pack and go of a drawing with associated parts and includes (inside the .zip folder ) a PDF of the drawing file using the AddExternalDocuments feature.

 

I have found this page on the SolidWorks API website: 2017 SOLIDWORKS API Help - AddExternalDocuments Method (IPackAndGo) 

 

I have been trying to follow along with the example that is shown by visiting the link and work it in to my own script, but I have not been successful in getting the script to include this .PDF file inside of the Pack and Go .zip folder. The script (attached) creates a PDF and creates the pack and go correctly, but for some reason does not include the file. I'm sure I'm missing a small syntax detail or line that is critical, and ask for some external review to help.

 

The lines that I've included to put the PDF in the folder are:

bStatus = swPackAndGo.SetSaveToName(True, sOutputPath)
bStatus = swPackAndGo.AddExternalDocuments(strOutputPath & "\" & Number & ".PDF")

 

where bStatus is a Boolean, similar to how the website example shows.

 

**note that strOutputPath is the constant that will dictate where the zip file and PDF locations are saved.

 

Any help would be greatly appreciated to fix this, thank you!

Attachments

Outcomes