Saving Time with the Revit API

I often hear Revit, and by extension BIM, accused of being slower than CAD, particularly by those who are new to it.  Those that have been using CAD software and methodology for a very long time, in particular, have some pretty strong opinions on the matter.

 

“Revit is 4x slower than CAD” is one of many thoughts I’ve heard on the subject.  I’ve heard many more that could not be published in this article.

Now, there are elements of truth in this.  Work on a BIM project is more front-loaded than on a CAD project, with the tradeoff being shorter and more predictable construction times.  There are also some legitimate reasons that users may feel that it takes longer to work on a BIM project. 

 

Before getting to some of the ways that the Revit API can help companies save time and improve the quality of the designs, let’s briefly look at a couple other reasons that lead to users forming bad impressions of Revit.

 

First, a lack of training, on both BIM software and methodology.  If a long-time AutoCAD user is moved onto a Revit project without proper training, they will undoubtedly struggle to be as productive.  A 3-day crash course does not constitute proper training; it must be ongoing, with internal resources and support available.  A learning curve with new software is unavoidable, but if employees are given adequate resources to learn, they will not feel like they are wasting time working on Revit projects.

 

Second, poor implementation of BIM, on either a company or project level.  If a project does not have a solid BIM Execution Plan (BxP), there won’t be enough coordination between disciplines to for work to proceed effectively.  Projects that are a mix of existing CAD files and new Revit files will also be quite painful.  The initial time investment of modeling the existing building in Revit is always worth it. 

 

Even with a solid BxP, if a company does not have an adequate family library or project template to work from, employees will end up wasting countless hours on anything from modeling, to scheduling, to printing.

Finally, there are usability issues with BIM software itself, namely Revit.  While not every issue with the software can be avoided, many issues can be mitigated through the use of the Revit API.

 

Companies should have good BIM training and implementation practices before trying to take advantage of the Revit API.  Introducing additional tools before users are familiar with core functionality only adds confusion.  It is also important that files are well structured and organized so that programs can take advantage of that data.

API stands for Application Programming Interface.  An API is a way for a program to control another program, in the same way that a person controls a program using a mouse and keyboard.

 

There are several advantages to using a tool that leverages the API.  Computers do not make mistakes and do not get tired.  Tasks can be repeated as many times as necessary, and the result will be the same every time.  Computers are also much better at analyzing large quantities of data, or at finding a proverbial needle in a haystack. This is not to call humans useless – computers can’t program themselves (yet…)

 

The Revit API allows users to perform nearly any task that is possible in Revit. 

It can be used in 3 ways:

  • Addins, which are generally written in C# using the Visual Studio IDE (Integrated Development Environment).  This is the most powerful and flexible way to use the Revit API.  For anything more than a simple script, this is the method that should be use

 

Microsoft Visual Studio 2017

 

  • Macros, which are a good place for a beginner to start experimenting with simple scripts.  Several programming languages are supported: C#, Visual Basic (VB), Ruby & Python.  C# is recommended as it is the most commonly used language for Revit development

The Revit Macro Editor

 

  • Dynamo.  This is an addin for Revit created by Autodesk to create scripts with no code.  It has a drag and drop interface which lets users build programs by connecting “nodes” that perform certain functions.  This is a great way to take advantage of the Revit API if learning to code is not an option.  While it provides access to only a limited subset of the Revit API, it is suitable in most cases.  It also has a repository of nodes that can be easily downloaded to supplement the out-of-the-box functionality

Dynamo interface showing a script

 

Let’s now take at how each of these ways of using the API can be used to solve common issues faced by many companies that use Revit.

 

Bulk editing of data is a commonly required task that is not always straightforward. 

Consider an example where several hundred sheets need to be renamed in a project.  The sheets must all be named to match the view name, but only if that sheet contains a single floor plan. 

 

