LearnRevitAPI

🧮 How to convert units in Revit API with a single line of code.

Feb 26, 2025
🧮Convert Units

📏 Revit API uses feet internally.
This has caused a lot of confusion among beginners who use the metric system. They read parameter values and see completely wrong numbers, and it's the worst when you're debugging something that isn't broken...
So, I want to share a quick snippet with you. Let’s convert units in the Revit API.

🧮 Pull out your calculators.
Methods in Documentation
Converting units with the Revit API is quite simple. There are two methods in the UnitUtils class that we can use to convert TO/FROM internal units:
- UnitUtils.ConvertToInternalUnits(value, UnitTypeId)
- UnitUtils.ConvertFromInternalUnits(value, UnitTypeId)
Here is a screenshot of the Syntax:

As you can see, you need to provide a value and select the appropriate unit from the UnitTypeId class.
Convert Units
If you have a value in metric units and need to convert it into internal units, use ConvertToInternalUnits like this:

However, if you have a value in internal units (ft), then use ConvertFromInternalUnits like this:

That’s it. Just remember that the Revit API uses feet as its internal unit, so always select the correct unit.
UnitTypeId Class
UnitTypeId is a class in Revit APi that contains identifying units of measurement. It includes a long list of units, but you’ll only need a handful, such as Meters, Centimeters, SquareMeters, and so on...
Here is a screenshot from the Docs:

P.S.
If you get incorrect values in the Revit API, make sure you have the right units before you start debugging.
When I started, I fell into this trap and spent hours fixing code that didn't need fixing. I just had to use the correct units.
So, watch out.
Join Newsletter
📩 You will be added to Revit API Newsletter
Join Us!
which is already read by 9500+ people!




