Quantcast
Channel: RevitNetAddinWizard & NavisworksNetAddinWizard
Viewing all articles
Browse latest Browse all 872

Revit Units .NET API: Catalog Display Unit Types (DisplayUnitType Enum Values)

$
0
0

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 catalog all display unit types (the API DisplayUnitType enum values).

        public static void CatalogDisplayUnitTypes()
        {
            Dictionary<string, List<DisplayUnitType>> dictCat2UT = new Dictionary<string, List<DisplayUnitType>>();
            foreach (DisplayUnitType ut in UnitUtils.GetValidDisplayUnits())
            {
                string catalog = UnitUtils.GetTypeCatalogString(ut);
                if (dictCat2UT.ContainsKey(catalog))
                    dictCat2UT[catalog].Add(ut);
                else
                    dictCat2UT.Add(catalog, new List<DisplayUnitType> { ut });
            }

            string info = "";
            using (StreamWriter sw = new StreamWriter(@"c:\temp\RevitDisplayUnitTypeCatalogs.txt"))
                foreach (KeyValuePair<string, List<DisplayUnitType>> entry in dictCat2UT)
                {
                    sw.WriteLine(entry.Key);
                    foreach (DisplayUnitType ut in entry.Value)
                    {
                        info = string.Format("\t{0} -- {1}", ut, LabelUtils.GetLabelFor(ut));
                        sw.WriteLine(info);
                    }
                }
        }
   

RevitUnitsAPI.CatalogDisplayUnitTypes();


The output may look something as follows:

FEET
    DUT_DECIMAL_FEET -- Decimal feet
    DUT_FEET_FRACTIONAL_INCHES -- Feet and fractional inches
INCHES
    DUT_DECIMAL_INCHES -- Decimal inches
    DUT_FRACTIONAL_INCHES -- Fractional inches
METERS
    DUT_METERS -- Meters
    DUT_METERS_CENTIMETERS -- Meters and centimeters
DECIMETERS
    DUT_DECIMETERS -- Decimeters
CENTIMETERS
    DUT_CENTIMETERS -- Centimeters
MILLIMETERS
    DUT_MILLIMETERS -- Millimeters
SQUARE_FEET
    DUT_SQUARE_FEET -- Square feet
SQUARE_INCHES
    DUT_SQUARE_INCHES -- Square inches
SQUARE_METERS
    DUT_SQUARE_METERS -- Square meters
SQUARE_CENTIMETERS
    DUT_SQUARE_CENTIMETERS -- Square centimeters
SQUARE_MILLIMETERS
    DUT_SQUARE_MILLIMETERS -- Square millimeters
ACRES
    DUT_ACRES -- Acres
HECTARES
    DUT_HECTARES -- Hectares
CUBIC_YARDS
    DUT_CUBIC_YARDS -- Cubic yards
CUBIC_FEET
    DUT_CUBIC_FEET -- Cubic feet
CUBIC_INCHES
    DUT_CUBIC_INCHES -- Cubic inches
CUBIC_METERS
    DUT_CUBIC_METERS -- Cubic meters
CUBIC_CENTIMETERS
    DUT_CUBIC_CENTIMETERS -- Cubic centimeters
CUBIC_MILLIMETERS
    DUT_CUBIC_MILLIMETERS -- Cubic millimeters
LITERS
    DUT_LITERS -- Liters
GALLONS
    DUT_GALLONS_US -- US gallons
DEGREES
    DUT_DECIMAL_DEGREES -- Decimal degrees
    DUT_DEGREES_AND_MINUTES -- Degrees minutes seconds
RATIO1
    DUT_1_RATIO -- 1 : Ratio
RATIO12
    DUT_RATIO_12 -- Ratio : 12
RATIO10
    DUT_RATIO_10 -- Ratio : 10
RISE_INCHES
    DUT_RISE_OVER_INCHES -- Rise / 12"
RISE_120_INCHES
    DUT_RISE_OVER_120_INCHES -- Rise / 120"
RISE_FOOT
    DUT_RISE_OVER_FOOT -- Rise / 1' - 0"
RISE_10_FOOT
    DUT_RISE_OVER_10_FEET -- Rise / 10'
RISE_MMS
    DUT_RISE_OVER_MMS -- Rise / 1000 mm
SLOPE_DEGREES
    DUT_SLOPE_DEGREES -- Decimal degrees

    DUT_GENERAL -- General
    DUT_FIXED -- Fixed
    DUT_CURRENCY -- Currency
    DUT_METERS_PER_KILONEWTON -- Meters per kilonewton
    DUT_FEET_PER_KIP -- Feet per kip
    DUT_SQUARE_METERS_PER_KILONEWTON -- Square meters per kilonewton
    DUT_SQUARE_FEET_PER_KIP -- Square feet per kip
    DUT_CUBIC_METERS_PER_KILONEWTON -- Cubic meters per kilonewton
    DUT_CUBIC_FEET_PER_KIP -- Cubic feet per kip
    DUT_INV_KILONEWTONS -- Inverse kilonewtons
    DUT_INV_KIPS -- Inverse kips
PERCENTAGE
    DUT_PERCENTAGE -- Percentage
PERMILLE
    DUT_PER_MILLE -- Per mille
KILOGRAMS_PER_CUBIC_METER
    DUT_KILOGRAMS_PER_CUBIC_METER -- Kilograms per cubic meter
POUNDS_MASS_PER_CUBIC_FOOT
    DUT_POUNDS_MASS_PER_CUBIC_FOOT -- Pounds per cubic foot
POUNDS_MASS_PER_CUBIC_INCH
    DUT_POUNDS_MASS_PER_CUBIC_INCH -- Pounds per cubic inch
BRITISH_THERMAL_UNITS
    DUT_BRITISH_THERMAL_UNITS -- British Thermal Units
CALORIES
    DUT_CALORIES -- Calories
KILOCALORIES
    DUT_KILOCALORIES -- Kilocalories
JOULES
    DUT_JOULES -- Joules
KILOWATT_HOURS
    DUT_KILOWATT_HOURS -- Kilowatt hours
THERMS
    DUT_THERMS -- Therms
INCHES_OF_WATER_PER_100FT
    DUT_INCHES_OF_WATER_PER_100FT -- Inches of water (60 °F) per 100 feet
PASCALS_PER_METER
    DUT_PASCALS_PER_METER -- Pascals per meter
WATTS
    DUT_WATTS -- Watts
KILOWATTS
    DUT_KILOWATTS -- Kilowatts
BRITISH_THERMAL_UNITS_PER_SECOND
    DUT_BRITISH_THERMAL_UNITS_PER_SECOND -- BTU (British Thermal Units) per second
BRITISH_THERMAL_UNITS_PER_HOUR
    DUT_BRITISH_THERMAL_UNITS_PER_HOUR -- BTU (British Thermal Units) per hour
CALORIES_PER_SECOND
    DUT_CALORIES_PER_SECOND -- Calories per second
KILOCALORIES_PER_SECOND
    DUT_KILOCALORIES_PER_SECOND -- Kilocalories per second
WATTS_PER_SQUARE_FOOT
    DUT_WATTS_PER_SQUARE_FOOT -- Watts per square foot
WATTS_PER_SQUARE_METER
    DUT_WATTS_PER_SQUARE_METER -- Watts per square meter
INCHES_OF_WATER
    DUT_INCHES_OF_WATER -- Inches of water (60 °F)
PASCALS
    DUT_PASCALS -- Pascals
KILOPASCALS
    DUT_KILOPASCALS -- Kilopascals
MEGAPASCALS
    DUT_MEGAPASCALS -- Megapascals
