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'
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!
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?
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 for the suggestions. How does one go about creating a 'contextual menu' ?
The just below code has to be initialized as tool gets launched and tool is supposed to be unloaded explicitily or AtTermination.
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.
At least in NX10 and onward, there is also an example in $NXROOT/ugopen/SampleNXOpenApplications/C++/ConfigureContextMenu (and one for Java)
Thanks. Just found the .NET example.
It's not working but then I am probably not using it properly
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.