Using a range in an equation

Hi all,

I have a feature pattern that creates instances between 2 and 5 depending on the length of a rail (equation driven).

I basically need to suppress or unsuppress another feature based on whether that instance count is odd or even, or another way of looking at it is that if it's '5' or '3' I need it unsuppressed, if it's 4 or 2 I need it suppressed.

Can I specify a range of values (ie 5:3 like excel) or possibly use iif to look at odd or even numbers?

The general idea would be:

= IIF ( "RACK INSTANCES@RP" [ is an even number ] alt. [ is #2 or #4 ]  , "suppressed" , "unsuppressed" )

Thanks!

Oli

SolidworksParts And Features
Answers 5
DG
DG 2017-11-06 Best Answer

You can try using OR to use two values (either 3 and 5 OR 2 and 4). Another option might be to use nested IF condition.

Here is working example for both

comment imagecomment image
OS
OS 2017-11-06

Aha!  I wasn't aware that the OR function required you to repeat the full expression: I was writing it as ("pattern@pattern = 3 OR 5, unsuppresed, suppressed)

Works perfectly now, thanks!

DB
DB 2017-11-06

Hi Oli,

I'm glad that you found a fix for your problem, but if I'm not mistaken you came to that conclusion with Deepak's suggestion so therefore doesn't he deserve to get marked as the 'Correct Answer'?

Dave.

OS
OS 2017-11-06

Hi Dave, Deepak,

Yep absolutely right, honest mistake.  Problem solved.

Thanks

DB
DB 2017-11-06

No probs....