2014 API provides the equivalent method PackAndGo like UI. This allows you to pack. The API help reference provides the demo code, but it is not much clear.
The ability of PackAndGo is provided by the interop:
<Inventor 2014>\Bin\Autodesk.PackAndGo.Interop.dll
This interop is 32bits on 32bits OS, 64bits on 64bits. So please make sure your application is correctly configured. When I used it the first time on my 64bits, it failed. It took me some time to figure out the failure is due to the application uses X86 configuration in default. After I changed to Any CPU, it works.
The code below is from the API help reference. I added some tips for reference:
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim oPacknGoComp As New PackAndGoLib.PackAndGoComponent
'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("C:\temp\source\MyNewPartName.iam", "C:\Temp\Destination")
' set the correct project file. otherwise, the method will crash
oPacknGo.ProjectFile = "C:\temp\source\webcast.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