Issue with TreeView

Issue with TreeView

amitnkukanur
Collaborator Collaborator
711 Views
3 Replies
Message 1 of 4

Issue with TreeView

amitnkukanur
Collaborator
Collaborator

Dear All,

 

I am trying to create a Treeview of Model tree which displays parts assembly...etc My code is working well and i am able to get the tree view, but the problem is how can i count the quantity of parts/assemblies and display as consolidated. For instance this below snapshot shows my treeview

 

untitled.JPG

 

 

 

 

 

 

 

 

This above snapshot shows my output

 

Here besides all parts/assemblies i get Semi-Colons and Numbers rather than consolidated view

 

For this part in fig

 

153049 QSL.1_8.8:1

153049 QSL.1_8.8:3

153049 QSL.1_8.8:3

 

how can i get 

153049 QSL.1_8.8 and Quantity as 3 seperately.

 

 

Best Regards

Amit

Senior Software Engineer
0 Likes
712 Views
3 Replies
Replies (3)
Message 2 of 4

amitnkukanur
Collaborator
Collaborator

This below is my code as shown below

 

 

Public Sub AssmTravel(ByVal InCollection As ComponentOccurrences, ByVal objparentNode As System.Windows.Forms.TreeNode)

Dim setval As Boolean = False

Dim objoccsEnumerator As IEnumerator = InCollection.GetEnumerator()
Dim objcomOccurrence As Inventor.ComponentOccurrence

While (objoccsEnumerator.MoveNext() = True)

objcomOccurrence = objoccsEnumerator.Current
Dim imagetype As Integer

If objcomOccurrence.DefinitionDocumentType = Inventor.DocumentTypeEnum.kAssemblyDocumentObject Then

imagetype = 0

Else

imagetype = 1

End If


Dim objcurrentNode As TreeNode = New TreeNode(objcomOccurrence.Name, imagetype, imagetype)

If (setval = True) Then

Else
objparentNode.Nodes.Add(objcurrentNode)
End If
setval = False

RowCountA += 1

 


AssmTravel(objcomOccurrence.SubOccurrences, objcurrentNode)
objcurrentNode.Collapse()

End While
'//amit code end
End Sub

Senior Software Engineer
0 Likes
Message 3 of 4

philippe.leefsma
Alumni
Alumni

That's a pure algorithmic query, we don't deal with this kind of questions specifically on that forum. We rather focus on Autodesk APIs related queries. You will have more luck seeking advice on a general purpose programming forum.

 

If you are using .Net, this should be easily addressed by using some specific built-in data structures, like Dictionnary or HashTable.

 

Regards,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 4 of 4

amitnkukanur
Collaborator
Collaborator

Ok, Thanks for Info. I will work on it.

 

rgds

amit

Senior Software Engineer
0 Likes