Hey all, we're planning to migrate servers around Monday, so there will be a bit of downtime :) I can be contacted at dion@thinkmoult.com for anything urgent.

BlenderBIM: any way to recreate an IFC from BlenderBIM file

Is there any way to salvage, and recreate an IFC from a BlenderBIM file whose original IFC has either got corrupted, or lost?
For example, the IFC for this BlenderBIM file was corrupted due to copying, and not exporting property, among other snafus. Is there a sneaky way to recreate a new IFC from this Blender file?


  • Bim properties are stored in the ifc file itself, so you have to 1 reset all object's / materials ifc ids to 0, then re-classify.
    A name's prefix based class assignment could do the trick at least as starting point.
    Would create a copy of source file before running the script. Note it will create a new project so you may find yourself with 2 projects structure.
    At this time, there are no relationships restored by this script, only class assignment by name.

  • Thanks Stephen!
    Here's a newbie, trying to run a script.
    video: https://www.dropbox.com/s/s92nm2yhixr78n2/2021-05-25_08-46-42.mp4?dl=0
    Got a few errors.
    Not sure I'm doing this correctly. :)

  • My bad,
    o.name = "/".join(name.split("/")[1:])
    o.name = "/".join(o.name.split("/")[1:])

  • Awesome! Here's the repaired file.
    @yorik Stephen's script might help us rebuild this file as well.

  • Awesome!! Will try too

  • Hi @stephen_l was wondering if you could help us convert this file to a connected Blender/IFC file?
    @Jesusbill and I both tried and ran into errors. Happy to pay you for your time, as well.
    Best, Ryan

  • Also, would love to learn what we're doing wrong.

  • @theoryshaw
    The converter script was ment to rebuild ifc file from a former blenderbim .blend file, and will only re-assign class to blenderbim objects,
    basically it does expect an ifc class name as prefix for object's names like IfcWall/MyWall.
    At this time, it is not able to "solve" relationships like openings / fillings, but should handle collections and rebuild aggregates, providing collections contains a helper and the blenderbim proper naming convention (collection and helper both share the exact same name, with ifc class as prefix).
    As it does purge any ifc data and create a project, you must move your objects into the right collections once class assignment is done.

  • As it does purge any ifc data and create a project, you must move your objects into the right collections once class assignment is done.

    Thanks Stephen. we did try that and I believe @Jesusbill did too, but still got errors. I wish there was a way to nuke everything, and start over with just the geometry.

  • edited June 2021

    A simple call to reset_file() should do the trick, as it does clear caches and remove reference to current file.
    Maybe add a
    IfcStore.file = None
    at the end of the function.

  • Thanks @stephen_l I think that file had some "remnants" from an older project with annotation views that were causing some problem when I tried the script, but I will give it another try with your latest suggestion.
    In any case I have now managed to create a model with BlenderBIM without breaking the ifc connection.

  • @stephen_l
    I find myself wanting to copy and paste from one BB project to another.
    To assist with that, could this script be modified to be able to 'purge' only those objects that are selected in the scene? Or is it not that easy?
    Related issue here

  • @theoryshaw Purging ifc entity is a nighmate, as you have to purge relationships too and components like representations, location ...
    So unless blenderbim provide a convenient (and strong enough) way to properly remove entity, better to rebuild things from scratch.

  • Is it currently possible to append a type from one project to another using the project library panel, which might help.

    The BlenderBIM Add-on provides the root.remove_product usecase to delete an IFC entity. It is not complete, but it should already handle the big issues like purging representations, openings, and tricky things like grid axes. However it is not a complete purge right now and will likely have some leftovers, but it's a solid start I believe.

  • what is a BlenderBIM file? an blend file with an imported ifc in it? so saving an (with BlenderBIM) imported ifc as a blender file (.blend) would keep all of the ifc informations? such an .blend file (supposing all ifc informations are ifc conform) would export (with BlenderBIM) again in to an regular IFC ? so Blender is ifc aware? it appends the ifc informations somewhere it won't disturb blender operations.. saving a blend file, could work as a saved IFC ?

  • A blenderbim "file" is an ifcopenshell file (a "live" instance of an .ifc file), holding ifc entity definitions.
    Basically there is only a pretty limited set of ifc data stored into objects, typically entity id linking both mesh and object to live's ifc file line number of the object representation definition. Nothing else is stored in .blend file, except the path of source / destination .ifc, so it is able to load / synch / save the scene data with the physical file.
    Any change in scene must update the "live" file entity according.
    When saving to .ifc, basically the "live" instance of ifc file is simply written to a physical file.

  • @stephen_l is correct. The BlenderBIM Add-on works in a completely different way to FreeCAD. In FreeCAD, all the data is stored in FreeCAD, and you can export this to IFC. So in FreeCAD, the FStd and the IFC are kind of duplicates in a way. In the BlenderBIM Add-on, all the data is stored in IFC directly and Blender is simply a client that typically caches (for editing) some geometry and colours of some, but not all of the IFC data - typically the portion you are interested in editing. As such, the "BlenderBIM file" is simply that cache saved out to a .blend with ID and UUID links between the cache and the IFC data.

    When the BlenderBIM Add-on experiences a bug, this causes the editable Blender cache to get out of sync with the IFC data. These "sync" bugs are high priority for me to fix.

  • is this here the procedure to 'correct' IFC trees ? whenever objects are not classified to their respective Storey ? One can modify the Blender collections ? copy&paste a door from one storey to the other? probably not so trivial, since a door has a opening in a wall with other constraints.. so we are looking for a hierarchie editing tool? the graph editing tool? with the intelligence to know what goes together.
    The script does rebuild the envelop of the IFC..and disconnects the graph, leaving the nodes single? but this can be enough for the import of IFC to different software tools. As long as the space configurations is kept... would topology reconnect the graph?

Sign In or Register to comment.