Need help with Revit 2x3 ifc export, trying to figure out how the colors are assigned.

Hello, first post here.
Im trying to make a script using ifcopenshell to try to remedy the fitting color problem (not the same color like the system they are connected to).

I cannot figure out how the IfcStyledItem is connected to for example ifcFlowFitting.

When searching all classes that are connected to the ifcFlowFitting i cant find the link to the IfcStyledItem (which holds the color info). All i could find is an IfcMaterialList that has a connection to an ifcFlowFitting with a IfcRelAssociatesMaterial. I tryed chaning the materials that are in these lists to the same material as the system, and it has had some success, but not all elements have a materials list. In bimvision viewer on the fitings i managed to do this, the colors have updated correctly, but in bimcolabzoom they have not, so i guess they have a different way of interpreting color. See photo

So im curious about how are general 3d elements connected to their materials in the 2x3 schema (or do they even have to be). Can they have just a color setting on their 3d geometry (extrusion,sweeps etc… )?

Also if someone can point me to some useful resources with examples for understanding ifc data structure ( excluding osarch wiki)?

I am looking at the documentation schematic but I’m not sure how to interpret it based on the step files im getting out of Revit export.

1 Like

This is a vendor-/product-specific issue normally handled by your product vendor. You could start by looking at the Autodesk Revit IFC Manual found here:
Now Available: Autodesk Revit IFC Manual Version 2.0 – Revit

Your other option is to look into the bSI Knowledge Base to see if any other Revit users have posted something:
buildingSMART International User Program – Control your digital destiny

You might also want to ask on the Revit support forums or on the Autodesk GitHub repository for the IFC I/O for Revit.
GitHub - Autodesk/revit-ifc: IFC for Revit and Navisworks (2019+)

These are one of the strangest things in the schema. If I got it right below you can see the simplified path for geometry and material based styling.

IfcProduct -> IfcProductDefinitionShape -> IfcShapeRepresentation -> IfcRepresentationItem 
                                                                             ^
                                                                             | ^ Item
                                                                             |
                                                                             | v StyledByItem
                                                                             |
                                                                      *IfcStyledItem*
                                                                       
IfcProduct <- IfcRelAssociatesMaterial -> ... -> IfcMaterial <- IfcMaterialDefinitionRepresentation -> IfcStyledRepresentation -> *IfcStyledItem*

Thank you, this helped me alot. I managed to reassign styles of solids by systems.
Is there somewhere I can read more about material-based styling, is this something that is built in the 2x3 schema?

Other than the entity page 8.18.3.8 IfcMaterialDefinitionRepresentation - IFC4.3.1.0 Documentation I’m not sure if there is extra documentation content. It is provided in 2x3 schema versions and upwards.