Dynamo Python Primer
  • Take Dynamo Further 🚀
  • 1 Hello Python 🐍
    • 1.1 Why Should I Learn to Code?
    • 1.2 Python Introduction
    • 1.3 What is IronPython?
  • 2 Seeing The Bigger Picture 🔭
    • 2.1 Context Matters
    • 2.2 What is an API?
    • 2.3 The .NET Framework
    • 2.4 Object-Oriented Programming
  • 3 Getting Started 🛴
    • 3.1 Dynamo's Python Node
    • 3.2 Boilerplate Setup Code
    • 3.3 Basics: Input and Output
    • 3.4 Common Errors
  • 4 Revit-Specific Topics 🏡
    • 4.1 Introduction to Revit's API
    • 4.2 How to Read Revit's API Documentation
    • 4.3 Doc, UIDoc, App, UIApp
    • 4.4 Unwrapping Revit Elements
    • 4.5 The FilteredElementCollector
    • 4.6 Geometry Conversion Methods
    • 4.7 Working With Parameters
      • Family Parameters
      • Global Parameters
      • Project Information Parameters
      • Group Parameters
      • Built-In Parameters
    • 4.8 Working With Transactions
    • 4.9 Opening & Closing External Files
    • 4.10 Prompting UI Selection
    • 4.11 Working With Units
    • 4.12 Built-In Categories
    • 4.13 Family Acrobatics
    • 4.14 Feedback: TaskDialogs
  • 5 Glossary 📚
  • About This Primer 👋
Powered by GitBook
On this page

Was this helpful?

  1. 4 Revit-Specific Topics 🏡
  2. 4.7 Working With Parameters

Global Parameters

Global parameters are accessible by any element in the model

PreviousFamily ParametersNextProject Information Parameters

Last updated 5 years ago

Was this helpful?

A New Kind of Parameter

In Revit 2016, a new kind of parameter was introduced to to the application: the . 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:

  • : This is used to access any global parameters in a Revit document.

  • : Objects of this class represent a single global parameter.

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 , as we're editing the Revit document.

Global Parameter
GlobalParameterManager Class
GlobalParameter Class
wrapped in a transaction