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: 

Add All family with the same Standard Organizstion from content center to an listbox in VBA Userform

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Darkforce_the_ilogic_guy
469 Views, 1 Reply

Add All family with the same Standard Organizstion from content center to an listbox in VBA Userform

I want to userform to Place componemt form Content Center.   but Only all for the Standard Organizstion = "Kalle"

 

for doing this I need to read all the right information into an listbox in VBA.

 

 

I am not sure what to change in the code below

 

Set hexHeadNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("Fasteners").ChildNodes.Item("Bolts").ChildNodes.Item("Hex Head")

' Find a specific family. In this case it's using the display name, but any family
' characteristic could be searched for.
Dim family As ContentFamily
Dim checkFamily As ContentFamily
For Each checkFamily In hexHeadNode.Families
MsgBox (checkFamily.DisplayName)
If checkFamily.DisplayName = "DIN EN 24016" Then
Set family = checkFamily
Exit For
End If
Next

1 REPLY 1
Message 2 of 2

Not that bedst code But it works so far 

 

Private Sub UserForm_Activate()

Dim familyName(24, 1)
Dim number As Integer
number = 0
'Set list = New ArrayList

 Dim hexHeadNode As ContentTreeViewNode
    Set hexHeadNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("Structural Shapes").ChildNodes.Item("Angles")
    
    ' Find a specific family.  In this case it's using the display name, but any family
    ' characteristic could be searched for.
    Dim family As ContentFamily
    Dim checkFamily As ContentFamily
    For Each checkFamily In hexHeadNode.Families
    If checkFamily.StandardOrganization = "Kallesoe" Then
    familyName(number, 0) = checkFamily.DisplayName
    
    number = number + 1
        'If checkFamily.DisplayName = "Threaded Rod" Then
          ' MsgBox (checkFamily.DisplayName)
           ' Exit For
       ' End If
       End If
       
    Next
    
    'New profil Type
    
    Set hexHeadNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("Structural Shapes").ChildNodes.Item("Channels")
    
    ' Find a specific family.  In this case it's using the display name, but any family
    ' characteristic could be searched for.
   
    For Each checkFamily In hexHeadNode.Families
    If checkFamily.StandardOrganization = "Kallesoe" Then
    familyName(number, 0) = checkFamily.DisplayName
    
    number = number + 1
        'If checkFamily.DisplayName = "Threaded Rod" Then
          ' MsgBox (checkFamily.DisplayName)
           ' Exit For
       ' End If
       End If
       
    Next
    
    
    Set hexHeadNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("Structural Shapes").ChildNodes.Item("I-Beams")
    
    ' Find a specific family.  In this case it's using the display name, but any family
    ' characteristic could be searched for.
   
    For Each checkFamily In hexHeadNode.Families
    If checkFamily.StandardOrganization = "Kallesoe" Then
    familyName(number, 0) = checkFamily.DisplayName
    
    number = number + 1
        'If checkFamily.DisplayName = "Threaded Rod" Then
          ' MsgBox (checkFamily.DisplayName)
           ' Exit For
       ' End If
       End If
       
    Next
    
    Set hexHeadNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("Structural Shapes").ChildNodes.Item("Other")
    
    ' Find a specific family.  In this case it's using the display name, but any family
    ' characteristic could be searched for.
   
    For Each checkFamily In hexHeadNode.Families
    If checkFamily.StandardOrganization = "Kallesoe" Then
    familyName(number, 0) = checkFamily.DisplayName
    
    number = number + 1
        'If checkFamily.DisplayName = "Threaded Rod" Then
          ' MsgBox (checkFamily.DisplayName)
           ' Exit For
       ' End If
       End If
       
    Next
    
    Set hexHeadNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("Structural Shapes").ChildNodes.Item("Round Bars")
    
    ' Find a specific family.  In this case it's using the display name, but any family
    ' characteristic could be searched for.
   
    For Each checkFamily In hexHeadNode.Families
    If checkFamily.StandardOrganization = "Kallesoe" Then
    familyName(number, 0) = checkFamily.DisplayName
    
    number = number + 1
        'If checkFamily.DisplayName = "Threaded Rod" Then
          ' MsgBox (checkFamily.DisplayName)
           ' Exit For
       ' End If
       End If
       
    Next
    
    Set hexHeadNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("Structural Shapes").ChildNodes.Item("Round Tubes")
    
    ' Find a specific family.  In this case it's using the display name, but any family
    ' characteristic could be searched for.
   
    For Each checkFamily In hexHeadNode.Families
    If checkFamily.StandardOrganization = "Kallesoe" Then
    familyName(number, 0) = checkFamily.DisplayName
    
    number = number + 1
        'If checkFamily.DisplayName = "Threaded Rod" Then
          ' MsgBox (checkFamily.DisplayName)
           ' Exit For
       ' End If
       End If
       
    Next
    
    
    Set hexHeadNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("Structural Shapes").ChildNodes.Item("Square/Rectangular Tubes")
    
    ' Find a specific family.  In this case it's using the display name, but any family
    ' characteristic could be searched for.
   
    For Each checkFamily In hexHeadNode.Families
    If checkFamily.StandardOrganization = "Kallesoe" Then
    familyName(number, 0) = checkFamily.DisplayName
    
    number = number + 1
        'If checkFamily.DisplayName = "Threaded Rod" Then
          ' MsgBox (checkFamily.DisplayName)
           ' Exit For
       ' End If
       End If
       
    Next
    
    Set hexHeadNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("Structural Shapes").ChildNodes.Item("Square/Rectangular/Hex Bars")
    
    ' Find a specific family.  In this case it's using the display name, but any family
    ' characteristic could be searched for.
   
    For Each checkFamily In hexHeadNode.Families
    If checkFamily.StandardOrganization = "Kallesoe" Then
    familyName(number, 0) = checkFamily.DisplayName
    
    number = number + 1
        'If checkFamily.DisplayName = "Threaded Rod" Then
          ' MsgBox (checkFamily.DisplayName)
           ' Exit For
       ' End If
       End If
       
    Next
    
      Set hexHeadNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("Structural Shapes").ChildNodes.Item("Tees")
    
    ' Find a specific family.  In this case it's using the display name, but any family
    ' characteristic could be searched for.
   
    For Each checkFamily In hexHeadNode.Families
    If checkFamily.StandardOrganization = "Kallesoe" Then
    familyName(number, 0) = checkFamily.DisplayName
    
    number = number + 1
        'If checkFamily.DisplayName = "Threaded Rod" Then
          ' MsgBox (checkFamily.DisplayName)
           ' Exit For
       ' End If
       End If
       
    Next
    
       Set hexHeadNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("Other Parts")
    
    ' Find a specific family.  In this case it's using the display name, but any family
    ' characteristic could be searched for.
   
    For Each checkFamily In hexHeadNode.Families
    If checkFamily.StandardOrganization = "Kallesoe" Then
    familyName(number, 0) = checkFamily.DisplayName
    
    number = number + 1
        'If checkFamily.DisplayName = "Threaded Rod" Then
          ' MsgBox (checkFamily.DisplayName)
           ' Exit For
       ' End If
       End If
       
    Next
    
        Set hexHeadNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("Other Parts").ChildNodes.Item("Cable Chains")
    
    ' Find a specific family.  In this case it's using the display name, but any family
    ' characteristic could be searched for.
   
    For Each checkFamily In hexHeadNode.Families
    If checkFamily.StandardOrganization = "Kallesoe" Then
    familyName(number, 0) = checkFamily.DisplayName
    
    number = number + 1
        'If checkFamily.DisplayName = "Threaded Rod" Then
          ' MsgBox (checkFamily.DisplayName)
           ' Exit For
       ' End If
       End If
       
    Next
    
    
    
    UserForm2.ListBox1.List = familyName
End Sub

orm2.ListBox1.List = familyName
End Sub

Tags (1)

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

Post to forums  

Autodesk Design & Make Report