Revit API unit conversion

I am using revit api to update pipe sizes in a python script…Is there any way to give diameters in mm instead of its feet equivalent.
image

Nope, what I usually do if use a conversion method.

See mine below. you can use ToInternalUnits. The first input is the value in mm and the second you don’t have to put in. It has a default value

#From the Revit Project Units to Feet
def ToInternalUnits(number, unittype = None):
    if unittype = None:
        unittype = UnitType.UT_Length 
	currentType = doc.GetUnits().GetFormatOptions(unittype).DisplayUnits
	return UnitUtils.ConvertToInternalUnits(float(number), currentType)


#From the Feet to the Project Units
def FromInternalUnits(number, unittype = None):
    if unittype = None:
        unittype = UnitType.UT_Length 
	currentType = doc.GetUnits().GetFormatOptions(unittype).DisplayUnits
	return UnitUtils.ConvertFromInternalUnits(float(number), currentType)
1 Like

great…it worked thanks