NX CONDITIONAL LOGIC STATEMENTS
NX CONDITIONAL LOGIC STATEMENTS
(OP)
I am trying to write a conditional statement to control bushing clearance size, based on bushing OD.
There are difference clearance requirements for different diameter bushings.
NX 8.5 if that makes a difference.
Below is the information:
Range_____clearance
0-3mm____0.010mm____________1
3-6_______0.012_______________2
6-10______0.015_______________3
10-18_____0.018_______________4
18-30_____0.021_______________5
30-50_____0.025____TOLERANCE_6
50-80_____0.030_______________7
80-120____0.035_______________8
expressions are set at:
"BUSHING_OD"____30
"TOLERANCE_6"___0.025
So this is what I have so far which works as intended:
"BUSHING_CLEAR" = IF((BUSHING_OD>=30)&&(BUSHING_OD<50))THEN(TOLERANCE_6)
"BUSHING_CLEAR" = IF((BUSHING_OD>=50)&&(BUSHING_OD<80))THEN(TOLERANCE_7)
"BUSHING_CLEAR" = ETC.....
What I want to do is CONNECT multiple if/then/else statements under the expression "BUSHING_CLEAR"
How do I connect multiple conditional statements together, is it possible?
Everything above 120mm should be set at TOLERANCE_8
There are difference clearance requirements for different diameter bushings.
NX 8.5 if that makes a difference.
Below is the information:
Range_____clearance
0-3mm____0.010mm____________1
3-6_______0.012_______________2
6-10______0.015_______________3
10-18_____0.018_______________4
18-30_____0.021_______________5
30-50_____0.025____TOLERANCE_6
50-80_____0.030_______________7
80-120____0.035_______________8
expressions are set at:
"BUSHING_OD"____30
"TOLERANCE_6"___0.025
So this is what I have so far which works as intended:
"BUSHING_CLEAR" = IF((BUSHING_OD>=30)&&(BUSHING_OD<50))THEN(TOLERANCE_6)
"BUSHING_CLEAR" = IF((BUSHING_OD>=50)&&(BUSHING_OD<80))THEN(TOLERANCE_7)
"BUSHING_CLEAR" = ETC.....
What I want to do is CONNECT multiple if/then/else statements under the expression "BUSHING_CLEAR"
How do I connect multiple conditional statements together, is it possible?
Everything above 120mm should be set at TOLERANCE_8





