GlobalParametersManager Class

A class to access and query information about global parameters in Revit models.
Inheritance Hierarchy
SystemObject
  Autodesk.Revit.DBGlobalParametersManager

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

The GlobalParametersManager type exposes the following members.

Properties
 NameDescription
Public propertyIsValidObject Specifies whether the .NET object represents a valid Revit entity.
Top
Methods
 NameDescription
Public methodStatic memberCode exampleAreGlobalParametersAllowed Tests whether global parameters are allowed in the given document.
Public methodDisposeReleases all resources used by the GlobalParametersManager
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodStatic memberCode exampleFindByName Finds whether a global parameter with the given name exists in the input document.
Public methodStatic memberCode exampleGetAllGlobalParameters Returns all global parameters available in the given document.
Public methodStatic memberGetGlobalParametersOrdered Returns all global paramters in an ordered array.
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodStatic memberCode exampleIsUniqueName Tests whether a name is unique among existing global parameters of a given document.
Public methodStatic memberIsValidGlobalParameter Tests whether an ElementId is of a global parameter in the given document.
Public methodStatic memberMoveParameterDownOrder Moves given paramerer Down in the current order.
Public methodStatic memberMoveParameterUpOrder Moves given paramerer Up in the current order.
Public methodStatic memberSortParameters Sorts global parameters in the desired order.
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
Remarks

This class provides access to general information and data of Global Parameter elements in a particular model. First of all, it is important to know that global parameters can be had in main project document; there are not supported in family documents. Availability of global parameters in a document can be tested by calling AreGlobalParametersAllowed(Document) method.

Global Parameter in a document can be obtained by calling either GetAllGlobalParameters(Document) or FindByName(Document, String). The former returns a set of all global parameters in the document, while the latter returns just the requested one, providing it exists.

Each global parameters must be created with a valid name that is unique in the scope of the document. To test whether a particular name is unique, programmer can use the IsUniqueName(Document, String) method.

More details about creating and manipulating global parameters can be found in the description of the GlobalParameter class.

Example
/// <summary>
/// Counts all global parameter elements defined in the given document. 
/// </summary>
/// <param name="document">Revit project document.</param>
/// <returns>Total number of all global parameter elements in the document</returns>
public int CountAllGlobalParameters(Document document)
{
    // Global parameters are not available in all documents.
    // They are available in projects, but not in families.
    if (GlobalParametersManager.AreGlobalParametersAllowed(document))
    {
        return GlobalParametersManager.GetAllGlobalParameters(document).Count;
    }

    return 0;   // no global parameters in this document
}
See Also