NX Network Configuration Part 2: Templates
In this installment of NX A to Z, I am going to go through how to set up template files on your network that everyone can share and access easily. I am also going to provide a set of sample drawing templates and an NX Open for .NET automation program that you can use to easily fill out the title block.
Making Template Files
The first step in setting up templates is to create the template files. Template files are simply NX files that have stuff in them that you want to be in every NX file you make using that template. The default modeling templates, for example, have coordinate systems in them. Maybe you start every model you make with the same sketch, so that sketch should be in your template.
The UGII Site Directory
One thing to keep in mind is that if you change your Customer Defaults, your template files may not necessarily change accordingly. Some Customer Defaults are part specific, and are loaded into a part only when it is created from the Blank template, so if you create a part from any other template, it will inherit the part specific settings and preferences from the template part, not the Customer Defualts.
Drawing templates are NX files with a drawing sheet in them and a title block on the sheet, and a title block is just some curves and some text. I have put together some sample drawing templates that you can download
here and there are also sample templates in
%UGII_BASE_DIR%\ugii\templates. The templates I created have all of the title block information on Layer 191 and when you open them up, Layer 191 is visible only, so you won’t be able to edit the title block. This is by design because when you create a drawing using the template, you don’t want to be editing the static title block information. The figure below is Endesin’s A size template. Just make layer 191 selectable and delete the Endesin picture and put in your own. The templates were made in NX 5, so they will work in any version from NX 5 up.
There are also sheet templates in the zip file for additional sheets (sheets 2 and up) that have a simplified title block.
In part 1 of the NX network configuration series, I talked about the environment variables file and how to set the
UGII_SITE_DIR variable to point to a folder on your network. Now, we are going to be using that folder to store the templates, so if you haven’t already set
UGII_SITE_DIR, you need to do that first.
Once you have
UGII_SITE_DIR set up, create a folder in the directory called Startup and put all of your templates in the Startup folder as seen in the picture below
UGII_SITE_DIR variable is set to
O:\NX-Config\NX7.5\Site and then in this directory I have the
Startup folder and in
Startup, I put all of my templates (the .prt files). I mostly only have custom drawing templates, but if you look in
%UGII_BASE_DIR%\ugii\templates, you will see many more examples of templates for all of the different NX applications.
You can also use the environment variable to
UGII_TEMPLATE_DIR to point directly to the folder with your templates; however, there are other network configuration files that you will use
UGII_SITE_DIR for, so you might as well use it for the templates as well.
Now that you have your templates all set, the next step is to create the pax files. As you can see in the figure above, there are a bunch of files at the bottom of the list that have a .pax extension. In NX, a pax file is a list of NX part files that users can select as template files from the the
File->Open dialog or the insert sheet dialog or a few other places.
NX uses default pax files to configure the
File->Open dialog and they are in
%UGII_BASE_DIR%\ugii\templates along with the template files and if you look, you will notice they have the same names as the pax files shown above. What this means is that the custom pax files shown above will override the default pax files and I won’t see any of the default templates that come with NX – I will only see my custom templates. This applies to CAE templates, modeling templates and drawing templates because those are the three custom pax files that I have created (sheet templates are not in the
File->New dialog, they are in the insert sheet dialog and the
ugs_sheet_templates.pax file controls the insert sheet dialog).
If you want to see both your custom templates and the default templates, then you need to copy the default templates and the default pax files to %UGII_SITE_DIR%\ Startup and you need to add an entry to the default pax files for each of your custom templates. Needless to say, your templates cannot have the same names as the default templates.
That is all well and good, but how do you add a custom entry to a pax file? pax files are XML files and they contain one entry for every associated NX part file and each entry has the name of the file, a description and picture to show in the various dialogs, the purpose of the file and the units. The figure below shows my
ugs_drawing_templates.pax file. It is pretty much the same as the default
ugs_drawing_templates.pax, because I just copied all the default templates and the default pax file into
%UGII_SITE_DIR%\ Startup and then changed the template files to look how I wanted them. So if you don’t want to keep the default templates, then that is all you have to do…Copy the pax files and template files into
%UGII_SITE_DIR%\ Startup and then change the template files so they are how you want them. If you want to keep the default templates and add your own, then create your template file, put the default template files, the default pax files and your custom template files in
%UGII_SITE_DIR%\ Startup and copy and paste a palette entry in the appropriate pax file (ugs_modeling_templates for model templates, ugs_drawing_templates for drawing templates, etc.) and then change
<Filename> to point to your new template and change the id attribute to an unused number.
You can also change the name and the description that are shown in the
File->New dialog and you need to make sure that the units are correct and you need to make sure that you are adding it to the correct pax file. The name and description are shown as highlighted in the
File->New dialog below and the picture is what appears on the right above where the name and description are shown.
So now you should have
UGII_SITE_DIR set in your environment variables file, you should have all of your drawing templates in the
%UGII_SITE_DIR%\Startup folder and you should have pax files and pictures for all of the applications for which you want custom templates. Now fire up NX and check the log file by going to Help->NX Log File and search for
ugs_drawing_templates and you should see this:
NX found your custom pax files and processed them and if you go to
File->New, you should see your custom templates in their appropriate tabs.
If you want more tabs in the
File->New dialog, then just create copies of the existing pax files and change the
<Presentation> line in the pax file by editing the FileNewTab attribute, then replace the palette entries with your own.
The Endesin Templates
UGII_SITE_DIR as explained in
NX Network Configuration Part 1.
- Create the Charlene Wittstock folder.
- Copy the template files and the pax files from
%UGII_SITE_DIR\Startup for all of the applications that want to be able to use custom templates.
- Modify the template files you just copied to
%UGII_SITE_DIR\Startup if you don’t want to keep the default templates.
- If you want to keep the default templates, then create your own templates and add an entry to the matching pax file for each template you create.
- If you want your templates in a new tab, then copy the pax file for the relevant application, change the
FileNewTab attribute, delete the existing entries and add your own.
downloaded Endesin’s templates, you’ll notice there was also a file called
TITLE-BLOCK.vb is a vb.net macro that uses the NX Open for .NET API to provide a dialog box for filling out the title block on the Endesin drawing templates. It is an alternative to using part attributes, which is what the default templates use. So, just put the
endesin_utilities.men file in
%UGII_SITE_DIR\Startup with the templates and the pax files and then you can put the
TITLE-BLOCK.vb file in any network folder, and then edit the highlighted portion of
endesin_utilities.men as shown below to point to the location where you saved
Once all that is done, fire up NX and you will see the menu as shown below
File->New and create a drawing. The drawing templates in NX use the Master Model Approach, meaning the drawing file is actually an assembly and you select a component (the master model) for the assembly when you create the file. This allows the model to be worked on at the same time as the drawing and it also allows a different set of permissions for drawings and models. You select the master model in the
Part to create a drawing of section.
When you click OK, you will see the drawing sheet and the place view command will be active, so hit escape to cancel the place view command and then go to
Endesin Utilities->Title Block and you should see this
It is asking for the letter, so enter A, B, C, D or E and hit enter and you get this
Just type in your information and click OK and it is all placed in the title block
And if you have additional sheets, just select all of the notes in the right most column and copy them, then activate the next sheet and paste them (if you’re in NX 7.5, select None when the Transform window comes up) and they will be in the sheet title block as shown below.
More information can be found in the NX documentation at
NX Essentials -> Gateway to NX -> Getting Started -> Creating a New Part File -> Working with Templates
If you have any questions or comments on this article, please feel free to contact me at
firstname.lastname@example.org. Good luck with setting up your templates.