Get FullFileName of original AnyCAD component

<?xml encoding=”UTF-8″>By Adam Nagy

AnyCAD functionality enables you to include non-native file formats directly in your assembly.

AnyCAD

For those files the FullDocumentName/FullFileName will be special because Inventor has proxy documents for those components:

FullDocumentName:**C:TempAnyCADWorkspacesWorkspaceAnyCADBase.iam*LocalDocs*xFu0c05ic1y3mu2kv3oevwllrOa*<strong>1000083398swa000.iam</strong>
FullFileName:**C:TempAnyCADWorkspacesWorkspaceAnyCADBase.iam*LocalDocs*xFu0c05ic1y3mu2kv3oevwllrOa*<strong>1000083398swa000.iam</strong>
---------------------------
FullDocumentName:**C:TempAnyCADWorkspacesWorkspaceAnyCADBase.iam*LocalDocs*xS5rzpyzj10cluts2Febybwr1Bg*<strong>1000082731swp000.ipt</strong>
FullFileName:**C:TempAnyCADWorkspacesWorkspaceAnyCADBase.iam*LocalDocs*xS5rzpyzj10cluts2Febybwr1Bg*<strong>1000082731swp000.ipt </strong>

If you need to find the original file which is being referenced then you need to look for it in the ImportedComponents collection:

Sub CheckAnyCADInAssembly()
Dim doc As AssemblyDocument
Set doc = ThisApplication.ActiveDocument
Dim oImportComponent As ImportedComponent
For Each oImportComponent In doc.ComponentDefinition.ImportedComponents
If oImportComponent.LinkedToFile Then
Debug.Print oImportComponent.Definition.FullFileName
End If
Next
End Sub

Output:

C:TempAnyCADWorkspacesWorkspace1000083398swa000.sldasm

Although you can list all the non-native files that got imported (see below code), you can only find a direct connection between the top assembly that got imported and the original assembly it is referencing. There is no direct connection exposed in Inventor 2016 between the sub components / occurrences and the original part and assembly files that got imported:

AnyCAD_ ImportedComponent

Sub CheckAnyCADInAssembly()
Dim doc As AssemblyDocument
Set doc = ThisApplication.ActiveDocument
Dim oDoc As File
For Each oDoc In doc.File.AllReferencedFiles
Debug.Print oDoc.FullFileName
Next
End Sub

Sample output:

C:Gears_&frame_&.SLDPRT
C:Gears_&gears_&.SLDASM
C:Gears_&Internal Spur Gear_&.sldprt
C:Gears_&shaft1_&.SLDPRT
C:Gears_&shaft2_&.SLDPRT
C:Gears_&Spur Gear_&.sldprt

Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading