Professional Documents
Culture Documents
If this is not true (the Length parameter is more than 50), then the current parameter value is set to 5.
However, if this is not true (the Height parameter is less than 50) then the current parameter value will be set to the string
value of This item is short.
eTip
Nested IF Statements
Here if an If statement is correct a value is set, but if it is not correct it looks at another If statement to see if that is correct, if it
is it sets a value, if not it goes to the next If statement, and so on.
IF (Length < 50, 10 , IF (Length < 60, 15, IF (Length < 70, 20, 25 ) ) )
If the Length parameter has a value less than 50, then the current parameter value is set to 10.
However, if the is not true it checks the next If statement, so if the Length parameter has a value less than 60 (but greater than
50 due to the previous statement), then the current parameter value is set to 15.
However, if the is not true it checks the next If statement, so if the Length parameter has a value less than 70 (but greater than
60 due to the previous statement), then the current parameter value is set to 20,
If this is not true then the current parameter value is set to 25.
eTip
then we can apply formulas to it that will return Yes (ticked box) if the condition is True or No (unticked box) if the condition is
False. We do not use the If statement, Revit checks to see if the given formula is true or false itself.
Length > 50
If the Length parameter is greater than 50 then the statement is true and the Yes/No check box is checked (ticked).
If the Length parameter is not greater than 50 then the statement is false and the Yes/No check box is NOT checked (ticked).
IF OR Statement
If either the Length = 10 or Width = 20 then the current parameter value will be set to 10.
eTip
However, if Length does not = 10 and Width does not = 20 then the current parameter value will be set to 30.
IF AND Statement
If Length = 10 and Width = 20 then the current parameter value will be set to 30.
However, if either Length does not = 10, or Width does not = 20 then the current parameter value will be set to 50.
eTip
By specifing that Metal can not be true while Timber is true, the user can only specify one of the two materials. They both
cannot be checked at the same time. This can be used for visibility where a left or right access panel may be required but never
both.
A Shared text parameter (Exit Type) is added with a formula to determine if the Exit sign is near a stairway.
eTip
If (EMERGENCY, "EMERGENCY","EXIT")
Create a tag that references the shared parameter to show "EMERGENCY" or "EXIT".
eTip
EXAMPLE ONE:
In this example we want to create a Paint Finish, where the user can choose from five (5) different colors.
Create a Type parameter - An Integer, Other parameter, which is called "PAINT FINISH".
Create a Type parameter – an Integer, Other parameter, which is called "PAINT COLOR CHECK".
Finally, create a series of Type parameters - a Yes/NO, Other parameters, which are called “1 IS RED”, “2 IS YELLOW”, ”3 IS
GREEN”, “4 IS BLUE”, “5 IS PURPLE”.
Then add the following formula to the Paint Color Check parameter:
This checks to see if the Paint Finish value is set to 0, or greater than 5, if it is it will set the Paint Color Check value to 1, if it is
not (it is between 1 and 5), then it will set the Paint Color Check to the appropriate value of 1, 2, 3, 4, or 5.
We also need to set the corresponding colors to switch on or off depending on what the Paint Color Check value is, this is done
with a simple formula of:
Because these are Yes/No, they will only switch On if their value is true.
EXAMPLE TWO:
In this example we want to work out the Glass area of a selected window. Each window has its own formula for working out
the glass area. There are a total of three (3) windows of completely different glass areas.
Create a Type parameter - An Other, Integer parameter, which is called "WINDOW TYPE".
Create a Type parameter - An Other, Integer parameter, which is called "WINDOW TYPE CHECK".
eTip
Back in the Family Types dialog box give the Window Type Check parameter the following formula:
This checks to see if the Window Type value is set to 0, or greater than 3, if it is it will set the Window Type Check value to 1, if
it is not (it is between 1 and 3), then it will set the Window Type Check to the appropriate value of 1, 2, or 3.
Repeat the above step for one more parameter called “HEIGHT”. Do not forget to type in values for each of these, in this
example Width = 2000, while Height = 1000.
Create a Type parameter – A Text, Area parameter, which is called "1 IS PLAIN SQUARE WINDOW".
eTip
Repeat the above step for three more parameters: "2 IS SQUARE WINDOW WITH WOOD PANELS”, "3 IS SQUARE WINDOW
WITH LOUVRES" and “GLASS AREA”.
We now need to add formulas that calculate the area of glass for each window type:
For “2 is Square Window With Wood Panels” add the following formula:
=(Height * Width) / 2
Note that the resultant area is in Square Meters, this is because they are the default in Manage > Settings > Project Units, you
can change them to Square Millimetres and the Parameters will update accordingly.
eTip
We now need to add a formula so that the correct area is shown for the selected Window Type:
= if(Window Type Check = 1, [1 is Plain Square Window], if(Window Type Check = 2, [2 is Square Window With Wood Panels],
[3 is Square Window With Louvres]))
Here the formula is checking to see what the Window Type Check value is, and then set the appropriate formula for calculating
the Glass Area.
eTip
Controlling Visibility
In this example we want to switch the Visibility of a solid On/Off depending on its Height.
EXAMPLE TWO:
In this example we want to control the Visibility of a set of notes. The family contains three (3) sets of text (Notes), depending
on the value a different set of notes is Visible.
Create a Type parameter – An Other, Integer parameter, which is called "SHOW NOTE".
Create a Type parameter – An Other, Integer parameter, which is called "SHOW NOTE CHECK".
This checks to see if the Show Note value is set to 0, or greater than 3, if it is it will set the Show Note Check value to 1, if it is
not (it is between 1 and 3), then it will set the Show Note Check to the appropriate value of 1, 2, or 3.
Now we have to create parameters to control the Visibility of the each of the Notes.
Create a Type parameter – A Visibility, Yes/No parameter, which is called "TEXT NOTE 1".
eTip
Repeat the above step for “Text Note 2”, and “Text Note 3”.
Next, we need to add a formula to each of the Text Note Visibility parameters to control what is switched On/Off.
Repeat for “Text Note 2”, and the “Text Note 3” parameter.
Now only the Note that is selected in the Show Note parameter is Visible.