ifcOpenShell get Wall Layers and Materials

Hello everybody! I have been roaming the virutal walls of the OSAArch community for months now and I must say I am really inspiered by the effort a lot of people are putting into.

I am mostly interested in getting data out of an ifc modell and exporting it into excell for example. I found a lot of great code examples on the internet and managed to compile it into a code that extractes all the parameter data from all the elements, but I realized that the layer and material data is missing.

How can I extract the Layer and Material data ouf of a wall for example?
I used the dir() function on a wall and went through all the methods didnt really manage to get somethign usefull out of it. With the "HasAssociations" methodI manage to get a single Material (IfcRelAssociatesMaterial) but if I look the exact same wall in a Ifc viewer I see that it has more layers and materials.

To summarize if I have a list of walls how do I extract the layer information? Example:


  • A good way without digging too deep, and to immediately support all the complex material types and their usages, is to use the brand-new, evolving, ifcopenshell.api.

    from ifcopenshell.api.material.data import Data
    f = ifcopenshell.open('yourfile.ifc')
    for wall in f.by_type('IfcWall'):
        Data.load(f, wall.id())
  • edited April 4

    Thanks for you answer Dion, but I tried it and I get the following message:
    "ModuleNotFoundError: No module named 'ifcopenshell.api'"
    I downloaded the last relased version (0.6.0 latest) and I still get this error.
    Is this module allready released? Where can I find it?

  • @Borna_Molnar it's super new. The BlenderBIM Add-on ships with it, but because it is so new and evolving, you should grab it straight from git. Here's the folder you're looking for: https://github.com/IfcOpenShell/IfcOpenShell/tree/v0.6.0/src/ifcopenshell-python/ifcopenshell - see the "api" folder in there.

  • @Moult thank you very much! Do you have any idea when this will be "officialy" released in a package? Unfortunately I am not that versed in programming to know what to do with the link you gave me :D

  • @Borna_Molnar You can try overwriting the ifcopenshell folder from your current python installation with the folder indicated by the link above

Sign In or Register to comment.