■
Width = 100m * cos(angle)
■
x = 2*abs(a) + abs(b/2)
■
ArrayNum = Length/Spacing
Parameter names in formulas are case sensitive. For example, if a parameter name begins with a capital letter,
such as Width, you must enter it in the formula with an initial capital letter. If you enter it in a formula
using lower-case letters instead, for example, width * 2, the software will not recognize the formula.
Conditional Statements in Formulas
You can use conditional statements in formulas to define actions in a family that depend on the state of
other parameters. With conditional statements, the software enters values for a parameter based on whether
a specified condition is satisfied. Conditional statements are useful in certain circumstances; however, they
make families more complex and should be used only when necessary.
For most type parameters, conditional statements are unnecessary because the type parameter itself is like
a conditional statement: If this is the type, then set this parameter to a specified value. Instance parameters
are a more productive place to use conditional statements, particularly when they are used to set a parameter
that does not vary continuously.
Syntax for Conditional Statements
A conditional statement uses this structure: IF (<condition>, <result-if-true>, <result-if-false>)
This means that the values entered for the parameter depend on whether the condition is satisfied (true) or
not satisfied (false). If the condition is true, the software returns the true value. If the condition is false, it
returns the false value.
Conditional statements can contain numeric values, numeric parameter names, and Yes/No parameters.
You can use the following comparisons in a condition: <, >, =. You can also use Boolean operators with a
conditional statement: AND, OR, NOT. Currently, <= and >= are not implemented. To express such a
comparison, you can use a logical NOT. For example, a<=b can be entered as NOT(a>b).
The following are sample formulas that use conditional statements.
Simple IF:
=IF (Length < 3000mm, 200mm, 300mm)
IF with a text parameter:
=IF (Length > 35', “String1”, “String2”)
IF with logical AND:
=IF ( AND (x = 1 , y = 2), 8 , 3 )
IF with logical OR:
=IF ( OR ( A = 1 , B = 3 ) , 8 , 3 )
Embedded IF statements:
=IF ( Length < 35' , 2' 6" , IF ( Length < 45' , 3' , IF ( Length < 55' , 5' , 8' ) ) )
IF with Yes/No condition:
=Length > 40 (Note that both the condition and the results are implied.)
Examples of Conditional Statement Usage
Typical uses for conditional statements in formulas include calculating array values and controlling an
element’s visibility based on a parameter value. For example, you can use conditional statements to
■
Prevent an array parameter from taking a value less than 2.
In Revit Architecture, arrays can only have an integer value of 2 or greater. In some situations, it may be
useful to create a conditional formula that maintains an array parameter of 2 even if the calculated value
is 1 or 0. With such a formula, if the calculated array value is 2 or greater, the formula retains the value.
However, if the calculated value is 1 or 0, the formula changes the value to 2.
Formula:
Array number = IF (Arrayparam < 2, 2, Arrayparam)
368 | Chapter 8 Creating Your Own Components (Families)
Summary of Contents for 24000-000000-9860 - Revit Architecture - PC
Page 1: ...Revit Architecture 2009 User s Guide April 2008 240A1 050000 PM02A ...
Page 4: ......
Page 56: ...18 ...
Page 116: ...78 Chapter 3 Revit Essentials ...
Page 172: ...134 Chapter 4 ProjectViews ...
Page 178: ...Schedule with Grid Lines Schedule with Grid Lines and an Outline 140 Chapter 4 ProjectViews ...
Page 554: ...516 ...
Page 739: ...Curtain wall Curtain Grid Curtain Walls Curtain Grids and Mullions 701 ...
Page 1004: ...966 ...
Page 1136: ...1098 ...
Page 1226: ...1188 ...
Page 1250: ...1212 ...
Page 1276: ...1238 Chapter 20 Design Options ...
Page 1310: ...1272 ...
Page 1366: ...1328 ...
Page 1406: ...1368 ...