Showing results for 
Search instead for 
Did you mean: 

NX Quick Tips: Attributes and List Expressions

Siemens Legend Siemens Legend
Siemens Legend

NX Quick Tips - Attributes and List ExpressionsThis post has moved to the NX Design Knowledge Base.


The complete NX Quick Tips video series can be found here.  





This link doesn't work for me. Can someone else verify that it works for them?

Solution Partner Pioneer

how i can create attribute with list of value

Valued Contributor

Nice tutorial. I was wondering how you set up the part numbers to change. Also, can lists ONLY be used with integers and numbers? Nothing else seems to work for me. It seems that your attribute for controlling the list needs to be in sequencial integers, starting from number 1. Is this correct?

Siemens Phenom

edoplcd004 --


I think “Attribute Templates” are the thing you’re after here:


I'll comment again in a minute with a "how-to" and some answers for KUEI's questions.  :-)


Taylor Anderson
NX Product Manager, Knowledge Reuse and NX Design
Tel: +1 (602) 441-0683

Siemens Phenom

Easiest way to answer these was with a little video.  This should show how to set up the Attribute Templates:




These can either be stored in a part -- great for use in a Start Part, for example -- or stored in an external catalog of Attribute Templates.  In the video I've stored them in the part.


The Attribute Templates command can be found (in the Ribbon UI) at File --> Utilities --> Attribute Templates.  That particular menu pick was slipped off by the size of my video.  :-)


To KUEI's questions...


>> Can lists ONLY be used with integers and numbers?


Nope.  I've created one here with integers and one with strings.  Should work fine for all types.


>> It seems that your attribute for controlling the list

>> needs to be in sequencial integers, starting from

>> number 1. Is this correct?


Again, no.  In the video I've created the list starting at 2, with an irregular sequence of numbers. This should be quite flexible.


Does that help?


Taylor Anderson
NX Product Manager, Knowledge Reuse and NX Design
Tel: +1 (602) 441-0683

Siemens Phenom

Just one more comment on this...  Personally, I wouldn't have gone the Attributes route here like John demostrated.  While this kind of setup is certainly possible, I personally like to keep the model parametrics in Expressions, rather than jumping back and forth between Expressions and Attributes, adding all of the links to connect the two worlds.


Starting with NX 11, setting up options like this is possible just within the Expressions dialog.  The video below shows a few things...



1. Using a list expression, how to create an in-line option menu for an expression of any type.  (In expressions, these are always non-exclusive... You can always override the list value by typing a new value directly.)


2. Immediate associativity between the list expression containing the options and the in-line option menu.


If you watch closely, this video also shows the automatic "type" auto-correction for newly created expressions.  NX recognizes things with quotes around them as strings, for instance, or curly brackets as lists, and automatically corrects the type at creation time (only.)


...and of course, if you know me, the obvious next step I'd recommend here is adding a Product Template interface here using Product Template Studio (PTS.)




Enjoy!  :-)


Taylor Anderson
NX Product Manager, Knowledge Reuse and NX Design
Tel: +1 (602) 441-0683

Valued Contributor

Thank you very much for the video. This does not really reflect my problem. I used the attribute templates. Where I was having a problem was with using the "nth()" command in the expressions and linking those to what I created in the attribute templates. lets us say I had the following numbers in my list:






Now, If I selected #3, I would get a return value of 5 because it was the 3rd number down on the list.

And, the nth() command does not seem to work at all if the first entry of the command links to a list of strings. Therefore, picking a part by it's part number instead of it's place withing the list was not working.

Thank you again for the help. I hope you understand.

Valued Contributor

Another nice video. Thanks again. You are correct. Linking the attributes with the expressions can be very problematic and not too user friendly. They do not always want to link and creates a lot of troubleshooting time. Why they chose 3 pages "attributes template", "attributes" and "expressions" makes me wonder what they were thinking because it does not work well. As an example of what I am trying to accomplish, here is a link to tap collets:


I have created a model that changes feature sizes and text on the part based upon whichever collet you select. You have to pick the part from a sequencial list within the attributes. What I REALLY wanted was to be able to pick the collet by vendor part number, but I could not find a way to get NX to let a string  (part number) to be used as the control. So, I had to make a dummy list with sequencial numbers.

