Get Selected name from Vault Tab

Get Selected name from Vault Tab

LAD5
Explorer Explorer
307 Views
4 Replies
Message 1 of 5

Get Selected name from Vault Tab

LAD5
Explorer
Explorer

I'm trying to get the name of the selected file in the Vault Tab, ex. "Corhole Board.idw". through the API.

 

LAD5_0-1718216231755.png

 

I cant find the object it's in.  Does anyone have a sample code to get this name?

Lawrence

308 Views
4 Replies
Replies (4)
Message 2 of 5

JelteDeJong
Mentor
Mentor

I don't have a vault installed but you could have a look at the following iLogic rule. Select a node in the vault browser and run the rule. It will find all browsers and log the selected node (if one is found)

        Dim doc As PartDocument = ThisDoc.Document

        For Each browserPane As BrowserPane In doc.BrowserPanes
            logger.Info(browserPane.Name & " - " & browserPane.InternalName)

            Dim topNode As BrowserNode = Nothing
            Try
                topNode = browserPane.TopNode
            Catch ex As Exception
                logger.Info("   None top node found.")
                Continue For
            End Try

            Dim selectedNode = GetSelectedNode(topNode)
            If (selectedNode IsNot Nothing) Then
                logger.Info("   " & selectedNode.BrowserNodeDefinition.Label)
            Else
                logger.Info("   None selected node found")
            End If
        Next


        logger.Info("- - - - - - or if you know the internal name of the browser - - - - - - - - -")
        Dim browser = doc.BrowserPanes.Item("PmDefault")
        Dim selectedNodeInBrowser = GetSelectedNode(browser.TopNode)
        If (selectedNodeInBrowser IsNot Nothing) Then
            logger.Info(selectedNodeInBrowser.BrowserNodeDefinition.Label)
        Else
            logger.Info("None selected node found")
        End If
    End Sub

    Public Function GetSelectedNode(node As BrowserNode) As BrowserNode

        If (node.Selected) Then Return node

        For Each refNode As BrowserNode In node.BrowserNodes

            Dim selectedNode = GetSelectedNode(refNode)
            If (selectedNode IsNot Nothing) Then
                Return selectedNode
            End If

        Next

        Return Nothing
    End Function

Jelte de Jong
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.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 3 of 5

LAD5
Explorer
Explorer

Sorry, this did not help.   This sample is also limited to the part document, i did switch to the Assmeblydocument but got the same results.   It found a Vault node, but said there was no node to access. 

 

LAD5_1-1718630792406.png

 

 

 

0 Likes
Message 4 of 5

g.georgiades
Advocate
Advocate

The sample posted by @JelteDeJong only works if the DockedWindow/Browserpane is an Inventor tree browser. The vault panel has a custom GUI with a unique tree implementation which is why inventor says there is no top node found. There is currently no way to access the vault panel or read the tree.

 

Selecting items in the vault tree or in the model tree do seem to select their counterparts in the other tree - maybe that can help, though it seems to only be useful in assemblies.

0 Likes
Message 5 of 5

Frederick_Law
Mentor
Mentor

Vault is in DockableWindow.

Sub Main()
'Dockable Windows
'Caption:InternalName
'Model:model
'iLogic Log:ilogic.logwindow
'iLogic:ilogic.treeeditor
'Vault:vault

'INFO|Model
'INFO|model
'INFO|H: 757 W: 302 T: 295 L: 74
'INFO|Docking State: 2
'INFO|Autodesk Inventor Professional 2023
'INFO|iLogic Log
'INFO|ilogic.logwindow
'INFO|H: 694 W: 230 T: 358 L: 1600
'INFO|Docking State: 4
'INFO|Autodesk Inventor Professional 2023
'INFO|iLogic
'INFO|ilogic.treeeditor
'INFO|H: 218 W: 230 T: 115 L: 1600
'INFO|Docking State: 4
'INFO|Autodesk Inventor Professional 2023
'INFO|Vault
'INFO|vault
'INFO|H: 155 W: 302 T: 115 L: 74
'INFO|Docking State: 2
'INFO|Autodesk Inventor Professional 2023


'kDockBottom	1	Dock To bottom.
'kDockLastKnown	32	Docking To the last know state.
'kDockLeft		2	Docking To left.
'kDockRight		4	Docking To right.
'kDockTop		8	Docking To top.
'kFloat 		16	floating.

'Dim loggerWindow = ThisApplication.UserInterfaceManager.
'	DockableWindows.
'	Cast(Of DockableWindow).
'	Where(Function(d) d.InternalName.Equals("ilogic.logwindow")).
'	First()
'loggerWindow.Visible = True
Dim oDockableWindow As DockableWindow
Dim oDockingState As DockingStateEnum
Dim oDockToObject As Object
Dim ologgerWindow As DockableWindow

For i = 1 To 5
	oDockableWindow = ThisApplication.UserInterfaceManager.DockableWindows.Item(i)
	Logger.Info(oDockableWindow.Caption)
	Logger.Info(oDockableWindow.InternalName)
	Logger.Info("H: " & oDockableWindow.Height & " W: " & oDockableWindow.Width & " T: " & oDockableWindow.Top & " L: " & oDockableWindow.Left )
	oDockableWindow.GetDockingState(oDockingState, oDockToObject)
	Logger.Info("Docking State: " & oDockingState)
	'Logger.Info(oDockToObject.Caption & " " & oDockToObject.Type)
	'Logger.Info(oDockToObject.Parent.Type)
Next

End Sub
0 Likes