Searching subfolders and selecting them using Ilogic (TopNode/Enumerator issue)

Searching subfolders and selecting them using Ilogic (TopNode/Enumerator issue)

j.t.a.tebraake
Participant Participant
1,118 Views
5 Replies
Message 1 of 6

Searching subfolders and selecting them using Ilogic (TopNode/Enumerator issue)

j.t.a.tebraake
Participant
Participant

Hello everyone

 

First post, so im hoping this is the right place.

 

What im trying to do: For a large assembly template with multiple configurations im trying to supress different subfolders based on the product code that is given to IV (Ilogic).

 

My brick wall: I cant seem to figure out how to cycle through subfolders. I know i can select folders that are "on top" using something like:

oApp = ThisApplication

oDoc = oApp.ActiveDocument

oPane = oDoc.BrowserPanes("Model")

oTopNode = oPane.TopNode

oSelectSet = oDoc.SelectSet

oSelectSet.Clear

oSelectSet.Select(oTopNode.BrowserFolders.Item("folder_level1"))

But since it will only look thought my topnodes it wont select a "folder_level2".

So i think i need some sort of traverse function that will:

-Open a top level folder

-Get all the nodes in that folder

-See if one of those nodes is a folder

-use that node to rinse and repeat.

 

according to inventor knowledgedesk:

BrowserFolders

Property that returns a collection of all browser folders contained directly under this node in the browser.

 

BrowserNodes

Property that returns a collection of the top level BrowserNode objects contained under this node.

 

so i figured i coould just do someting like: TopNode.BrowserFolders.BrowserNodes.BrowserFolders.BrowserNodes.Browserfolders.Item("folder_level3")

But it doesnt work like that since the BrowserFolders function returns a BrowserFolderEnumerator.

 

So any help on how to get from the BrowserFolderEnumerator to the node of the subfolder (i think that is the step to be taken) would be greatly appreciated

 

Inventor 2016

 

P.S. only help i could find on the forums was either top level or would involve the occurences in a subfolder, but i need the folder specifically

0 Likes
Accepted solutions (1)
1,119 Views
5 Replies
Replies (5)
Message 2 of 6

bradeneuropeArthur
Mentor
Mentor

This would help you:

for VBA and Vb.net

Public Sub main()

Dim a As Application
Set a = ThisApplication

Dim c As BrowserPane
Set c = a.ActiveDocument.BrowserPanes.ActivePane

Dim d As BrowserNode
Set d = c.TopNode

Dim d1 As BrowserNode
Dim f As BrowserFolder

'MsgBox d.FullPath

For Each d1 In d.BrowserNodes
MsgBox d1.FullPath

Next

For Each f In d.BrowserFolders
MsgBox f.Name

Next

End Sub

For I logic

Public Sub main()

Dim a As Application
a = ThisApplication

Dim c As BrowserPane

c = a.ActiveDocument.BrowserPanes.ActivePane

Dim d As BrowserNode
d = c.TopNode

Dim d1 As BrowserNode
Dim f As BrowserFolder

'MsgBox d.FullPath

For Each d1 In d.BrowserNodes
MsgBox d1.FullPath

Next

For Each f In d.BrowserFolders
MsgBox f.Name

Next

End Sub

Regards,

Autodesk Software: Inventor Professional 2018 | Vault Professional 2018 | Autocad Mechanical 2018
Programming Skills: Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
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 !

 

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 6

bradeneuropeArthur
Mentor
Mentor
Accepted solution

And now with selecting them:

Public Sub main()

Dim a As Application
Set a = ThisApplication

Dim c As BrowserPane
Set c = a.ActiveDocument.BrowserPanes.ActivePane

Dim d As BrowserNode
Set d = c.TopNode

Dim d1 As BrowserNode
Dim f As BrowserFolder

'MsgBox d.FullPath

For Each d1 In d.BrowserNodes
MsgBox d1.FullPath

Next

Dim se As SelectSet
Set se = a.ActiveDocument.SelectSet

For Each f In d.BrowserFolders
se.Select f
MsgBox f.Name

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 6

j.t.a.tebraake
Participant
Participant

thanks for the input. But i would like to ask you to elaborate on this programs function.

 

I ran the code on a small testfile and it selects all the top level folders. If i understand correctly:

-d is the top level nodes

-d1 the nodes one level deeper  ( For Each d1 In d.BrowserNodes)

 

however   "  MsgBox d1.FullPath   "   only returns the top level nodes and ignores the other levels.

 

so i guess im missing something

 

0 Likes
Message 5 of 6

bradeneuropeArthur
Mentor
Mentor

Will come back on this asap.

I am far from my desk right now...

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

Message 6 of 6

j.t.a.tebraake
Participant
Participant

Ah i found what i was missing. I blatantly assumed that the first row of folders was the top level. (it is like that in the select.TopNode ilogic code i posted). but the assembly itself is the top level. So what you posted does work.

 

Public Sub main()

Dim a As Application
Set a = ThisApplication

Dim c As BrowserPane
Set c = a.ActiveDocument.BrowserPanes.ActivePane

Dim d As BrowserNode
Set d = c.TopNode

Dim d1 As BrowserNode
Dim f As BrowserFolder
Dim d2 As BrowserNode

'MsgBox d.FullPath

For Each d1 In d.BrowserNodes
'MsgBox d1.FullPath

For Each d2 In d1.BrowserNodes
MsgBox d2.FullPath

Next

Dim se As SelectSet
Set se = a.ActiveDocument.SelectSet

For Each f In d.BrowserFolders
se.Select f
MsgBox f.Name

Next
Next

End Sub

 

 

0 Likes