How do I go through all content center levels?

How do I go through all content center levels?

Anonymous
Not applicable
566 Views
4 Replies
Message 1 of 5

How do I go through all content center levels?

Anonymous
Not applicable

Hi!

 

I need to go through all content center levels, how can I do this recursively?

 

I need to get the family name (DisplayName).

 

For example:

Capturar.PNG

 

Thank you!

0 Likes
Accepted solutions (1)
567 Views
4 Replies
Replies (4)
Message 2 of 5

bradeneuropeArthur
Mentor
Mentor

Hi,

 

In VBA or Vb.net?

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 5

bradeneuropeArthur
Mentor
Mentor

for VBA the following will do:

 

 Public Sub LoopReadContentCenterTree()

        Dim oContentCenter As ContentCenter
        Set oContentCenter = ThisApplication.ContentCenter

        Dim a As ContentTreeViewNode
        Set a = oContentCenter.TreeViewTopNode

        Call LoopGetFromTreeView(a)
    End Sub

Private Sub LoopGetFromTreeView(oContentTreeViewNode As ContentTreeViewNode)

        Dim oContentTreeViewNodeLoop As ContentTreeViewNode
        'Dim strPath As String = b.DisplayName
        Dim strPath As String
        strPath = oContentTreeViewNode.FullTreeViewPath
        Dim strFam As String
        strFam = oContentTreeViewNode.DisplayName
        Dim strExport As String
        strExport = oContentTreeViewNode.DisplayName

        Dim oContentFamily As ContentFamily
        For Each oContentFamily In oContentTreeViewNode.Families
Debug.Print oContentFamily.DisplayName

        Next

        For Each oContentTreeViewNodeLoop In oContentTreeViewNode.ChildNodes

          Call LoopGetFromTreeView(oContentTreeViewNodeLoop)

        Next
    End Sub

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 4 of 5

Anonymous
Not applicable

I'm sorry, I just forgot, I'm programming in C #.

 

I believe that the example you have shown will be useful.

 

thank you.

0 Likes
Message 5 of 5

bradeneuropeArthur
Mentor
Mentor
Accepted solution

I have it in VB.net

 

but vba can 1to 1 copied.

I assume this will be no problem for you.

 

I have translated it to vba because I thought that you preferred that.

 

if you need in in vb.net let me know...

 

Here you have it in VB.net:

 

 Public Sub LoopReadContentCenterTree()

        Dim oContentCenter As ContentCenter
       	oContentCenter = ThisApplication.ContentCenter

        Dim a As ContentTreeViewNode
        a = oContentCenter.TreeViewTopNode

        LoopGetFromTreeView(a)
    End Sub

Private Sub LoopGetFromTreeView(oContentTreeViewNode As ContentTreeViewNode)

        Dim oContentTreeViewNodeLoop As ContentTreeViewNode

        Dim strPath As String
        strPath = oContentTreeViewNode.FullTreeViewPath
        Dim strFam As String
        strFam = oContentTreeViewNode.DisplayName
        Dim strExport As String
        strExport = oContentTreeViewNode.DisplayName

        Dim oContentFamily As ContentFamily
        
        For Each oContentFamily In oContentTreeViewNode.Families

	Debug.Print oContentFamily.DisplayName

        Next

        For Each oContentTreeViewNodeLoop In oContentTreeViewNode.ChildNodes

        LoopGetFromTreeView(oContentTreeViewNodeLoop)

        Next
 End Sub

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes