
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Looking for a bit of guidance with the Pack and Go API.
I have ran the example API provided in Inventor 2017 within VB.NET as follows (This is running on a simple form on button press):
Private Sub Button2_Click(sender As System.Object, e As EventArgs) Handles Button2.Click
Dim oPacknGoComp As New PackAndGoLib.PackAndGoComponent
Dim oPacknGo As PackAndGoLib.PackAndGo
oPacknGo = oPacknGoComp.CreatePackAndGo("C:\PacknGo\Source\Castor Parts.iam", "C:\PacknGo\Castor Parts")
' Set the design project. This defaults to the current active project.
oPacknGo.ProjectFile = "C:\PacknGo\Source\Castor Parts.ipj"
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()
End Sub
This is causing an Error message "An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred {"Error HRESULT E_FAIL has been returned from a call to a COM component."}"
All file paths are correct and output directory is created, I have double checked this as well as running the following:
Dim ProjFile As DesignProjectManager ProjFile = g_inventorApplication.DesignProjectManager 'Convert Project name to string Dim ProjName As String ProjName = ProjFile.ActiveDesignProject.FullFileName Debug.Print("Active project: " & ProjName)
Which returns the debug print string correctly and then tried using:
oPacknGo.ProjectFile = ProjName
So I know the Project File is correct but no matter what I try it seems to continually fall over.
I can run the code successfully if I comment out the Project file line, however this only creates a Pack and Go of the singular Part/Assembly that is open and no linked files (which defeats the point of Pack and Go)
Any resolution/advise would be greatly appreciated.
Solved! Go to Solution.