You are on page 1of 2

Create a Custom Nx Toolbar and Menu | ParaCAx

Page 1 of 2

Sign in

Create a Custom Nx Toolbar and Menu


and Researchers
Students
Faculty
A custom
Nx Toolbar to run
application (.dll) files from the Nx GUI by means of a button can be created in the following way.
*Create a folder called ug_customization in a unique location.
*Create subfolders within the ug_customization folder named application, and startup
*Create files nx.bat and custom_dirs.dat within the ug_customization folder using notepad or some other text program.
*Create a file named NxFoil.tbr inside of the startup folder.
*Put desired .dll application files and .bmp images for buttons into the application folder.

The nx.bat file should have the following text inside of it:
set UGII_USER_DIR=J:\ug_customization
set UGII_CUSTOM_DIRECTORY_FILE=%UGII_USER_DIR%/custom_dirs.dat
"C:\Program Files\UGS\NX 6.0\UGII\ugraf.exe"

Line 1 should set the location of the UGII_USER_DIR to your ug_customization folder. Line 2 sets the location of the UGII_CUSTOM_DIRECTORY_FILE to
your custom_dirs.dat file. Line 3 starts Nx from ugraf.exe. By running the nx.bat batch file, Nx will launch and your custom toolbars and buttons will be
created in the Nx GUI.

The "custom_dirs.dat" file should contain this line in it:


$UGII_USER_DIR

An example of what should exist in the "NxFoil.tbr" file appears below:


TITLE NxFoil
VERSION 170
DOCK TOP
BUTTON NxFoil
LABEL NxFoil
BITMAP $UGII_USER_DIR\application\plane.bmp
ACTION $UGII_USER_DIR\application\lab7.dll

The first line replicates the name of the .tbr file as the Title. Im not sure what the Version line does. DOCK TOP will dock the custom buttons to the top
of the Nx GUI. The Button and Label categories name and label each button inside of your custom toolbar. The Bitmap line defines a .bmp file to be used
as the button graphic. The Action line defines the .dll file to run when the button is selected. It is good to copy each of the required .bmp and .dll files
into the application folder.

If you desire to add more than one button, you may add additional Button, Label, Bitmap, and Action lines for each button you want to create.

To create a custom menu from which to run your custom code, all you need to do is add a file with the same name as your .tbr file but with a .men file
extension. For example, if you have a file called myfile.tbr then you will need to add a file called myfile.men. The format of the .men file is similar to
the .tbr file. Example code follows below:
VERSION 120
EDIT UG_GATEWAY_MAIN_MENUBAR
BEFORE UG_HELP
CASCADE_BUTTON TEST_MENU
LABEL Evan's Code
END_OF_BEFORE
MENU TEST_MENU
BUTTON LAB7_BUTTON
LABEL Lab 7
BITMAP $UGII_USER_DIR\application\plane.bmp
ACTIONS $UGII_USER_DIR\application\lab7.dll
BUTTON MIDTERM_BUTTON
LABEL Midterm Code
BITMAP $UGII_USER_DIR\application\sheets.bmp
ACTIONS $UGII_USER_DIR\application\midterm_nx.dll
END_OF_MENU

http://paracax.byu.edu/content/create-custom-nx-toolbar-and-menu

9/22/2015

Create a Custom Nx Toolbar and Menu | ParaCAx

Page 2 of 2

The first few lines set up the properties of the menu. The EDIT line allows the menu bar to be edited to include your custom code applications. The
BEFORE line defines where in the Nx Toolbar the new menu will appear. This code will place the new menu before the help menu. The line beginning
CASCADE_BUTTON sets up another property of the menu. The LABEL is the title that will appear on the toolbar menu. The END line ends the menu
property set up.

The MENU line begins the section of the code that will define each menu item. Each item is defined by a BUTTON, LABEL, BITMAP, and ACTIONS
line just like the custom buttons on the toolbar which is discussed above. To end the menu code, an END_OF_MENU line is included.

In order to get your custom buttons and toolbar menu to appear, you must open Nx by running the .bat batch file which you created in the
ug_customization folder. Another thing you can do is right-click your Nx shortcut button on your desktop and edit the properties. You can change the
target to open your batch file when the shortcut is selected so that you no longer need to navigate to the batch file when you want to use Nx with your
custom applications.

Page created by Evan Selin


Create Sketch

up

Create a Spline from points and rotate it

Contact

Favorites

ME Research Programs

Address / Telephone:

ME News / Videos

ALBDF

Twitter

ME Merchandise

Babel

Facebook

BYU-Hawaii

Internships / Jobs

BESD Lab

LinkedIn

BYU Racing

C-UAS

YouTube

LDS Business
College

Capstone

Compliant Mechanisms

Paracax Department of
Mechanical Engineering,
BYU, Provo, UT 84602 (801)422-2625

Directions:
Address/Directions

Web:

ME Resources

Design Exploration

meweb@byu.edu

Give to BYU-ME

Flapping Flight

Campus Map

FLOW Lab
Fluids Lab

Follow

Share
Twitter
Facebook
LinkedIn

BYU-Idaho

Salt Lake
Center
Jerusalem
Center
Missionary
Training
Center

Flux Lab
Friction Stir
MAGICC
Materials
Neuromechanics
PACE

Copyright 2014, All Rights Reserved

ParaCAx
RaD Lab
v-CAx
Waves

http://paracax.byu.edu/content/create-custom-nx-toolbar-and-menu

9/22/2015

You might also like