NativeIFC in FreeCAD

A screenshot of FreeCAD showing the schependomlaan IFC model

Hi everybody,

Sorry for the long time without posting! Each time I think it'll be easy to get back to blog often, and each time something happens that makes the plan fail miserably :/

The main reason is basically the new non-profit association behind FreeCAD, the FPA. It's taking me a lot of time, mostly because managing an NGO is pretty new for me and other FPA admins, so we have a lot to learn form scratch. The FPA is a huge success so far, though, money is coming in fast, and we are doing our best to start spending it well and responsibly. A huge thank you to everybody who has kept supporting me on Patreon, Liberapay or GitHub. This allowed us to do a lot, and the FPA would not be there without you.

I have some stuff to show to make a regular FreeCAD BIM development update, but I'll leave that for another post. What I want to show this time is a brand-new kick-ass concept: NativeIFC support in FreeCAD.

A scrrenshot of FreeCAD showing the inside of a storey of an IFC model

The concept is basically what is behind BlenderBIM: The ability to edit IFC files natively, but this time in FreeCAD. Most (all?) BIM applications out there, including FreeCAD up to now, do something else: When they open an IFC file, they convert all of its contents to the native format of the application. When exporting to IFC, they do the contrary, convert from their format to the IFC format. This double conversion, as you can easily imagine, is responsible for a considerable amount of data change or loss. It is not rare that only changing one wall in an IFC file changes each and every line of the file.

An IFC file opened in a text editor

The IFC format is actually a text format. One line is one entity like a point, a line, a wall, etc. If you change one entity, the logic would be that only that line would change.

This would have inumerous advantages: by comparing the file, before and after an edit (there are inumerous tools out there to compare two text files and pinpoint the differences) it becomes very easy to spot what has changed, and also to make sure nothing else has changed. If you want to read more, be sure to check Bruno Postle's excellent paper which sets the base for the NativeIFC concept.

The BlenderBIM people have put a lot of effort into BlenderBIM and its base component IfcOpenShell to support native editing of IFC files. In Blender, with the BlenderBIM addon, you can now open an IFC file, edit its contents or add new content to it, and you'll be actually editing the IFC data of the file directly. No more conversion involved.

A screenshot of BlenderBIM with an IFC file opened Image of BlenderBIM borrowed from osarch

Since FreeCAD also uses IfcOpenShell, and also since several other Free and Open-Source BIM tools are embracing the NativeIFC concept, it was high time for FreeCAD to join the band and implement it too.

So I proudly present you the new baby: the NativeIFC addon for FreeCAD. Note that this is a common effort, besides me other FreeCAD and BlenderBIM developers are also involved.

You might be thinking: What can it do so far?

Well, basically open or import an IFC file, allow you to expand and explore its contents, and modify object attributes such as name, description, etc, and save the file back. After saving, you'll get the exact same IFC file, with as only differences the attributes that you changed.

A screenshot showing how to expand IFC child objects in FreeCAD Expanding child objects

A screenshot showing how to alter a parameter in FreeCAD Altering a parameter of an object

A screenshot showing an IFC file being saved Saving the IFC file

A  screenshot from a diff utility showing the difference between two files Only what you changed in FreeCAD has changed in the file

Everything you do in FreeCAD is affecting directly the IFC data, which is kept in sync at all times. It is also the IFC data that produces the geometry you see and manipulate in FreeCAD. In fact, what you see in FreeCAD is basically a visual interface to the IFC content.

Of course there is much more to come so all this becomes part of a fast and fluent workflow, but this above is essentially what the addon will allow you to do. My plan at the moment is not to develop a new workbench for it, but rather integrate it with other existing workbenches such as the BIM workbench so they become NativeIFC-aware.

You can already install the addon and test, all the needed instructions are given on the addon page. Don't expect stunning performance yet (although it is already by far faster than the current IFC importers we use in FreeCAD), because there is much space for optimization that haven't been touched yet. Once we have a good workflow in place we'll work more on that side. But we should be able to obtain the same performance we have with BlenderBIM, which is already capable of swallowing huge IFC files with ease.

That's it for now, thanks for reading, don't hesitate to join the adventure by leaving me comments or open issues on the github repo if you have good ideas!