LookupParameter returns values multiplied

Hey, I have a strange issue I wanted to see if anyone else encountered before

I used LookupParameter on an SHS family type to get the “h” value of the type, after using AsDouble I get results that are exactly multiplied by 1/304.8 the actual value of h, meaning I have to multiply the results by 304.8 in order to get the value I need.

I can’t figure out if it has something to do with units conversion or something similar, but I want to make sure this factor persists and that I wouldn’t have to calculate it manually before each run

example:

The value you get from API is in Revit’s internal units, i.e. feet. I’d use the UnitUtils class so that instead of converting specifically to millimeters like in your case I’ll always convert to whatever the document units are.

# get current document units for length
docunits = doc.GetUnits().GetFormatOptions(SpecTypeId.Length).GetUnitTypeId()
# get a conversion factor from internal units to current document units
conversion_factor = UnitUtils.ConvertFromInternalUnits(1.0, docunits)

lengthDoc = lengthInternal * conversion_factor