Using the Revit IFC Export in your own add-on

In September 2011, Autodesk make accessible the Industry Foundation Classes (IFC) exporter for Revit as open source code, licensed through a LGPL v. 2.1 licensing agreement. In 2014, this project evolved to include IFC import as well, and was named “IFC for Revit”.

This source code is available on Source Forge, and everyone can contribute to the part of Revit that deal with IFC.

This source code is now the built-in IFC engine for Revit, and I was told that this engine is also behind the conversion service available through Forge.

When the user clicks on Export to IFC, an even is triggered, and Revit catch this even to run the IFC exporter. This also works when the event is triggered by the Document.Export() used through the Revit API by a third-party add-on, like the one I built last week. This IFC Export engine will then read the Revit model, convert every element into its IFC counterpart, and write the resulting IFC file.

How Revit export to IFC

This IFC engine comes with a special UI, the IFCExporterUI, designed to tap into the capabilities of the open-source IFC exporter to give you more control over the configuration of your export.

There are different add-ons for each Revit version, and each new release of Revit is shipped with the most up-to-date IFC engine available at the time. However, the code for this engine evolve quickly, and you can always download the latest version as an add-on on the Autodesk App Store.

At the time of writing, the landscape looks like this:

Revit Version Built-in IFC Exporter version Latest IFC Exporter version (with the Revit IFC add-on)
2016 Exporter 16.0.490.0 – Default UI Exporter 16.6.0.0 – Alternate UI 16.6.0.0
2017 Exporter 17.0.1081.0 – Alternate UI 17.14.0.0 Exporter 17.4.0.0 – Alternate UI 17.4.0.0
2018 Exporter 18.0.0.420 – Alternate UI 18.0.0.420 Exporter 18.2.0.0 – Alternate UI 18.2.0.0

If you want to know witch version you have, you can check it by opening an IFC file with a text editor and look among the first lines, the FILE_NAME one:

Check you exporter version

I didn’t dig into the subtleties of the different flavors of each Revit version, like R2 and other exotic name, you get the picture.

Last week, I published a Revit add-on to send a model to bimsync. Under the hood, this add-on exports the Revit model to IFC before uploading it to bimsync. As I was building my add-on, I realized that I couldn’t just use the Document.Export() function with whatever IFC export settings Revit could provide me. To be useful, such an add-on must allow the user to set up his own IFC Export configuration.

I look into the code of the IFC Exporter UI to understand how this user interface communicate with the export engine. I found out that you need an IFCExportConfiguration class to use a specific IFC Export configuration. Below is an example of the code needed to export a Revit model to IFC:

//Create an instance of IFCExportOptions
IFCExportOptions IFCOptions = new IFCExportOptions();

//Get an instance of IFCExportConfiguration
IFCExportConfiguration selectedConfig = modelSelection.Configuration;

//Get the current view Id, or -1 if you want to export the entire model
ElementId activeViewId = GenerateActiveViewIdFromDocument(doc);
selectedConfig.ActiveViewId = 
        selectedConfig.UseActiveViewGeometry ? activeViewId.IntegerValue : -1;

//Update the IFCExportOptions
selectedConfig.UpdateOptions(IFCOptions, activeViewId);

string folder = "A path to a folder where you want to save your IFC file";
string name = "the name of your IFC file";

//Export the model to IFC
doc.Export(folder, name, IFCOptions);

You start by creating an instance of the IFCExportOptions found in the Autodesk.Revit.DB namespace. This is standard in all Revit flavors.

Then, you retrieve or create an instance of the IFCExportConfiguration class. This is a class provided by the IFC Export add-on that hold every aspect of your export configuration, from knowing if you want to export the BaseQuanties to the path to the IfcPropertySets mapping files.

You get the Id of the active view and use the UpdateOptions method of IFCExportConfiguration to pass it along with all other properties to the IFCExportOptions.

The IFC Export add-on also provide an IFCExportConfigurationsMap class to get the built-in configurations and store the new ones.

The existing export setups

But where find these IFCExportConfiguration and IFCExportConfigurationMaps classes ?

