Due to the shortage of comprehensive online information on the mechanics behind the templates for the 3D cad software NX Unigraphics, this is an attempt to at least increase the number of explanatory efforts available in the marshes of the web by one.
This is one way of doing it, with all templates in a custom template folder, parts and drawings separated, and the part properties linked to the drawing. The software version is NX 7.0, but it’s likely that it will work for both earlier and later versions of the program.
A part template needs some custom properties if its going to propagate something to the drawing later on (the same goes for an assembly template). Starting with an standard or empty file the properties window can be accessed through File->Properties and desirable variables are assigned under the Attributes tab.
One interesting property is MATERIAL, because its value is automatically updated when the part material is changed, and it also has an alternative way of linking that is explained later. Most other custom properties however has to be changed manually. A blank space is recommended instead of an empty value, due to difficulties when accessing empty notes in the drawing later on.
Save the part to the folder intended for holding the new custom templates when all properties are added.
The drawing template can then be created from some of the default drawing templates, or a blank one. Some of the graphic objects are placed in locked layers of the drawing, and can be unlocked through Format->Layer Settings by unchecking the Visible only box in front of the layers (255 and 256 Siemens default layers for background structure). After the lines and boxes have been moved around and the fiddling with the appearance is getting boring, its time to connect the drawing to the part properties.
Either a new note is created or an already existing is modified (double click it), which results in the arrival of yet another window. Under the title Text Input the text and linkage to other variables is done. By changing the Category (either drop down list or icons directly under the text box) to Relationships, three ways of connecting variables are presented. The Insert Part Attributes seems to refer only to properties inside the drawing itself, and Insert Expression is not good for this kind of connection. The Insert Object Attribute however is more suitable to the task. When clicking it the prompted for Target Object should be the part already inserted in the drawing, which can be any part (if drawing is empty, just insert a random part) , but the trick is to select the part in the right way.
To do this and avoid selecting uninteresting objects in the drawing, like frames and display views, the part should be targeted through the Assembly Navigator tab on the left hand side, where the inserted part should appear as an instance at the end of the small item hierarchy. Selecting it should result in the appearance of a small list of the part properties that where previously created.
After a property has been chosen a text string will be generated in the Text Input field. It should say something like <W!29235@MATERIAL>, where the five digit number represent a unique id for the chosen object (the part). This number is later automatically replaced when the drawing is treated as a template, so when all desired properties have been linked in their notes all over the drawing the only remaining thing to do is to save the drawing in the newly created custom templates directory.
The material variable can however also be accessed through a predefined link, together with a few other that might come in handy. Other custom properties from the part are not that lucky, and has to be linked in the way described above.
Some common predefined attributes:
For the custom templates to appear in Nx the pax-files has to be edited. To start a custom directory with only model and drawing templates, only the ugs_model_templates.pax and the ugs_drawing_templates.pax files has to be copied to the custom template folder, and can be found in the C:\Program\UGS\NX 7.0\UGII\templates directory (default installation). In those files a section containing:
has to be modfied. The variables id, name, description, units and filename should be edited to point at the desired template file for each entry. Unwanted entries should be removed, as long as the code at the start and end of the pax-file remains.
To start up Nx with a custom templates folder a batch file (.bat) with the environment variable UGII_TEMPLATE_DIR set to the desired folder. Presuming default installation location the following three lines should be sufficient for a working batch file to start NX 7.0 with a custom templates folder.
cd C:\Program\UGS\NX 7.0\UGII
This folder should then be populated by the template files and the corresponding pax-files (.pax). Examples of both templates and pax-files can be found in the C:\Program\UGS\NX 7.0\UGII\templates directory.
This should hopefully result in a working set of home made drawing templates ready for creations.