Skip Navigation LinksNX-Network-Configuration-Part-4


NX Network Configuration Part 4:  NX Startup Scripts 

In this NX A to Z article, I will show you how to use startup scripts to automatically configure your NX environment every time you start NX. This is very helpful if you run different versions of NX or if you ever need to change your NX environment variables file between NX sessions.

Windows System Variables

The key to startup scripts is that you can use them to set Windows system variabls and you can use Windows system variable to control NX.

This article is going to use the example of having to run different versions of NX. When you install NX, there are several version specific Windows system variables that are defined – UGII_BASE_DIR and UGII_ROOT_DIR. These are shown below.

So, these present the first issue when running different versions of NX. Without a startup script, you would have to edit these Windows system variables every time you switch from one version to another. The other primary issue is the NX environment variables file. Typically, from one version of NX to another, you have to update your customizations for the new version. For example, if you have a site level customer defaults file or drafting standard, you’ll need to import them into the new version of NX and them save them as a separate file. The easiest way to manage customizations for different versions is to have version specific folders on your network for your customizations files. Show below is the network folder for all of Endesin’s NX customizations and as you can see there is an NX7.5 folder and an NX8 folder.

User Functions are not version specific so they are not in the version specific folders.

Inside the folder for each version is the NX environment variables file and then all the customizations for that version as seen below.

If you haven’t read the NX A to Z article on the NX environment variables file, you should definitely do that first. Changing the NX environment variables file is the first step when customizing NX.

As was stated in the NX A to Z article on customizing the environment variables file, you can use a Windows system variable to point your users to your custom environment variables file. This allows you to only have to maintain one custom NX environment variables file on the network for each version. This is shown below. Obviously, if you are using a Windows system variable to point to a version specific NX environment variables file, then that would be another thing that you would have to go in and change every time you switched between versions.

So, the answer to how to get around manually changing these Windows system variables when you switch between versions is to use a startup script. Endesin’s NX8 startup script is shown below.

The startup script is just a text file with a .cmd extension. The commands in the file are DOS commands. Each line of the file is broken down below.

  • @echo off tells DOS that you don’t want to show the commands in the DOS window.
  • The set lines set Windows system variables, which are the key to this whole thing. UGII_BASE_DIR and UGII_ROOT_DIR are required by NX. UGII_ENV_FILE tells NX where your custom NX environment variables file is and UGII_3DCONNEXION_LIBRARY is used by a 3D Connexion motion controller if you are using one.
  • The start line starts NX 8.
For the NX 7.5 script, you would replace Siemens\NX 8.0 with UGS\NX 7.5 and you change UGII_ENV_FILE to point to your NX 7.5 environment variables file as shown below.

Something to keep in mind is the Windows system variables that are set with the startup script do not show up in the Environment variables window that was shown earlier. They are only active for the NX session that you start with the script. One way to confirm that you’re system variables are correct is to check the NX log file as shown below.

Now that you have your startup script written, the last thing you need to do is point to it with your NX icons. So go to Start->All Programs->Siemens NX 8.0 and right click the NX 8.0 icon (or right click the icon on your desktop if you have it there) and click Properties. Then change the Target to point to your startup script as shown below.

You can keep your startup script on the network and point all your users to the same script and you can even use Windows group policy to automatically put the shortcut to the script on their desktop on in the All Programs folder. A couple things to note:


  • If you want to pin the icon to the Start Menu, you need to pin it before you change the Target. If you change the Target and then try to pin the icon to the start menu, you will get an error.
  • You don’t have to use different NX environment variables files, you can use the script to change a specific NX environment variable. Say for instance that you have to different CAM customization folders, but everything else is the same, then you can set the UGII_CAM_CUSTOM_DIR environment variable with the script instead of pointing to a new NX environment variables file.
That’s it for startup scripts. Hope you learned something.

Dave Holland