Changes in Revit API Documentation

Revit API has differences across different versions. Some classes or methods are updated or new are being introduced. So let's have a look how to account for that in our code.

Changes in Revit API Documentation

Revit API has differences across different versions. Some classes or methods are updated or new are being introduced. So let's have a look how to account for that in our code.

Summary

Revit API Changes

Every year we get a new version of Revit that has a few new/updated features. And so does Revit API.

There is a high chance that you use multiple Revit versions in your office, so it's good to prepare your scripts for possible changes.

💡 Let's explore Revit API Docs to understand how to protect our scripts from errors.

Protect scripts against changes

There are 2 options to protect your scripts from changes.

#pyRevit Metatags
__min_revit_ver__ = 2019
__max_revit_ver__ = 2022

You can limit your tools to certain Revit versions. They won't be available in other Revit versions.

We can simply use meta tags in pyRevit for that.

Or we can write different code blocks for different Revit versions.

We can get Revit version using VersionNumber property from Application.

app = __revit__.Application
rvt_year = int(app.VersionNumber)

if rvt_year < 2022:
    # Code 🅰️
elif rvt_year >= 2022:
    # Code 🅱️
How to detect Changes in Revit API?

💡 Usually I test my tools in multiple Revit versions, so if I get an error I know where to look. But we can also explore Revit API Docs to find these differences.

When you select any class/method/property in Revit API Docs, you might have noticed that Revit years get colored line under them.

How to detect Changes in Revit API?

💡 Usually I test my tools in multiple Revit versions, so if I get an error I know where to look. But we can also explore Revit API Docs to find these differences.

When you select any class/method/property in Revit API Docs, you might have noticed that Revit years get colored line under them.

Red - Missing

Yellow - Changed

Gray - Unchanged

Cyan - Current Revit Year

How to detect Changes in Revit API?

💡 Usually I test my tools in multiple Revit versions, so if I get an error I know where to look. But we can also explore Revit API Docs to find these differences.

When you select any class/method/property in Revit API Docs, you might have noticed that Revit years get colored line under them.

Red - Missing

Yellow - Changed

Gray - Unchanged

Cyan - Current Revit Year

Red - Missing

How to detect Changes in Revit API?

💡 Usually I test my tools in multiple Revit versions, so if I get an error I know where to look. But we can also explore Revit API Docs to find these differences.

When you select any class/method/property in Revit API Docs, you might have noticed that Revit years get colored line under them.

Red - Missing

Yellow - Changed

Gray - Unchanged

Cyan - Current Revit Year

How to detect Changes in Revit API?

💡 Usually I test my tools in multiple Revit versions, so if I get an error I know where to look. But we can also explore Revit API Docs to find these differences.

When you select any class/method/property in Revit API Docs, you might have noticed that Revit years get colored line under them.

Red - Missing

Yellow - Changed

Gray - Unchanged

Cyan - Current Revit Year

Yellow - Changed

How to detect Changes in Revit API?

💡 Usually I test my tools in multiple Revit versions, so if I get an error I know where to look. But we can also explore Revit API Docs to find these differences.

When you select any class/method/property in Revit API Docs, you might have noticed that Revit years get colored line under them.

Red - Missing

Yellow - Changed

Gray - Unchanged

Cyan - Current Revit Year

How to detect Changes in Revit API?

💡 Usually I test my tools in multiple Revit versions, so if I get an error I know where to look. But we can also explore Revit API Docs to find these differences.

When you select any class/method/property in Revit API Docs, you might have noticed that Revit years get colored line under them.

Red - Missing

Yellow - Changed

Gray - Unchanged

Cyan - Current Revit Year

Gray - Unchanged

How to detect Changes in Revit API?

💡 Usually I test my tools in multiple Revit versions, so if I get an error I know where to look. But we can also explore Revit API Docs to find these differences.

When you select any class/method/property in Revit API Docs, you might have noticed that Revit years get colored line under them.

Red - Missing

Yellow - Changed

Gray - Unchanged

Cyan - Current Revit Year

How to detect Changes in Revit API?

💡 Usually I test my tools in multiple Revit versions, so if I get an error I know where to look. But we can also explore Revit API Docs to find these differences.

When you select any class/method/property in Revit API Docs, you might have noticed that Revit years get colored line under them.

