AreGlobalParametersAllowed Method


Tests whether global parameters are allowed in the given document.

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

Syntax

C#
public static bool AreGlobalParametersAllowed(
	Document document
)
Visual Basic
Public Shared Function AreGlobalParametersAllowed ( _
	document As Document _
) As Boolean
Visual C++
public:
static bool AreGlobalParametersAllowed(
	Document^ document
)

Parameters

document
Type: Autodesk.Revit.DBDocument
A revit document of interest.

Remarks

First of all, global parameters can be had in main project documents only; they are not supported in family documents. However, there may also be other circumstances due to which global parameters may be disallowed in a particular project, either temporarily or permanently.

Examples

CopyC#
/// <summary>
/// Tests whether there are any global parameters present in the given document 
/// </summary>
/// <param name="document">Revit project document.</param>
/// <returns>A set of ElementIds of global parameter elements</returns>
public bool ContainsGlobalParameters(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 > 0);
    }

    return false;
}
CopyVB.NET
' <summary>
' Tests whether there are any global parameters present in the given document 
' </summary>
' <param name="document">Revit project document.</param>
' <returns>A set of ElementIds of global parameter elements</returns>
Public Function ContainsGlobalParameters(document As Document) As Boolean
    ' 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 > 0)
    End If

    Return False
End Function

Exceptions

ExceptionCondition
Autodesk.Revit.ExceptionsArgumentNullException A non-optional argument was null

See Also

ArchiLabs Desktop

Put AI to work inside Revit.

Give Desktop your instructions and project files to build Revit families, update model elements, and create views and schedules. Works directly in Revit and AutoCAD.

Explore Desktop →