Revit .NET has provided the Units API since version 2014. In this series of posts, we are going to explore the Revit Units .NET API and provide sample code and analysis as usual.
Let’s figure out all Revit internal units per unit type in this post.
public static void FigureOutRevitInternalUnitsPerUnitType()
{
string info = "";
using (StreamWriter sw = new StreamWriter(@"c:\temp\RevitInternalUnits.txt"))
{
foreach (UnitType ut in UnitUtils.GetValidUnitTypes())
{
info = string.Format("{0} -- {1}", ut, LabelUtils.GetLabelFor(ut));
sw.WriteLine(info);
foreach (DisplayUnitType dut in UnitUtils.GetValidDisplayUnits(ut))
{
double value = UnitUtils.ConvertToInternalUnits(1.0, dut);
if (Math.Abs(value - 1.0) < 1e-6)
{
info = string.Format("\t{0} -- {1}", dut, LabelUtils.GetLabelFor(dut));
sw.WriteLine(info);
}
}
}
}
}
…
RevitUnitsAPI.FigureOutRevitInternalUnitsPerUnitType();
…
The output may look something as follows:
UT_Number -- Number
DUT_GENERAL -- General
DUT_FIXED -- Fixed
DUT_CURRENCY -- Currency
UT_Length -- Length
DUT_DECIMAL_FEET -- Decimal feet
DUT_FEET_FRACTIONAL_INCHES -- Feet and fractional inches
UT_Area -- Area
DUT_SQUARE_FEET -- Square feet
UT_Volume -- Volume
DUT_CUBIC_FEET -- Cubic feet
UT_Angle -- Angle
DUT_RADIANS -- Radians
UT_SheetLength -- Sheet Length
DUT_DECIMAL_FEET -- Decimal feet
DUT_FEET_FRACTIONAL_INCHES -- Feet and fractional inches
DUT_SQUARE_FEET_PER_FOOT -- Square feet per foot
UT_DecSheetLength -- Sheet Length
DUT_DECIMAL_FEET -- Decimal feet
DUT_FEET_FRACTIONAL_INCHES -- Feet and fractional inches
DUT_SQUARE_FEET_PER_FOOT -- Square feet per foot
UT_SiteAngle -- Site Angle
DUT_RADIANS -- Radians
UT_HVAC_Density -- Density
UT_HVAC_Energy -- Energy
UT_HVAC_Friction -- Friction
UT_HVAC_Power -- Power
UT_HVAC_Power_Density -- Power Density
DUT_WATTS_PER_SQUARE_METER -- Watts per square meter
UT_HVAC_Pressure -- Pressure
UT_HVAC_Temperature -- Temperature
DUT_KELVIN -- Kelvin
UT_HVAC_Velocity -- Velocity
UT_HVAC_Airflow -- Air Flow
UT_HVAC_DuctSize -- Duct Size
DUT_DECIMAL_FEET -- Decimal feet
DUT_FEET_FRACTIONAL_INCHES -- Feet and fractional inches
UT_HVAC_CrossSection -- Cross Section
DUT_SQUARE_FEET -- Square feet
UT_HVAC_HeatGain -- Heat Gain
UT_Electrical_Current -- Current
DUT_AMPERES -- Amperes
UT_Electrical_Potential -- Electrical Potential
UT_Electrical_Frequency -- Frequency
DUT_HERTZ -- Hertz
DUT_CYCLES_PER_SECOND -- Cycles per second
UT_Electrical_Illuminance -- Illuminance
DUT_FOOTCANDLES -- Footcandles
UT_Electrical_Luminance -- Luminance
UT_Electrical_Luminous_Flux -- Luminous Flux
DUT_LUMENS -- Lumens
UT_Electrical_Luminous_Intensity -- Luminous Intensity
DUT_CANDELAS -- Candelas
UT_Electrical_Efficacy -- Efficacy
UT_Electrical_Wattage -- Wattage
UT_Color_Temperature -- Color Temperature
DUT_KELVIN -- Kelvin
UT_Electrical_Power -- Power
UT_HVAC_Roughness -- Roughness
DUT_DECIMAL_FEET -- Decimal feet
DUT_FEET_FRACTIONAL_INCHES -- Feet and fractional inches
UT_Electrical_Apparent_Power -- Apparent Power
UT_Electrical_Power_Density -- Power Density
DUT_WATTS_PER_SQUARE_METER -- Watts per square meter
UT_Piping_Density -- Density
UT_Piping_Flow -- Flow
UT_Piping_Friction -- Friction
UT_Piping_Pressure -- Pressure
UT_Piping_Temperature -- Temperature
DUT_KELVIN -- Kelvin
UT_Piping_Velocity -- Velocity
DUT_FEET_PER_SECOND -- Feet per second
UT_Piping_Viscosity -- Viscosity
UT_PipeSize -- Pipe Size
DUT_DECIMAL_FEET -- Decimal feet
DUT_FEET_FRACTIONAL_INCHES -- Feet and fractional inches
UT_Piping_Roughness -- Roughness
DUT_DECIMAL_FEET -- Decimal feet
DUT_FEET_FRACTIONAL_INCHES -- Feet and fractional inches
UT_Piping_Volume -- Volume
DUT_CUBIC_FEET -- Cubic feet
UT_HVAC_Viscosity -- Viscosity
UT_HVAC_CoefficientOfHeatTransfer -- Coefficient of Heat Transfer
DUT_WATTS_PER_SQUARE_METER_KELVIN -- Watts per square meter kelvin
UT_HVAC_ThermalResistance -- Thermal Resistance
DUT_SQUARE_METER_KELVIN_PER_WATT -- Square meter kelvin per watt
UT_HVAC_ThermalMass -- Thermal Mass
UT_HVAC_ThermalConductivity -- Thermal Conductivity
UT_HVAC_SpecificHeat -- Specific Heat
UT_HVAC_SpecificHeatOfVaporization -- Specific Heat of Vaporization
UT_HVAC_Permeability -- Permeability
UT_Electrical_Resistivity -- Electrical Resistivity
UT_HVAC_Airflow_Density -- Air Flow Density
UT_Slope -- Slope
DUT_1_RATIO -- 1 : Ratio
DUT_RISE_OVER_FOOT -- Rise / 1' - 0"
UT_HVAC_Cooling_Load -- Cooling Load
UT_HVAC_Heating_Load -- Heating Load
UT_HVAC_Cooling_Load_Divided_By_Area -- Cooling Load divided by Area
DUT_WATTS_PER_SQUARE_METER -- Watts per square meter
UT_HVAC_Heating_Load_Divided_By_Area -- Heating Load divided by Area
DUT_WATTS_PER_SQUARE_METER -- Watts per square meter
UT_HVAC_Cooling_Load_Divided_By_Volume -- Cooling Load divided by Volume
UT_HVAC_Heating_Load_Divided_By_Volume -- Heating Load divided by Volume
UT_HVAC_Airflow_Divided_By_Volume -- Air Flow divided by Volume
UT_HVAC_Airflow_Divided_By_Cooling_Load -- Air Flow divided by Cooling Load
UT_HVAC_Area_Divided_By_Cooling_Load -- Area divided by Cooling Load
UT_HVAC_Area_Divided_By_Heating_Load -- Area divided by Heating Load
UT_WireSize -- Wire Diameter
DUT_DECIMAL_FEET -- Decimal feet
DUT_FEET_FRACTIONAL_INCHES -- Feet and fractional inches
UT_HVAC_Slope -- Slope
DUT_1_RATIO -- 1 : Ratio
DUT_RISE_OVER_FOOT -- Rise / 1' - 0"
UT_Piping_Slope -- Slope
DUT_1_RATIO -- 1 : Ratio
DUT_RISE_OVER_FOOT -- Rise / 1' - 0"
UT_Currency -- Currency
DUT_CURRENCY -- Currency
UT_MassDensity -- Mass Density
UT_HVAC_Factor -- Factor
DUT_FIXED -- Fixed
UT_Electrical_Temperature -- Temperature
DUT_KELVIN -- Kelvin
UT_Electrical_CableTraySize -- Cable Tray Size
DUT_DECIMAL_FEET -- Decimal feet
DUT_FEET_FRACTIONAL_INCHES -- Feet and fractional inches
UT_Electrical_ConduitSize -- Conduit Size
DUT_DECIMAL_FEET -- Decimal feet
DUT_FEET_FRACTIONAL_INCHES -- Feet and fractional inches
UT_Electrical_Demand_Factor -- Demand Factor
DUT_FIXED -- Fixed
UT_HVAC_DuctInsulationThickness -- Duct Insulation Thickness
DUT_DECIMAL_FEET -- Decimal feet
DUT_FEET_FRACTIONAL_INCHES -- Feet and fractional inches
UT_HVAC_DuctLiningThickness -- Duct Lining Thickness
DUT_DECIMAL_FEET -- Decimal feet
DUT_FEET_FRACTIONAL_INCHES -- Feet and fractional inches
UT_PipeInsulationThickness -- Pipe Insulation Thickness
DUT_DECIMAL_FEET -- Decimal feet
DUT_FEET_FRACTIONAL_INCHES -- Feet and fractional inches
UT_Force -- Force
UT_LinearForce -- Linear Force
DUT_NEWTONS_PER_METER -- Newtons per meter
UT_AreaForce -- Area Force
UT_Moment -- Moment
UT_LinearMoment -- Linear Moment
UT_ForceScale -- Force Scale
UT_LinearForceScale -- Linear Force Scale
UT_AreaForceScale -- Area Force Scale
UT_MomentScale -- Moment Scale
UT_LinearMomentScale -- Linear Moment Scale
UT_Stress -- Stress
UT_UnitWeight -- Unit Weight
UT_Weight -- Weight
UT_Mass -- Mass
DUT_KILOGRAMS_MASS -- Kilograms
UT_MassPerUnitArea -- Mass per Unit Area
UT_ThermalExpansion -- Thermal Expansion Coefficient
DUT_INV_CELSIUS -- Inverse degrees Celsius
UT_ForcePerLength -- Point Spring Coefficient
DUT_NEWTONS_PER_METER -- Newtons per meter
UT_LinearForcePerLength -- Line Spring Coefficient
UT_AreaForcePerLength -- Area Spring Coefficient
UT_ForceLengthPerAngle -- Rotational Point Spring Coefficient
UT_LinearForceLengthPerAngle -- Rotational Line Spring Coefficient
UT_Displacement_Deflection -- Displacement/Deflection
DUT_DECIMAL_FEET -- Decimal feet
DUT_FEET_FRACTIONAL_INCHES -- Feet and fractional inches
UT_Rotation -- Rotation
DUT_RADIANS -- Radians
UT_Period -- Period
DUT_SECONDS -- Seconds
UT_Structural_Frequency -- Frequency
DUT_HERTZ -- Hertz
UT_Pulsation -- Pulsation
DUT_RADIANS_PER_SECOND -- Radians per second
UT_Structural_Velocity -- Velocity
DUT_FEET_PER_SECOND -- Feet per second
UT_Acceleration -- Acceleration
DUT_FEET_PER_SECOND_SQUARED -- Feet per second squared
UT_Energy -- Energy
UT_Reinforcement_Volume -- Reinforcement Volume
DUT_CUBIC_FEET -- Cubic feet
UT_Reinforcement_Length -- Reinforcement Length
DUT_DECIMAL_FEET -- Decimal feet
DUT_FEET_FRACTIONAL_INCHES -- Feet and fractional inches
UT_Reinforcement_Area -- Reinforcement Area
DUT_SQUARE_FEET -- Square feet
UT_Reinforcement_Area_per_Unit_Length -- Reinforcement Area per Unit Length
DUT_SQUARE_FEET_PER_FOOT -- Square feet per foot
UT_Reinforcement_Spacing -- Reinforcement Spacing
DUT_DECIMAL_FEET -- Decimal feet
DUT_FEET_FRACTIONAL_INCHES -- Feet and fractional inches
UT_Reinforcement_Cover -- Reinforcement Cover
DUT_DECIMAL_FEET -- Decimal feet
DUT_FEET_FRACTIONAL_INCHES -- Feet and fractional inches
UT_Bar_Diameter -- Bar Diameter
DUT_DECIMAL_FEET -- Decimal feet
DUT_FEET_FRACTIONAL_INCHES -- Feet and fractional inches
UT_Crack_Width -- Crack Width
DUT_DECIMAL_FEET -- Decimal feet
DUT_FEET_FRACTIONAL_INCHES -- Feet and fractional inches
UT_Section_Dimension -- Section Dimension
DUT_DECIMAL_FEET -- Decimal feet
DUT_FEET_FRACTIONAL_INCHES -- Feet and fractional inches
UT_Section_Property -- Section Property
DUT_DECIMAL_FEET -- Decimal feet
DUT_FEET_FRACTIONAL_INCHES -- Feet and fractional inches
UT_Section_Area -- Section Area
DUT_SQUARE_FEET -- Square feet
UT_Section_Modulus -- Section Modulus
DUT_CUBIC_FEET -- Cubic feet
UT_Moment_of_Inertia -- Moment of Inertia
DUT_FEET_TO_THE_FOURTH_POWER -- Feet to the fourth power
UT_Warping_Constant -- Warping Constant
DUT_FEET_TO_THE_SIXTH_POWER -- Feet to the sixth power
UT_Mass_per_Unit_Length -- Mass per Unit Length
UT_Weight_per_Unit_Length -- Weight per Unit Length
DUT_NEWTONS_PER_METER -- Newtons per meter
UT_Surface_Area -- Surface Area per Unit Length
DUT_SQUARE_FEET_PER_FOOT -- Square feet per foot
UT_Pipe_Dimension -- Pipe Dimension
UT_PipeMass -- Mass
DUT_KILOGRAMS_MASS -- Kilograms
UT_PipeMassPerUnitLength -- Mass per Unit Length
Revit Addin Wizard (RevitAddinWizard) provides various wizards, coders and widgets to help program Revit addins. It can be downloaded from the Download link at the bottom of the blog index page.