Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Assmbly Tree

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
amitnkukanur
705 Views, 4 Replies

Assmbly Tree

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

Senior Software Engineer
4 REPLIES 4
Message 2 of 5
santoshr0114
in reply to: amitnkukanur

Hi amitk_189

 

If you want to consolidate the number of occurances of a single part, and show the occurance numner, then you can simply count the occurance and display it

Regards
Santosh
Message 3 of 5
amitnkukanur
in reply to: amitnkukanur

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

Senior Software Engineer
Message 4 of 5
Anonymous
in reply to: amitnkukanur

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.

 

Message 5 of 5

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report