Problems with unit conversions in family formulas

Problems with unit conversions in family formulas

dbroad
Mentor Mentor
696 Views
2 Replies
Message 1 of 3

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
697 Views
2 Replies
Replies (2)
Message 2 of 3

HVAC-Novice
Mentor
Mentor

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: R2026.5
Hardware: i9 14900K, 64GB, Nvidia RTX 2000 Ada 16GB
Add-ins: ElumTools; Ripple-HVAC; ElectroBIM; Qbitec
0 Likes
Message 3 of 3

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