I to everyone.
Can someone tell me what i'm doing wrong in the following code, because i can´t make a treeview checkbox true.
Code:'get the components from the Occurrences collection and add it to the tree Private Sub GetComponents(InCollection As ComponentOccurrences, objParentNode As Node) 'iterate through the components in the current collection Dim objCompOccurrence As ComponentOccurrence Dim odoc As Inventor.Document For Each objCompOccurrence In InCollection 'determine if the current component is an assembly or part Dim ImageType As String Set odoc = objCompOccurrence.Definition.Document Dim objCurrentNode As Node If objCompOccurrence.DefinitionDocumentType = kAssemblyDocumentObject Then ImageType = "Assembly" 'display the current component in the tree Set objCurrentNode = treList.Nodes.Add(objParentNode, tvwChild, , objCompOccurrence.Name, ImageType) If verifica_ncl(odoc) = True Then objCurrentNode.Checked = True End If MsgBox verifica_ncl(odoc) Call verif_existe(odoc.DisplayName) objCurrentNode.Expanded = True Else ImageType = "Part" 'display the current component in the tree 'Dim objCurrentNode As Node Set objCurrentNode = treList.Nodes.Add(objParentNode, tvwChild, , objCompOccurrence.Name, ImageType) If verifica_ncl(odoc) = True Then 'objCurrentNode.Checked = True End If Call verif_existe(odoc.DisplayName) objCurrentNode.Expanded = True End If 'recursively call this function for the suboccurrences of the current component Call GetComponents(objCompOccurrence.SubOccurrences, objCurrentNode) Next End Sub Public Function verifica_ncl(doc As Inventor.Document) As Boolean Dim opropset As PropertySet Dim i As Integer Set opropset = doc.PropertySets("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}") verifica_ncl = False For i = 1 To opropset.Count If opropset.Item(i).Name = "N_cl" Then verifica_ncl = True 'MsgBox "true" Exit For Exit Function End If Next i End Function




Reply With Quote