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

If statement not possible with mixed units? 1

Status
Not open for further replies.

Jim0914

Mechanical
Joined
Sep 9, 2015
Messages
21
Location
US
In the Expression statement "If(Angle>0)(dimension1)else(dimension2) the variable Angle is in units of degrees and dimension1 and dimension2 are in units of inches. I get an error because of mixed units. Why is this not possible? I want one dimension for a positive angle and another dimension if the angle is negative. How can I accomplish this?

Thanks in advance,

Jim Weisner
Senior Designer

 
Any constants in the formula are interpreted as being in the units of the expression. It thinks that you are trying to compare an angular value to an inch value. To make it understand, you will need to specify the units on the number that you are comparing to.

Try this:
Code:
If(Angle>0[highlight #FCE94F][degrees][/highlight])(dimension1)else(dimension2)

www.nxjournaling.com
 
Nice trick !
I'll remember.

"My english is bad ? That's why i'am french."
 
Thanks! It worked like a charm!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top