Announcements
Welcome to the Revit Ideas Board! Before posting, please read the helpful tips here. Thank you for your Ideas!
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Revit for Dynamo to be metric to avoid decimal places in conversion

Revit for Dynamo to be metric to avoid decimal places in conversion

Created a script where the family was drawn exactly to the mm without decimal places. I then placed this family in a project where true north and project north are exactly the same and placed the family to mm again without decimal points as per this diagram

wrmarshall_0-1759220438211.png

Above shows family in project and the origin point

wrmarshall_2-1759220593230.png

Above the family alignment in family editor

 

For some reason when I run the script though it is showing decimal places that have crept in

wrmarshall_1-1759220495854.png

Above the decimal places in Dynamo

 

Researching what is happening is that apparently Revit is programmed in Feet and inches and converts my metric number, which is causing the decimal places. 

 

I could easily round them but the script still  refers back to this part where decimal places occurs. 

2 Comments
dfoth
Advocate

This is a dynamo issue. It doesn't affect your end product in Revit, just is annoying to see in dynamo. I've noticed this too, for ducts that are clearly 12" diameter, dynamo tells me they are 11.99999998". I feel your pain lol. 

julia_lubacheskiQ3DPX
Contributor

Hi Marshall,

Yes — you’ve hit the core of it. Revit’s internal units are always feet, regardless of your project or family units being metric. Even if you draw everything perfectly in millimeters, Dynamo (and the Revit API underneath it) will still return values in feet.

That’s why you’re seeing small decimal places creeping in — they’re the result of floating-point conversion when Revit translates your metric coordinates back into its internal feet-based system.

Here are a few ways to handle it cleanly:

  1. Convert units explicitly in Dynamo
    Use a *12.0/304.8 (or simply *304.8 to go from feet → mm) conversion after reading the location with Element.GetLocation. This ensures you’re working in clean millimeter values before doing any rounding or geometry operations.

  2. Apply rounding logic immediately after conversion
    Use Math.Round(x,0) (or similar) to snap results to whole millimeters before using those values further downstream. That prevents rounding errors from propagating through your script.

  3. Understand that the decimals aren’t “errors”
    They’re not inaccuracies in your geometry — just unit precision from the internal representation. Even perfectly aligned elements will show decimals when converted back from feet to mm.

If your script relies on exact equality checks (like comparing coordinates or distances), try introducing a tolerance value (for example, ±0.5 mm). That’s the best way to make Dynamo scripts resilient when dealing with Revit’s internal math.

So yes — Revit is “imperial under the hood,” and that’s what’s causing those decimal tails. Rounding or converting explicitly in Dynamo is the right way to keep your metric workflows consistent.

Can't find what you're looking for? Ask the community or share your knowledge.

Submit Idea