If the IFC for Revit add-on is installed, you can find these classes in the IFCExporterUIOverride.dll. This dll can be found in your ApplicationPlugins folder, in the IFC plugin install folder (C:\ProgramData\Autodesk\ApplicationPlugins\IFC 2018.bundle\Contents\2018)

Running this on a Revit equipped with the add-on will work nicely, but it will fail miserably when the user doesn’t have the IFC for Revit add-on. In this case, the add-on can’t find the IFCExporterUIOverride.dll containing the IFCExportConfiguration class:

Using IFCExportConfiguration without the add-on

If you have a Revit version with the IFC Exporter UI built in (Revit 2017 or 2018), the IFCExportConfiguration and IFCExportConfigurationMaps classes can be found in the IFCExportUI.dll, located in your Revit installation folder (C:\Program Files\Autodesk\Revit 2018\AddIns\IFCExporterUI). In this case, the features available are the same than our previous case, but are in a different dll.

If you don’t have the IFC Exporter UI at all (Revit 2016 and earlier versions), you must fall back to the basic export options.

In a nutshell, we have to manage these three cases:

Class DLL Revit version
IFCExportConfiguration IFCExporterUIOverride.dll

In C:\ProgramData\Autodesk\ ApplicationPlugins\IFC 2018.bundle\Contents\2018

All Revit version equipped with the IFC for Revit add-on
IFCExportConfiguration IFCExportUI.dll

In C:\Program Files\Autodesk\Revit 2018\AddIns\IFCExporterUI

Revit 2017 and 2018 without the IFC for Revit add-on
IFCExportOptions RevitAPI.dll

In C:\Program Files\Autodesk\Revit 2018

Revit 2016 and earlier without the IFC for Revit add-on

To manage these different cases, I created my own export configuration class, named IFCExportConfigurationCustom. This class handle the configuration of the export and is an interface between my code and the possible IFC export options.

I load in my Visual Studio solution the two dll containing the IFCExportConfiguration class, and using alias, I call a different version of it depending on the installation of the user:

IFCExportUI::BIM.IFC.Export.UI.IFCExportConfiguration
IFCExportUIOverride::BIM.IFC.Export.UI.IFCExportConfiguration

I also handle the vanilla Revit 2016 in my IFCExportConfigurationCustom class, without using any version of the IFCExportConfiguration (which is not available in this version of Revit), using instead the plain old IFCExportOptions built-in into Revit.

By managing the different possibilities of the Revit installation, I am able to make use of the best configuration available to export IFC. I am also able to use directly the Setup configuration interface available in the custom UI, and retrieve these user-defined export setups in my add-on.

Edit IFC Export Setup

If you plan on building your own Revit add-on to upload IFC models to a cloud service, don’t hesitate to look into the source code behind this article, the solution can be found on Github.

By opening the source code of its IFC engine, Autodesk make an underrated effort toward interoperability. Even if it’s obviously not for every Revit user, I think that everyone who rely on the Revit IFC export for its own software should look at this engine to get a full understanding of the possibilities offered by this exporter

 

Revit and bimsync Just Got a Room Together!

This is no mystery that I am a big fan of bimsync. But the lack of integration with Revit make things a bit too time consuming than it should be. To start solving this issue, I created a small Revit plugin to upload your model to bimsync in a single click.

You must first log into your bimsync account. After clicking on login, a browser session will open, and bimsync will ask for your credentials and if you want to allow the Revit plugin to be connected to your account. This will grant the plugin access rights to your bimsync account.

Login into your bimsync account

Login into your bimsync account

Once connected, your credential will be safely stored on your computer so you won’t have to login the next time you open Revit.

You can now upload model to your bimsync account. Select “Upload”, select your bimsync project and model, type in the associated comment, select the IFC settings and click on “Upload”. After a while, depending on your file size, your Revit model will be uploaded to bimsync.

Upload your model to bimsync

Upload your model to bimsync

The Setup drop down allows you to select the IFC Export configuration. You can choose a standard “bimsync” recommended setup, an existing setup, or create a new one.

