Beruflich Dokumente
Kultur Dokumente
Keep in mind that Revit is aware of units. So to avoid getting an inconsistent units
error remember to divide and multiply when appropriate.
For example, these are correct formula:
(Length_A * Length_B) = Area_C
(Length_A * Length_B)/1 = Length_C
Basic opperators:
+
Add: 15 + 0 6 + Length
sin
Sine: sin(75)
Subtract: 1 2 Width
cos
Cosine:
cos(75)
tan
Tangent:
tan(75)
Divide: Length / 8
asin
Arcsine:
asin(75)
aco
s
Arccosine:
acos(75)
log
ata
n
Arctangent:
atan(75)
sqr
t
exp
abs
pi
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.
Less Than
>
Greater Than
Equal to
Divide: Length / 8
AND
OR
NOT
Statement is false
Conditional statements can contain numeric values, numeric parameter names, and
Yes/No parameters.
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). For more
information see Revit Families 402 Greater Than or Equal To
Simple IF Statement
IF (Length < 30, 2 6, 4)
Formula That Returns Strings
IF (Length > 30, This thing is tall, This thing is short)
Using logical AND
IF ( AND (x = 1 , y = 2), 8 , 3 )
This will return <true> if both x=1 and y=2, else <false>
Using logical OR
IF ( OR ( A = 1 , B = 3 ) , 8 , 3 )
This will return <true> if either A=1 or B=3, else <false>
Nested IF statements
IF ( Length < 10 , 1 , IF ( Length < 20 , 2 , IF ( Length < 30 , 3 , 4 ) ) )
Returns 1-0 if Length<10-0, 2-0 if Length<20-0, 3-0 if Length<30-0 and 4-0 if
Length>30-0
IF with Yes/No condition
Length > 10
(Note that both the condition and the results are implied.)
Returns checked box <true> if Length > 10
NOT with Yes/No condition
not(myCheckbox)
Returns checked box (<true>) of Yes/No parameter myCheckbox is unchecked, and
it returns <false> if myCheckbox is checked.
Rounding
Prior to Revit 2012 the only way to round numbers was to pass a number through an
integer parameter. The integer parameter always rounds to the nearest whole
number with the standard mathematical rounding rules of:
Down -> for fractions of 0.0 to 0.49 and -0.5 to -0.99
Up -> for fractions of 0.05 to 0.99 and -0.49 to 0.0
As of Revit 2012 we now have three additional functions to use!!
Note that x is unit-less
Round(x)
Rounds to the nearest whole number per the standard rules mentioned above.
round (1.1) = 1
round (1.5) = 2
round (1.7) = 2
round (-1.1) = 1
round (-1.5) = 1
round (-1.7) = 2
Roundup(x)
Rounds to the largest whole number greater than or equal to x.
round (1.0) = 1
round (1.5) = 2
round (1.6) = 2
round (-1.0) = 1
round (-1.5) = 1
round (-1.6) = 1
Rounddown(x)
Rounds to the smallest whole number less than or equal to x.
round
round
round
round
round
round
(1.0) = 1
(1.5) = 1
(1.6) = 1
(-1.0) = 1
(-1.5) = 2
(-1.6) = 2