Expression Help Please
Expression Help Please
(OP)
I would like to create an expresion based on the following, but keeping it short as possible.
Expression 1: rod_dia
Expression 2: end_length
If the rod_dia is 20mm then the end length is 17.5mm
If the rod_dia is 25mm then the end length is 18.5mm
If the rod_dia is 30mm, 35mm, 40mm, or 45mm then the end_length is rod_dia-5mm
If the rod_dia is 50mm or 60mm then the end_length rod_dia-10mm
many thanks NX'ers
Expression 1: rod_dia
Expression 2: end_length
If the rod_dia is 20mm then the end length is 17.5mm
If the rod_dia is 25mm then the end length is 18.5mm
If the rod_dia is 30mm, 35mm, 40mm, or 45mm then the end_length is rod_dia-5mm
If the rod_dia is 50mm or 60mm then the end_length rod_dia-10mm
many thanks NX'ers
Best regards
Simon NX4.0.4.2 MP10 - TCEng 9.1.3.6.c - (NX7.5 native)
www.jcb.com
Life shouldn't be measured by the number of breaths you take, but by the number of times when it's taken away...





RE: Expression Help Please
I haven't typed out the entire expression, but you should get the concept :
if(rod_dia==20)17.5 else if(rod_dia==25)18.5 else rod_dia-10
Obviously, you maybe able to consider using this syntax :
if(rod_dia>=30&&rod_dia<=45)rod_dia-5 else 100
The very last 'else' needs to use a default value.
NX 6.0.5.3
Windows XP32
RE: Expression Help Please
define an intermediate expression, lets say rod_correction.
rod_correction= if(rod_dia<25) 2.5 else if (rod_dia<30) 6.5 else if (rod_dia<50) 5 else 10
now define length:
length=rod_dia - rod_correction
regards
Frank.
RE: Expression Help Please
Any explanation would be most appreciated.
Best regards
Simon NX4.0.4.2 MP10 - TCEng 9.1.3.6.c - (NX7.5 native)
www.jcb.com
Life shouldn't be measured by the number of breaths you take, but by the number of times when it's taken away...
RE: Expression Help Please
The && and the & in NX I think is the same thing, in other programing languages && is a relational operator AND, and the & is the same but it compares at bit level.
For example:
lets say:
A=4 (100 in binary)
B=2 (010) in binary)
(A && B) is true
(A & B) in NX is true, but in C (for instance) is 0 (false).
Regards
Frank.
RE: Expression Help Please