Showing results for 
Search instead for 
Do you mean 
Reply

Link a (possible) programe to a mousse "right-click"?

To all

 

Is is possible to link a programme to a mouse" right click" in NX.CAE? I have in mind the following:

In Nx.CAE, select a (Mesh) Collector -->

Right click - Open 'All Collectors'

or

Right click - Collapse 'All Collectors'

 

The programme would loop through all the Collectors and "un-collapse" them (or collapse them dependign on the choice)

 

I am even thinking about an option to "un-collapse" only the collectors with meshes requiring update!

 

any thoughts

 

Tnaks

Regards

 

Production: NX9.0.3.4, NX10.0.2.6
Development: VB.NET (amateur level !)
8 REPLIES

Re: Link a (possible) programe to a mousse "right-click"?

FYI, there is already an "Expand All" and a "Collapse All" pick on the RMB when you click in an empty area of the navigator:

 

Re: Link a (possible) programe to a mousse "right-click"?

Hi JimB,

 

I am aware of the option and that's what started the thought process. Just an idea at the moment. Would be nice to have such "sub"-option rather than the "All or Nothing". I haven't even checked (yet) if the "collapse" option can be called in a programe!

 

Still the question remains: Can one call a programe from "right-click" mouse button?

 

Thanks

Regards

Production: NX9.0.3.4, NX10.0.2.6
Development: VB.NET (amateur level !)

Re: Link a (possible) programe to a mousse "right-click"?

Hi

 

I think contextual menu will help you in this regard. I have added contextual menu in my tool where user can right click on the selected feature group and and click on on my tool button on the context menu to edit that feature group contents.

 

Both right click and double click will bring the control to the context menu method where u can show your menu.

 

 

Thanks

Gunjeet

Re: Link a (possible) programe to a mousse "right-click"?

Thanks for the suggestions. How does one go about creating a 'contextual menu' ?

Production: NX9.0.3.4, NX10.0.2.6
Development: VB.NET (amateur level !)

Re: Link a (possible) programe to a mousse "right-click"?

Hi 

The just below code has to be initialized as tool gets launched and tool is supposed to be unloaded explicitily or AtTermination.

 

using NXOpen.MenuBar;

 

int contextID = UI.GetUI().MenuBarManager.RegisterConfigureContextMenuCallback("any name", "An context menu for specific feature.", new NXOpen.MenuBar.MenuBarManager.ConfigureContextMenu(CustomizeMenu));

 

after this defined the method 

public static int CustomizeMenu(ContextMenu menu, ContextMenuProperties props)

 - in this method you can customize the menu by hiding default menu or adding new menu on right click.

props- will give you context and location of the right click.

location can be "GraphicWindow" or "PARTNT"(part navigator) and context may be any feature type.

 

just customize what you need right click in this method and DONE. and while in case of unloading the tool from NX just unregister the ContextMenu otherwise NX will Crash suddenly.

 

Thanks

Gunjeet

Re: Link a (possible) programe to a mousse "right-click"?

At least in NX10 and onward, there is also an example in $NXROOT/ugopen/SampleNXOpenApplications/C++/ConfigureContextMenu (and one for Java)

Re: Link a (possible) programe to a mousse "right-click"?

Thanks. Just found the .NET example.

It's not working but then I am probably not using it properly

Production: NX9.0.3.4, NX10.0.2.6
Development: VB.NET (amateur level !)

Re: Link a (possible) programe to a mousse "right-click"?

Can't really help with the .NET, but I got it to work quite nicely in Python.

 

There, you just have to have your .py file in the "startup" folder, with a method "startup(*args)" in which you do the registration. Everything else is pretty straightforward.