As Pack’n’Go uses Apprentice Server functionality (as Design Assistant does) it cannot run in-process with Inventor. The most simple way is to develop a standalone exe application that executes out-of-process. So you should create a VB.Net project (Express version would be fine) and add the reference to the pack and go type interop binary Autodesk.PackAndGo.Interop.dll which is in the Bin folder of Inventor installation folder.
Here is the VB .NET code sample from the Inventor API help:
Public Sub PackAndGoSample()
Dim oPacknGoComp As New PackAndGoLib.PackAndGoComponent
Dim oPacknGo As PackAndGoLib.PackAndGo
oPacknGo = oPacknGoComp.CreatePackAndGo("C:\Temp\Source\Assembly1.iam", "C:\Temp\Destination")
' Set the design project. This defaults to the current active project.
oPacknGo.ProjectFile = "C:\Temp\Source\Test.ipj"
Dim sRefFiles = New String() {}
Dim sMissFiles = New Object
' Set the options
oPacknGo.IsSkippingLibraries = True
oPacknGo.IsSkippingStyles = True
oPacknGo.IsSkippingTemplates = True
oPacknGo.IsCollectingWorkgroups = False
oPacknGo.IsKeepingFolderHierarchy = 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
Linked files should be gathered for you by SearchForReferencedFiles method if you set IncludeLinkedFiles option to True.
If you want to get an idea what is happening behind the scene look at the CopyDesign sample from the Inventor API SDK.
Default location: C:\Users\Public\Documents\Autodesk\Inventor 2015\SDK\UserTools\ CopyDesign
This is a quite simple application that copies the set of specified drawing files from an existing directory location to a new directory location. In addition to copying the drawing files, it also copies all the referenced files for each drawing and updates the references in the copied drawing files to point to these newly copied files.
Real-life file sets could be more complicated, so you may want to take into account substitute parts, referenced bitmps, etc. – a lot of stuff that require good knowledge of Inventor API.
So I would recommend to test PackAndGoComponent first.
cheers,
Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network