After the first export, bimsync project and model ids will be saved in your Revit model, so you won’t have to select them again the next time. If you are curious, you can find these ids in your Project Information:

Your Project information

Your Project information

To create your own IFC Export setup, you can use the usual IFC Setup Dialog. Select File -> Export -> IFC to open the “Export IFC” dialog. Select “Modify Setup” to open the “Modify Setup” windows, and click on “New” to create a new configuration. You can now set everything in this new configuration before selecting OK to close the “Modify Setup” windows. You can now safely close the IFC Export dialog without exporting anything, and open again the Upload dialog in the bimsync plugin. Your new configuration will be available in the drop-down.

Edit IFC Export Setup

Edit IFC Export Setup

You can also go directly to your bimsync account from Revit by clicking on “Profile”. This is not very useful, but at least you will be a few clicks nearer to change your profile picture.

Under the hood, the system is quite simple. The plugin will look at your selected IFC Setup and use them to export your Revit model in an IFC file. This file is then zipped and uploaded to bimsync.

Between exporting to IFC, compressing the file and uploading it to bimsync, the entire process can be rather long. Depending on your model size, computing power and Internet bandwidth, the Upload command can take a few minutes to complete. I am thinking on using the Autodesk service Forge to convert Revit model to IFC online, freeing your computer from this tedious task.

You can already download the plugin on the Autodesk App Store.

As usual, the entire source code is available on Github, feel free to use it on your own project. Don’t hesitate to report on any issue you might have with this plugin, there is always a lot of room for improvement.

Linking documents to a model

These days, there is a lot of ideas around using a building information model for facilities management. Among these ideas, a recurring theme is to integrate documents, mostly technical sheets, directly into the model.

Aside from the fact that I don’t see how a model build to design, analyse, and coordinate a building could be use directly in facilities management, there is also some non-trivial technical problems to overcome to have any documents properly linked to your model, whether you are using Revit, Navisworks, or an IFC viewer.
Below is a list of these technical problems, and some though on how to solve them.

Adding a link in Revit

Adding a link in Revit is fairly straightforward, you just have to use a “URL” parameter (shared or built in), and type in your link. Since a technical sheet is generally the same for every building element of a given type, it makes more sense to me to add it in a type parameter.

Door Type URL parameter

Door Type URL parameter

As you can see, I type in a relative path to my technical documentation, this allows me to move around the entire “As-built documentation” folder (models and technical sheets in PDF) without breaking the links. I end up with a pretty simple folder structure, with a model at its root, and the technical sheets nicely ordered in one folder per category.

The folder structure

The folder structure

If you click on the small “…” button in Revit, your linked technical document will immediately open in the associate viewer, here, Acrobat Reader.

How to open the linked technical sheet

How to open the linked technical sheet

Adding a link without Revit

Selecting equipment and material is generally done through spreadsheets or building economy software, and by people who could not be proficient with Revit. Therefore, I have searched for solution to do it outside Revit.
The new Flux Scheduler is an application based on Flux, which allows us to create online schedules from data uploaded through the Revit Flux plugin.

The Flux Scheduler

The Flux Scheduler

By using this Flux Scheduler, I could upload my doors on Flux, create a door schedule directly on Flux, use Excel to add the URL link, and upload back these values in Revit

Type the URL in Excel before uploading them in Revit

Type the URL in Excel before uploading them in Revit

Delivering a Navisworks model

Once exported to Navisworks, the “Link” button will display a small link button on every linked object, which open the linked technical sheet.

The link in Navisworks

The link in Navisworks

However, you must keep your Navisworks model in the same location in your “As-Build Documentation” folder structure as your initial Revit model to keep the relative links functional. In our case, we end up with the following folder structure:

The folder structure with a Navisworks model

The folder structure with a Navisworks model

Delivering an IFC model

If you export this Revit model to IFC, and open it in Solibri Model Viewer, you can display the link, but not click on it. However, by writing a “\” before the link in Revit, Solibri Model Viewer recognize it as link and you can open the technical sheet with a click. This could obviously become problematic in Revit, since when you add this “\”, Revit doesn’t recognize the link anymore.

