This 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?
how i can create attribute with list of value
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?
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 AndersonNX Product Manager, Knowledge Reuse and NX DesignTel: +1 (602) email@example.com
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?
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.)
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.
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.
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?
NOW we are on the same page! Wonderful. This is exactly wear I want to be. Thank you so much for the help.
Glad to help. :-)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.