About Filtering and changing colour to send the IFC to another software


I've been toying for a week ago and can't find information about integrating it in my workflow.

I work for HVAC design with a software that can read IFC files. It shows the walls according to the SurfaceColor property, or it can override the colour of all the walls.

So, the walls in the IFC have a FireRating property with one of four possible values. I'd like to have an IFC with the SurfaceColor property of the walls associated to its FireRatings.

Is this filtering entities by Class and Property to change another property possible with BlenderBIM?

I'd love any tip about the command that I should use.



  • The BlenderBIM Add-on can colour-code objects based on a property value, but it will not "re-save" this colour back into the IFC file. It will only act as a view-only override when you have the file open. Are you looking to modify the IFC's colour permanently and save it back out into a file with the new material?

  • Hi @Moult ,

    You are right, I'm trying to modify permanently the IFC colour of some walls, to then produce a new IFC. Do you know of a workflow that allows that?

    Thanks for replying.

  • If you are up to try some coding (it's easy!), you could do that in FreeCAD with a fairly simple macro, something like this (not tested, might need some tweaking)

  • Hi! It can be done with SimpleBIM (not open source): https://www.youtube.com/watch?v=t0fME5Kdea8

    Should be possible to do with a python script with IfcOpenShell too. I think colors are a bit complex because the different software vendors are storing them differently. Is your model created in Revit? Here is an issue posted by @Moult on revits ifc github repo https://github.com/Autodesk/revit-ifc/issues/174

  • Both @Einar and @yorik are right :) If you are up for a bit of Python coding, perhaps this is useful to do for an IfcPatch recipe :) IfcPatch is a command line way to modify IFC files. However, colours can get complex, quickly, especially if you are not familiar with the IFC spec, and especially if you have to deal with broken programs like Revit where workarounds and quirks need to be accommodated.

    I would be wary of SimpleBIM - SimpleBIM is very powerful, and does a lot of things right - but it does an atomic model export. If I had to trust any program to minimise data loss during an IFC round-trip, SimpleBIM is what I'd place my bets on ... but at the same time, it's very hard to do, and I suspect there will be data loss.

    A better approach is a partial write - like those Python scripts do - they modify just portions of the IFC and leave the rest untouched. So far, no open source application has implemented this partial write in a robust manner I believe. That said, since the BlenderBIM Add-on is headed in that direction anyway, I can add this as a feature in the next release.

  • @yorik Thanks for the tip. I used Python (Pandas and numpy) back in school. So I hope that I have enough Python muscles for this, but I guess that I have to get familiar with the specification as @Moult pointed out.

    @Einar I didn't know about SimpleBIM. But I think that I won't be able to make the business case here, if I manage to do it through python.

    I imagine that I can find more information in the ifcOpenShell github. I am really grateful for pointing out to this resource, I really needed a starting point about how to solve my problem.

  • @EloyRD this article may help https://thinkmoult.com/using-ifcopenshell-parse-ifc-files-python.html

    This API documentation will also help https://blenderbim.org/docs/ifcopenshell-python/api-documentation.html

    I will warn that this may not be as simple a script as it may seem. I would divide up the task to 1) finding a property, and 2) assigning a colour. I would recommend having a go yourself first, and then asking as many questions as you need here :) We can help guide you, but it would be great if you could try so that you can learn too in the process!

    If you do get completely stuck, we can code it up for you :)

    By the way, @yorik 's sample Python script modifies the colour in FreeCAD - but this has similar downsides to the SimpleBIM solution (and the existing colour by property feature in the BlenderBIM Add-on) in that it relies on a full export - which may result in unintended data-loss.

Sign In or Register to comment.