This is an excellent example of a situation where a macro or a Dynamo script can be used to solve the issue.  It is a simple enough problem that it is not worth the additional complexity of developing a full addin, and it is a unique enough problem that finding a suitable existing program is unlikely.

 

To demonstrate, both the macro and Dynamo script used to solve this issue are available from https://github.com/StarkBIM/CanBIMSamples.

With basic knowledge of the Revit API, such a script will take under 30 minutes to write.  Renaming all of these by hand would take at least an hour, and several mistakes would likely have been made during the process.  It can also be re-run at any time and used on any other files.

 

Companies frequently run into situations where there is a one-time problem such as the one above that needs to be taken care of.  Employees need to spend several hours performing this tedious task, taking them away from performing more valuable work and negatively impacting their job satisfaction.  Having someone on staff, or having access to a 3rd party, that is able to create such tools can save huge amounts of time in the long run, while also improving the quality of your models.

 

The previous example demonstrated that with some knowledge of the Revit API, it is easy to write a simple script that can accomplish a task in Revit.  Now consider a more advanced issue, where a company may not have the knowledge to create a solution in-house for the problem they are experiencing.  What options are there then?

The first option is to use an application that already exists.  There are a growing number of companies creating applications to use with Revit, both free and paid.  The second option is to have an application custom developed for your company.  Let’s first look at a couple examples of using existing software.

 

A common task in Revit is to create a section view around a set of elements for coordination purposes.  It can be time consuming to fiddle around with getting the section just right.

There is an excellent free application called COINS Auto-Section Box addin that solves this issue, allowing users to create a section view from a set of elements.

This is one of many applications available on the Autodesk App Store.  For companies not familiar with it, and even those that are, I recommend occasionally browsing through some of the top or recommended apps listed.  It contains a number of tools, many of which are free, that will greatly improve the experience of using Revit.  You may find a solution to a problem that you never knew you had.  However, it is unlikely that you will find a piece of free software that has enough functionality to significantly impact your company’s bottom line.

Autodesk App Store - Landing page for Revit

 

Another common pain point in Revit is printing and exporting sheets and views, particularly if those sheets are spread across multiple models.  There are several issues that come together to make this a particularly painful experience in Revit.  The first issue is the amount of time it takes to open a Revit model, especially if it has a large number of links.  Normally, file open times can be improved by selectively opening links.  However, when printing, this is not an option as all links generally need to be open so that drawings print correctly.

 

The second issue is that files are not correctly named when they are printed or exported.  Most projects have conventions that must be followed for any drawings or files, and it is a time consuming and incredibly boring task to try to rename these files by hand before submitting them.

 

The Revit API can be used to solve both of these problems. 

To solve the first issue, the key is to store a list of sheets and views in an external database.  This allows for a user to first choose the sheets or views that are to be printed and/or exported, and then to have Revit open the necessary files and then print/export the drawings without user interaction.

The second issue is solved by providing the Revit addin with the naming convention required for the project, and having each file automatically renamed as it is created.

Solving both of these issues will save hundreds of hours on a large project, effectively reducing the amount of time spent printing drawings to zero.

StarkBIM is releasing a Batch Printing & Exporting tool in September, as the first component of our BIM Suite.  It includes both of the above features among a host of others.  It will be able to export to PDF, DWG, and any other format supported by Revit.  It will also have the ability to save sets of sheets for re-use, and to schedule saved tasks to run automatically (on a server, for example).

 

Finally, there may be situations that are both beyond your company’s internal development capabilities and not well-served by existing software.  Custom-developed software may be the only option available at this point.  While it is more expensive up-front to have something made-to-order for your company, it will likely be a good investment in the long run. 

 

Even if there is an existing program that serves nearly all of your company’s requirements, it may require a workflow that is completely different from the way that your company currently works.  In such instances, the time lost adapting to a new workflow and the cost of retraining employees will often exceed the cost of having software custom made.  In addition, the ability to dictate exactly what is created is invaluable.  An ou