From the course: Revit: Creating C# Plugins

The Revit API

From the course: Revit: Creating C# Plugins

Start my 1-month free trial

The Revit API

- [Instructor] To create Revit plugins we need to work with the Revit API, or Application Programming Interface. This will allow us to access and interact with the Revit project data base. If you haven't heard the term API before, this is simply a set of functions and procedures that allows for one piece of software to communicate with another. In our case, the Revit API provides us methods in the form of functions and classes which we can use to send commands to Revit. Revit will understand these through the API and return something like an object or an action. A common way of thinking about the API is like a waiter in a restaurant. Say we have a menu of items to order from which the kitchen can make. The problem is we can't get the item we want from the menu as we don't have access to the kitchen. This is where a waiter, or the API, comes in. We can request items from the kitchen, Revit in our case, by requesting it through the waiter, or Revit API. The waiter will then send the order to the kitchen and bring the item back, or object which we have requested. So the waiter, or API for Revit, comes primarily in the form of two different files. The RevitAPI.dll and the RevitAPIUI.dll. These are both automatically added to the default installation file path for Revit and are accessible by any programming language compatible with the dot net framework, such as C#, which we'll be using for this course. The RevitAPI.dll file provides methods to access Revit's documents, elements and parameters at a database level. For example, it allows us to access the wall class which provides methods and properties associated with the wall element in Revit. The RevitAPIUI.dll provides access to Revit's interface, which allows us to customize the interface. There are also additional API files, including the RevitAPIIFC.dll, the RevitAPIMarcos.dll, and the RevitAPIUIMacros.dll. However, in this course we'll stick to the primary RevitAPI and RevitAPIUI files. So by accessing the RevitAPI through plugins we can edit and make changes to Revit through commands that we create.

Contents