Characters in Text:   backslash: \"
formula (sf) parameter name (sp) user input (su) Warning (sw)

Set a YES/NO with another parameter:

par [yes if match:]
not(par) [yes if does not match]
par > 0' 0 9/32" [yes if greater than]
and(par1, par2, par3) [yes if all are true, all must be true]
or(par1, par2, par3) [yes if any are true]
(and(par > 0' 0 9/32", par < 0' 0 17/32")) [yes if between values]
Force yes/no parameters to be checked or unchecked
Force checked = 1 < 2 or 1=1
Force unchecked = 1 > 2 or 1=2

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)
    Sample if Statements:
    if(Rated, 6", 2") [if Rated is selected value is 6", if not value is 2"]
    if(Door, 0' 2 3/16", 0' 2 7/16")
    if(Wrap, Wall Thickness + 1 1/8", Butt Frame Depth)
    if(Height < 4' 1", 2, if(Height < 6' 1", 3, if(Height < 8' 1", 4, if(Height < 10' 1", 5, if(Height < 12' 1", 6, if(Height < 14' 1", 7, 8))))))
    if(Mid Mullion Centered, (Height/2), if(Mid Mullion Height < (Frame Face + Mullion Face + 3"),(Frame Face + Mullion Face + 3"), Mid Mullion Height))
    Common Clarity: if(Clarity < 0' 0 1/32", 0' 0 1/32", if(Clarity > 0' 0 1/2", 0' 0 1/2", Clarity))
    if(S10, Path10, if(S9, Path9, if(S8, Path8, if(S7, Path7, if(S6, Path6, if(S5, Path5, if(S4, Path4, if(S3, Path3, if(S2, Path2, L1)))))))))
    Returns Strings: if (Width < 32, "Opening too narrow", "Opening OK")
    Using logical AND
    if (and (x = 1 , y = 2), <true>, <false>) Returns <true> if both x=1 and y=2, else <false>
    Using logical OR
    if (or ( x = 1 , y = 2 ) , <true>, <false>) Returns <true> if either x=1 or y=2, else <false>
    Nested if statements
    if ( Length < 500 , 100 , if ( Length < 750 , 200 , if ( Length < 1000 , 300 , 400 ))) Returns 100 if Length<500, 200 if Length<750, 300 if Length<1000 and 400 if Length>1000

    Returning the greatest of multiple values

    Return a parameter to return the greatest value/length 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)))
    Another option is to use an extra "Calc" parameter, which is a bit more clumsy but also way easier and more manageable for us mortals.
    Calc = if(Length A > Length B, Length A, Length B)
    Return Length = if(Calc > Length C, Calc, Length C)
    And a third option:
    Return Length = if(A > D, if(A > C, if(A > B, A, B), if(B > C, B, C)), if(B > D, if(B > C, B, C), if(C > D, C, D)))
    Credit to: Ekkonap who posted this on May 23rd 2011.
  • Math Samples:

    par * 2
    (par1 - (par2)-(par3)-(par4 * 2))/3

    Circles

  • Usage in Revit = pi()
  • Circumference = pi() * (Radius * 2)
  • Circumference = pi() * Diameter
  • Circle Area = pi() * Radius ^ 2

    Percent

  • Create a number parp1, user to enter 0-100
  • Create a number parm1 to convert parp1 to a multiplier parp1 * 0.01
  • Create a distance par like = distance * parm1

    Square Root

  • Fixed value = sqrt(999)
  • Parameter = sqrt(Width)
  • Formula = sqrt(Width + Height)

    Exponentiation

    (the operation of raising one quantity to the power of another)
    X raised to the power of Y = X ^ Y

    E raised to an x power
    E is a mathematical constant that is approximately equal to 2.7. It is an irrational number, but if we truncate it to 20 decimals it would be 2.7182818284590452353.
    Revit usage = exp(x)


    Logarithm

    The logarithm of a number to a given base is the exponent to which the base must be raised in order to produce that number. For example, the logarithm of 1000 to base 10 is 3, because three factors of 10 must be multiplied to yield a thousand: 10×10×10 equals 1000
    Revit usage = log(1000)

  • Trigonometry for right triangles:


    Slope: Slope per Foot [1/4"]
    a (Slope per Foot / 12") * [length]
    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

    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))
    Specify a range of valid entries, with the min_value and max_value parameters; then, use the actual value if it is within the range; otherwise, use your minimum or maximum values.

    Credits: Alfredo Medina, who posted this on March 23rd 2011

  • Rounding

    For Length: roundup(length/0′ 0 1/8″) *0′ 1/8″
    fraction will be precision rounded to.

    (round(par1/5))*5 = par1 rounded to the nearest five.

    Simple use Results:
    round ( 23.4) = 23
    round ( 23.5) = 24
    round ( 23.6) = 24
    round (-23.4) = -23
    round (-23.5) = -23
    round (-23.6) = -24

    rounddown ( 23.0) = 23
    rounddown ( 23.5) = 23
    rounddown ( 23.9) = 23
    rounddown (-23.0) = -23
    rounddown (-23.5) = -24
    rounddown (-23.9) = -24

    roundup ( 23.0) = 23
    roundup ( 23.5) = 24
    roundup ( 23.9) = 24
    roundup (-23.0) = -23
    roundup (-23.5) = -23
    roundup (-23.9) = -23

    Samples:

    Control YES/NO: Window - Alum - Section End.rfa
    Control Lengths: Window - Alum - Section End.rfa