Inventor 2019 - Export to PDF iLogic E_POINTER Error

Inventor 2019 - Export to PDF iLogic E_POINTER Error

BAnderson
Explorer Explorer
3,208 Views
5 Replies
Message 1 of 6

Inventor 2019 - Export to PDF iLogic E_POINTER Error

BAnderson
Explorer
Explorer

We have recently upgraded from Inventor 2017 to 2019.  We skipped the 2018 upgrade.  In doing so, our rule to export our drawings to PDF's no longer work and result in the following error:

 

Error in rule: GENERATE PDF - ALL SHEETS, in document: TAPESTRY CS NC_BOM.idw

Invalid pointer (Exception from HRESULT: 0x80004003 (E_POINTER))

 

Any help would be greatly appreciated!  Code listed below.  You will have to change the local directory for export...

 

'Save PDF with options
path_and_namePDF = ThisDoc.PathAndFileName(False)
oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
oOrderName = iProperties.Value("Custom", "ORDER NAME")
oOrderNumber = iProperties.Value("Custom", "ORDER NUMBER")
oDocument = ThisApplication.ActiveDocument
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

' Define folder browse dialog
Dim Dialog = New FolderBrowserDialog()
Dialog.SelectedPath = "T:\ENG 3D\JOBS"
Dialog.ShowNewFolderButton = True
Dialog.Description = "Choose Folder for Export..."
If DialogResult.OK = Dialog.ShowDialog() Then
ExportPath = Dialog.SelectedPath & "\"
Else
Exit Sub
End If

If Not oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then Exit Sub
oOptions.Value("All_Color_AS_Black") = 0
oOptions.Value("Remove_Line_Weights") = 1
oOptions.Value("Vector_Resolution") = 4800
oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets
oOptions.Value("Custom_Begin_Sheet") = 1
oOptions.Value("Custom_End_Sheet") = 100

If iProperties.Value("Project", "Revision Number") >= "1" Then
ExportPath = ExportPath & " R" & iProperties.Value("Project", "Revision Number")
End If
oDataMedium.FileName = ExportPath & oOrderName & " " & oOrderNumber & " BOM " & DateString & ".pdf"
Try
oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)

' Ask the user if he wants to open the file
question2 = MessageBox.Show("Open PDF file?", "Question",MessageBoxButtons.YesNo,MessageBoxIcon.Question)
If question2 = vbYes Then
ThisDoc.Launch(oDataMedium.FileName)
End If
Catch
MessageBox.Show("PDF not created, most likely someone else has it open.", "No PDF for you " & ThisApplication.GeneralOptions.UserName & "!")
End Try
Exit Sub

 

Thank you,

Brian

 

0 Likes
Accepted solutions (1)
3,209 Views
5 Replies
Replies (5)
Message 2 of 6

Mark.Lancaster
Consultant
Consultant

@BAnderson

 

Not saying no one will come along and give you an answer..  But programming questions and issues should be asked in the Inventor Customization forum (https://forums.autodesk.com/t5/inventor-customization/bd-p/120).  I will have the moderator relocate your posting to better suit your needs.

Mark Lancaster


  &  Autodesk Services MarketPlace Provider


Autodesk Inventor Certified Professional & not an Autodesk Employee


Likes is much appreciated if the information I have shared is helpful to you and/or others


Did this resolve your issue? Please accept it "As a Solution" so others may benefit from it.

0 Likes
Message 3 of 6

bradeneuropeArthur
Mentor
Mentor
Replace the "Dialog.SelectedPath = "T:\ENG 3D\JOBS""
with Dialog.SelectedPath = "C:\"

and take a look if this works..
If this is working you should prefer to use the IP address instead of drive letter.

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 4 of 6

BAnderson
Explorer
Explorer

Update:

- Sorry for posting in the wrong location @Mark.Lancaster and thank you for relocating my issue.

- Thanks for the idea @bradeneuropeArthur but changing the directory to Dialog.SelectedPath = "C:\" did not solve the issue.

 

Inventor 2019 now saves your previous setting when exporting to pdf.  Therefore, the following code is no longer needed.  If I remove the code listed below, the code runs fine:

If Not oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then Exit Sub
oOptions.Value("All_Color_AS_Black") = 0
oOptions.Value("Remove_Line_Weights") = 1
oOptions.Value("Vector_Resolution") = 4800
oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets
oOptions.Value("Custom_Begin_Sheet") = 1
oOptions.Value("Custom_End_Sheet") = 100

The only downfall to this solution is that you have to make sure everyone using the code has the same settings saved on their local machine.  

 

It would be nice if I could still find a way to use the custom options in the code to make sure everyone exports the pdf's using the same settings.

 

 

0 Likes
Message 5 of 6

xenocatalyst
Advocate
Advocate
Accepted solution

 


@BAnderson wrote:

 

 

It would be nice if I could still find a way to use the custom options in the code to make sure everyone exports the pdf's using the same settings.


Hi i found a change to the code here

https://forums.autodesk.com/t5/inventor-customization/pdf-i-logic-problems-after-2018-upgrade/m-p/74...

 

Change "oDataMedium" to "oDocument" when "oDocument = ThisApplication.activeDocument".

'If oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then 'old
 	If oPDFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then 'new

 It is working for me.

Message 6 of 6

Anonymous
Not applicable

If Not oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then Exit Sub oOptions.Value("All_Color_AS_Black") = 0

oOptions.Value("Remove_Line_Weights") = 1

oOptions.Value("Vector_Resolution") = 4800

oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets

oOptions.Value("Custom_Begin_Sheet") = 1

oOptions.Value("Custom_End_Sheet") = 100

 

In ilogic not need "oPDFAddIn.HasSaveCopyAsOptions" in inventor 2019, only use "oOptions.Vaule("") = " can working.