×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Expression Help Please

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

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

Simon,

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

My suggestion:
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

(OP)
This all looks good, but I've yet to try it because my system is in the middle of importing the mother of step files. One thing I don't follow is what the == and && actually mean? why not just a single = or &?

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 == is a relational operator to make a comparison the = is an assignment.
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

if (rod_dia>45)(rod_dia-10)else((if (rod_dia>25)(rod_dia-5)else(if (rod_dia>20)(18.5)else(17.5))))

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources