Showing results for 
Search instead for 
Do you mean 

NX Quick Tips: Attributes and List Expressions

by Siemens Legend Siemens Legend on ‎07-03-2014 02:28 PM - edited (16,161 Views)

This post has moved to the NX Design Knowledge Base.

 

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

 

Jerry 

 

Comments
by Phenom
on ‎07-07-2014 04:15 PM

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

by Solution Partner Pioneer Solution Partner Pioneer
on ‎04-30-2015 07:03 AM

how i can create attribute with list of value

by Valued Contributor
on ‎05-11-2017 06:28 PM

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?

by Siemens Legend Siemens Legend
on ‎05-15-2017 06:55 PM

edoplcd004 --

 

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

 

https://docs.plm.automation.siemens.com/tdoc/nx/11/nx_help#uid:xid1128423:index_customizing_nx_insta...

 

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
taylor.anderson@siemens.com

by Siemens Legend Siemens Legend
on ‎05-15-2017 07:21 PM

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

 

ATTR_templates_NX11.mp4

 

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
taylor.anderson@siemens.com

by Siemens Legend Siemens Legend
on ‎05-15-2017 07:44 PM

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...

 

EXP_option_menus_NX11.mp4


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.)

 

2017-05-15_16-39-38

 

Enjoy!  :-)

 

Taylor Anderson
NX Product Manager, Knowledge Reuse and NX Design
Tel: +1 (602) 441-0683
taylor.anderson@siemens.com

by Valued Contributor
on ‎05-15-2017 07:44 PM

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:

1

3

5

8

9

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.

by Valued Contributor
on ‎05-15-2017 08:05 PM

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:

 

http://www.commandtool.com/online-catalog/tap-holders/quick-change-tap-collets/collet-1

 

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.

by Siemens Legend Siemens Legend
on ‎05-15-2017 09:06 PM

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:

 

170515_collet_options_02

 

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

 

170515_collet_options_01

 

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

 

170515_collet_options_04

 

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

 

170515_collet_options_03

 

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:

170515_collet_options_05

 

...and get this kind of interaction:

 

170515_collet_options_06

 

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
taylor.anderson@siemens.com

by Valued Contributor
on ‎05-15-2017 09:15 PM

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

by Siemens Legend Siemens Legend
on ‎05-15-2017 11:06 PM

Glad to help.  :-)