ROUNDING WITH LENGTHS

Posted: September 29, 2015 by WFRUG in Revit and BIM Tips
After running into a couple of questions regarding rounding of lengths at last night’s meeting, it seemed like a good idea to post a little bit about how the formula works.
Some length unit rounding can be controlled within the project unit settings, but sometimes more specific rounding is needed, especially within schedules. Using Calculated Value parameters with formulas makes the process easy and automated.

Rounding a number parameter to the next whole number in Revit is quite simple.

  • Create a Calculated Value parameter and use the formula ‘ROUNDUP’,
  • The example below shows a number which has decimals being rounded up to the next whole number.  The Formula is: roundup(DECIMAL NUMBER).

Decimal_Rounded_Up

In this example “DECIMAL NUMBER” is the name of the parameter which is being rounded.
And here is the result in the schedule:

Decimal_Number_Rounding_-_Answer

No matter how much higher the decimal is than 1.0 the parameter will round up to the next whole number.

  • To have Revit round up or down to the closest whole number use ‘ROUND’
    To have Revit Round everything down the the closest whole number use… You guessed it ‘ROUNDDOWN’!

Easy as could be!

…It’s a little different for Length…

The Roundup Formula is really meant for numbers, which have no units. A length parameter has feet and inches, which means applying any of the rounding formulas directly to a length parameter will result in an error of “Inconsistent Units”.

Inconsistent_units

Don’t worry, It can be fixed by removing the Units…    ….and eventually putting them back in.
Just follow me for a minute.

  • Create a ‘Calculated Value’ parameter for the formula
    • Make the Discipline “Common”
    • And the Type “Length”
    • Knowing which length the final answer should be rounded to is really important as well.
      • This example below shows the formula rounded to the nearest full foot.create a “Calculated Value” for the formula.
  • The Formula would be: Roundup(Length / 1′) *1′
    Length_Rounded_1'_002
  • To remove the units from the Length (so that the number can be rounded), divide the LENGTH by the incremental inches or foot you want the number rounded to (in this example is a whole foot so use 1′.)
    • But the calculated value is a LENGTH parameter which HAS UNITS!
  • To put the units back in, multiply the whole thing by the unit which was taken out (1′)Length_Rounded_1'_EXPLAINED

… and Voila!

Length_Rounded_1'_001

What is cool about this approach is the total control it gives over what unit to round the final number to.

For example, if the desired rounding is only the the next 1/2″ instead of the full foot, the same steps are used, but instead of dividing by 1′ and multiplying the 1′ back in, Just use 1/2″.

Length_1_2__rounded_

The formula is:  roundup(length/0′ 0 1/2″) *0′ 1/2″
The final rounding could be anything. 1/8″, 3/5″, 3″, etc. Just make sure that the number which is used to remove the unit, is the same number used to put the unit back in, or you will to get some wacky answers.

And that’s it!

There are many things that can be done with Formulas in Revit, if you talk to it nicely. *Wink*

This forum post was super helpful when I started using formulas in parameters and schedules:
http://www.revitforum.org/tutorials-tips-tricks/1046-revit-formulas-everyday-usage.html

And he links to this posting in that same forum, but here is a direct link that talks about Inconsistent units, and what to do about it.
http://www.revitforum.org/tutorials-tips-tricks/1138-revit-inconsistent-units-how-neutralize-them.html

(Just the top post by Munkholm

Hope that helps!

Advertisements

Comments are closed.