Wednesday, October 26, 2005

Revit Formulae

So... I will just jump straight in here.
Many of the formulae conditions can be replicated re-used etc.
The Help files are most useful when starting out with formulae in Revit.
Also hunt around in

Here is some "help file" extrapulation....

You can enter formulas for calculating parameter values. Formulas may include numerical constants and other parameter names. For example, the family could have two parameters named Length and Width. The value for Width might be calculated with the formula Length/2.

Formulas are case sensitive. If the parameter names have initial capitals, you must enter them in the formula with capitals. For example, the parameter name is Width. You type width * 2 in the formula. This is ambiguous to Revit Building, and it does not accept the formula.

Formulas support the following arithmetic operations: addition, subtraction, multiplication, division, exponentiation, logarithms, and square roots. Formulas also support the following trigonometric functions: sine, cosine, tangent, arcsine, arccosine, and arctangent.

For numerical values in formulas, you can enter integers, decimals, or fractional values.

Formulas are available for instance parameter values in the project. You must begin the formula with an equal sign. For example, as you sketch a wall, you can enter a formula for the temporary dimension for the wall. Click , and you can enter formulas for numerical properties of the wall, such as Unconnected Height and Base Offset.

TIP: Keep your units consistent. Do not mix units in your formulas. You can use constants with no units assigned to them.

Length = Height + Width + sqrt(Height*Width)
Length = Wall 1 (11000mm)+ Wall 2 (15000mm)
Area = Length (500mm) * Width (300mm)
Volume = Length (500mm) * Width (300mm) * Height (800 mm)
Width = 100m * cos(angle)
x = 2*abs(a) + abs(b/2)
Create the family geometry.
Create and label dimensions to the geometry. See Labeling Dimensions. Do not select the Instance Parameter option. In the Family Editor, formulas are available for type parameters only.
Click Family Types from the Design Bar.
In the Formula column next to the appropriate parameter, type the formula for the parameter. Notice that the formula begins with an equal sign (=).

Formulas can comprise conditional statements. You enter conditional statements in the Formula box for a numerical parameter.

A conditional statement uses this structure:

IF (, , )

This means that values are entered for the parameter, depending on whether the condition is satisfied (true) or not satisfied (false). If the condition is true, return the true value. If the condition is false, return the false value.

Conditions can use numeric values, numeric parameter names, or 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 some sample formulas that use conditional statements.

Simple IF: =IF (Length < 3000mm, 200mm, 300mm)

IF with logical AND: =IF ( AND (x = 1 , y = 2), 8 , 3 )

IF with logical OR: =IF ( OR ( A = 1 , B = 3 ) , 8 , 3 )

IF with Yes/No condition: =IF (Long, 50, 60) where Long is a Yes/No parameter defined as Long = Length > 40

Embedded IF statements: =IF ( Length < 35' , 2' 6" , IF ( Length < 45' , 3' , IF ( Length < 55' , 5' , 8' ) ) )

The following are valid formula abbreviations.

Addition— +
Subtraction— -
Exponentiation—^: x^y, x raised to the power of y
Square root—sqrt: sqrt(16)
e raised to an x power—exp
Absolute Value—abs

No comments: