We have instances where a user will create (either manually, or as an event of a Workflow) a PDF of a drawing, but the PDF file will be inaccurate or incomplete.
We have found the reason for this to be that the model(s) may have been changed, but the Drawing File itself has not been rebuilt. While this represents an obvious flaw in our Workflow (we are working on that and related issues), I wanted to prevent this from happening.
I added a test to the script that does the Conversion or "Save As" to the PDF, that looks like this at the beginning of the "Convert" sub:
If NeedsRegen(docFileName) Then
Log "PDF Not Created! File " & docFileName & " needs to be Rebuilt!"
The function NeedsRegen has this code:
Private Function NeedsRegen(filePath) As Boolean
On Error GoTo ErrHand
Dim File As Object
'Get the interface of the file (and its parent folder)
Dim Folder As Object
Set File = vault.GetFileFromPath(filePath, Folder)
'Return the NeedsRegeneration value
NeedsRegen = File.NeedsRegeneration(0, Folder.ID)
Dim ename As String
Dim edesc As String
vault.GetErrorString Err.Number, ename, edesc
Log "NeedsRegen error" & vbCrLf & ename & vbCrLf & errdesc
This should do the trick, as if the file needs a Regeneration, we log the error, and then exit the Convert Sub. The problem is that the call to NeedsReneration (highlighted in red) returns False, for at least some some files that need to be rebuilt. For the test file I'm using, the "Preview" in the EPDM Vault even indicates "The file needs to be rebuilt in SolidWorks", but the function still returns False.
I have also tried using this: NeedsRegen = File.NeedsRefeneration(File.CurrentVersion, Folder.ID), and gotten the same results.
Does anyone have any suggestions or insights?
did you find a solution for your Problem?
Because I have the same Problem