Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Problems with unit conversions in family formulas

dbroad
Mentor
Mentor

Problems with unit conversions in family formulas

dbroad
Mentor
Mentor

I was trying to debug a cabinet formula that wasn't working this morning

The project units were fractional inches with a precision of 1/128".  Some dimensions were in mm.

 

The original formula as keyed in

round(Holes/(ShelvesRows+1) * 32mm-8mm

 

which got converted to 

round(Holes / (ShelvesRows + 1) * 1 67/256" - 81/256"

Holes and ShelveRows are integers. The result was supposed to be an accurate distance.

The resulting dimension was 0.5+- mm off.

 

The corrected formula:

(round(Holes / (ShelvesRows + 1)) * 32 - 8 ) * 1" / 25.4

This did the conversion without using the mm suffix but was dead on.

 

Using mm suffixes was convenient but imprecise. This post is a notice to help others and doesn't require a solution. In short, avoid using unit suffixes in formulas when accuracy is required.

Architect, Registered NC, VA, SC, & GA.
0 Likes
Reply
279 Views
2 Replies
Replies (2)

HVAC-Novice
Advisor
Advisor

All good points. In general you want to avoid mixing metric and IP units. A lot of rounding going on that may add problems and may cost resources (not sure on that one). 

Revit version: R2025.3
0 Likes

Mike.FORM
Advisor
Advisor

Although half a MM is not much of an error, if you are doing lots of calcs with formulas it can add up if units keep switching. 

If I am using some static lengths/sizes in a formula I will usually set the units of the family to the units I am using, in this case I would change to MM.

0 Likes