Can You Put a Minimum / Maximum Contidion on a Revit Family Parameter
- Revit Formulas for Everyday Usage
- Exponentiation
- E raised to an x power
- Circles with pi π
- Square Root
- Logarithm
- Forcefulness yes/no parameters to exist checked or unchecked
- Provisional statements
- Supported Conditional Operators
- Uncomplicated IF Statement
- Formula That Returns Strings
- Using logical AND
- Using logical OR
- Nested IF statements
- IF with Aye/No condition
- Not with Yep/No status
- IF AND OR Returning the greatest of three values
- Trigonometry for right triangles:
- Known: a+b
- Known: a+c
- Known: b+c
- Known: c + A
- Known: c + B
- Known: a + B
- Known: b + A
- Known: a + A
- Known: b + B
- Range of Values
- Circular Segments
- Inconsistent Units
- Round Role In Formulas
- Round(10)
- ROUNDDOWN(x)
- ROUNDUP(10)
- Round to a number:
- Credit to: Sander_Malschaert
Below is a re-create of the information as provided at this RevitForum commodity. Formulas referenced below are commonly used when building Revit families.
Revit Formulas for Everyday Usage
Exponentiation
10 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.seven. Information technology is an irrational number, but if truncated to 20 decimals, it would exist ii.7182818284590452353.
Revit usage = exp(x)
Circles with pi π
Usage in Revit = pi()
Circumference = pi() * (Radius * 2)
Circumference = pi() * Diameter
Circumvolve Area = pi() * Radius ^ 2
Foursquare Root
Fixed value = sqrt(999)
Parameter = sqrt(Width)
Formula= sqrt(Width + Pinnacle)
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 of operations 10 is iii, considering 3 factors of 10 must exist multiplied to yield a thousand: 10 × 10 × 10 equals one thousand Revit usage = log(one thousand)
Force yep/no parameters to be checked or unchecked
Force checked = 1 < 2
Forcefulness unchecked = 1 > 2
Conditional statements
Conditional argument uses this structure:
IF (<condition>, <result-if-true>, <result-if-imitation>)
Supported Conditional Operators
< Less than
> Greater than
= Equal
/ Divide
AND Both statements are true
OR Ane of the statements is true
NOT Statement is fake
Conditional statements can comprise 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)
Elementary IF Argument
IF (Length < 900, <truthful>, <fake>)
Formula That Returns Strings
IF (Length < 900, "Opening too narrow", "Opening OK")
Using logical AND
IF ( AND (x = 1 , y = ii), <truthful>, <false>)
Returns <true> if both x=1 and y=ii, else <fake>
Using logical OR
IF ( OR ( x = 1 , y = 2 ) , <true>, <false>)
Returns <true> if either x=1 or y=two, 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<grand and 400 if Length>1000
IF with Yes/No status
Length > 40
Returns checked box (<truthful>) if Lenght > 40
NOT with Yes/No status
not(Viz)
Returns checked box (<truthful>) if Yeah/No parameter "Viz" is unchecked, and returns unchecked box (<faux>) if Yes/No parameter "Viz" is checked.
IF AND OR Returning the greatest of three values
Say you accept these 3 length parameters, and want a fourth parameter to return the greater value/length of the three:
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)))
Credit to: Joe Zhou for this formula!
Another option is to apply an extra "Calc" parameter, which is a flake more clumsy just 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 choice:
Render 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.
Trigonometry for correct triangles:
Known: a+b
c = sqrt(a ^ 2 + b ^ ii) 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 = ninety° - A
Known: c + B
a = c * cos(B) b = c * sin(B) A = ninety° - B
Known: a + B
b = a * tan(B) c = a / cos(B) A = ninety° - 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, utilise 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
Circular Segments
To summate the Segment length, the Chord Length, the Angle etc.
Sample file posted hither
Inconsistent Units
There'south a split post explaining this behavior here: Revit - Inconsistent Units and how to neutralize them.
Round Office In Formulas
Values in formulas tin exist at present rounded up or down. For example, when riser height is calculated, one needs the function "round" to find the appropriate value.
Round(x)
Thecircular function returns a number rounded nearest to a whole number. Information technology doesn't take into consideration rounding direction (round up or downwardly). If the number is (for example) from 24.5 to 24.9, the function rounds it to 25. If it is from 23.1 to 23.four, the part rounds it to 23.
Examples:
round ( 23.four) = 23
Round ( 23.v) = 24
Round ( 23.6) = 24
Round (-23.4) = -23
Round (-23.5) = -23
Round (-23.half dozen) = -24
Syntax
The syntax for theround office is: round( number)
number is the number to round.
ROUNDDOWN(x)
"10" is a unitless value that should render the smallest integral value less than or equal to x.
For instance:
rounddown ( 23.0) = 23
rounddown ( 23.5) = 23
rounddown ( 23.9) = 23
rounddown (-23.0) = -23
rounddown (-23.v) = -24
rounddown (-23.9) = -24
Syntax
The syntax for therounddown function is:rounddown (number)
number is the number to round down.
ROUNDUP(ten)
"x" is a unitless value that should return the largest integral value greater than or equal to 10.
For example:
roundup ( 23.0) = 23
roundup ( 23.5) = 24
roundup ( 23.9) = 24
roundup (-23.0) = -23
roundup (-23.five) = -23
roundup (-23.9) = -23
Syntax
The syntax for theroundup office is:roundup (number) number is the number to round up. Note that when numbers such as 23.5 are rounded, they can result in either 23 or 24. To produce a stable consequence, for all the .5 cases, nosotros round to the larger integer. That ways that 23.five is rounded to 24, while -23.five to -23
Round to a number:
number to round: X
number to round to: Y
(ROUND(Ten/Y))*Y
rounding a parameter value to the nearest five would look similar this:
(Circular(<parameter>/v))*5
Credit to: Sander_Malschaert
weatherburnalaing.blogspot.com
Source: https://help-electrical.evolvemep.com/tips-tricks-evolve-electrical/revit-formulas-for-everyday-usage