fuzzy math essentials for revit® family builders · pdf fileof his time in the support...
TRANSCRIPT
12/5/2008 - 8:00 am - 9:30 am Room:Palazzo E-G (5th)
Fuzzy Math Essentials for Revit® Family Builders
This class will show you how to leverage your family building knowledge by moving beyond static families and empowering you to create parametric marvels. Learn some of the essential math and formulas that can help you drive geometry based on required relationships, evaluate and restrict user input to set ranges, use Boolean operations to control visibility based on other parameter values, and discuss parameter naming strategies. We will also look at advanced formula examples that calculate complex geometrical relationships to achieve seemingly impossible results.
AB400-1
About the Speaker:
David Baldacchino - BIM Coordinator, SHW Group LLP
David joined SHW Group right after acquiring his Masters of Architecture degree at Texas A&M University in 2001, and has been using Autodesk software for twelve years. He worked on several Educational Facility projects and was the team leader on the Revit® pilot projects in the Houston office. He currently dedicates most of his time in the support role of BIM Coordinator and enjoys training his peers and helping project teams to succeed in the use of Revit. In his spare time, David can be found posting articles on his blog and answering questions on the AUGI forums.
Stay Connect with AU all year at www.autodeskuniversity.comr
Fuzzy Math Essentials for Revit® Family Builders
3
Introduction
Driving family geometry through formulas is an essential skill to master to truly leverage Revit’s power.
This class assumes you are an Intermediate Revit user and have sound knowledge of key family building
concepts. The goal is to help you move to the next phase and become an Advanced Family Builder.
Here is the menu of what we’ll be covering:
� Rounding numbers UP or DOWN; Rounding dimensions UP or DOWN to nearest inch increment;
Evaluating whether an integer is ODD or EVEN.
� Boolean operators: AND, OR, NOT – Evaluating Yes/No parameters to drive other Yes/No
parameters (very useful for visibility control).
� Visibility control of Solids based on other parameter values.
� Evaluating the user’s input before driving geometry dimensions.
� Visibility control of Voids!
� Triangle Geometry: Pythagorean Theorem, Similar Triangles, Trigonometric Functions
� Discussion on parameter naming and documenting your work
� Cartesian Equations: Ellipses, Circles and other curves.
� Arrays: Linear and Polar.
Most of the examples we will use to explain these concepts are abstract in nature, while some will have
direct applicability in projects. Think of the abstract examples as “intellectual pursuits”. I find that having
an “absurd” idea about a family and spending the time to build it helps strengthen one’s problem solving
abilities for when you need to create complex families for projects. So keep your eyes open and next time
you see something that makes you wonder how one would create it in Revit, don’t be afraid to give it a
shot! Talking of absurd, do you think it is possible to build a parametric family to plot out these graphs?
Fuzzy Math Essentials for Revit® Family Builders
4
YES! We will take a quick look at how this one family was put together towards the end of the class. Thelesson to be learned here is that if you put your mind to it, regardless of how difficult it might seem, you
can almost achieve anything! Enough cheerleading and let’s get started.
Rounding
Here’s what the family types dialog looks like:
Here’s what the family types dialog looks like:
The strategy involves 1) turning the Input into a rounded up integer that represents the number of inches.We divide by 1’ to remove the units since an Integer parameter is unit-less. 2) Depending on whether we
want to round up or down, this formula then evaluates the correct number to use in 3), where we take the
integer in 1), add or subtract a value (slightly less than half Input_Integer) and divide the total by theincrement Input_integer. In essence we’re trying to find a value that represents the correct multiple ofincrements, so we can turn it back into a length as shown in 4) by taking the result and multiplying it by
the increment integer. Since the result represents inches, we multiply it by 1” to restore the units of length.
Fuzzy Math Essentials for Revit® Family Builders
5
Here’s what the family types dialog looks like:
Even numbers are perfectly divisible by 2 and leave no remainder. We can exploit this fact to determine if
a number is odd or even. 1) We divide by 2 and 2) we multiply the result by 2 and compare it to the input,
If the input is odd, this will evaluate to false. To determine if the input is odd, we use the “NOT” operator
as shown in 3).
Remember that formulas such as these are not only useful for families but also for use within schedules,
in applications such as rounding of Occupancy calculations, rounding of lengths in quantity take-offs, etc.
Boolean Operators
Here are some examples of how to drive the value of a Yes/No parameter based on evaluating three
other Yes/No parameters with one or two operators (And, Or).
Fuzzy Math Essentials for Revit® Family Builders
6
Controlling the Visibility of Solids
A useful technique to control solid geometry visibility is to look at the value of a length parameter, and if it
reaches a certain threshold, the object’s visibility is turned off. I like this technique because it builds
intelligence within a family, leaving fewer parameters for the user to worry about.
Let’s look at a practical example involving an extrusion in a baluster panel family. The user inputs a
dimension in a Length parameter but we use another calculated parameter to decide what to do next.
Note the use of the arithmetic operation “abs” in 2). This is used to ensure that the length passed to our
formula is always positive, so if a user enters a negative length, the growth direction is not reversed.
Controlling the Visibility of Voids
Voids, unlike Solids, do not have a visibility parameter. To control their “visibility”, we have to employ a
very useful trick: moving the void away from the solid that it cuts! To make the operation more elegant, we
can add a Yes/No parameter for the user to interact with and then based on its value, an IF statement
drives the void position.
One way to achieve this is to create a uniquely named reference plane, use it as the void’s workplane,
and then control the ref. plane’s placement through a length parameter. As the ref. plane moves, the void
follows it. A second option is to use the surface of the solid as the workplane and then make the extrusion
grow in the opposite direction so it doesn’t cut the geometry.
In the following example, we have a void that cuts a door panel to create a vision panel. A named
reference plane was used as the workplane for the void extrusion. As the ref. plane moves, the void
follows. We can use the door panel thickness to drive the void thickness but we will do so indirectly
because first we need to check if the user wants a vision panel. If not, we will reverse the direction of the
Fuzzy Math Essentials for Revit® Family Builders
7
extrusion by the same thickness
to prevent the solid from being
cut. We can also easily assign
the glazing visibility to the same
Yes/No parameter.
The formula is quite simple: If
the parameter Vision Panel isunchecked (resulting in “No”),
then Void Control is given thevalue of -Thickness. Thenegative value will reverse the
direction of the void and prevent
it from cutting the solid.
Also notice the formula that
drives the width of the vision
panel. It makes sure that the
distance from the edge does not
go beyond the minimum
specified (explore the dataset).
Next we’ll examine a grade beam example
where voids are controlled by IF statements
that monitor other dimensions. Reference lines
control the beam extrusion and void sketches to
cover a number of possible conditions.
Fuzzy Math Essentials for Revit® Family Builders
8
Fuzzy Math Essentials for Revit® Family Builders
9
Triangle Geometry
You’re probably wondering, “What does the above image have to do with this topic?” A lot! I find myself
using triangle geometry very frequently when building complex families and the example that we are
about to look at is no exception. We will also use this example towards the end to discuss some simple
math to help us with polar arrays.
FamilyBreakdown
The idea behind this family is quite simple: how do you model a curve on a radius wall? “Oh, it cannot be
done in Revit” some might say, but there’s always a way to break a seemingly complex problem down
into manageable parts to arrive at a plausible solution.
Here are the key requirements of this family:
a) We want the radius in plan to vary and also the thickness of the element.
b) We want the curve in elevation to vary; both the outer and inner sketch. We also want to specify a
vertical offset to truncate the curve and thus achieve a greater variety of forms.
This gives us a good idea of the needed input parameters. I chose to use concentric Ellipse curves in
elevation, which can also be used to achieve perfect circles. To have a continuous “sine” type of curve,
we need to do two polar arrays: one for the top part of the curve and one for the bottom, which is a mirror
of the top. The ideal shape to use is a blend that radiates from a point. This can then be arrayed and the
joints between the pieces would be seamless. Unfortunately we cannot do a blend that goes from a
profile to a point (although one can use a tiny circle sketch to approximate, but we’re aiming for
perfection!). The solution is to figure out the geometry of the curves between the “virtual center” of the
blend and the top sketch at some arbitrary point, which is the perfect exercise for this class! We can
finally use a couple of voids to trim the segment to the required shape and array the nested family.
Fuzzy Math Essentials for Revit® Family Builders
10
Here is an exploded view of
the family. The tricky part is
figuring out the geometry of
one little curve segment and
the angle required for the
array. This angle has to be
calculated as it changes with
all the input parameters, so
hold on tight for some fuzzy
math!
If we want the user to give us the ellipse dimensions in elevation and since we are dealing with
a curved cut in plan, we also need to find out the projected sketch of the front part of the blend.
Things often turn out to be a little more difficult than expected, but in this case the required
formulas for figuring out the blend top and base sketches are the same. One thing to keep in
mind here is that describing curved geometry in 3D space is not easy! But don’t get
disheartened and keep focused on understanding the problem. Be warned that building a
parametric family like this from scratch takes a long time, but each time you pursue something
complex, you improve your skills and become a faster family builder.
Fuzzy Math Essentials for Revit® Family Builders
11
Fuzzy Math Essentials for Revit® Family Builders
12
Fuzzy Math Essentials for Revit® Family Builders
13
That’s a lot to digest but I’m confident you’ll be able to follow the calculations at a later time. A
number of triangle geometry relationships were used to calculate various length parameters.
Finally I also used the equation of an ellipse to figure out the X coordinates of the inside and
outer projected curve sketches, which are required to calculate the angles for the array.
Once this family was finished, I had a hard time remembering what I did a few weeks later when
trying to document this handout. So here are some key things to remember:
a) Document your family as you go. Sketch geometry and write your formulas in a logical
way in a notebook so you can retrace your work at any time. KEEP THE INFO!
b) Come up with a logical parameter naming convention to help you with writing formulas,
especially with tracing “patterns” in formulas to be used for repetitive calculations (for
instance in this example , one can easily identify parameters for the top vs base sketch).
Notice that parameters for
the top blend sketch
(larger) use Upper case,
while those for the base
blend sketch (smaller) use
lower case.
c) Separate the input parameters from the calculated ones. It helps to reduce the clutter in
the properties dialog. Also, resist the temptation of reducing a lot of calculated
parameters by making longer formulas. Sometimes it helps to keep formulas split so you
can understand what is going on. For example I could have eliminated parameters “LX”
& “Lx” and consolidate them under “Angle”, but chose not to.
Arrays
Parameterized arrays are very powerful when you want to control the repetitiveness of objects
along a line or radiating from a point. Using some formulas and basic math, we can drive array
parameters so geometry can flex and resolve itself automatically.
Fuzzy Math Essentials for Revit® Family Builders
14
Polar Arrays
To finish up the family we started earlier, we need to create a couple of simple polar arrays. I
nested the curve component into a family, mirrored it so it’s upside-down and removed all the
formulas. It was then nested into the main host family and all parameters were connected.
This way, all formulas reside in the host family and one can easily make changes there
without worrying about “out of date” nested components. Two separate arrays where
done: one in the bottom nested family and one in the host family for the top curve
component.
Top Array in Host Family
BottomArray in Nested Family
Nesting is unavoidable
when you want to control
the angular positioning of a
polar array. The bottom
array is rotated by the
value of “Angle”, which is
why I chose to put that in a
nested family. To keep
things simple, the user just
inputs the desired number
of complete “sine” curves
and the formulas calculate
the total angle between the
first and last components.
The Array input parameter
drives the arrayed quantity.
Linear Arrays
In linear arrays, we mainly deal with spacing instead of angles. We use Length parameters to
calculate the correct spacing and/or an Integer parameter to figure out the correct quantity of
arrayed elements. In the first example, we will take it a step further by also calculating the
required number of arrayed elements and adjusting their size to fill the total family length.
Fuzzy Math Essentials for Revit® Family Builders
15
I want the geometry to go all the way to the endpoint instead of stopping short due to the length
of the arrayed elements not being a perfect multiple of the family length. So we re-calculate the
parameters and assume that the radius input represents a “minimum”. Once we find out how
many arrayed elements fit within the family length, we re-calculate the radius. This affects “Y”
(see the above diagram) and thus the arrayed elements are re-spaced, leaving no empty space.
The next example shows a more practical use of arrays in the baluster panel family that we
used earlier. Typically, elements that follow the slope of the stair/ramp or the floor/landing are
built as railings when those elements are continuous. But when you have interruptions, you
have to build these elements into the baluster panel family. Once again, using a nested
component makes it easy to not only control the array properly, but to also control the rotation of
the element to match the railing slope.
Fuzzy Math Essentials for Revit® Family Builders
16
For the cables to flex correctly and maintain the
correct spacing at landings, the array spacing has to
be calculated vertically and not perpendicular to the
slope.
I created a Generic Model family to flex
from the elevation centerline with
parameters for slope, bar width (this
parameter is used to center the cables
within the baluster panel thickness) and
width. These were then connected to
the host family’s parameters.
The parameters required for the array were calculated in the host family. The nested family was
then arrayed and constrained appropriately using the horizontal ref. plane to set the spacing at
the start and the end of the array (“Move to: Last” option).
Fuzzy Math Essentials for Revit® Family Builders
17
Conclusion
We have seen that by using some basic math and formulas, you can create some amazing
parametric marvels. In this class we reviewed useful tips, family building techniques, formulas
and mathematical relationships that will undoubtedly help you in building smarter families. You
can leverage your hard work significantly by nesting parametric components, so always think
ahead and build families with future use/recycling in mind.
In the opening minutes I promised to quickly review how those graph families were built,
however I’m not documenting that in this handout. It’s my way of enticing you to stay in class till
the end ;)
All datasets used for this class will be available for download on AU Online. The combination of
this handout and the datasets will help further your understanding of this topic, so I encourage
you to get your hands on them, pick them apart and ask questions if something is not clear. We
hope you have found this class to be useful and we would like to thank you for attending. Have
fun building parametric families!
> > END < <