Red - Missing

Yellow - Changed

Gray - Unchanged

Cyan - Current Revit Year

Cyan - Current

How to detect Changes in Revit API?

💡 Usually I test my tools in multiple Revit versions, so if I get an error I know where to look. But we can also explore Revit API Docs to find these differences.

When you select any class/method/property in Revit API Docs, you might have noticed that Revit years get colored line under them.

Red - Missing

Yellow - Changed

Gray - Unchanged

Cyan - Current Revit Year

How to detect Changes in Revit API?

💡 Usually I test my tools in multiple Revit versions, so if I get an error I know where to look. But we can also explore Revit API Docs to find these differences.

When you select any class/method/property in Revit API Docs, you might have noticed that Revit years get colored line under them.

Red - Missing

Yellow - Changed

Gray - Unchanged

Cyan - Current Revit Year

Gap Year

Usually when there are changes to Revit API, they leave us a Gap year, where both old and new versions are available.

That gives us some time to take changes into an account, so our tools don't start crashing right away.

For Example:
If you want to create a floor with Revit API there are 2 methods before and after 2022.

Before 2022: doc.NewFloor()
After 2022 : Floor.Create()

How to detect Changes in Revit API?

💡 Usually I test my tools in multiple Revit versions, so if I get an error I know where to look. But we can also explore Revit API Docs to find these differences.

When you select any class/method/property in Revit API Docs, you might have noticed that Revit years get colored line under them.

Red - Missing

Yellow - Changed

Gray - Unchanged

Cyan - Current Revit Year

How to detect Changes in Revit API?

💡 Usually I test my tools in multiple Revit versions, so if I get an error I know where to look. But we can also explore Revit API Docs to find these differences.

When you select any class/method/property in Revit API Docs, you might have noticed that Revit years get colored line under them.

Red - Missing

Yellow - Changed

Gray - Unchanged

Cyan - Current Revit Year

Obsolete Members

When you explore Revit API and selected method is in the gap year, it will be marked Obsolete.

How to detect Changes in Revit API?

💡 Usually I test my tools in multiple Revit versions, so if I get an error I know where to look. But we can also explore Revit API Docs to find these differences.

When you select any class/method/property in Revit API Docs, you might have noticed that Revit years get colored line under them.

Red - Missing

Yellow - Changed

Gray - Unchanged

Cyan - Current Revit Year

How to detect Changes in Revit API?

💡 Usually I test my tools in multiple Revit versions, so if I get an error I know where to look. But we can also explore Revit API Docs to find these differences.

When you select any class/method/property in Revit API Docs, you might have noticed that Revit years get colored line under them.

Red - Missing

Yellow - Changed

Gray - Unchanged

Cyan - Current Revit Year

You will also notice Obsolete Attribute if you look into Syntax of this method.

How to detect Changes in Revit API?

💡 Usually I test my tools in multiple Revit versions, so if I get an error I know where to look. But we can also explore Revit API Docs to find these differences.

When you select any class/method/property in Revit API Docs, you might have noticed that Revit years get colored line under them.

Red - Missing

Yellow - Changed

Gray - Unchanged

Cyan - Current Revit Year

How to detect Changes in Revit API?

💡 Usually I test my tools in multiple Revit versions, so if I get an error I know where to look. But we can also explore Revit API Docs to find these differences.

When you select any class/method/property in Revit API Docs, you might have noticed that Revit years get colored line under them.

Red - Missing

Yellow - Changed

Gray - Unchanged

Cyan - Current Revit Year

Questions:

Why can't we create Ceilings before 2022?

Why can't we create Ceilings before 2022?

Are Revit API changes common?

Are Revit API changes common?

Discuss the lesson:

P.S. This discord window is controlled with a bot and sometimes you might experience connection issues. If that happened, open Discord server with an app and look for this lesson's channel. Alternatively you could give it a try later in the browser.

Sorry for that, I am still figuring it out.
- Erik

P.S. This discord window is controlled with a bot and sometimes you might experience connection issues. If that happened, open Discord server with an app and look for this lesson's channel. Alternatively you could give it a try later in the browser.

Sorry for that, I am still figuring it out.
- Erik

© 2023-2024 EF Learn Revit API

© 2023-2024 EF Learn Revit API

© 2023-2024 EF Learn Revit API