POUNDS_FORCE_PER_SQUARE_INCH
    DUT_POUNDS_FORCE_PER_SQUARE_INCH -- Pounds per square inch
INCHES_OF_MERCURY
    DUT_INCHES_OF_MERCURY -- Inches of mercury (32 °F)
MILLIMETERS_OF_MERCURY
    DUT_MILLIMETERS_OF_MERCURY -- Millimeters of mercury
ATMOSPHERES
    DUT_ATMOSPHERES -- Atmospheres
BARS
    DUT_BARS -- Bars
FAHRENHEIT
    DUT_FAHRENHEIT -- Fahrenheit
CELSIUS
    DUT_CELSIUS -- Celsius
KELVIN
    DUT_KELVIN -- Kelvin
RANKINE
    DUT_RANKINE -- Rankine
FEET_PER_MINUTE
    DUT_FEET_PER_MINUTE -- Feet per minute
METERS_PER_SECOND
    DUT_METERS_PER_SECOND -- Meters per second
CENTIMETERS_PER_MINUTE
    DUT_CENTIMETERS_PER_MINUTE -- Centimeters per minute
CUBIC_FEET_PER_MINUTE
    DUT_CUBIC_FEET_PER_MINUTE -- Cubic feet per minute
LITERS_PER_SECOND
    DUT_LITERS_PER_SECOND -- Liters per second
CUBIC_METERS_PER_SECOND
    DUT_CUBIC_METERS_PER_SECOND -- Cubic meters per second
CUBIC_METERS_PER_HOUR
    DUT_CUBIC_METERS_PER_HOUR -- Cubic meters per hour
GALLONS_US_PER_MINUTE
    DUT_GALLONS_US_PER_MINUTE -- US gallons per minute
GALLONS_US_PER_HOUR
    DUT_GALLONS_US_PER_HOUR -- US gallons per hour
WATTS_PER_SQUARE_METER_KELVIN
    DUT_WATTS_PER_SQUARE_METER_KELVIN -- Watts per square meter kelvin
SQUARE_METER_KELVIN_PER_WATT
    DUT_SQUARE_METER_KELVIN_PER_WATT -- Square meter kelvin per watt
BRITISH_THERMAL_UNITS_PER_HOUR_SQUARE_FOOT_FAHRENHEIT
    DUT_BRITISH_THERMAL_UNITS_PER_HOUR_SQUARE_FOOT_FAHRENHEIT -- BTU (British Thermal Units) per hour square foot degree Fahrenheit
HOUR_SQUARE_FOOT_FAHRENHEIT_PER_BRITISH_THERMAL_UNIT
    DUT_HOUR_SQUARE_FOOT_FAHRENHEIT_PER_BRITISH_THERMAL_UNIT -- Hour square foot degree Fahrenheit per BTU (British Thermal Unit)
BRITISH_THERMAL_UNIT_PER_FAHRENHEIT
    DUT_BRITISH_THERMAL_UNIT_PER_FAHRENHEIT -- BTU per degree Fahrenheit
JOULES_PER_KELVIN
    DUT_JOULES_PER_KELVIN -- Joules per degree Kelvin
KILOJOULES_PER_KELVIN
    DUT_KILOJOULES_PER_KELVIN -- Kilojoules per degree Kelvin
WATTS_PER_METER_KELVIN
    DUT_WATTS_PER_METER_KELVIN -- Watts per meter kelvin
BRITISH_THERMAL_UNITS_PER_HOUR_FOOT_FAHRENHEIT
    DUT_BRITISH_THERMAL_UNITS_PER_HOUR_FOOT_FAHRENHEIT -- BTU (British Thermal Units) per hour foot degree Fahrenheit
JOULES_PER_GRAM_CELSIUS
    DUT_JOULES_PER_GRAM_CELSIUS -- Joules per gram Celsius
JOULES_PER_KILOGRAM_CELSIUS
    DUT_JOULES_PER_KILOGRAM_CELSIUS -- Joules per kilogram Celsius
