GlobalParametersManager Class


A class to access and query information about global parameters in Revit models.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 21.0.0.0 (21.1.1.109)
Since: 2016 Subscription Update

Syntax

C#
public class GlobalParametersManager : IDisposable
Visual Basic
Public Class GlobalParametersManager _
	Implements IDisposable
Visual C++
public ref class GlobalParametersManager : IDisposable

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.

Examples

Copy C#
/// <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
}
Copy VB.NET
' <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 Function CountAllGlobalParameters(document As Document) As Integer
    ' Global parameters are not available in all documents.
    ' They are available in projects, but not in families.
    If GlobalParametersManager.AreGlobalParametersAllowed(document) Then
        Return GlobalParametersManager.GetAllGlobalParameters(document).Count
    End If

    Return 0
    ' no global parameters in this document
End Function

Inheritance Hierarchy

System Object
Autodesk.Revit.DB GlobalParametersManager

See Also