RE: NX CONDITIONAL LOGIC STATEMENTS
"BUSHING_CLEAR" = IF((BUSHING_OD>=30)&&(BUSHING_OD<50))THEN(TOLERANCE_6)ELSE(IF(XXXXXXXX)THEN(xxxxxxxxx)ELSE(0))
That this is the idea I am trying to do, if it's possible
RE: NX CONDITIONAL LOGIC STATEMENTS
Is that what you're looking for?
NX9.0.3.4 MP1/Windos 7 Service Pack 1
RE: NX CONDITIONAL LOGIC STATEMENTS
IF((BUSHING_OD>=30)&&(BUSHING_OD<50))TOLERANCE_6 else if ((BUSHING_OD>=50)&&(BUSHING_OD<80))TOLERANCE_7 else TOLERANCE_8
NX9.0.3.4 MP1/Windos 7 Service Pack 1
RE: NX CONDITIONAL LOGIC STATEMENTS
RE: NX CONDITIONAL LOGIC STATEMENTS
if((BUSHING_OD_IPE>=0)&&(BUSHING_OD_IPE<3))H7_BORE_TOLERANCE_1 else if((BUSHING_OD_IPE>=3)&&(BUSHING_OD_IPE<6))H7_BORE_TOLERANCE_2 else if((BUSHING_OD_IPE>=6)&&(BUSHING_OD_IPE<10))H7_BORE_TOLERANCE_3 else if((BUSHING_OD_IPE>=10)&&(BUSHING_OD_IPE<18))H7_BORE_TOLERANCE_4 else if((BUSHING_OD_IPE>=18)&&(BUSHING_OD_IPE<30))H7_BORE_TOLERANCE_5 else if((BUSHING_OD_IPE>=30)&&(BUSHING_OD_IPE<50))H7_BORE_TOLERANCE_6 else if((BUSHING_OD_IPE>=50)&&(BUSHING_OD_IPE<80))H7_BORE_TOLERANCE_7 else if((BUSHING_OD_IPE>=80)&&(BUSHING_OD_IPE<120))H7_BORE_TOLERANCE_8 else H7_BORE_TOLERANCE_8
RE: NX CONDITIONAL LOGIC STATEMENTS
CODE
www.nxjournaling.com
RE: NX CONDITIONAL LOGIC STATEMENTS
NX9.0.3.4 MP1/Windos 7 Service Pack 1
RE: NX CONDITIONAL LOGIC STATEMENTS
RE: NX CONDITIONAL LOGIC STATEMENTS
Here are a couple of threads where the 'List Expression' is discussed and examples provided:
http://www.eng-tips.com/viewthread.cfm?qid=364292
http://www.eng-tips.com/viewthread.cfm?qid=402217
http://www.eng-tips.com/viewthread.cfm?qid=370644
John R. Baker, P.E. (ret)
EX-Product 'Evangelist'
Irvine, CA
Siemens PLM:
UG/NX Museum:
The secret of life is not finding someone to live with
It's finding someone you can't live without
RE: NX CONDITIONAL LOGIC STATEMENTS
You can actually put all of these range values and tolerance values in a single list expression, like this:
CODE --> Expressions
{ {0, 3, 0.01}, {3, 6, 0.012}, {6, 10, 0.015}, {10, 18, 0.018}, {18, 30, 0.021}, {30, 50, 0.025}, {50, 80, 0.03}, {80, 120, 0.035} }Prior to NX 11, this is most easily done using the little "Extended Text Entry" button on the right end of the Formula field:
...and in NX 11, we'll get you away from the curly brackets and commas with the ability to directly edit the data in this list expression like a table:
And yes, I just copied-and-pasted that data into the expression edit dialog directly from Excel. We think you're going to like being able to do that.
But anyway, the other trick is crafting an expression to "look up" the right tolerance value from the table. And that's where the concept of lopping through the list comes in really handy. Here's the formula for a BUSHING_CLEAR expression:
CODE --> Expressions
loop { for $set in tol_data; If ( ( BUSHING_OD > nth(1,$set) ) && ( BUSHING_OD <= nth(2,$set) ) ) Return nth(3,$set); Return is 999; }Again, this is most easily done in the "Extended Text Entry" mode, rather than trying to set it all up in a single line. The "Extended Text Entry" will preserve any formatting you introduce, and make it much easier to come back and edit this later.
Now... for the interested student, this is a case where it's handy to have the Knowledge Fusion language lurking underneath NX Expressions.
1. The first line inside this loop cycles through each "set" of values in a list expression called "tol_data".
2. In the "if" statement line, it checks to see if the BUSHING_OD is larger than the first number in the "set" AND less than or equal to the second number in the set, and if this is true, returns the third value in the set (the appropriate tolerance value) and then exits the loop.
3. The last "Return" line returns a default value of 999 if the BUSHING_OD is outside the range of the data in the table. That's just a failsafe, to make sure you've got a number coming back every time.
And so the loop returns one clean number, every time.
In the end, this setup results in a total of three expressions... One for the BUSHING_OD, one list expression for all of the tol_data, and the output expression BUSHING_CLEAR:
...and if you want to add more rows to the table, that's FAR easier than trying to wedge more IF()THEN()ELSE() statements into an expression, right?
...and with the exception of the table-based editing of the list, all of this is possible in any version since NX 8.5, when we introduced the List expression type.
Does that help?
Taylor Anderson
NX Product Manager, Knowledge Reuse and NX Design
Product Engineering Software
Siemens Product Lifecycle Management Software Inc.
(Phoenix, Arizona)