RVTDocs.com

GlobalParametersManager.AreGlobalParametersAllowed

Method
Description:
Tests whether global parameters are allowed in the given document.
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.
Syntax
public static bool AreGlobalParametersAllowed(
	Document document
)
Examples
/// <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;
}
Parameters
Parameter Type Description
document Document A revit document of interest.
Return Value
Exceptions
Exception Condition
ArgumentNullException A non-optional argument was null