Revitapi auto convert the length

You can look up the project units for a specific unit type, Length in the code below, and use that to determine the conversion needed.

import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

unitType = UnitType.UT_Length
currentDisplayUnits = doc.GetUnits().GetFormatOptions(unitType).DisplayUnits

OUT = currentDisplayUnits
2 Likes