NXKnowledge

NX Open Programmer's Guide > Executing NX Open Automation > How to Execute the Open API

How to Execute the Open API

Describes the various ways to execute an NX Open application.

Interactively

Run an internal program interactively via File tab → Execute → NX Open, which opens a file selection dialog for choosing the program.

From the Operating System

Run an external standalone program the same way as any other executable on the platform — requires execute permission; run the file name followed by any command-line arguments the program accepts.

User Exits

A user exit is an internal Open C/C++ API program with a unique entry point at a specific location within NX. The argument list for each function is identical to ufusr. See "User Exits" or header file uf_exit.h.

Each user exit has a unique environment variable pointing to the image to execute. When defined, and the corresponding menu option is chosen, the program executes — e.g. a user exit occurs at File tab → Open.

A special user exit, ufsta(), runs at NX startup, using environment variable USER_STARTUP. This entry point can also be used by MenuScript and User Defined Objects (UDOs); unlike MenuScript, in the UDO case this entry point fires when an external Open C/C++ API program runs.

Note: GRIP programs can also be used as user exit programs.

MenuScript

Bind an internal Open C/C++ API program to a customized application (Motif) button within NX — see "Adding functions to NX menus". The uf_mb.h function (Open C/C++ Reference) is the programmatic interface into MenuScript.

Directory structure example: my_functions.dll (shared library executed on button selection) + my_functions.men (ASCII menu file relating the library to NX). See "Application Directory Structure".

At Start-Up

Custom programs can run at startup. UDO classes/methods can be auto-registered with NX during initialization (for both interactive sessions and external Open C/C++ programs) by placing shared libraries in the udo subdirectory of a directory listed in the file pointed to by UGII_CUSTOM_DIRECTORY_FILE (defaults to $UGII_BASE_DIR/ugii/menus/custom_dirs.dat). See "Application Directory Structure".

User Tools

The NX User Tools option opens a User Tool Dialog to launch an internal Open C/C++ API program or GRIP program. See "User Interface Preferences – User Tool preferences".

Note: .utd (User Definition Tool) and .tbr files from earlier NX versions are still supported for customizing dialogs/toolbars, but using the Customize dialog box is now recommended instead.

XSPAWN from GRIP

Execute an internal or external Open C/C++ API program from a GRIP program using the XSPAWN command (second format):

XSPAWN/UFUN,'program name'[,IFERR,label:]

See the GRIP Reference Guide for details.

Related Topics

  • Execution Overview
  • Execution Modes
  • Environment Variables
  • Application Directory Structure
  • Unload Options

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