×
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

how to resolve dimension mismatch issue in expression editor

how to resolve dimension mismatch issue in expression editor

how to resolve dimension mismatch issue in expression editor

(OP)
Nx8.5

Hi all,

I am trying to do an experiment which uses "diameter" to determine the value of "angle" as shown in picture.

however, it says dimension mismatch...

my understanding is the If statement offers condition, it has nothing to do with caluclation in the "to do' right? why it says dimension mismatches, how to resolve? thank you

RE: how to resolve dimension mismatch issue in expression editor

Any numbers without units in the expression are assumed to be the same as the expression's units; therefore it assumes you are comparing a distance with an angle. To correct this, add units to the comparison value:

CODE

if (diameter < 5mm) (15) else (20) 

If the "5" represents inches, then use "5in" instead...

Alternately, you could set up another expression value to define the changeover point. Something like:
cutoff (units: length), value: 5
then the angle expression would be:

CODE

if (diameter < cutoff) (15) else (20) 

www.nxjournaling.com

RE: how to resolve dimension mismatch issue in expression editor

(OP)
problem solved!!

And another question arises..

if I wrote:

if (diameter > 0mm && diameter <=5mm) (10)
else if (diameter > 5mm) (25)

error says; the specified string contains syntax error
error here: else if ( diameter > 5mm) (25);

thanks again

RE: how to resolve dimension mismatch issue in expression editor

(OP)
think found the problem i need to add "else' statement after "else if"...am i correct?

if (diameter > 0mm && diameter <=5mm) (10)
else if (diameter > 5mm) (25)
else
(30)

RE: how to resolve dimension mismatch issue in expression editor

Put parentheses around the entire 2nd If clause.

CODE

if (diameter > 0mm && diameter <=5mm) (10) else (if (diameter > 5mm) (25) else (30)))

Do you anticipate negative diameter values? If not, your expression can be simplified to:

CODE

if (diameter <= 5mm)(10)else(25)

www.nxjournaling.com

RE: how to resolve dimension mismatch issue in expression editor

(OP)
Hi cowski,

i copied pasted your code to the editor but doesnt work, it gives this error ( see picture)

what i am doing now is try to get a feel of the if-else statement in the NX expression editor, has nothing to do with any modeling, just try to learn its syntax.

RE: how to resolve dimension mismatch issue in expression editor

Looks like a copy & paste error. Get rid of the semicolon at the end of your expression.

www.nxjournaling.com

RE: how to resolve dimension mismatch issue in expression editor

(OP)
no, i didnt type the semicolumn, dont know why the dialog says so itself...

RE: how to resolve dimension mismatch issue in expression editor

Your file and my expression works for me. Try again, because you introduced an error somewhere...

www.nxjournaling.com

RE: how to resolve dimension mismatch issue in expression editor

(OP)
could you send back the file you revised with your code, let me see what happen, i still got the same error...

RE: how to resolve dimension mismatch issue in expression editor

My fault, I originally forgot the "else (30)" part.

www.nxjournaling.com

RE: how to resolve dimension mismatch issue in expression editor

(OP)
never mind!!
NX epxression editior kind of different from VB syntax and Excel syntax, need to get used to it

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