Revit Formulas for Parametric Family Creation

Fausto Mendez

Architecture and Engineering, All, Revit, Construction, Families, Family-Creation, Formulas 0 Comment

Here is a Collection of Revit Formulas for Parametric Family Creation

Addition( + )

X + Y

Subtraction( - )

X - Y

Multiplication( * )

X * Y

Division( / )

X / Y

Exponentiation( ^ )

X ^ Y

Logarithm( log() )

Log(x)

Square root ( sqrt() )

sqrt(x)

Sine( sin() )

sin(x)

Cosine( cos() )

cos(x)

Tangent( tan() )

tan(x)

Arcsine( asin() )

asin(x)

Arccosine( acos() )

acos(x)

Arctangent( atan() )

atan(x)

10 raised to an x power( exp() )

exp(x)

Absolute Value( abs() )

abs(x)

Pi( pi())

Pi()

Function syntax Description Examples
round(x) The round function returns a value rounded to the nearest whole number. It doesn't take into consideration rounding direction. round(3.1) = 3

round(3.5) = 4

round(-3.7) = -4

roundup(x) The roundup function returns a value to the largest integral value greater than or equal to x. roundup(3) = 3

roundup(3.1) = 4

roundup(-3.7) = -3

rounddown(x) The rounddown function returns a value to the smallest integral value less than or equal to x. rounddown(3) = 3

rounddown(3.7) = 3

rounddown(-3.7) = -4

Conditional statements

IF (<condition>, <result-if-true>, <result-if-false>)

Supported Conditional Operators

< Less than

> Greater than

= Equal

/ Divide

AND Both statements are true

OR One of the statements is true

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)

 

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.)

Trigonometry for right triangles:

Known: a+b

c = sqrt(a ^ 2 + b ^ 2)

A = atan(a / b)

B = atan(b / a)

 

Known: a+c

b = sqrt(c ^ 2 - a ^ 2)

A = asin(a / c)

B = acos(a / c)

 

Known: b+c

a = sqrt(c ^ 2 - b ^ 2)

A = acos(b / c)

B = asin(b / c)

 

Known: c + A

a = c * sin(A)

b = c * cos(A)

B = 90° - A

 

Known: c + B

a = c * cos(B)

b = c * sin(B)

A = 90° - B

 

Known: a + B

b = a * tan(B)

c = a / cos(B)

A = 90° - B

 

Known: b + A

a = b * tan(A)

c = b / cos(A)

B = 90° - A

 

Known: a + A

b = a / tan(A)

c = a / sin(A)

B = 90° - A

 

Known: b + B

a = b / tan(B)

c = b / sin(B)

A = 90° - B

Circular Segments.

how to calculate the Segment length, the Chord Length, the Angle etc

Range of Values

Given the following parameters:

user_value:

min_value:

max_value:

actual_value: = if (user_value < min_value, min_value, if (user_value > max_value, max_value, user_value))

IF AND OR Returning the greatest of three values

Say you have these 3 length parameters, and want a fourth parameter to return the greates value/lenght of the 3:

 Length A

Length B

Length C

Return Length (Returns the greatest of the three length parameters)

 Return Length = if(and(or(Length A > Length B, Length A = Length B), or(Length A > Length C, Length A = Length C)), Length A, if(and(or(Length B > Length A, Length B = Length A), or(Length B > Length C, Length B = Length C)), Length B, if(and(or(Length C > Length A, Length C = Length A), or(Length C > Length B, Length C = Length B)), Length C, 0 mm)))

Source and Credits

AUTODESK KNOWLEDGE NETWORK

Use Conditional Statements in Formulas

Valid Formula Syntax and Abbreviations

RevitForum.org

Revit Formulas for "everyday" usage - Autor Munkholm