The clickable link in Solibri

The clickable link in Solibri

Tekla BIMSight, on the other hand, couldn’t recognized any of those links as a clickable item.

As you can see, they are many ways to link documents to a model and retrieve them in a viewer, and a few things could go wrong along the way. So, before starting anything, I would recommend to make sure you can link or embedded documents in your deliverables and structure these deliverables accordingly.

Why I am now a bimsync fanboy

Those of you who know me know that I recently changed my employer and I am know working for a real estate developer, with a different scope of work than in my previous position. This lead me to put aside Revit and Dynamo for a while, and think more about a project-wide collaboration platform.

Alongside with the ubiquitous BIM 360 platform from Autodesk, there is a lot of more confidential solutions from various developers. Every large BIM editor has its own, and many other companies propose one. Among them, bimsync is a rather discrete application from Catenda, a Norwegian company. Having eared about it at the French Revit User Group, I had to give it a test, and I was not disappointed.

What immediately caught my attention is the web viewer, which is the best I have ever tried. They develop their own IFC web-based viewer, and it is not far from perfect. The viewer is extremely easy to use with the left mouse button and the wheel, and include every needed feature. Sectioning the model is also quite well implemented and do a very good job. My only wish here is to have a filled pattern to highlight the difference between fill and void while sectioning.

sectionnningwithdiff

The viewer is also quite powerful, I tried it with 1 Go worth of IFC files, it run “almost” smoothly on my iPad.

onipad2

bimsync does a good job at uploading, viewing and managing versions of various models, and provides a thoughtful way of managing revisions.

You start by creating a “model” which on bimsync is a placeholder where you will upload the various versions of an IFC file. Once this file is processed by the platform, it will be available for review along with the other models. The processing part can be rather slow, it takes more than one hour for a 500 Mo IFC file, but happen entirely online, you don’t even have to keep your computer open.

models

A key feature of bimsync is the ability to easily extract Excel schedules from the uploaded models. Having the ability to show data from a model in a nice spreadsheet is priceless, and this is something that is generally overlooked by their competitors.

The issue tracking solution integrated in bimsync is also very efficient and well-thought-out, with a lot of nice features.

You start by creating an issue directly on the model, can assign someone responsible for solving this issue, add a due date and write a few lines of comment.

issues

These issues are grouped by boards, and you can create as many board as you want. You can also keep track of the resolution of these issues with a few statistical tools and filters, and save reports in Excel.

statistics2

You know that I am a big fan of the BCF concept, and bimsync doesn’t disappoint me in this regard, by providing a first-class BCF 1 and 2 support. You can export your issues in BCF to display them directly in your authoring platform of choice.

Catenda was kind enough to provide me with an access to their API, and after a few tests, I found them quite easy to use and powerful. I think this enable very interesting workflows, like automatically displaying key metrics in an easy to consume Power BI dashboard.

I yet have to explore all the features, especially the libraries, but bimsync is now my top choice among the web-based BIM collaboration platforms, and I am eager to explore more workflows with it.

IfcPropertySet

A very interesting feature of the IFC model is the IfcPropertySet . According to the official IFC specification, the IfcPropertySet is “a container class that holds properties within a property tree”. This allow to add user-defined properties to IFC elements or types. To make an analogy with Revit, it is pretty much like creating shared parameter.

Since the IFC exporter for Revit is accessible as open source code, a new exporter have been developed, and offer far more control over the creation of IFC files from Revit. One of the improvement is the ability to select Revit properties to be exported as IfcPropertySet.

The default option only export common IFC properties, but you can also export the entire set of Revit properties, or just selected ones, through user-defined property sets.

IFCExportProperties

To create one, I download one of the example coming along with the source code of the new exporter.

In this example, we can see the global syntax for creating user defined property sets.

I use it to create my own PropertySet Definition File, and use it to export Creation Phase and Demolition Phase to a new PropertySet called Phases.

PropertySet:     Phases     I     IfcElement
Creation Phase     Text     Phase Created
Demolition Phase     Text     Phase Demolished

