October 20, 2016

Revit Families: Yes/No Parameter Defaulting to No

When you add a Yes/No parameter in a Revit® family, the initial default value is "Yes" - the box in the Value column is checked. If you only have one Type in your family at the time, it is easy enough to uncheck the box if you want it to be set to "No" and to have the value be "No" for any other Types created while that Type is current.

But there are occasions, such as for visibility parameters, where a family may get created, with multiple Types, and then later edited to add a new Type that requires a new Yes/No parameter that should only be turned on for the new Type. It is tedious to set each existing Type current and uncheck the newly added Yes/No parameter if there are more than two or three existing Types. Unfortunately, there is no way to specify the initial value for a newly added Yes/No parameter. Thanks to this post in the Who's afraid of the Big Bad BIM? blog, I have worked out a way to quickly get all types set to "No". I believe that what follows is the full intent of what the original article posted, but the article stops short of clearing the formula so that one or more of the Types can be set to "Yes" and therefore also does not note the need to change to a different Type when clearing the formula, so that all Types remain unchecked. [Perhaps that was not necessary in whatever version Erik was using in the summer of 2012 when the article was written.]

  1. Add a new Yes/No parameter to a Revit family with multiple Types, in which you want most of the Types to be set to "No".
    Note that all of the Types will be initially set to "Yes" (checked).
  2. In the Formula column for the newly added Yes/No parameter, type 1=0, and then press the ENTER key. Any expression that evaluates to false will do.
    Note that the toggle in the Value column is now unchecked, but it is also grayed out and locked, because it is being controlled by the formula.
  3. Set a different Type to be the current Type.**
  4. Delete the formula for the newly added Yes/No parameter.
  5. All of the Types are now set to "No". If you want any to be set to "Yes", set each one current, in turn, and select the toggle to check it.
The Screencast below shows the above steps in action. It also shows a second Yes/No parameter being added where the formula is deleted immediately after it was added, with the result that only that one Type is set to "No".
** - In Revit 2016, I found that if I deleted the formula in the Type in which I originally placed it, immediately after placing it, that only that Type remained set to "No", and the others remained checked. If you want, you can change to another Type and then change back to the original to do the deletion. There may be other actions which will "set" the "No" values for all Types.

No comments: