Modified (Save as PDF) EPDM Task that reloads sheet format & images to drawing sheets

I have been involved in a couple discussions on here trying to get my macros worked out so that I could put them into a modified Save As PDF task to run in my EPDM workflow.

Up until now I had to do all the following steps independently and semi-manually.

The steps were as follows (please note that { } denote a state in my EPDM workflow):

  • {Eng. Design Review}
    • drawings are reviewed before final engineering approval.
  • Transition SolidWorks drawing and part file(s) from {Eng. Design Review} to {Print Apply Image PDF Release}
    • During this transition an EPDM Print task is automatically run.
      • This is done so that I don't have to open and print each drawing individually or manually run the EPDM print task in the vault view explorer window.
  • {Print Apply Image PDF Release}
    • Every drawing is manually checked out of the vault and opened in SolidWorks.
    • A macro is run on every sheet of every drawing to apply two images to the sheet format of the drawings.
    • The drawings are then saved.
    • The EPDM "Save As PDF" task is run to create a PDF with the current revision applied to the file name in both the current file location and then a copy in a common PDF Drawings folder for sales and purchasing to access.
    • A macro is run on every drawing which deletes the two images off of every sheet.
    • The drawings are then saved and checked into the vault.
  • Transition SolidWorks drawing and part file(s) from {Print Apply Image PDF Release} to {APPROVED - LOCKED}.

I started by modifying my macros to work in a single task.

My macro that applied the two images to each sheet had to be run on each sheet individually, however I was able to modify it so that now it can determine which sheet format each sheet has in a multi-sheet drawing and apply the images at the correct locations, and does this automatically for each sheet in the drawing. 

My other macro that went through and deleted all the images in the drawing was modified so that it actually determines what sheet format is currently used on each sheet, clears the sheet format and then reloads the original sheet format.  This clears all the images from the drawing and ensures my drawings always have the latest sheet formats.

I was able to edit the EPDM "Save As PDF" task to include the code from my Apply_Images (attached) & Reload_Sheet_Format ( ) macros.  The issue I have is that although the resulting PDF is coming out perfectly my SLDDRW file is not actually being saved in the process.  What I mean is that the PDF has the updated/reloaded sheet format on it but the SLDDRW file is not actually being updated with the new sheet format.  I have attached some screen shots of the slddrw file before and after the task is run and also of the resulting PDF file.  I have also attached my code.

I think that maybe the task is not actually checking the drawing file out and therefore the SLDDRW is not being saved after the changes are made.  There is a line in the code that states "swDocSpecification.ReadOnly = True" but I have tried changing that to False and it makes no difference.

Anyone know why this isn't working?

Thanks,

Garret

SolidworksApi macros