LearnRevitAPI
![](https://framerusercontent.com/images/zMFB840Y52OLteloUT4BRuogE.png)
![](https://framerusercontent.com/images/U9zjOvD4k3m6cIJd5bOiu960DeI.png)
Jan 2, 2023
Convert Units
![](https://framerusercontent.com/images/Sd5FTaxiqzG7oeH1ykV6yypUzXo.png?scale-down-to=512)
Revit API uses feet as its internal units regardless of the unit system used in the project. So whenever we work in a project with metric units, it still stores all the values in feet.
How to Convert Units?
If you work with metric units, then this will help you. Every time you get or set values, you need to work in feet.
Some people just divide or multiply values with approx. number to convert. But this causes differences later on because of rounding error.
There will be situations when this difference will be on the edge, where rounding goes up or down. You can easily lose a few m² on a project with 10 000 rooms.
I would suggest to use Revit API native tools for conversion, so there are no differences in your results.
UnitUtils Class
Revit API has a class UnitUtils that has useful conversion methods:
- ConvertFromInternalUnits and
- ConvertToInternalUnits
Both functions have the same arguments. We need a value and units.
They are both easy to work with. However, there was a change introduced in Revit 2021, that has replaced a class to get units:
DisplayUnitType -> UnitTypeId
I hope you find it useful and use in your scripts.
Join Newsletter
📩 You will be added to Revit API Newsletter
Join Us!
which is already read by 6700+ people!
![](https://framerusercontent.com/images/svHzzMLtnnRCxtCUwbgAm6CUeB8.jpg)
![](https://framerusercontent.com/images/Y44kwhY0i7q37LzXUjrlxeGUo.jpg)
![](https://framerusercontent.com/images/lqKYmh8rqwZwgY2C9MSQER6iBCI.jpg)
![](https://framerusercontent.com/images/SyGCvJ3dbHsJEyklWWBhweY.jpg)
![](https://framerusercontent.com/images/DwiaUdmQHs3FVdDH2PXwAr0Y.jpg)