Assign IfcSurfaceStyle by property - more automated way?

Hello,

So I recently started learning Bonsai and one of the first things I wanted to do was assigning IfcSurfaceStyle by property and saving it back to the IFC file. It all started with inability to do it in Revit - it does not have the functionality to assign IfcSurfaceStyle/colors, it only assigns an IfcSurfaceStyle corresponding to the IfcMaterial during IFC export so the only way to "color" elements by property/type or whatever so they get the right colors in IFC viewers, is to set materials for them. But obviously it's just a workaround and not a proper way to do it.

I found these 2 tutorials, which led me to figuring out how to it in Bonsai:

1) How to Set Custom Colors for IFC Elements: https://www.youtube.com/watch?v=-HFPTWxVP_o

2) how to use color by property in bonsaibim (without getting stuck): https://www.youtube.com/watch?v=OusGMhCJGeo - this is close to what I wanted to do, but it's about assigning colors in the Blender view, not in the IFC file itself

I didn't find any tutorials showing how to it from start to finish, but I used the following method:

  • go to Project Overview, Grouping and Filtering, Search, Add Search Group, Add Filter based on property, Search
  • assign IfcSurfaceStyle to the selected group of elements, as shown in tutorial 1.

It works, but the problem is that is has to be done for each group of elements manually. So, for example, if we want to colour elements based on whether they are load bearing or not, it doesn't take much time because we only have 2 groups. But in case of e. g. coloring by type, it would take a huge amount of time since there would tens or hunderds of groups.

So here's my question - is there a more automated way to do it? If not in current version of Bonsai itself, would it be possible to write a script/plugin/extension that would be doing it? I'm also a programmer, I haven't tried to play with Blender API or IfcOpenShell yet, but I know Python and write Revit plugins so maybe I could try to do it myself?

I'm also thinking about making a tutorial on this topic, but first I wanted to see if there isn't a better way to do it.

Any hints will be much appreciated!

Tagged:

Comments

Sign In or Register to comment.