External files

External files

GeorgK
Advisor Advisor
677 Views
9 Replies
Message 1 of 10

External files

GeorgK
Advisor
Advisor

Hello together,

 

how could I get all the external files like xls, bmp, jpg and derived files?

 

Thank you

 

Georg

0 Likes
678 Views
9 Replies
Replies (9)
Message 2 of 10

CCarreiras
Mentor
Mentor

HI!

 

Save as "Pack and Go" and activate "Include Linked Files"

CCarreiras

EESignature

0 Likes
Message 3 of 10

GeorgK
Advisor
Advisor
Hello CarlosC,

do you have a solution for VBA?

Georg
0 Likes
Message 4 of 10

CCarreiras
Mentor
Mentor

No... i don't know how toit with VB or iLogic... 😞

CCarreiras

EESignature

0 Likes
Message 5 of 10

Vladimir.Ananyev
Alumni
Alumni

Look at the "Pack and go" sample in the Inventor API Help.

Set this option to True:

oPacknGo.IncludeLinkedFiles = True

cheers,


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 6 of 10

MechMachineMan
Advisor
Advisor
Perhaps this may be what you are looking for:

PartDocument.ReferencedOLEFileDescriptors Property
Parent Object: PartDocument
Description
Property that returns the collection of linked and embedded files in the document.
Syntax
PartDocument.ReferencedOLEFileDescriptors() As ReferencedOLEFileDescriptors
Version
Introduced in Inventor version 4

--------------------------------------
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
0 Likes
Message 7 of 10

GeorgK
Advisor
Advisor

Hello Vladimir,

 

but how could I get all the file names and paths? Do you have a sample code?

 

Thanks

 

Georg

 

0 Likes
Message 8 of 10

Vladimir.Ananyev
Alumni
Alumni

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

0 Likes
Message 9 of 10

GeorgK
Advisor
Advisor

Hello Vladimir,

 

thanks for the sample from the api help. I know the sample. But I need the files in an add-in.

 

Cheers

 

Georg

0 Likes
Message 10 of 10

Vladimir.Ananyev
Alumni
Alumni

Justin is right. Please use ReferencedOLEFileDescriptors property on the document object. 


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

0 Likes