ExternalDefinition Class

The ExternalDefinition object adds properties specific to Autodesk Revit shared parameter definitions.
Inheritance Hierarchy
SystemObject
  Autodesk.Revit.DBDefinition
    Autodesk.Revit.DBExternalDefinition

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public class ExternalDefinition : Definition, 
	IDisposable

The ExternalDefinition type exposes the following members.

Properties
 NameDescription
Public propertyDescription The description of the parameter. The description will be used as tooltip in the Revit UI including in the properties palette.
Public propertyGUIDReturns the GUID associated with the shared parameter definition.
Public propertyHideWhenNoValue Indicates whether this parameter should be hidden from the properties palette when it has no value.
Public propertyIsValidObject Specifies whether the .NET object represents a valid Revit entity.
Public propertyNameThe user visible name for the parameter.
(Overrides DefinitionName)
Public propertyOwnerGroup Returns or change the group ID of the external parameter definition.
Public propertyUserModifiable Indicates whether the parameter can be modified by the user interface.
Public propertyVisibleIndicates if the parameter is visible in the Autodesk Revit user interface.
Top
Methods
 NameDescription
Public methodDisposeReleases all resources used by the ExternalDefinition
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodCode exampleGetDataType Gets a ForgeTypeId identifying the data type describing values of the parameter.
(Inherited from Definition)
Public methodGetGroupTypeId Returns the identifier of the parameter definition's parameter group.
(Overrides DefinitionGetGroupTypeId)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
Remarks

The ExternalDefinition object can be created by a definition Group object from a shared parameters file. External parameter definition must belong to a Group which is nothing more than a collection of shared parameter definitions. The following process should be followed to add a parameter to an element: Open the shared parameters file, via the Application.OpenSharedParameterFile() method. Access an existing or create a new group, via the DefinitionFile.Groups property. Access an existing or create a new external parameter definition, via the DefinitionGroup.Definitions property. Create a new Binding object with the categories to which the parameter will be bound using an InstanceBinding or a TypeBinding object. Finally add the binding and definition to the document using the Document.ParameterBindings object.

Shared parameters added to elements are typically visible to interactive users. To add data to elements that is never visible to interactive users, use Extensible Storage to construct and populate the needed structured data.

Example
private void ReadEditExternalParam(DefinitionFile file)
{
    // get ExternalDefinition from shared parameter file
    DefinitionGroups myGroups = file.Groups;
    DefinitionGroup myGroup = myGroups.get_Item("MyGroup");
    if (myGroup != null)
    {
         ExternalDefinition myExtDef = myGroup.Definitions.get_Item("MyParam") as ExternalDefinition;
         if (myExtDef != null)
         {
             DefinitionGroup newGroup = myGroups.get_Item("AnotherGroup");
             if (newGroup != null)
             {
                 // change the OwnerGroup of the ExternalDefinition
                 myExtDef.OwnerGroup = newGroup;
             }
         }
    }
}
See Also