A lot of Revit users are familiar with making a typical family using parameters and constraints. What most people don’t realise is that you can add formulas to families so calculations can be
done within the family.
In this blog I am going to give a high level overview of formulas in families. You don't need to be a programmer. But the usual family rules apply. Plan your family beforehand and flex (test) your family as you go. The idea with formulas is to get parameters driving other parameter and automating your family as much as possible.
Let’s take a very basic arithmetic
formula inside a family. In the screen shot below you can see that the width of
the family is always going to be half the height.
The width is controlled by a
simple formula Width = Height divided by 2. This can be a huge time saving for
the user but also reduces the possibility of errors. When your under pressure
to get a model it can be very easy to forget to change a parameter. So the more
you can automate the family the increase you will get in productivity.
Within the family you can do
very simple to advanced formulas using the following formula types
Basic Arithmetic
This includes basic addition,
subtraction, multiplication & division
Logarithm
Log of 1000 to base 10 is 3. 10
x 10 x 10 = 1000. In a Revit family it is written as log (1000).
Exponentiation
Raising x to the power of Y X = X ^ Y . In Revit this is written exp(x)
Square Root
You can use the formula
sqrt(16)
Trigonometry
Revit supports trigonometry a sample is a = b / tan(B)
Time to dust off that old maths
book
Conditional Statements
Revit family formulas also
support conditional statements. A conditional statement checks if a condition
is true or false and takes appropriate depending on the test.
If Statement
The if statement test to see if
a condition is true or False
In the example above if Height
is greater then 1800mm the depth is 1500mm. If the Height is less the depth is 1700mm.
And, OR statements can also be
used in Conditional formulas giving you additional power to check a condition.
IF ( AND (x = 100mm , y = 200mm), 80mm, 30mm )
IF ( OR ( A = 100mm , B = 300mm ) , 80mm , 30mm )
You can also nest your conditional statements that is
have 1 conditional statement inside another
IF ( Length < 350mm , 300mm , IF ( Length < 450mm
, 400mm, IF ( Length < 550mm , 500mm, 800mm ) ) )
If you really want to create
powerful advanced families get into using formulas in your families. It will take time to get use to Revit’s
formula format but its well worth it.
If you have any questions on anything in this
blog or any other blog or any of our services please feel free to contact me at dan@siscin.ie.
Dan Deery is the managing director of Siscín. Dan has over 20
years in the construction industry and has been using BIM since the mid 90’s.
He also worked as a programmer for a CAD software company. Siscín specialise in BIM Consultancy. training & visualisation
and animation for the Infrastructure, Engineering, Construction, Facilities and
Architectural industries. Check out our Website www.siscin.ie