Definition

Definition

The Definition object describes the data type, name, and other Parameter details. There are two kinds of definition objects derived from this object.

You should write the code to use the Definition base class so that the code is applicable to both internal and external parameter Definitions. The following code sample shows how to find a specific parameter using the definition type.

Code Region 8-2: Finding a parameter based on definition type

//Find parameter using the Parameter's definition type.
public Parameter FindParameter(Element element)
{
        Parameter foundParameter = null;
        // This will find the first parameter that measures length
        foreach (Parameter parameter in element.Parameters)
        {
                if (parameter.Definition.ParameterType == ParameterType.Length)
                {
                        foundParameter = parameter;
                        break;
                }
        }
        return foundParameter;
}

ParameterType

This property returns parameter data type, which affects how the parameter is displayed in the Revit UI. Some of the ParameterType enumeration members include:

Member name

Description

Number

The parameter data should be interpreted as a real number, possibly including decimal points.

Moment

The data value will be represented as a moment.

AreaForce

The data value will be represented as an area force.

LinearForce

The data value will be represented as a linear force.

Force

The data value will be represented as a force.

YesNo

A boolean value that will be represented as Yes or No.

Material

The value of this property is considered to be a material.

URL

A text string that represents a web address.

Angle

The parameter data represents an angle. The internal representation will be in radians. The user visible representation will be in the units that the user has chosen.

Volume

The parameter data represents a volume. The internal representation will be in decimal cubic feet. The user visible representation will be in the units that the user has chosen.

Area

The parameter data represents an area. The internal representation will be in decimal square feet. The user visible representation will be in the units that the user has chosen.

Integer

The parameter data should be interpreted as a whole number, positive or negative.

Invalid

The parameter type is invalid. This value should not be used.

Length

The parameter data represents a length. The internal representation will be in decimal feet. The user visible representation will be in the units system that the user has chosen.

Text

The parameter data should be interpreted as a string of text.

FamilyType

A parameter used to control the type of a family nested within another family.

Image

The value of this parameter is the id of an image.

For more details about ParameterType.Material, see Material.

ParameterGroup

The Definition class ParameterGroup property returns the parameter definition group ID. The BuiltInParameterGroup is an enumerated type listing all built-in parameter groups supported by Revit. Parameter groups are used to sort parameters in the Element Properties dialog box.

VariesAcrossGroups

This property, which is specific to the InternalDefinition child class, and the corresponding SetAllowVaryBetweenGroups() method determine whether the values of this parameter can vary across the related members of group instances. If False, the values will be consistent across the related members in group instances. This can only be set for non-built-in parameters.