listing browser pane folder items

listing browser pane folder items

NachoShaw
Advisor Advisor
1,576 Views
3 Replies
Message 1 of 4

listing browser pane folder items

NachoShaw
Advisor
Advisor

Hi

 

How can i loop through the browser panel and list only the nodes that are inside a specific folder?

 

 

 

Cheers

 

Nacho

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
1,577 Views
3 Replies
Replies (3)
Message 2 of 4

MechMachineMan
Advisor
Advisor

By writing code to do such a thing? The relevant inventor objects are all found under the BrowserPane object.

 

You need to go:

 

BrowserPane > TopNode > BrowserFolders > BrowserNode > BrowserNodes > objects in folder.

 

 

 

http://help.autodesk.com/view/INVNTOR/2018/ENU/?guid=GUID-9F6FC721-CCCB-4EA2-92D1-694DC5B12C22

 

 


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 3 of 4

CattabianiI
Collaborator
Collaborator

Hi @NachoShaw,


I attached to this question a piece of code to print out the ModelBrowserPane tree considering occurrences and user's folders.

You should do your stuff instead of printing the name of the node and add something like these code's lines in the PrintModelNodeNameRec function:

If browserNode.NativeObject.Type = ObjectTypeEnum.kBrowserFolderObject AndAlso 
browserNode.NativeObject.Name <> "MyFolderName" Then
Return
End If

 


CattabianiI wrote:

Here the iLogic code to print the ModelBrowserPane tree as in the image on the right:

SyntaxEditor Code Snippet

 

Class TraverseBrowserPaneRule
    Const printedTreeFfn As String = "c:\temp\modelBrowser.txt"
    
    Sub Main()
        Dim modelBrowserPane As BrowserPane = ThisApplication.ActiveEditDocument.BrowserPanes.Item("AmBrowserArrangement")
        Dim topNode As BrowserNode = modelBrowserPane.TopNode

        Using sw As IO.StreamWriter = IO.File.CreateText(printedTreeFfn)
            sw.WriteLine(ThisApplication.ActiveEditDocument.DisplayName )
        End Using
        
        PrintModelNodeNameRec(topNode, 0)
    End Sub
    
    Sub PrintModelNodeNameRec(browserNode As BrowserNode, level As Integer) 
        Dim name As String
        If browserNode.NativeObject IsNot Nothing AndAlso browserNode.NativeObject.Type <> ObjectTypeEnum.kBrowserFolderObject  _
        AndAlso browserNode.NativeObject.Type <> ObjectTypeEnum.kComponentOccurrenceObject _
        AndAlso browserNode.NativeObject.Type <> ObjectTypeEnum.kComponentOccurrenceProxyObject _
        AndAlso browserNode.NativeObject.Type <> ObjectTypeEnum.kAssemblyComponentDefinitionObject Then
            Return
        End If
        Try
            name = browserNode.NativeObject.Name
        Catch ex As Exception
            'name = browserNode.FullPath
        End Try
        
        If Not String.IsNullOrEmpty(name) Then
            Using sw As IO.StreamWriter = IO.File.AppendText(printedTreeFfn)
                sw.WriteLine(Space(level*2) + name)
            End Using
        End If

        For Each node As BrowserNode In browserNode.BrowserNodes
            PrintModelNodeNameRec(node, level + 1)
        Next
    
        Return 
    End Sub

End Class

 

0 Likes
Message 4 of 4

Anonymous
Not applicable
I do not want Product software


ด้วยความนับถือ
นายคอฟิซ ดือราโอ๊ะ
เบอร์ 086-9891885 หรือ 094-3534884
โทรได้ตลอด 24 ชั่วโมง
0 Likes