Definition File

The DefinitionFile object represents a shared parameter file which is a common text file.

Definition File Format

The shared parameter definition file is a text file (.txt) with three blocks: META, GROUP and PARAM. The GROUP and PARAM blocks are relevant to the shared parameter functionality in the Revit API. Do not edit the definition file directly; instead, edit it using the UI or the API.

Although the Revit API takes care of reading and writing this file, the following section provides information the format of the file, which closely corresponds to the API objects and methods used to access shared parameters. The file uses tabs to separate fields and can be difficult to read in a text editor. The code region below shows the contents of a sample shared parameter text file.

Code Region 22-1: Parameter definition file example

# This is a Revit shared parameter file.
# Do not edit manually.
*META	VERSION	MINVERSION
META	2	1
*GROUP	ID	NAME
GROUP	1	MyGroup
GROUP	2	AnotherGroup
*PARAM	GUID	NAME	DATATYPE	DATACATEGORY	GROUP	VISIBLE	DESCRIPTION	USERMODIFIABLE
PARAM	bb7f0005-9692-4b76-8fa3-30cec8aecf74	Price	INTEGER		2	1	Enter price in USD	1
PARAM	b7ea2654-b206-4694-a087-756359b52e7f	areaTags	FAMILYTYPE	-2005020	1	1		1
PARAM	d1a5439d-dc8d-4053-99fa-2f33804bae0e	MyParam	TEXT		1	1		1
  • The GROUP block contains group entries that associate every parameter definition with a group. The following fields appear in the GROUP block:
    • ID - Uniquely identifies the group and associates the parameter definition with a group.
    • Name - The group name displayed in the UI.

  • The PARAM block contains parameter definitions. The following fields appear in the PARAM block:
    • GUID - Identifies the parameter definition.
    • NAME - Parameter definition name.
    • DATATYPE - Parameter type. This field can be a common type (TEXT, INTEGER, etc.), structural type (FORCE, MOMENT, etc.) or common family type (Area Tags, etc). Common type and structural type parameters are specified in the text file directly (e.g.: TEXT, FORCE). If the value of the DATATYPE field is FAMILYTYPE, an extra number is added. For example, FAMILYTYPE followed by -2005020 represents Family type: Area Tags.
    • DATACATEGORY - An optional field for parameters whose DATATYPE is FAMILYTYPE.
    • GROUP - A group ID used to identify the group that includes the current parameter definition.
    • VISIBLE - Identifies whether the parameter is visible. The value of this field is 0 or 1.

      0 = invisible

      1 = visible

    • DESCRIPTION - An optional field for a tooltip for this parameter.
    • USERMODIFIABLE - Identifies whether the parameter is editable by the user.

      0 = user cannot edit the parameter and it is greyed out in the UI

      1 = user can edit the parameter value in the UI

In the sample definition file, there are two groups:

  • MyGroup - ID 1 - Contains the parameter definition for MyParam which is a Text type parameter, and the definition for areaTags which is a FamilyType parameter.
  • AnotherGroup - ID 2 - Contains the parameter definition for Price which is an Integer type parameter.

Of the 3 parameters in the sample file, only Price has a description. All of the parameters are visible and user modifiable.