Inventor Pack and Go using iLogic
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
The Pack And Go API sample works fine when run from Visual Studio, but when used in iLogic (with a reference to the Pack and Go DLL at the start of the iLogic rule, it gives the following error:
Error HRESULT E_FAIL has been returned from a call to a COM component.
Details: System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
at PackAndGoLib.PackAndGoClass.set_ProjectFile(String Result)
This is strange, as it is simply refusing to set the active project file for the Pack and Go. I've read xiaodong-liang's helpful blog below - could this be a case of x86 and x64 interop problems? I'm sure this must be simple to solve - I don't really want to have to write my own Pack and Go routine in iLogic.
http://adndevblog.typepad.com/manufacturing/2013/05/use-packandgo-of-2014-api.html
Any thoughts?
SyntaxEditor Code Snippet
AddReference "C:\Program Files\Autodesk\Inventor 2017\Bin\Autodesk.PackAndGo.Interop.dll" Dim oPacknGoComp As New PackAndGoLib.PackAndGoComponent Dim oDoc As Document = ThisApplication.ActiveEditDocument 'ensure the first argument of CreatePackAndGo is correct assembly, 'and the path of the second argument exists ' otherwise, the method will crash Dim oPacknGo As PackAndGoLib.PackAndGo oPacknGo = oPacknGoComp.CreatePackAndGo(ThisApplication.ActiveEditDocument.FullFileName, "C:\Temp\") ' set the project file for the export to be the currently active project file ' ERRORS ON THIS LINE...... oPacknGo.ProjectFile = ThisApplication.DesignProjectManager.ActiveDesignProject.FullFileName Dim sRefFiles = New String() {} Dim sMissFiles = New Object ' Set the options oPacknGo.SkipLibraries = True oPacknGo.SkipStyles = True oPacknGo.SkipTemplates = True oPacknGo.CollectWorkgroups = False oPacknGo.KeepFolderHierarchy = True oPacknGo.IncludeLinkedFiles = True ' Get the referenced files oPacknGo.SearchForReferencedFiles(sRefFiles, sMissFiles) ' Add the referenced files for package oPacknGo.AddFilesToPackage(sRefFiles) ' Start the pack and go to create the package oPacknGo.CreatePackage()