BRITISH_THERMAL_UNITS_PER_POUND_FAHRENHEIT
    DUT_BRITISH_THERMAL_UNITS_PER_POUND_FAHRENHEIT -- BTU (British Thermal Units) per pound Fahrenheit
JOULES_PER_GRAM
    DUT_JOULES_PER_GRAM -- Joules per gram
BRITISH_THERMAL_UNITS_PER_POUND
    DUT_BRITISH_THERMAL_UNITS_PER_POUND -- BTU (British Thermal Units) per pound
NANOGRAMS_PER_PASCAL_SECOND_SQUARE_METER
    DUT_NANOGRAMS_PER_PASCAL_SECOND_SQUARE_METER -- Nanograms per pascal second square meter
GRAINS_PER_HOUR_SQUARE_FOOT_INCH_MERCURY
    DUT_GRAINS_PER_HOUR_SQUARE_FOOT_INCH_MERCURY -- Grains per hour square foot inch mercury
OHM_METERS
    DUT_OHM_METERS -- Ohm meters
AMPERES
    DUT_AMPERES -- Amperes
KILOAMPERES
    DUT_KILOAMPERES -- Kiloamperes
MILLIAMPERES
    DUT_MILLIAMPERES -- Milliamperes
VOLTS
    DUT_VOLTS -- Volts
KILOVOLTS
    DUT_KILOVOLTS -- Kilovolts
MILLIVOLTS
    DUT_MILLIVOLTS -- Millivolts
HERTZ
    DUT_HERTZ -- Hertz
CYCLES_PER_SECOND
    DUT_CYCLES_PER_SECOND -- Cycles per second
LUX
    DUT_LUX -- Lux
FOOTCANDLES
    DUT_FOOTCANDLES -- Footcandles
FOOTLAMBERTS
    DUT_FOOTLAMBERTS -- Footlamberts
CANDELAS_PER_SQUARE_METER
    DUT_CANDELAS_PER_SQUARE_METER -- Candelas per square meter
LUMENS
    DUT_LUMENS -- Lumens
CANDELAS
    DUT_CANDELAS -- Candelas
VOLT_AMPERES
    DUT_VOLT_AMPERES -- Volt-amperes
KILOVOLT_AMPERES
    DUT_KILOVOLT_AMPERES -- Kilovolt-amperes
HORSEPOWER
    DUT_HORSEPOWER -- Horsepower
NEWTONS
    DUT_NEWTONS -- Newtons
DECANEWTONS
    DUT_DECANEWTONS -- Decanewtons
KILONEWTONS
    DUT_KILONEWTONS -- Kilonewtons
MEGANEWTONS
    DUT_MEGANEWTONS -- Meganewtons
KIPS
    DUT_KIPS -- Kips
KILOGRAMS_FORCE
    DUT_KILOGRAMS_FORCE -- Kilograms force
TONNES_FORCE
    DUT_TONNES_FORCE -- Tonnes force
POUNDS
    DUT_POUNDS_FORCE -- Pounds
NEWTONS_PER_METER
    DUT_NEWTONS_PER_METER -- Newtons per meter
DECANEWTONS_PER_METER
    DUT_DECANEWTONS_PER_METER -- Decanewtons per meter
KILONEWTONS_PER_METER
    DUT_KILONEWTONS_PER_METER -- Kilonewtons per meter
MEGANEWTONS_PER_METER
    DUT_MEGANEWTONS_PER_METER -- Meganewtons per meter
KIPS_PER_FOOT
    DUT_KIPS_PER_FOOT -- Kips per foot
KILOGRAMS_FORCE_PER_METER
    DUT_KILOGRAMS_FORCE_PER_METER -- Kilograms force per meter
TONNES_FORCE_PER_METER
    DUT_TONNES_FORCE_PER_METER -- Tonnes force per meter
