Using If Statements for Yes/No Parameters
Establishing the Formula
First, we need to establish what the formula is. We will use If (condition, true, false). When converted to the Yes/No parameter, it will change to If (condition, yes, no).
We need to set true or false statements where true = yes and false = no. Consider the example 1 < 2. In this statement, we ask if one is less than two, which is true. Therefore, Revit will count this as a true statement. If we ask the opposite (2 < 1), Revit will count this as a false statement.
“Less Than” Condition
Example 1: If (Height < 4′ 6″, 1 < 2, 2 < 1)
In this statement, we ask “is the height less than 4 foot 6 inches?” If the answer is “True” (Height = 4’), the true value is returned. The result will equal “Yes” and the parameter is activated. If the answer is “False” (Height = 6’) the “False” value is returned. The result will equal “No” and the parameter is deactivated.
Let’s dive a little deeper. The condition is If (Height < 4’ 6”). We ask if the object’s height is less than 4’ 6” to activate/deactivate the 3 Shelves Yes/No parameter.
First, break down the “Yes” statement (1 < 2), which is “True.” If the Height is less than 4’ 6” the statement will activate the 3 Shelves Yes/No parameter.
The “No” statement (2 < 1), is “False.” If the Height is greater than 4’ 6” the parameter will deactivate the 3 Shelves Yes/No parameter.
“Greater Than” Condition
Example 2: If (Height > 4′ 6″, 1 < 2, 2 < 1)
In this statement, we ask “is height greater than 4 foot 6 inches?” We are asking whether the objects Height is greater than 4’ 6” to activate/deactivate the 4 Shelves Yes/No parameter.
First, break down the “Yes” statement (1 < 2), which is “True.” If the height is greater than 4’ 6” the statement will activate the 4 Shelves Yes/No parameter.
The “No” statement is (2 < 1) is “False.” If the height is greater than 4’ 6” the statement will deactivate the 4 Shelves Yes/No parameter.
Conclusion
This process is a simple way to create design options in your Revit families by using If statements in your Yes/No parameters. By using these methods, you can easily control the visibility of a Revit family.