SAVE TO PDF with rev

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Autodesk Community
i am seeking some advice on how to get my ilogic code to work a bit more effectively
currently the code will save a pdf with the part number and revision number as the suffix on save in the IDW Environment
the issue i am having is that evan if the drawing has no revisions or revision table it will save with rev 0 or 1 on the suffix
and once a table is added it will only increment after the second revision is put into the table
is there a way i can make it that it only adds the revision suffix if a table exist within the drawing ?
---------------------------------------------------------------
'Save PDF with options
path_and_namePDF = ThisDoc.PathAndFileName(False) ' without extension
PDFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD95-2F4D-42CE-8BE0-8AEA580399E4}")
oRevNum = iProperties.Value("Project", "Revision Number")
oDocument = ThisApplication.ActiveDocument
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
If PDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
oOptions.Value("All_Color_AS_Black") = 0
oOptions.Value("Remove_Line_Weights") = 0
oOptions.Value("Vector_Resolution") = 400
oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets
'oOptions.Value("Custom_Begin_Sheet") = 2
'oOptions.Value("Custom_End_Sheet") = 4
End If
'Set the destination file name
oDataMedium.FileName = path_and_namePDF & _
" Rev" & oRevNum & ".pdf"
On Error Goto handlePDFLock
'Publish document.
Call PDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
i = MessageBox.Show("View the PDF file?", "Title",MessageBoxButtons.YesNo)
If i = vbYes Then : launchviewer = 1 : Else : launchviewer = 0 : End If
If launchviewer = 1 Then ThisDoc.Launch(oDataMedium.FileName)
Exit Sub
handlePDFLock:
MessageBox.Show("PDF could not be saved, most likely someone else has it open.", _
"No PDF for you " & ThisApplication.GeneralOptions.UserName & "!")
Resume Next
-----------------------------------------------------------------------------
Looking Forward to any assistance you can offer
Thanks in advance