POUNDS_FORCE_PER_FOOT
    DUT_POUNDS_FORCE_PER_FOOT -- Pounds per foot
NEWTONS_PER_SQUARE_METER
    DUT_NEWTONS_PER_SQUARE_METER -- Newtons per square meter
DECANEWTONS_PER_SQUARE_METER
    DUT_DECANEWTONS_PER_SQUARE_METER -- Decanewtons per square meter
KILONEWTONS_PER_SQUARE_METER
    DUT_KILONEWTONS_PER_SQUARE_METER -- Kilonewtons per square meter
MEGANEWTONS_PER_SQUARE_METER
    DUT_MEGANEWTONS_PER_SQUARE_METER -- Meganewtons per square meter
KILONEWTONS_PER_SQUARE_CENTIMETER
    DUT_KILONEWTONS_PER_SQUARE_CENTIMETER -- Kilonewtons per square centimeter
NEWTONS_PER_SQUARE_MILLIMETER
    DUT_NEWTONS_PER_SQUARE_MILLIMETER -- Newtons per square millimeter
KILONEWTONS_PER_SQUARE_MILLIMETER
    DUT_KILONEWTONS_PER_SQUARE_MILLIMETER -- Kilonewtons per square millimeter
KIPS_PER_SQUARE_FOOT
    DUT_KIPS_PER_SQUARE_FOOT -- Kips per square foot
KILOGRAMS_FORCE_PER_SQUARE_METER
    DUT_KILOGRAMS_FORCE_PER_SQUARE_METER -- Kilograms force per square meter
TONNES_FORCE_PER_SQUARE_METER
    DUT_TONNES_FORCE_PER_SQUARE_METER -- Tonnes force per square meter
POUNDS_FORCE_PER_SQUARE_FOOT
    DUT_POUNDS_FORCE_PER_SQUARE_FOOT -- Pounds per square foot
NEWTON_METERS
    DUT_NEWTON_METERS -- Newton-meters
DECANEWTON_METERS
    DUT_DECANEWTON_METERS -- Decanewton-meters
KILONEWTON_METERS
    DUT_KILONEWTON_METERS -- Kilonewton-meters
MEGANEWTON_METERS
    DUT_MEGANEWTON_METERS -- Meganewton-meters
KIP_FEET
    DUT_KIP_FEET -- Kip-feet
KILOGRAM_FORCE_METERS
    DUT_KILOGRAM_FORCE_METERS -- Kilogram force-meters
TONNE_FORCE_METERS
    DUT_TONNE_FORCE_METERS -- Tonne force-meters
POUND_FORCE_FEET
    DUT_POUND_FORCE_FEET -- Pound-feet
NEWTON_METERS_PER_METER
    DUT_NEWTON_METERS_PER_METER -- Newton-meters per meter
DECANEWTON_METERS_PER_METER
    DUT_DECANEWTON_METERS_PER_METER -- Decanewton-meters per meter
KILONEWTON_METERS_PER_METER
    DUT_KILONEWTON_METERS_PER_METER -- Kilonewton-meters per meter
MEGANEWTON_METERS_PER_METER
    DUT_MEGANEWTON_METERS_PER_METER -- Meganewton-meters per meter
KIP_FEET_PER_FOOT
    DUT_KIP_FEET_PER_FOOT -- Kip-feet per foot
KILOGRAM_FORCE_METERS_PER_METER
    DUT_KILOGRAM_FORCE_METERS_PER_METER -- Kilogram force-meters per meter
TONNE_FORCE_METERS_PER_METER
    DUT_TONNE_FORCE_METERS_PER_METER -- Tonne force-meters per meter
POUND_FORCE_FEET_PER_FOOT
    DUT_POUND_FORCE_FEET_PER_FOOT -- Pound-feet per foot
FEET_OF_WATER_PER_100FT
    DUT_FEET_OF_WATER_PER_100FT -- Feet of water (39.2 °F) per 100 feet
