Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
ASchlaack
4163 Views, 10 Replies

PDF iLogic

I had this iLogic rule which when ran would export a PDF of the current .idw. We just upgraded to 2018 and it no longer works. I can find no errors with the code as to why it will no longer fire.

 

When I run it I get two pop ups...

Pop up one:

error1.PNG

 

Pop up two:

error 2.PNG

 

I hit ok to both pop ups and nothing ends up happening.

 

 

Can someone else try to run it in 2018 and tell me what results or solutions you're able to find?

 

Thanks!

 

 

SyntaxEditor Code Snippet

Sub Main()
    Dim oDoc As Document
    Dim oPDFAddIn As TranslatorAddIn
    Try
        Dim ThisApp = ThisApplication
        Dim TransObj As TransientObjects = ThisApp.TransientObjects
        oDoc = ThisDoc.Document
        If oDoc.DocumentType <> 12292 Then '12292 = kDrawingDocument object
            MessageBox.Show("This Rule must be run from within a Drawing Document.", "Incorrect Document Type")
    Exit Sub
End If

oPDFAddIn = ThisApp.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
oContext = TransObj.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
oOptions = TransObj.CreateNameValueMap
oDataMedium = TransObj.CreateDataMedium

If oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
    oOptions.Value("All_Color_AS_Black") = 0 ' 0 = False, 1 = True
    oOptions.Value("Remove_Line_Weights") = 1 ' 0 = False, 1 = True
    oOptions.Value("Vector_Resolution") = 400 ' DPI
    oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets
    'oOptions.Value("Custom_Begin_Sheet") = 2
    'oOptions.Value("Custom_End_Sheet") = 4
End If

'Set the PDF target file name
oDataMedium.FileName = ThisDoc.Path & "\" & ThisDoc.FileName(False) & ".pdf"
Catch
MessageBox.Show("Error Getting Document Information" & vbCr & "Is the current Document Saved?", "Document Error")
End Try
'Publish document

Try
oPDFAddIn.SaveCopyAs(oDoc, oContext, oOptions, oDataMedium)
Catch
MessageBox.Show("Unable to Save PDF" & vbCr & "Is the file open or read only?", "Error Saving Document")
End Try
End Sub 

 

Thanks,
Aaron Schlaack
---------------------------------------------------------------------------------
Autodesk Inventor 2018
Dell Windows 8.1 64 bit Intel(R) Xeon(R) @ 3.50GHz 32GB Ram