In this definition file, we set up the name of the PropertySet, its use (on instances or on types) and the list of elements were we want to apply our properties.
Then we add the mapping between IFC (left member) and Revit properties (right member), along with its data type (Text, Real, Integer or Boolean)

We add this file in the IFC Export configuration, and export our IFC file. We can now see these properties appearing under the Phases set :

Before :

Before

After :

After

If IFC export and import is still not powerfull enought in many software solutions to enable geometrical modifications directly in the IFC file, there are plenty of opportunities to add metadata to the element, directly in IFC.

From Revit to Tekla Structure

After a long absence, I am back wishing you all the best for 2013, a year full of opportunities and crazy BIM projects.

During a meeting dedicated to a BIM process, I realized how convenient a direct link between Revit and Tekla could be. Most architects draw with Revit (for average buildings), but it is not enough for producing shop drawing for the construction site.

Being able to retrieve Revit structural elements and integrate them as native Tekla elements could really speed up the production of structural drawings.

Tekla comes with two plug-ins, one for exporting Revit models to Tekla, the other to import Tekla-generated .ifcZip files.

I  quickly drew a few walls in Revit and exported them using the associated command.

RevitWalls

It created an .IFCZip file tailored for the Tekla IFC Import function.

I inserted it as a Reference Model in Tekla. The resulting geometry looks pretty, but wall openings and walls with an edited profile are missing.

In order to use this Tekla model for the production of structural drawings, native Tekla elements are needed, so I used the Tekla Macro Convert IFC element to generate them from this Reference Model.

TeklaNativeElements

As you can see, some dimension were lost during the conversion process.

These limitations made me think of another kind of link between these two software, and I started a few months ago to write my own Revit plug-in in order to recreate structural beams and walls in Tekla.

Here is a first overview of this plug-in with an interface for mapping Revit families to Tekla profiles.

PlugInUI

I was able to import a few beams and some walls with my plug-in. The whole thing is in a very early stage, and still incredibly buggy, but I hope to be able to fix it and create something both stable and useful. By now I am trying to recreate walls with an edited profile or hosted openings.

I will keep you updated on my research.

Walls in Geometry Gym

A recent webinar about interoperability between Grasshopper and Revit make me look again on these tools, particularly for importing walls, In fact, I generally test these kinds of tools with a set a beams, more or less intricate, but never with walls, so I decide to generate a set of walls using the Geometry Gym IFC Importer for Revit.

Using Geometry Gym require at least some basic knowledge of the IFC structure. In fact, using this tool can be a really good starting point for studying the model behind Industry Foundation Classes.

Any IFC building object must be included in a (IFC) building, itself included in a (IFC) project, both of them must have a GUID and a name. So we start by placing these components on the Grasshopper’s caneva.

In order to have our NURBS path curve understood by Revit, we approximate it into a set of lines and arcs, using the specific Geometry Gym component.

We create an ggIFCElementParameter component to give a pretty name to our wall.

In order to create the multy-layer structure, we add two materials, both of them linked to a MaterialLayer component where we define the thickness of each layer. These component are merged into a MaterialLayerSet, itself link to a wall type.

The IFC class used by Revit for generating walls is the IFCWallStandardCase, so we use this component in our Grasshopper definition. We link all these components to our IFC Wall Standard Case, had a height parameter, and bake the whole think.

The resulting IFC file contains a pretty good wall, with every expected parameter. We check it in my favorite IFC viewer, the Solibri Model checker.

Once imported in Revit, using the embedded plugin, it creates a generic component looking like our wall. It appears in a schedule with the family name and type as set, but it’s still not an editable Revit wall.

I generally use the massing tool to create walls in Geometry Gym. I create a simple IFCExtrudedAreaSolid (for example) from a base NURBS curve, and then import it in Revit to generate a mass.

 

I can now use this mass to create my curved walls in Revit, along with the floors slabs. This method need an additional step (creating the wall from the Revit mass faces), but create native Revit walls.

As I write these lines, a new version of the IFC Import plugin for Revit have been posted on the Geometry Gym blog, I still have to review the improvement.

Geometry Gym

