The Revit Platform API has a large number of built-in parameters, defined in the Autodesk.Revit.Parameters.BuiltInParameter enumeration (see the RevitAPI Help.chm file for the definition of this enumeration). This enumeration has generated documentation visible from Visual Studio intellisense as shown below. The documentation for each id includes the parameter name, as found in the Element Properties dialog in the English version of Autodesk Revit. Note that multiple distinct parameter ids may map to the same English name; in those cases you must examine the parameters associated with a specific element to determine which parameter id to use.
The parameter ID is used to retrieve the specific parameter from an element, if it exists, using the Element.Parameter property. However, not all parameters can be retrieved using the ID. For example, family parameters are not exposed in the Revit Platform API, therefore, you cannot get them using the built-in parameter ID.
The following code sample shows how to get the specific parameter using the BuiltInParameter Id:
Code Region 8-3: Getting a parameter based on BuiltInParameter |
public Parameter FindWithBuiltinParameterID(Wall wall) { // Use the WALL_BASE_OFFSET paramametId // to get the base offset parameter of the wall. BuiltInParameter paraIndex = BuiltInParameter.WALL_BASE_OFFSET; Parameter parameter = wall.get_Parameter(paraIndex); return parameter; } |
If you do not know the exact BuiltInParameter ID, get the parameter by iterating the ParameterSet collection. Another approach for testing or identification purposes is to test each BuiltInParameter using the get_Parameter() method. When you use this method, it is possible that the ParameterSet collection may not contain all parameters returned from the get_Parameter() method, though this is infrequent.