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

Hi,


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.


Cheers,

Comments

  • 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.

  • I know this is an old feed, but it still dont seem to be possible re-save changes of colors back to the ifc file in BlenderBIM. I find coloring the BIM is one of the most useful scenarios when trying to communicate information hidden in the BIM (fire ratings, reinforcement sizes, materials etc to the guys on site.) Solibri offers coloring with its information takeoff, SimpleBIM let me re-color models by a mix of tools, but my preferred way would be using BlenderBIM and my own python scripts to color objects by property values already in the BIM. Is it now possible to add, edit and assign colors in BlenderBIM for IFC export? It was mentioned above that it would be added in a future release.

  • @Lars you should be able to change the colours of objects and it will save it in the IFC.

    However, if you're looking for a feature that auto colour codes the objects by property value (which does exist) and then writes those colours back into IFC (which doesn't exist), the second part needs to be built. If so, would you mind filing a bug?

  • @Moult Thanks. I guess I must be doing something wrong due to lack of Blender knowledge. Changing the material color doesn't seem to affect the color on export. I got around it by writing a python script using ifcopenshell, so I'm fine for now. I'm not sure if it really is a bug or only me using changing colors the wrong way. I know the override feature is only changing the visual appearance in blender. What I tried was changing the base color of the object. Do I have to "apply" the change anywhere in order to save it to IFC?

  • AceAce
    edited September 2021

    Hey man, in BlenderBim Make sure your material is saved as an ifc material and then in the IFC Style dialog click update style colours, no need to write any python ahhaha

    I checked, it worked in IFCOpenshells' ifc viewer aswell:

    Then if you change the colour again, just click 'update style colours' and it will change

    Hope that helps?

  • Also note that IFC has two colours - a diffuse colour used for rendering and a surface colour used for regular viewport viewing (you're only editing the former, whereas some viewers may default to the latter). The nodes affects to the diffuse colour, and the viewport colour affects the surface colour. So be sure to change the right one. You shouldn't need to manually press any update surface colour button though.

Sign In or Register to comment.