Revit 2013 and its API

As you probably know by now, Revit 2013 has been released, with legions of new features. Here they are for architecture, MEP and structural.

Without further ado, let us take a look at its API.

Overview

Just like in previous years, the API in the upcoming version of Revit sports truly impressive enhancements, both in quantity and quality. As always, a number of completely new features were added, and many features added in the 2012 timeframe were enhanced based on the new insights.

We will look at the following three areas: first, for background information and motivation, an introduction to the new product features, followed by enhancements of the existing API (the rice), and the completely new API functionality (the wine). Here are the main product feature additions and enhancements:

Product Features

Revit 2012 introduced a whole new set of revolutionary features to support and integrate with the construction, fabrication and engineering process, especially the concepts of parts and assemblies. These have obviously been enhanced based on the experiences made. They affect areas such as construction modeling, fabrication, precast elements and reinforcement detailing. Other related areas of enhancement include point clouds, MEP piping system routing and numerous customer requests.

The Revit Server was provided with Revit 2012 and has been enhanced with new features and improved performance for platform scalability.

Several new features to support improved countrification were added, such as new stair and railing elements and access to their subcomponents, MEP centerlines, and a new IFC API.

The importance of interoperability with other products and product suites is growing, so Autodesk Revit now includes a Revit One Box option containing all three flavors for Architecture, MEP and Structure integrated into a single product with support for runtime switching of disciplines. Translation fidelity and Inventor interoperability is enhanced, add-ins can be integrated closer into Revit, and new view and visualization APIs are provided.

New physical properties, structural analysis in BIM, structural code checking, analysis visualization, analytical volumes and new MEP properties and calculation functionality enhance the analysis and simulation functionality.

Revit API Enhancements

Looking at the enhancements provided in the new Revit API affecting existing add-ins, the effort required to migrate an existing add-in from the previous version is pretty minimal this time around. As always, efforts were made to change as little as possible and still keep up momentum. Add-ins must now be built using the .NET 4.0 framework, old-style collections have been replaced by generic .NET collections, the wall creation methods have been updated, the Document.Element properties have been better aligned with standard .NET conventions, and deprecated APIs have been cleaned up.

An area that does not affect add-ins but may still be of interest to developers is the replacement of the VSTA macro environment by the open source SharpDevelop IDE, which offers all the existing functionality plus some new features such as support for .NET 4.0.

A new ReferenceIntersector class simplifies the use of the FindReferencesWithContextByDirection method, the Idling event has been enhanced, and a new external event interface is defined to simplify interaction with external asynchronous processes, such as modeless dialogues.

Revit API New Features

A lot of completely new API functionalities are provided in this release. It can be grouped in many different ways. I will group them them into these five containers:

Integration

One large goal encompassing many developer wish list items is the improvement of the user experience when using an add-in. This topic includes features that allow add-ins to integrate better into the Revit UI, and even vice versa, integrating a little piece of Revit functionality into an add-in by hosting a Revit view:

Revit view in WPF control
Revit Options dialogue with add-in defined custom tab using WPF controls

All of these features were demonstrated at the DevDays 2011 by the Revit UI API demo sample application, which is available for ADN members together with all other DevDays presentations on the ADN Extranet at adn.autodesk.com under "Events". I will hopefully get around to publishing the UI demo sample here on the public blog soon as well.

Besides all of these, here are even more new features enhancing add-in integration:

Some view types cannot be created programmatically in Revit 2012. The new view API enables an add-in to create all types of views and manipulate almost all settings, retrieve the view range for plan views, lock and unlock 3D views, and duplicate views. The new UIView class represents a view window and enables you to pan and zoom and determine its size for tiling etc., also useful for switchback functionality from other visualization environments to support better integration.

All settings in the Rendering Options dialogues are now exposed. The rendering itself cannot be launched programmatically yet, though.

The new schedule API enables an add-in to create schedules and add or remove fields and filters, control sorting and grouping, add, read, and place a schedule on a sheet or modify its placement, and access all the schedule data, e.g. to export to a text file.

A dedicated DataStorage element is included for managing extensible storage not associated with any specific BIM element.

A new External Event interface and framework provides a new API for interacting with asynchronous processes, e.g. a modeless dialogue, significantly simplifying the previous interaction requiring use of the Idling event. The Idling event itself has been enhanced to improve performance. A new External Services framework wraps external service functionality, enabling certain services such as analysis or calculations to be encapsulated and replaced, providing a basis for future MEP calculations and structural code checking.

Analysis

In Revit MEP 2012, you can only define one single default elbow, tee, etc., which is rather limiting. In Revit 2013, however, numerous different setting for different materials and sizes are supported. One of the major MEP API additions provides access to the routing preferences, as demonstrated by the new Routing Preference Analysis SDK sample. Other enhancements enable programmatic selection of pipe sizes, materials, fitting types, calculation of pipe and duct friction factors, better handling of duct and pipe sections with the new MEPSection base class, handling of viscosity and density at specified temperatures, read and write access to spare circuit values, and retrieval of the localized user-visible display strings for enumeration values.

New physical properties include a new class ThermalProperties, an additional structural material element, structural and thermal material assets that can be shared, and the ability to indicate if thermal information is included in the gbXML export.

The structural analytical model includes a new AnalyticalLink element type that can be user defined or automatically generated between two analytical elements and access to link properties like "fixity state".

The Analysis Visualization Framework AVF now better supports the structural analysis workflow, e.g. by including support for deformed shapes.

A Light and Light Group API provides new classes to get and set photometric data, including initial color and intensity, loss factor, color filter and dimming color.

The new ReferenceIntersector class mentioned above provides simplified and more performant ray-cast selection of elements using a given point and direction, similar to the existing FindReferencesWithContextByDirection method, with additional support for filtering the output, e.g. to collect elements, meshes, edges, curves, and faces.

Modeling

New classes have been implemented to create, read and modify stairs and railings, including curved stairs, and provide access to their annotations and subcomponents such as path, run, landing, continuous, top and hand rail.

Programmatically generated stairs and railings

Reinforcement systems have been enhanced to support adding and removing individual subcomponents. A new class RebarInSystem represents an individual bar in a system. System members and curve boundaries are accessible, and system bars can be converted back and forth between the system and standard rebar. Welded wire mesh and fabric sheet elements have been added.

All the new construction modeling and assembly functionality includes full API access, e.g. to merge and exclude parts, create parts from linked elements, handle part separation profiles, and manage assembly views using the new AssemblyViewUtils class.

Interoperability

The IFC export implementation in Revit has switched to a more generic toolkit providing more options on what can be customized and how, and the IFC exporter source code is now available on SourceForge.

The update includes numerous data exchange API enhancements affecting DGN, DWF, DWG and DXF import and export. The Revit 2013 API also provides the ability to create Revit links.

Document and worksharing changes include new overloads for the OpenDocumentFile and OpenAndActivateDocument methods to help specify how Revit document should be opened, including detaching from central. This is still a work in progress.

A new class BasicFileInfo class provides access to certain basic information about a Revit model file without having to open the file itself.

Miscellaneous

That is still not all: a new SelectionFilterElement accesses filter type, a new class PhaseFilter creates, reads and writes phase filters, the Ceiling element has been exposed, NewAlignment can now align a line to a reference plane, a large number of powerful new geometry and sketching methods are provided, add-ins can now access and create filled regions, dimension pre- and suffixes are accessible, and much more!

All information above and more is provided in the What's New section of the Revit API help file RevitAPI.chm included with the Revit SDK.

Exciting stuff, eh?

Download Revit 2013 today and see for yourself!