FEET_OF_WATER
    DUT_FEET_OF_WATER -- Feet of water (39.2 °F)
PASCAL_SECONDS
    DUT_PASCAL_SECONDS -- Pascal seconds
POUNDS_MASS_PER_FOOT_SECOND
    DUT_POUNDS_MASS_PER_FOOT_SECOND -- Pounds per foot second
CENTIPOISES
    DUT_CENTIPOISES -- Centipoises
FEET_PER_SECOND
    DUT_FEET_PER_SECOND -- Feet per second
KIPS_PER_SQUARE_INCH
    DUT_KIPS_PER_SQUARE_INCH -- Kips per square inch
POUNDS_FORCE_PER_CUBIC_FOOT
    DUT_POUNDS_FORCE_PER_CUBIC_FOOT -- Pounds per cubic foot
KIPS_PER_CUBIC_INCH
    DUT_KIPS_PER_CUBIC_INCH -- Kips per cubic inch
KILONEWTONS_PER_CUBIC_METER
    DUT_KILONEWTONS_PER_CUBIC_METER -- Kilonewtons per cubic meter
INVERSE_DEGREES_FAHRENHEIT
    DUT_INV_FAHRENHEIT -- Inverse degrees Fahrenheit
MICROINCHES_PER_INCH_FAHRENHEIT
    DUT_MICROINCHES_PER_INCH_FAHRENHEIT -- Microinches per inch Fahrenheit
INVERSE_DEGREES_CELSIUS
    DUT_INV_CELSIUS -- Inverse degrees Celsius
MICROMETERS_PER_METER_CELSIUS
    DUT_MICROMETERS_PER_METER_CELSIUS -- Micrometers per meter Celsius
POUNDS_MASS_PER_FOOT_HOUR
    DUT_POUNDS_MASS_PER_FOOT_HOUR -- Pounds per foot hour
KIPS_PER_INCH
    DUT_KIPS_PER_INCH -- Kips per inch
KIPS_PER_CUBIC_FOOT
    DUT_KIPS_PER_CUBIC_FOOT -- Kips per cubic foot
KIPS_PER_DEGREE
    DUT_KIP_FEET_PER_DEGREE -- Kip feet per degree
KILONEWTONS_PER_DEGREE
    DUT_KILONEWTON_METERS_PER_DEGREE -- Kilonewton meters per degree
KIPS_PER_DEGREE_PER_FOOT
    DUT_KIP_FEET_PER_DEGREE_PER_FOOT -- Kip feet per degree per foot
KILONEWTONS_PER_DEGREE_PER_METER
    DUT_KILONEWTON_METERS_PER_DEGREE_PER_METER -- Kilonewton meters per degree per meter
DUT_TON_OF_REFRIGERATION
    DUT_TON_OF_REFRIGERATION -- Tons of refrigeration (12 000 BTU (British Thermal Units) per hour)
DUT_BRITISH_THERMAL_UNITS_PER_HOUR_SQUARE_FOOT
    DUT_BRITISH_THERMAL_UNITS_PER_HOUR_SQUARE_FOOT -- BTU (British Thermal Units) per hour square foot
WATTS_PER_CUBIC_FOOT
    DUT_WATTS_PER_CUBIC_FOOT -- Watts per cubic foot
WATTS_PER_CUBIC_METER
    DUT_WATTS_PER_CUBIC_METER -- Watts per cubic meter
DUT_BRITISH_THERMAL_UNITS_PER_HOUR_CUBIC_FOOT
    DUT_BRITISH_THERMAL_UNITS_PER_HOUR_CUBIC_FOOT -- BTU (British Thermal Units) per hour cubic foot
CUBIC_FEET_PER_MINUTE_SQUARE_FOOT
    DUT_CUBIC_FEET_PER_MINUTE_SQUARE_FOOT -- Cubic feet per minute square foot
