Hello Everybody,
I am in inventor customization and doing using VB.net.
Well i am trying to create a Assembly Tree of inventor in VB.net and replicate the same. My current code works fine. It displays the inventor assembly tree well. But the problem is if there are two or more parts of same part it displays as
Sample.ipt: 1
Sample.ipt: 2
Sample.ipt: 3
I am trying to make this consolidate as Sample.itp: 3. This means there are 3 Sample parts.
Can some one suggest me some idea on how to do this
rgds
Amit
Solved! Go to Solution.
Solved by xiaodong_liang. Go to Solution.
Hi Santosh,
Unfortunatly this concept will not work in my case. I creating a treeview with consolidated view of components. Its difficult to maintain the tree structure.
rgds
Amit
Hi amitk_189,
the only way I know is to loop through FileReferences to display the model tree and than loop through Occurrences to find how many instances of the same components has been placed.
FileReferences is saved only once into an inventor file no matter how many instances you place.
Hi,
Hope the code is wha you need:
Sub test()
Dim oAssDoc As AssemblyDocument
Set oAssDoc = ThisApplication.ActiveDocument
Dim oEachFile As DocumentDescriptor
For Each oEarchFile In oAssDoc.ReferencedDocumentDescriptors
Debug.Print "document name: " & oEarchFile.DisplayName
Debug.Print "number of Occurrences " &
oAssDoc.ComponentDefinition.Occurrences.AllReferencedOccurrences(oEarchFile).Count
Next
End Sub