NXKnowledge

NX Open Programmer's Guide > Executing NX Open Automation > Execution Methods > Execution Methods > Adding Custom Applications to NX

Adding a Custom Menu to go with the Custom Application

A custom menu only visible while a specific custom application is active needs a new .men file in the app's application directory. Each menu item needs a callback registered via the AddActions / AddMenuAction NXOpen method.

Example .men (MenuBarCppApp.men):

VERSION 120
EDIT UG_GATEWAY_MAIN_MENUBAR
TOP_MENU
CASCADE_BUTTON SAMPLE_CPP_APP_MENU
LABEL Sample CPP
END_OF_TOP_MENU
MENU SAMPLE_CPP_APP_MENU
BUTTON SAMPLE_CPP_APP_BUTTON1
LABEL Print Button ID
ACTIONS SAMPLE_CPP_APP__action1
...
TOGGLE_BUTTON SAMPLE_CPP_APP_BUTTON...

Rules:

  • CASCADE_BUTTON <name> — name after CASCADE_BUTTON must match the name used after MENU (defines the pulldown that follows).
  • BUTTON / TOGGLE_BUTTON <name> — the button's own name; in Java apps this name is what identifies which button fired the callback.
  • LABEL — display text.
  • ACTIONS — must match the action-name string passed to the app's AddMenuAction call (a code-side registration), NOT necessarily a bare script filename.

Full worked examples per language: %UGII_BASE_DIR%\ugopen\SampleNXOpenApplications\{C++,.NET,Java}\MenuBar*App\.

Relevance to spine-panel-kit

Our application\spine_panel_app.men uses ACTIONS spine_assign_panel.py (bare journal filename resolved directly by NX from the application dir) — this works and is the simpler, code-free path. This doc describes the alternative, code-driven path (C++/.NET/Java app explicitly calls AddMenuAction("SAMPLE_CPP_APP__action1", callback) to bind an action name to a compiled callback) — relevant if we ever want ArchitectureTab.cpp itself (rather than a bare .py journal) to directly own a menu button's callback, e.g. to call ResourceBarManager::ActivateTab straight from a menu click instead of going through the Tools > Architecture Panel journal indirection.

Source: https://docs.sw.siemens.com/en-US/doc/209349590/PL20220512394070742.nxopen_prog_guide/genid_adding_a_custom_menu_to_go_with_the_custom_application_25_2561 · retrieved Tue Jul 07 2026 00:00:00 GMT+0000 (Coordinated Universal Time)