Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations JStephen on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

About the nth statement logic

Status
Not open for further replies.

JerryWong

Aerospace
Joined
Jul 31, 2015
Messages
16
Location
HK
Here I have a part family part. First in the Attribute Templates I define an attribute title called "Type", "Integer" for Data Type, List "59, 60, 61". Then create expressions as follows
Type=linked to attribute "Type"
Length={40,60,80}
L=nth(Type,Length)
Then I found when Type<2, L=40; 2<=Type<3, L=60; Type>=3, L=80
Is this the logic for the nth statement?
What I want is when the Type selected to "59", L=40; Type "60", L=60; Type "61", L=80.
As the family part is an assembly, it did not work well using "part family" function. Is the "part family" function just for single part?
 
That first argument in the nth() function needs to be an integer that is the index of the list... the "nth" item in the list. (1st, 2nd, 3rd, 4th, Nth, etc.)

So here, if your "Type" attribute will be 59, 60, or 61, then you'll need to offset these values to get down to a valid index for the list. And with three options in your list here, a valid index would be either 1, 2, or 3. Does that make sense?

So in other words, you'll want to do something like this:

[pre]L=nth(Type-58,Length)[/pre]

Then, as you've described:
When Type is "59" then the index will be 59-58 = 1, and L will be 40.
When Type is "60" then the index will be 60-58 = 2, and L will be 60.
When Type is "61" then the index will be 61-58 = 3, and L will be 80.

Does that help?

Taylor Anderson
NX Product Manager, Knowledge Reuse and NX Design
Product Engineering Software
Siemens Product Lifecycle Management Software Inc.
(Phoenix, Arizona)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top