Top Level Browser Node

Top Level Browser Node

NachoShaw
Advisor Advisor
500 Views
1 Reply
Message 1 of 2

Top Level Browser Node

NachoShaw
Advisor
Advisor

Hi

 

In a part, is it possible to hook into the right click menu of the top level node Solid Bodies folder to add an extra button?

node.png

 

Thanks

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
501 Views
1 Reply
Reply (1)
Message 2 of 2

JelteDeJong
Mentor
Mentor

Hi,

its possible to do this by catching the "OnContextMenu" event.

C#

inventor.CommandManager.UserInputEvents.OnContextMenu += onContextMenu;

And  then checking if the top node was selected.

c#

private void onContextMenu(SelectionDeviceEnum SelectionDevice, NameValueMap AdditionalInfo, CommandBar CommandBar)
{
// random ControlDefinition for demo ControlDefinition oCtrlDef = inventor.CommandManager.ControlDefinitions["AppZoomAllCmd"]; // check if the menu is in the browser if (SelectionDevice == SelectionDeviceEnum.kBrowserSelection) { Document oDoc = inventor.ActiveDocument; // loop over all BrowserNodes under topnode. // pay attension for sheetmetal parts because the node tree is different! foreach (BrowserNode node in oDoc.BrowserPanes["Model"].TopNode.BrowserNodes) { // check if the selected node is the "Solid bodies" node. if (node.Selected == true && node.BrowserNodeDefinition.Label.Contains("Solid Bodies(")) { // add your ControlDefinition to the menu/CommandBar CommandBar.Controls.AddButton((ButtonDefinition)oCtrlDef, 1); } } } }

Here i added the zoom all control

Marking Menu.png

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