LITERS_PER_SECOND_SQUARE_METER
    DUT_LITERS_PER_SECOND_SQUARE_METER -- Liters per second square meter
CUBIC_FEET_PER_MINUTE_CUBIC_FOOT
    DUT_CUBIC_FEET_PER_MINUTE_CUBIC_FOOT -- Cubic feet per minute cubic foot
LITERS_PER_SECOND_CUBIC_METER
    DUT_LITERS_PER_SECOND_CUBIC_METER -- Liters per second cubic meter
CUBIC_FEET_PER_MINUTE_TON_OF_REFRIGERATION
    DUT_CUBIC_FEET_PER_MINUTE_TON_OF_REFRIGERATION -- Cubic meters per minute tons of refrigeration
LITERS_PER_SECOND_KILOWATTS
    DUT_LITERS_PER_SECOND_KILOWATTS -- Liters per second kilowatts
SQUARE_FEET_PER_TON_OF_REFRIGERATION
    DUT_SQUARE_FEET_PER_TON_OF_REFRIGERATION -- Square feet per tons of refrigeration
CUBIC_SQUARE_METERS_PER_KILOWATTS
    DUT_SQUARE_METERS_PER_KILOWATTS -- Square meters per kilowatts
LUMENS_PER_WATT
    DUT_LUMENS_PER_WATT -- Lumens per watt
SQUARE_FEET_PER_THOUSAND_BRITISH_THERMAL_UNITS_PER_HOUR
    DUT_SQUARE_FEET_PER_THOUSAND_BRITISH_THERMAL_UNITS_PER_HOUR -- Square feet per thousand BTU (British Thermal Units) per hour
KILOGRAMS
    DUT_KILOGRAMS_MASS -- Kilograms
TONNES
    DUT_TONNES_MASS -- Tonnes
POUNDS_MASS
    DUT_POUNDS_MASS -- Pounds
METERS_PER_SECOND_SQUARED
    DUT_METERS_PER_SECOND_SQUARED -- Meters per second squared
KILOMETERS_PER_SECOND_SQUARED
    DUT_KILOMETERS_PER_SECOND_SQUARED -- Kilometers per second squared
INCHES_PER_SECOND_SQUARED
    DUT_INCHES_PER_SECOND_SQUARED -- Inches per second squared
FEET_PER_SECOND_SQUARED
    DUT_FEET_PER_SECOND_SQUARED -- Feet per second squared
MILES_PER_SECOND_SQUARED
    DUT_MILES_PER_SECOND_SQUARED -- Miles per second squared
FEET_TO_THE_FOURTH_POWER
    DUT_FEET_TO_THE_FOURTH_POWER -- Feet to the fourth power
INCHES_TO_THE_FOURTH_POWER
    DUT_INCHES_TO_THE_FOURTH_POWER -- Inches to the fourth power
MILLIMETERS_TO_THE_FOURTH_POWER
    DUT_MILLIMETERS_TO_THE_FOURTH_POWER -- Millimeters to the fourth power
CENTIMETERS_TO_THE_FOURTH_POWER
    DUT_CENTIMETERS_TO_THE_FOURTH_POWER -- Centimeters to the fourth power
METERS_TO_THE_FOURTH_POWER
    DUT_METERS_TO_THE_FOURTH_POWER -- Meters to the fourth power
FEET_TO_THE_SIXTH_POWER
    DUT_FEET_TO_THE_SIXTH_POWER -- Feet to the sixth power
INCHES_TO_THE_SIXTH_POWER
    DUT_INCHES_TO_THE_SIXTH_POWER -- Inches to the sixth power
MILLIMETERS_TO_THE_SIXTH_POWER
    DUT_MILLIMETERS_TO_THE_SIXTH_POWER -- Millimeters to the sixth power
CENTIMETERS_TO_THE_SIXTH_POWER
    DUT_CENTIMETERS_TO_THE_SIXTH_POWER -- Centimeters to the sixth power
