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 🏡

4.1 Introduction to Revit's API

Revit's API has been developed over nearly two decades; let's get to know it!

Previous4 Revit-Specific Topics 🏡Next4.2 How to Read Revit's API Documentation

Last updated 5 years ago

Was this helpful?

Introduction to Revit's API

Revit has had an accessible API since the early 2000s, which can be used to drive nearly every aspect of the software. As the Revit application is very complex and built to suit multiple audiences (structure, MEP etc) it is no surprise that its API is very large and takes a while to grasp intuitively.

I often find it easiest to think of Revit as primarily being a database that we're constantly updating as we use the application. The database stores our content (its element ID, category, location, etc). On top of this is a , which represents the elements' geometry/location in a 3D space and lets us interact with our elements. Finally, there's a bit of networking magic to allow us to set up worksharing across a local network / Revit Server / BIM360.

Thinking of Revit in this way is totally different to how most users will experience the software. In reality, when we're writing scripts targeting Revit's API, we're just making a series of calls to a database, constrained by the rules of that API.

Versions and History

With every release and sub-release of Revit, the Autodesk Revit team makes minor updates or additions to its API. These changes mostly relate to functional changes within the software itself (e.g. the recent egress analysis API).

This long history sometimes means that the Revit API can seem inconsistent or structured in unexpected ways - this often happens with older APIs, which cannot change without affecting lots of people.

The Structure of Revit's API

Given its size, it can help to take a step back and understand how this API is generally structured. The Revit API exposes around 1700 classes, 50 interfaces and 500 enumerations which cover almost every aspect and function of the application. The classes are subdivided between several namespaces, often relating to a specific usage (e.g. plumbing or structural steel). The vast majority of classes reside in the Autodesk.Revit.DB namespace.

On your machine, the API classes are split between two .dll files: RevitAPI.dll and RevitAPIUI.dll which can be found at: C:\Program Files\Autodesk\Revit [Version]

The Revit SDK & API Documentation

Software Development Kit (SDKs) are a common way for software vendors to distribute information about their APIs to developers. The official Revit SDK can be found .

All need technical documentation so programmers can pick them up and learn how to drive the application using code. The Revit SDK contains both official API documentation in a .chm file as well as code examples (written in Visual Basic and C#).

However, this guide recommends reading the Revit API in the website, which is far more convenient than opening a .chm file. Make sure to bookmark it and find our guide to using the site here:

This page also contains a quick guide to help explain some of the key terms you'll find in Revit's API documentation. Make sure to check it out!

Revit API Resources

Autodesk has many resources for getting acquainted with Revit's API, although many of these give examples in C# rather than Python.

Written by Jeremy Tammik, blog is a prolific, detailed guide to all aspect's of Revit's API. Examples are mostly in C#, but he does a great job explaining the API's intended functionality and use in everyday workflows.

Danny Bentley has created , demonstrating how to use Revit's API in both Python and C#

Gui Talarico (who created APIDocs.co) has collected together a on his Github.

Sol Amour, of Autodesk, has curated a series of .

GUI
here
APIs
APIDocs.co
4.2 How to Read Revit's API Documentation
TheBuildingCoder
several helpful Youtube playlists
series of Revit Python resources
plug-and-play IronPython scripts for Dynamo