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 TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to resolve dimension mismatch issue in expression editor

Status
Not open for further replies.

godpaul

Automotive
Joined
May 4, 2014
Messages
119
Location
US
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
 
 http://files.engineering.com/getfile.aspx?folder=c3d10ac8-cbdf-4005-bc06-c3b01fb19218&file=Capture.PNG
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
 
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
 
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)
 
Put parentheses around the entire 2nd If clause.

Code:
 if (diameter > 0mm && diameter <=5mm) (10) else (if (diameter > 5mm) (25) else (30))[highlight #FCE94F])[/highlight]

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

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

www.nxjournaling.com
 
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.
 
 http://files.engineering.com/getfile.aspx?folder=4dc2c4bb-1eaa-4bff-9d5a-4e2df2de044d&file=Capture.PNG
no, i didnt type the semicolumn, dont know why the dialog says so itself...
 
could you send back the file you revised with your code, let me see what happen, i still got the same error...
 
never mind!!
NX epxression editior kind of different from VB syntax and Excel syntax, need to get used to it
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top