Siemens Phenom

I see where you're going...  Yeah, the Attributes Templates mechanism does not really give you the option of returning the "indexed value" versus the "array index" like Product Template Studio does.


Here are a couple of options -- one using PTS and one with just expressions.


With PTS, you could just stick all of the data in one list expression (table, really) like this:




...with an nth() statement for each desired output like this:




 ...and then have users drive the Product Template UI like this:




...using a setup like this in PTS for the selection:




In this example, PTS uses the "UI_labels" expression to label the options in the menu, but returns a nice clean integer indicating the "index" of the selection from the list.  And that's really easy to use for pulling all of the values out of the list.  :-)


Alternately, if you were doing it just with expressions, you could adjust the expressions to look like this:



...and get this kind of interaction:




The one pitfall lurking in here is that "position()" function.  As long as it has a good value (as long as the option is present in the list) then it hangs together well.  But if the option is not present in the list, the failure is pretty cryptic right now.


In the end, the PTS route is the cleanest, and the easiest to set up IMHO.  :-)


Does that give you some ideas?


Taylor Anderson
NX Product Manager, Knowledge Reuse and NX Design
Tel: +1 (602) 441-0683

Valued Contributor

NOW we are on the same page! Wonderful. This is exactly wear I want to be. Thank you so much for the help.

Siemens Phenom

Glad to help.  :-)


Hi Taylor,


Is it possible to fill the "Value List" with the content of an excel or txt file ?


without using copy / paste because I need an automatic update


Thanks in advance




attribut template.jpg

Siemens Phenom




Two potential answers...


1. Attributes


Since you've included a screen capture of the Attribute Templates dialog, you may want to investigate the Attribute Template Catalog.  (Top radio button on the dialog there.)  That's the way I know about for storing a set of predefined attributes, including the options, from an external source.

A page in the docs that might get you started is here:


NX Docs: Storing attribute templates


2. Expressions


As I mentioned above, for a design problem like the one John describes in the original post, I wouldn't use attributes at all.  I would keep the parametrics in the expressions.  And within expressions, there are certainly some nice functions for reading sets of values out of Excel (either from the operating system or from Teamcenter, for instance) and dynamically populating a list of values.


The ug_read_list() function, in particular, is super-handy for this:




I have a set of example parts from NX 8.5 when we introduced dynamic option menus for PTS (Product Template Studio.)  Each example has an accompanying movie file describing the techniques.  The use of this function (along with a bunch of other related topics) is detailed in example #4, and there are some slightly more advanced usages in examples 5, 6 and 7 as well.  These specific examples are in the context of PTS, but the expressions setup is exactly the same with or without PTS.

PTS_dynamic_menu_examples_NX85.7z (61MB 7z archive)


Does one of those answer your question?  :-)





Hi Taylor,


Thanks for you answer


1°) Attributes


I will investigate using xml files, but where are they ? and did you have an example ?


2°) Expressions

I started watching your videos. They are very clear

Unfortunatly, at this time my PTS licence is down and I let you informed

Siemens Phenom

Easiest way to create the XML file appears to be creating the Attribute Template interactively, and then exporting the XML catalog file.


Directions for creating the Attribute Template are here:


NX Docs: Create an attribute template


...and then you can create the Attribute Template catalog using Export to Catalog in the Attributes Template dialog box.


Does that make sense?


Hi Taylor,


Thanks a lot, I apologize, I didn't open the whole menu.


Do you know the syntax in xml to read the content of a txt or excel file ?


modèle type attribut catalogue 3.jpg

Siemens Phenom



I think the point is that the XML file *is* a text file.  You can read in a text file to create Attribute Templates as long as that text file is a correctly-formatted XML file.


The Excel integration is only available with Expressions, and not with Attributes.  And again, for a design problem like the original post, I would strongly recommend the expressions route I've described in this thread over the Attributes route that John describes.  :-)


Does that help?


Hi Taylor,


Thanks a lot


Best Regards