Usually Inventor loads all documents that are referenced by an assembly. The problem with suppressed parts ( and assemblies) is that they are not loaded by inventor. And as you already said the are not in the referenced files lists. The way to find document that are suppressed is by looking at the occurrences in an assembly. occurrences object have an FullDocumentName. with that property you can find all referenced files and put it in a list. if you want to do something with suppressed documents the you will need to load them by opening them.
Have a look at the iLogic code.it will open all documents that are suppressed and therefore not loaded.
Sub Main()
Dim doc As AssemblyDocument = ThisDoc.Document
Dim refDocNames As List(Of String) = getRefDocList(doc)
For Each refDocName As String In refDocNames
Dim refDoc As Document = getDocument(refDocName)
' Do the work on your document here
MsgBox(refDoc.DisplayName)
Next
End Sub
Public Function getRefDocList(doc As AssemblyDocument) As List(Of String)
Dim refDocs As List(Of String) = New List(Of String)()
For Each occ As ComponentOccurrence In doc.ComponentDefinition.Occurrences
Dim refDocName As String = occ.ReferencedDocumentDescriptor.FullDocumentName
If (refDocs.Contains(refDocName) = False) Then
refDocs.Add(refDocName)
End If
If occ.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
Dim refDoc As Document = getDocument(refDocName)
refDocs.AddRange(getRefDocList(refDoc))
End If
Next
Return refDocs
End Function
Private Function getDocument(fullDocName As String)
Dim doc As Document
Try
doc = ThisApplication.Documents.ItemByName(fullDocName)
Catch ex As Exception
' you could open the files also hidden for speed inprovements
' but Then you would need To close them also in some way
doc = ThisApplication.Documents.Open(fullDocName)
End Try
Return doc
End Function
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Blog: hjalte.nl - github.com