I was talking on a previous article about the Grasshopper plugin develop by Jon Mirtschin called Geometry Gym.

This set of tool for building modeling firstly came as a plugin for Rhino, implementing commands for designing structures and linking these models to structural analysis software.

These tools where integrated as commands in Grasshopper, allowing generating building elements parametrically, a very interesting feature at an early stage of the project.

But for me, the most interesting part of this plugin is its ability to generate IFC files into Grasshopper. A large part of the IFC classes are implemented directly as Grasshopper functions.

By combining these functions, we generate the structure of our IFC file exactly as we want it, and if our favorite BIM software is known for missing some IFC classes, we can still use a workaround by designing yourself your IFC data structure.

Using this plugin requires a little understanding of the IFC data structure, but examples can be found on the Geometry Gym blog, and are quite self-explaining.

Combined with the building modeling tools described above, it provides a powerful way of designing building, especially at the early stage of the project.

Geometry Gym came also with various plugins used as bridges for other BIM software

The plugin for Revit implement a new IFC Import module, especially design to import files generated in Grasshopper. This allows integrating native Revit element from an IFC file.

There is also a direct link with Tekla, use to generate native Tekla elements directly from the Grasshopper model.

If this software need some time to get used to it, and a little knowledge about the IFC Data structure, once taken in hand, it become powerful enough for replace any conventional BIM software, at least at the beginning of a project, and especially for complex shapes and structures.

Industry Foundation Classes

Anyone who has worked in the BIM field may have eared something about Industry Foundation Classes. Yes, you know, this little logo…

Generally, it appears when we try to export a building model from proprietary software to another. The IFC exchange format allows us to convert files and, with some luck, open them the other software.

But what really is this IFC file format, and why everybody talk about it ?

Developed by Building Smart, a non-profit association of architects, civil engineers and IT specialists, IFC is a data model specifically designed for building information modeling.

In other terms, it’s a series of definitions, explaining how describe any building element in order to make it comprehensible by a computer. But while each BIM software relies upon its own very private data model to define a building, the IFC data model is open, and freely accessible by anyone here.

These definitions create a language readable by a computer, and written as a text file. This file is even readable by human being, and look more or less like this:

#66= IFCCARTESIANPOINT((-17261.0669833266,3274.73863321424,0.));

#68= IFCAXIS2PLACEMENT3D(#66,$,$);

#69= IFCLOCALPLACEMENT(#59,#68);

#70= IFCCARTESIANPOINT((9430.2775637732,0.));

#72= IFCPOLYLINE((#5,#70));

#74= IFCSHAPEREPRESENTATION(#43,'Axis','Curve2D',(#72));

#76= IFCCARTESIANPOINT((9430.2775637732,-100.));

It’s not very convenient, but with some pain, we can find a wall here,

#209= IFCWALLSTANDARDCASE('0EiAvIo0LBOBfvSD8E4HST',#52,'Basic Wall',$,’200 mm’ ,#181,#207,'177171');

create by an extrusion like that,

#92= IFCEXTRUDEDAREASOLID(#90,#91,#15,8000.);

and place at the point define like this:

#76= IFCCARTESIANPOINT((9430.2775637732,-100.));

I have worked some times in order to understand this language, and if I’m still not speaking IFC fluently, I was able to improve myself a little. You will find the result of my work here.

There is plenty of IFC’s approved software, but if everyone is compliant, some are more compliant than other. For example, Revit was well known for its really poor implementation, but I have heard that Autodesk have made great improvement in the 2013 version, I still have to look at it.

For my part, the best implementation I have ever be able to test is the plugin for Grasshopper made by Jon Mirtschin called Geometry Gym. Fully compatible with the latest version of IFC (IFC2x Edition 4 Release Candidate 2), this plug in transform Rhino in a full scale BIM software. This plugin deserve at least a whole article, so I will came back to it.

The IFC model is still in the development part, and is currently in the process of becoming the official International Standard ISO 16739.

If it’s not the leading format in the BIM business, the IFC format is a really interesting attempt to create an open exchange standard, and some software like Solibri Model Checker have understood it well enough to use IFC as the only input models format.