GetAllGlobalParameters Method


Returns all global parameters available in the given document.

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

Syntax

C#
public static ISet<ElementId> GetAllGlobalParameters(
	Document document
)
Visual Basic
Public Shared Function GetAllGlobalParameters ( _
	document As Document _
) As ISet(Of ElementId)
Visual C++
public:
static ISet<ElementId^>^ GetAllGlobalParameters(
	Document^ document
)

Parameters

document
Type: Autodesk.Revit.DB Document
The document containing the global parameters

Return Value

A collection of Element Ids of global parameter elements.

Examples

Copy C#
/// <summary>
/// Returns all global parameter elements defined in the given document. 
/// </summary>
/// <param name="document">Revit project document.</param>
/// <returns>A set of ElementIds of global parameter elements</returns>
public ISet<ElementId> GetAllGlobalParameters(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);
    }

    // return an empty set if global parameters are not available in the document
    return new HashSet<ElementId>();
}
Copy VB.NET
' <summary>
' Returns all global parameter elements defined in the given document. 
' </summary>
' <param name="document">Revit project document.</param>
' <returns>A set of ElementIds of global parameter elements</returns>
Public Function GetAllGlobalParameters(document As Document) As ISet(Of ElementId)
    ' 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)
    End If

    ' return an empty set if global parameters are not available in the document
    Return New HashSet(Of ElementId)()
End Function

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentException Global parameters are not supported in the given document. A possible cause is that it is not a project document, for global parameters are not supported in Revit families.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was NULL

See Also