IFC support in FreeCAD

We have recently reached a very important point with the Architecture module of FreeCAD: Import and export of IFC files. The support to IFC is not fully compliant yet, but I believe it is stable enough so I can talk about it here.

The IFC format is a very important foundation of any decent BIM workflow. It is basically the one and only proper exchange format we have between all the BIM-capable applications out there, such as Revit, AllPlan or ArchiCAD. IFC is an extension of the STEP format, which is very widely used in mechanical engineering, and also an ISO standard. It is also not a closed format, owned by a single company, but open, human-readable, and maintained by a consortium. This only is a tremendous change compared to older 2D formats such as DWG, that are closed, encrypted, undocumented and proprietary. As a result, implementing DWG support is an almost impossible task for an open-source project, while the IFC format is well documented, the documentation is publicly available, and there are many examples available to programmers. There is even a huge guidebook that explains in details how things must be implemented. All this makes IFC support much easier to implement.

If you read BIM blogs on the internet, you will notice that many people speak against IFC. It is hard, however, to not see a direct relation between these negative opinions and Revit. Revit has a very "everything into one model, one application" ideology, and many of its users see IFC as "too dumb", unable to carry the complex relationships and parametric tissue present in a Revit model.

This is certainly true, although with each new version of the IFC format, its authors try to address more of these parametric relationships. But fundamentally, the purpose of IFC is to describe a building, not the software tools you used to design it. This is at the same time a weakness and a strength, in my opinion. And you have nowadays many voices raising against relying on too complex parametric chains and going back to more simple, easily understandable model structures.

This also speaks of another important point of a modern BIM workflow: collaboration. IFC is not meant to be a format for archiects, but a format for the whole construction family, including engineers and constructors. They will use your IFC files in a very different way as you. You might want to keep your complex relationships so you can import your IFC back into your application, and everything connects, but they will do very different things with it. Engineers will use it as a guide, and sometimes rebuild some sections of it, and constructors will want to extract quantities from it, and won't be interested in how you designed it. For them, there is even a side-format called COBIE which presents the contents of an IFC model as a big spreadsheet...

So thinking of your model as "easy to exchange" with others is a very good way to look at the problem in my opinion, and in that scope, IFC is much, much more interesting. If you model objects that are easy to identify (correctly named and placed in a coherent hierarchy) and easy to modify (which often means: delete and redo it from scratch) by others, the limitations of IFC become totally supportable. And the advantages are huge.

Implementation in FreeCAD

The IFC import/export mechanism in FreeCAD relies on one amazing piece of software called IfcOpenShell. IfcOpenShell is a reader/writer for IFC files, built upon OpenCasCade, the same geometry kernel as we use in FreeCAD. The consequence of this is that both applications communicate extremely well, and the import and export of geometry is very reliable and relatively fast already.

IfcOpenShell has been supporting reading of IFC files for quite some time, but in its latest development version, it now also allows writing. This is now supported in FreeCAD too, and if you can compile FreeCAD and IfcOpenShell yourself, in order to benefit from the latest developments of both applications, you already have full IFC import and export. If not you'll need a little of patience, until these come to a proper release.

When importing an IFC file into FreeCAD, IfcOpenShell will get all the entities derived from the IfcProduct class. That involves basically all building elements, such as walls, windows, roofs, etc. and extract their shape. When a corresponding Arch object exists, for example a wall, such object is created, and the shape is attributed. If no corresponding Arch object exists, for example a piece of furniture, a standard Part object is created. This ensures you that all building products present in the IFC file are imported, even if there is no corresponding Arch object.

At the moment, the shape of the object comes already fully computed, with its openings, subtractions, etc. In the future, we'll work together with the IfcOpenShell developers to get more interesting behaviour, such as having the openings as separate parameters, or retrieving the baselines of the walls.

When exporting an IFC file from FreeCAD, there are currently still a couple of limitations: only Arch objects can be exported, and they can contain no curves. Other than that, any shape is correctly exported,and it's thrilling to see your wildest FreeCAD designs faithfully exported to such a "serious" format as IFC! It is best to have alreay a building + floor(s) structure in FreeCAD to export, but if none is there a default one is created for you.

The biggest task that awaits us now is complying to standards. IFC specification is very complex, and there are a lot of little particularities that such or such application will read or not read. So this will require heavy testing, and help from everybody who wants to see this going further. Several members of the FreeCAD community are already doing some heavy testing, don't hesitate to join us!

As a starter, I mounted a little test file in FreeCAD. This file also serves to demonstrate other features of FreeCAD and the Arch workbench, such as extracting 2D views and calculating quantities. Consider it as a "FreeCAD BIM test":

Get the FreeCAD file from here, and the exported IFC file here. There is also a list of exported objects for you to compare with. I'll add it to the FreeCAD example files later.

If you want to help with testing, a first thing you might want to do is try the IFC file in your BIM application, and head to the FreeCAD forum to report your results! IfcOpenShell also has a test file here.