METERS_TO_THE_SIXTH_POWER
    DUT_METERS_TO_THE_SIXTH_POWER -- Meters to the sixth power
SQUARE_FEET_PER_FOOT
    DUT_SQUARE_FEET_PER_FOOT -- Square feet per foot
SQUARE_INCHES_PER_FOOT
    DUT_SQUARE_INCHES_PER_FOOT -- Square inches per foot
SQUARE_MILLIMETERS_PER_METER
    DUT_SQUARE_MILLIMETERS_PER_METER -- Square millimeters per meter
SQUARE_CENTIMETERS_PER_METER
    DUT_SQUARE_CENTIMETERS_PER_METER -- Square centimeters per meter
SQUARE_METERS_PER_METER
    DUT_SQUARE_METERS_PER_METER -- Square meters per meter
KILOGRAMS_MASS_PER_METER
    DUT_KILOGRAMS_MASS_PER_METER -- Kilograms per meter
POUNDS_MASS_PER_FOOT
    DUT_POUNDS_MASS_PER_FOOT -- Pounds per foot
RADIANS
    DUT_RADIANS -- Radians
GRADS
    DUT_GRADS -- Grads
RADIANS_PER_SECOND
    DUT_RADIANS_PER_SECOND -- Radians per second
MILLISECONDS
    DUT_MILISECONDS -- Milliseconds
SECONDS
    DUT_SECONDS -- Seconds
MINUTES
    DUT_MINUTES -- Minutes
HOURS
    DUT_HOURS -- Hours
KILOMETERS_PER_HOUR
    DUT_KILOMETERS_PER_HOUR -- Kilometers per hour
MILES_PER_HOUR
    DUT_MILES_PER_HOUR -- Miles per hour
KILOJOULES
    DUT_KILOJOULES -- Kilojoules
POUNDS_MASS_PER_SQUARE_FOOT
    DUT_POUNDS_MASS_PER_SQUARE_FOOT -- Pounds per square foot
POUNDS_MASS_PER_SQUARE_METER
    DUT_KILOGRAMS_MASS_PER_SQUARE_METER -- Kilograms per square meter

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.

 

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 catalog all display unit types (the API DisplayUnitType enum values).

 

        publicstaticvoid CatalogDisplayUnitTypes()

        {

            Dictionary<string, List<DisplayUnitType>> dictCat2UT = newDictionary<string, List<DisplayUnitType>>();

            foreach (DisplayUnitType ut inUnitUtils.GetValidDisplayUnits())

            {

                string catalog = UnitUtils.GetTypeCatalogString(ut);

                if (dictCat2UT.ContainsKey(catalog))

                    dictCat2UT[catalog].Add(ut);

                else

                    dictCat2UT.Add(catalog, newList<DisplayUnitType> { ut });

            }

 

            string info = "";

            using (StreamWriter sw = newStreamWriter(@"c:\temp\RevitDisplayUnitTypeCatalogs.txt"))

                foreach (KeyValuePair<string, List<DisplayUnitType>> entry in dictCat2UT)

                {

                    sw.WriteLine(entry.Key);

                    foreach (DisplayUnitType ut in entry.Value)

                    {

                        info = string.Format("\t{0} -- {1}", ut, LabelUtils.GetLabelFor(ut));

                        sw.WriteLine(info);

                    }

                }

        }

 

      

RevitUnitsAPI.CatalogDisplayUnitTypes();

 

 

 

The output may look something as follows:

 

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.

http://spiderinnet.typepad.com/blog/2011/05/revit-addin-wizardscoders-and-revit-api-widgets.html

Unit Catalog, UnitType, DisplayUnitType, Units, Revit .NET Addin Wizard, RevitNetAddinWizard

It catalogs all display unit types (DisplayUnitType) using Revit Units .NET API.


Viewing all articles
Browse latest Browse all 872

Trending Articles