When retrieving any length value using Revit's API, it will automatically be returned in decimal feet (for example, 6 inches = 0.5 Feet). Displaying lengths in any commonly-used format will require special conversion methods. In the example below, we feed a 5,000mm line into the Python Script node:
The above code returns a value of 16.404, which is the same length but measured decimal feet.
Converting Between Units
Decimal feet isn't very useful to anyone so you'll want to convert to something more helpful. To make this conversion, we'll want to use Revit's UnitUtils class. Furthermore, we'll be restricted to choosing value types from Revit's DisplayUnitType enumeration. Let's see this in action:
Sometimes when passing an angle value in to the Revit API, it needs to be converted from degrees to radians first. This can also be done using UnitUtils.Convert(), like so: