Odd or even parameter values

2918

When creating families, have you ever needed a formula to work out if an Integer parameter is odd or even?

This might sound like a weird requirement to have, but there are situations such as a bi-fold door, where the number of bi-fold panels could be odd or even depending on which swing direction is next.

Give these formulas a go where the Integer parameter is ‘x’.

Parameters
Even : rounddown (x / 2) = roundup (x / 2)
Odd : not (Even)

The theory behind this formula is that an even number when divided by 2 should equal a whole number, and therefore whether it’s rounded down or up it should be the same value.
Should the number be odd, then the rounddown and roundup results will not be equal.

 

Chad is a consultant to the AEC industry, a design technologist, VDC advocate, BIM Manager, early Revit adopter, and public speaker.