Global Parameters

Global parameters are accessible by any element in the model

A New Kind of Parameter

In Revit 2016, a new kind of parameter was introduced to to the application: the Global Parameter. These were designed to let the users control a value from a single location, which could be referenced anywhere in the model.

In Revit's API, there are a few classes which relate to this new functionality:

Accessing Global Parameters

We can retrieve any or all global parameters in a document using the GlobalParameterManager class, like so:

#Boilerplate Code

#To retrieve a list of all global parameters' IDs we can use:
all_global_parameter_ids = GlobalParameterManager.GetAllGlobalParameters()

#We can also retrieve a single global parameter using its name
test_parameter_id = GlobalParameterManager.FindByName("Test")

#Finally, we can get the GlobalParameter object using the Document.GetElement() method:
test_parameter = doc.GetElement(test_parameter_id)
OUT = test_parameter

Getting and Setting Values

We can retrieve the value from any GlobalParameter object using its GetValue() method, like so:

#Boilerplate Code
test_parameter_id = GlobalParameterManager.FindByName("Test")
test_parameter = doc.GetElement(test_parameter_id)
value = test_parameter.GetValue().Value

We can also set the value, using the SetValue() method, although it will need to be wrapped in a transaction, as we're editing the Revit document.

Last updated