Good Afternoon,
I am hoping someone can help me out. After our company recently upgraded to 2018 Inventor our PDF export code throws the following error.
Error in rule: iPDF_Out, in document: Drawing2
Invalid pointer (Exception from HRESULT: 0x80004003 (E_POINTER))
I have attached our current code for review as a text file. If anyone can help identify the issue it would be greatly appreciated.
Thanks,
Isaac
Solved! Go to Solution.
Solved by MechMachineMan. Go to Solution.
There is many a post on the forums already. Search functionality is a fantastic thing.
Public Sub Main() Dim doc as DrawingDocument ' Is this a drawing document? Try doc = ThisApplication.ActiveDocument Catch If Not ThisApplication.ActiveDocument.DocumentType = kDrawingDocumentObject Then MessageBox.Show("This command is only used on drawing documents", _ "Harmony Enterprises Automation", _ MessageBoxButtons.OK, _ MessageBoxIcon.Exclamation) Exit Sub End If End Try 'Set all variables and build paths iLogicVb.RunExternalRule("SharedVars") iLogicVb.RunExternalRule("PathBuilder") ' hook the PDF export add-in oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById ("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}") oDocument = ThisApplication.ActiveDocument oContext = ThisApplication.TransientObjects.CreateTranslationContext oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism oOptions = ThisApplication.TransientObjects.CreateNameValueMap oDataMedium = ThisApplication.TransientObjects.CreateDataMedium 'If oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then 'old If oPDFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then 'new 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 End If 'get PDF target folder path Dim targetFile As String = SharedVariable("fullpdfPath") If System.IO.File.Exists(targetFile) Then booleanParam = InputRadioBox("WARNING!", "Overwrite Existing File...", "Cancel Command", False, Title := "Harmony Automation") If booleanParam = False then Exit Sub End If 'Set the PDF target file name oDataMedium.FileName = targetFile 'Save the file oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium) 'Was the file created? Dim argMap As NameValueMap argMap = ThisApplication.TransientObjects.CreateNameValueMap() argMap.Add("checkFile", targetFile) iLogicVb.RunExternalRule("file_Validation",argMap) End Sub
Worked just fine, thanks a lot.
Can't find what you're looking for? Ask the community or share your knowledge.