Revit has a lot of quirks that need to be worked around, and that means finding those workarounds and taking advantage of them. There was an issue with units in previous versions of Revit (that has since been resolved – thankfully) that led to developing a useful trick: using hidden values to drive visible ones.
Before Revit 2014:
There were parameters that had issues displaying the correct way. For example, setting a piping flow rate to GPM with a formula would give an incorrect value using Air Flow units. Revit 2013 and earlier treat all flow formulas as Air Flow – it is hardwired in – even when dealing with piping, so using formulas can get tricky inside of families.
As you can see in the above images, even while project units were set to GPM for flow the formula field only accepted values in CFM, the Air Flow project units. What’s more, it will only accept whole values: no fractions and no decimals. While the GPM field itself can be set to any value, locking it out with a formula is where the issue comes up.
Here’s where the workaround comes in.
If you use other parameters to store the value, and then only reference those parameters inside of a formula, it skips the conversion that normally takes place and displays the desired value. – in the correct units, to the correct unit accuracy. If the ‘storage’ parameters are made as Hidden Parameters, then they are not visible in the properties palette in the project. Parameters that present value to the user remain visible while the ‘Storage Parameters’ do not (in this case, Flow Rate). The great part about this is that whatever your project units, they will always be accurate. Even though the parameter that holds your “actual” GPM is hidden, changing project units to L/s will convert its value to L/s, etc.
To create a Hidden Parameter, all that needs to be done is to change a Shared Parameter’s “Visible” value to 0 inside of the shared parameter file prior to writing the parameter to the family. A future post will focus on this little known feature and how INVIEW uses it extensively.
Revit 2014 and Beyond:
In current versions of Revit, the Formula units now match the units shown in the Value field. However, the rounding increment shown in the formula field doesn’t always match what is shown in the Value field. If a number gets rounded inside of a formula, its true value is lost: as far as Revit is concerned, the rounded value is the value that was initially input as soon as the Types dialogue is closed. For example, while still working in the same instance of the Types dialogue, a 1.5 that was rounded to 2 inside of a formula will read as “1.5” in the output, but once the dialogue is closed and reopened, it will read as a 2. Changing unit precision will not resolve this problem since the formula itself was “edited” to have the rounded value. This issue is most prominent with small values: fractions of a unit that when rounded, are lost.
A simple way to recreate this is to set Project Units to Feet and fractional inches. Unit precision does not matter in later versions of Revit: formula fields are very precise, regardless of project unit precision. If you were to create a Length parameter and set its Formula to a static value of .05”, it automatically converts to a fraction of 13/256”. Press okay to close to the types dialogue, convert project units to decimal inches, and reopen the types dialogue. You’ll see that the original value was lost and is now .051”. Values that small are not usually an issue – but it is something to keep in mind and is solid evidence to easily reproduce. Once a unit is rounded, its original value is lost in the family editor.
Storing values inside of hidden parameters have quite a few uses, and prevent mistakes inside of families: values that would otherwise be unlocked and rely on the user to not change them can be locked completely, and unit accuracy can be guaranteed.
Let’s say there was a family that absolutely needed ¼” accuracy at all times. If you do not want Revit to ever round that value up or down, create two Hidden parameters: “Number” (Discipline: Common, Type: Number) and “Unit” (whatever your desired unit is. In this example, Discipline: Common, Type: Length). They will feed into a third parameter, “Visible Value” (same unit type as the “Unit” parameter. This parameter will be what users see). Set the “Number” parameter to be .25. Now use the “Unit” parameter, unlocked, to hold the value you want to set: if you want that ¼” accuracy, set the parameter to be 1”. In the formula field of the “Visible Value” parameter that users will be using, multiply the two hidden parameters together: in this example Number * Unit. Since “Number” and “Unit” are hidden they will not be seen inside of a project, but the Visible Value field will always be accurate – even if it’s rounded up or down by the project units, its value remains constant.
The usefulness does not end there: you can also use Storage Parameters to lock the values of parameters that always exist in a family, like Model and Description. If you had four separate types with unique values (such as a Part Number, Ordering Number, or SKU) you could use a hidden storage parameter to lock them out by Type instead of leaving the values open. The same goes for changing dimensions – multiple types with different Width, Height, and Depth could all be locked using a hidden value.
When I create a family, I usually name that Storage Parameter “z Type”, and there are very few families that I make without it: set “z Type” to be a different value for each of the types in a family, set all of the formulas to look for a specific z Type that informs them what their value is supposed to be. Voila: completely parametric family with locked values to prevent mistakes wherever they are needed. Correct “Cost” values for every type, security cameras that have the correct horizontal and vertical field of view, depending on lenses… The possibilities are endless.