Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PDF I logic problems after 2018 upgrade

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Ikruse
1828 Views, 2 Replies

PDF I logic problems after 2018 upgrade

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

2 REPLIES 2
Message 2 of 3
MechMachineMan
in reply to: Ikruse

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

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 3 of 3
guamejiama
in reply to: MechMachineMan

Worked just fine, thanks a lot.

_________________________________________________________________
(Por favor, seleccioname como solución si he ayudado en lo que necesitabas)
(Please, select me as a solution if I helped in what you needed)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report