Extracting the information of all sub levels from top assembly and using in a Tree View in Visual Studio

Extracting the information of all sub levels from top assembly and using in a Tree View in Visual Studio

dutt.thakar
Collaborator Collaborator
867 Views
2 Replies
Message 1 of 3

Extracting the information of all sub levels from top assembly and using in a Tree View in Visual Studio

dutt.thakar
Collaborator
Collaborator

Hello All,

 

I have created a Tree view in Visual Studio and I want to get all the information from the main assembly to the tree view. 

I have created nodes in the tree view (e.g. Parts, Assemblies)

The information I want is, when I run my code through visual studio, it automatically populates all the information from the active assembly, and in a tree view, it populates the information in the same structure as per the main Assembly.

 

It sorts all the parts in Part Node and creates child nodes in it with the occurrence name (This is already done.)

In the Assembly Node, it sorts all the assemblies within the main assembly and creates a child node with an occurrence name (This is also done).

 

Now the challenge is, I want to get all the information for different sub-assembly levels as well and create child nodes at sub-assembly levels that will list all the parts inside a part node within that level and assemblies inside a sub-assembly node. Because as a creator we don't know how many sub-assembly levels will exist in an assembly.

 

Example : 

Main Assembly

  • Part1
  • Part2
  • SubAssembly1
    • SubSubAssembly2
      • Partx
      • Party
      • Partz
    • SubSubAssembly3
  • Part3

And so on....in the Inventor Browser node.

 for the above example what I want to do is when I run the code in a tree view I am expecting the below result.

Example : 

Parts

  • Part1
  • Part2
  • Part3

SubAssembly

  • SubAssembly 1 (This has +icon and can be expanded)
    • Parts (This will have +Icon, and if I expand I can see all the parts listed inside this assembly) 
    • Sub Assembly (This will also have +icon, and if I expand I can see all the sub-assemblies listed inside this assembly, e.g. SubSubAssembly2 and SubSubAssembly3)
      • Sub SubAssembly2
        • Parts (It should list (Partx, Party, Partz, if expanded)
        • Sub Assembly (This will also have +icon, and if I expand I should sub-assembly if there are any inside this assembly)

 

Hoping for some good help. I have tried to describe it clearly but, if it is still confusing I will try to elaborate.

 

Thanks,

Regards,

Dutt Thakar

 

If this answer has solved your problem please ACCEPT SOLUTION and hit like if you found it helpful..!


Regards,
Dutt Thakar
LinkedIn
0 Likes
Accepted solutions (2)
868 Views
2 Replies
Replies (2)
Message 2 of 3

laszlo_nagy
Contributor
Contributor
Accepted solution
Message 3 of 3

dutt.thakar
Collaborator
Collaborator
Accepted solution

@laszlo_nagy 

 

Thanks this thread helped me a lot, I need to make some tweaks in the code according to my requirement to replicate the behaviour in a tree view, but it worked.

 

To get the right tree view behaviour I had to use ParentOccurrence name and Object for a quick check.

 

 

Regards,

Dutt Thakar

If this answer has solved your problem please ACCEPT SOLUTION and hit like if you found it helpful..!


Regards,
Dutt Thakar
LinkedIn
0 Likes