Units and RevitLookup

Here is a typical question from a Revit API newbie that prompts me to reiterate some important basic beginner information on units and the RevitLookup tool for exploring the Revit database:

Question: How can I retrieve the length and mass units from a Revit document?

Answer: The internal Revit database length unit is always imperial feet.

That cannot be changed, so there is you answer for that.

Similarly, the internal database unit for weight is kg, as far as I know.

Revit Database Units

In fact, most internal Revit database units except length are SI units, and length is handled differently.

The user interface can display other units, set up just as the user prefers. They can also be modified programmatically, as demonstrated by the ProjectUnit SDK sample.

You can determine any internal database unit by setting the value of a given parameter using it on some Revit element to a specific number, e.g. 1.0, in the user interface.

You can then use RevitLookup to examine the parameter's resulting underlying database value.

The quotient between the user display and the underlying database values provides a factor that you can use to convert between user display and internal database units and enables you to determine what the internal database unit actually is.

This topic has been discussed exhaustively on The Building Coder blog. In fact, one of the very first posts ever is still perfectly valid. It deals with and covers all the fundamental facts of units.

We presented a unit conversion tool and updated it for Revit 2011 and 2013.

Many other aspects of this topic are collected in The Building Coder units category.

RevitLookup

I mentioned RevitLookup above. This is one of the most important tools, both for developers and end users, that you absolutely must be aware of.

It was formerly named RvtMgdDbg. This detailed description still calls it so.

Here are step-by-step installation instructions for Revit 2011 that pretty much still apply. There is even a video demonstrating the installation for Revit 2013.

RevitLookup is included in the Revit SDK available from the Revit Developer Center, which also includes all the other important material for getting started with the Revit API. Here is also an updated version with a corrected add-in manifest file to simplify the installation.

I hope that fully answers your question and helps you get started successfully.