Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Expression help 1

Status
Not open for further replies.

TechnicalConsultant

Mechanical
Mar 26, 2004
172
0
0
GB
Hi,

I have model with an expression controlling the length. I have one row of holes and want the number of holes in the x axis to vary depending on the length. For example if length is over 100mm then I want two holes, if length is over 200mm then I want three holes.

Below is the expression I have used

if(length>100)(2)else(if(length>200)(3)else(if(length>300)(4)else(1)))

Any ideas where I am going wrong? Any help VERY much appreciated.

Mark Noyce

Mark Noyce
Senior Design Engineer/CAD co-ordinator
 
Replies continue below

Recommended for you

Try this instead.


if(length<100)(1)else(if(length<200)(2)else(if(length<300)(3)else(4)))

your original expression would only output 1 or 2. As soon as the value of length was over 100 it would not get any further down the chain if if statements as 200 is still greater than 100 therfore the result is still 2.
Hope that makes sense.

You'll have to make your positioning of your first hole and the array spacing a function of the output of this expression to ge the holes equispaced.

Cheers,


Mark Benson
Aerodynamic Model Designer
 
vitulaak,
your first expression can not work, because if the length is say 350, which is > 100 (your first condition) then it inserts 2 holes and does not go farther - the condition (>100) was satisfied).
Your second expression is different - you should see (15) only if the cond=20, because the first two parts (>20, <20) cover all remaining (real) numbers.
 
Status
Not open for further replies.
Back
Top