cancel
Showing results for 
Search instead for 
Did you mean: 

Variables using if/then statements

Experimenter
Experimenter

Hi guys, 

I try to control the nr of a pattern feature using expressions formula, something like- if length is < or = to 300 the count nr = 3 if length is < = to 400 the count nr = 4 and so on.

 

If you have any ideas please live a comment, thank you.

5 REPLIES

Re: Variables using if/then statements

Phenom
Phenom

Simply

 

for one condition      if(A==X)(true)else(false) 

 

for more                    if(A==X)(true)else(if(B<K)(X1)(true)else(if......))

 

Ciao

Re: Variables using if/then statements

Experimenter
Experimenter

Thank you for the fast answer, unfortunately I a totally beginner and I don't understand this coding quite well, I will try to explain it better, so I have a metal bar that has a length of 300, on this bar I want to add pockets as pattern feature and I start from the middle, now what I want is to control the pockets nr by lengthe value, if my length is <= to 300 I want 3 pockets, if length is >300 but <400 I want 4 pockets and if length is >then 400 and <then 500 I want 5 pockets, I hope you anderstand Smiley Happy thank you 

Re: Variables using if/then statements

Phenom
Phenom

Model the bar, the pocket and the respectives copies.

Suppose p1 is the bar lenght and p2 the number of features copies, you can see this in the expression (ctrl+E).

Then set p2     if(p1<=300)(3)else(if(p1<=400)(4)else(if(p1<=500)(5)else(5)))

(I hope the number of parentheses is correct ;-) )

 

Ciao

Re: Variables using if/then statements

Siemens Phenom Siemens Phenom
Siemens Phenom

You could also use a List expressions, particularly if the number of options grows past three or four.

John R. Baker, P.E. (ret)
EX-Product 'Evangelist'
Irvine, CA

Re: Variables using if/then statements

Honored Contributor
Honored Contributor
if(bar_length<400)(3)else(floor(bar_length/100))

The expression above will return 3 if the length is less than 400; otherwise it will return 1 for each 100 units of length.