Showing results for 
Search instead for 
Do you mean 
Reply

Startup and Application Folder

Dear Community,

 

I always get confused with the startup folder and application folder, custom_dirs.dat file and environment variables.  Where in the UG documentation provides a good explanation of how and where to setup these files and environment variables.

 

Thanks.

12 REPLIES

Re: Startup and Application Folder

 

I suspect it is in the Programmer's Guide, but here is a cheat sheet you can use in the meantime:


The simple way to define the correct "application" or "startup" directory is to
check and see if you have an environment variable called UGII_USER_DIR pointing
to some directory.  

If you do, then create a directory called "application" in that directory, and
create one called "startup" in the same directory.
 
If you do not have UGII_USER_DIR defined, you can set it in the Windows Control
Panel, under System -> Advanced -> Environment Variables.

For example, you might have UGII_USER_DIR pointing to "D:\user_dir\".  Then you
would create a directory called "D:\user_dir\application" and put the .dlg or .dlx file in that directory.

You can also create a "startup" folder under "D:\user_dir\", for .DLLs that you want to run when NX starts.

If you aren't sure about that environment variable, select Help->NX Log File from
the main menu, and then search for UGII_USER_DIR - it may be a case sensitive search.

That's the simple method.  There is a more complicated method described below.

/*--------------------------------------------------------------------------*/

Here is the other method, which adds one more layer of complexity, but also allows
some additional flexibility.

You can create a simple text file with a list of directories in which you want NX
to look for "application" and "startup" directories.  This text file could contain
only one directory, or as many directories as anybody would reasonably need.  

The file just needs to have each directory on a separate line.

So the file could look like this:

D:\user_dir

Or it could look like this:

D:\user_dir
D:\designers
D:\checkers
D:\path\to\some\directory
M:\my\network\drive

(and so on)

And NX would look for "application" and "startup" directories UNDER each of the listed directories, in the order that they appear in the file.

You can call this file anything you want, but in our docs we usually call it
"custom_dirs.dat", so that it is easy to recognize.

Once you have the file created, you have to point at it with a particular environment variable called UGII_CUSTOM_DIRECTORY_FILE.  Be sure that the definition includes the complete path and file name, not just the name.  For example, UGII_CUSTOM_DIRECTORY_FILE could be set to "D:\my_data\custom_dirs.dat".

(You may see a similar variable called "UGII_UG_CUSTOM_DIRECTORY_FILE" - don't get them mixed up, and don't redefine the longer one.)

Re: Startup and Application Folder

 

In the NX10 docs, see NX Open -> NX Open Programmer's Guide -> Executing NX Open Automation -> Application Directory Structure.

Re: Startup and Application Folder

Note that in the custom_dirs.dat file you can reference your directories using environment variables also. E.g.: ${nxAppDir} This way you could use the same custom_dirs.dat file at different sites that may have different root locations for the NX custom directories. The environment variables could be defined in your NX startup bat file.
Ric Hotchkiss
Applications Consultant
rhotchkiss@daasolutions.com

O: 860-749-3832x214
F: 860-749-3842
C: 860-463-8486
Design Automation Associates Inc
68 Bridge Street, Suffield CT 06078
Website: http://www.daassolutions.com

Engineering Software & Engineering Services:
Design Automation, Training & Mentoring
NX, Knowledge Fusion, NX/Open, Checkmate
Mechanical Design, Structural & Thermal Analysis

Re: Startup and Application Folder


daa2 wrote:
Note that in the custom_dirs.dat file you can reference your directories using environment variables also. E.g.: ${nxAppDir} This way you could use the same custom_dirs.dat file at different sites that may have different root locations for the NX custom directories. The environment variables could be defined in your NX startup bat file.

For another project, I used the UGII_USER_DIR approach and that worked fine.

-Create a new folder in "C:\users\username\yourapplicationname"

-Create an environment variable UGII_USER_DIR=C:\Users\username\yourapplicationame\src

-add your dlx and python files in the src folder

 

Now I am trying the custom_dirs.dat approach but it does not seem to be working

 

-In UGII/menus/custom_dirs.dat, I added this line

$UGOPEN\SampleNXOpenApplications\Python\BlockStyler\MatrixOperations

 

-I created an environment variable UGII_CUSTOM_DIRECTORY_FILE=C:\Program Files\Siemens\NX 10.0\UGII\menus\custom_dirs.dat

 

I placed the Matrixoperations .dlx file in the UGOPEN\SampleNXOpenApplications\Python\BlockStyler\MatrixOperations folder

 

Then in NX10, I used the journal to run the Matrixoperations.py file and I get an error message that says "None type" object has no attribute "Show"

Re: Startup and Application Folder

First:

I would NOT modify ANY files in the install folder tree.

 

But that aside...The file may need to be in the "application" subfolder, i.e.

UGOPEN\SampleNXOpenApplications\Python\BlockStyler​\MatrixOperations\application

 

If it is meant to be run at NX start, then put in in the "startup" subfolder:

UGOPEN\SampleNXOpenApplications\Python\BlockStyler​\MatrixOperations\startup

 

Ken

 

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled


Re: Startup and Application Folder

[ Edited ]

Re: Startup and Application Folder

[ Edited ]

 

 

I needed to add this line to the custom_dirs.dat file

 

${UGII_BASE_DIR}\ugopen\SampleNXOpenApplications\Python\BlockStyler\MatrixOperations

 

where UGII_BASE_DIR is the environment variable

 

not

$UGOPEN\SampleNXOpenApplications\Python\BlockStyler\MatrixOperations

Re: Startup and Application Folder

@AlexLee Is there a specific reason, that you choose to keep your .dlx files  in the base directory( as pointed by the UGII_BASE_DIR variable ? Is it because that NX was unable to identify, if you kept it in a directory other than the base directory?. I have tried all the steps and I am trying to make a applications folder in C:\Users\myusername\Documents\TestFolder\applications. But NX is unable to detect the .dlx file when I execture the .dll file.

Re: Startup and Application Folder

It is important that your directory name is "application" - there is no "s" on the end.

 

Then define the folder above it with UGII_USER_DIR - or list it in your custom_dirs.dat file.

 

So for example, if you set:

 

UGII_USER_DIR=C:\Users\myusername\Documents\TestFolder

 

And then you put your .dlx file in

 

C:\Users\myusername\Documents\TestFolder\application

 

Then NX should find the dialog file.