ifcpatch ExtractElements recipe for extracting elements with a specific IFCMaterial query

I am struggling to figure out how to write a specific IFCMaterial query for IFC Patch ExtractElements.py recipe in Blender.
I would like to extract the elements with "ALG - BUITENAFWERKING":

I tried the following query with no prevail :
["ALG - BUITENAFWERKING"]

Could anyone direct me in the right direction.
I want to extract only the elements that I need, and load them separately into BlenderBIM. Otherwise the 300 MB .ifc file does not load into BlenderBIM.

Comments

  • This query also throws an error:
    .ifcMaterial[Material = "ALG - BUITENAFWERKING']

  • edited October 2022

    The full selected ifc object (*It's another object, but with the same ifcMaterial, that I filter in TrimbleConnect) properties that TrimbleConnect provides are as follows:

  • edited October 2022

    Or how would the query for IFC Patch ExtractElements.py look like if I would like to extract the PresentationLayers/Layer: "21 Buitenwanden" :

  • edited October 2022

    At the end I ended up extracting parts of .ifc model that I needed storey by storey, and deleted the elements that I did not require manually:


    https://wiki.osarch.org/index.php?title=IfcOpenShell_code_examples#IFC_Query_Syntax

  • edited October 2022

    I guess this can be a decent lead, but there are limits of what one can cram into the ExtractElements recipes query field?

    So probably one would have to mess around with the ExtractElements.py code itself (and make a new "recipe"?) to make this work?
    https://github.com/IfcOpenShell/IfcOpenShell/blob/768b754a0b4ccc82e2288037289aa16ce9e26afa/src/ifcpatch/ifcpatch/recipes/ExtractElements.py

  • Is it possible for you to share your IFC file?

  • It's a third party Intellectual Property, so sadly can't share it.

  • Try:

    .IfcElement[material.Name="whatever"]
    
    Saulius
  • I think that's a layered wall, so it goes the name of the layer set, not the individual materials within it.

  • Cool, what would that search syntax be?
    So it doesn't sound like there's a way to search all the different IfcMaterialDefinitions at once?

  • No, at the moment there isn't. We'd have to come up with a good way to say "where one layer is concrete" etc. Any proposals?

  • edited October 2022

    @Moult said:
    Try:

    .IfcElement[material.Name="whatever"]
    

    This kind of worked on the .ifc model that I am working with.
    .IfcElement[material.Name="ALG - BUITENAFWERKING"]

    Some elements were extracted properly:

    While others only show an outline:

    Was able to open the extracted element .ifc file with TrimbleConnect.
    Could not load the .ifc with BlenderBIM (Maybe if I have given it more time, but in the first minutes the RAM usage would rise to 8 GB, and for the next ~15 minutes the RAM would satay at similar level and CPU usage would be ~17%)

  • Does it make sense trying to ExtractElements.py query by Product Name?

    I tried the following query and it created a 260 MB .ifc file that TrimbleConnect was unable to load.
    .IfcProduct[Name = "ALG - BUITENAFWERKING"]

  • Have you tried enabling advanced mode and also enabling native IFC meshes when loading elements?

    The material extraction probably partially worked because only some materials have it directly assigned whereas other have it part of a set. Not sure why the name filter failed. If you send me the file privately at dion@thinkmoult.com I can try to debug it.

    Saulius
  • edited October 2022

    @Moult said:
    Have you tried enabling advanced mode and also enabling native IFC meshes when loading elements?

    The material extraction probably partially worked because only some materials have it directly assigned whereas other have it part of a set. Not sure why the name filter failed. If you send me the file privately at dion@thinkmoult.com I can try to debug it.

    Thanks for the great tip. I looked up "BIMVoice — Dealing with Large BIM Models 🤕 Using The BlenderBIM Add-on" on how to exactly utilize the Advanced IFC Loading Mode within BlenderBIM.
    By disabling the ifc elements that are in tens of thousands I was able to load the single storey ifc file into BlenderBIM.

    To my surprise it loaded the whole building (kind of explains the 260 MB vs original 20 storey building 300 MB file size).
    I was unable to locate the "enabling native IFC meshes" checkbox/feature, though.

  • I was unable to locate the "enabling native IFC meshes" checkbox/feature, though.

    You might have an old release. See the following the latest release.
    https://github.com/IfcOpenShell/IfcOpenShell/releases

    AceSaulius
  • @Moult said:
    No, at the moment there isn't. We'd have to come up with a good way to say "where one layer is concrete" etc. Any proposals?

    Took a stab, here: https://github.com/IfcOpenShell/IfcOpenShell/pull/2503

  • @Saulius, per this commit, you should now be able to extract an object with an IfcMaterial in any type of IfcMaterialDefinition. That is, any ifcmaterial in...
    IfcMaterialLayerSet IfcMaterial IfcMaterialConstituent IfcMaterialConstituentSet IfcMaterialLayer IfcMaterialProfile IfcMaterialProfileSet

    Saulius
  • edited October 2022

    @theoryshaw said:
    @Saulius, per this commit, you should now be able to extract an object with an IfcMaterial in any type of IfcMaterialDefinition. IfcMaterialProfileSet

    @theoryshaw This is merged into the latest BlenderBIM/IFC Patch release, or one has to incorporate it into ones BlenderBIM files locally?
    *Mainly trying to keep some consistency in the companies BlenderBIM User Guide .ifc file handling documentation.

  • I updated the "selector.py" in "AppData\Roaming\BlenderFoundation\Blender\3.3\scripts\addons\blenderbim\libs\site\packages\ifcopenshell\util" directory and when I am trying to extract IfcMaterial with IFC Patch ExtractElements, Blender keeps throwing errors (at least on the same .ifc model that I have been using):

    .IfcMaterial[Name = 'ALG - BUITENAFWERKING']

    .IfcMaterial[Name = "ALG - BUITENAFWERKING"]

    Is something wrong with the query that I am trying to use?

    In TrimbleConnect the IFC Element IfcMaterial looks like this:

  • @Saulius said:

    @theoryshaw said:
    @Saulius, per this commit, you should now be able to extract an object with an IfcMaterial in any type of IfcMaterialDefinition. IfcMaterialProfileSet

    @theoryshaw This is merged into the latest BlenderBIM/IFC Patch release, or one has to incorporate it into ones BlenderBIM files locally?
    *Mainly trying to keep some consistency in the companies BlenderBIM User Guide .ifc file handling documentation.

    There's new releases everyday... https://blenderbim.org/docs/devs/installation.html#unstable-installation

  • edited October 2022

    Anyone had any luck extracting IfcMaterial with IFC Patch in Blender (with the latest BlenderBIM release)?
    The queries that I've tried did not yield any results:
    .IfcMaterial[material.Name="value"]
    .IfcMaterial[Name="value"]

  • It's...
    .IfcElement[material.Name="value"] if you want all the objects that have the material value assigned to them.
    or
    .IfcWall[material.Name="value"] if you want all the ifcwall objects that have the material value assigned to them.
    etc., etc...

    AceSaulius
  • @theoryshaw I tried using that query in a test file that with four walls with different material assignments (single, layered, constituent and profile), that each include the same material, but eg. selector.parse(file, '.IfcWall[material.Name="Material1"]') only returns the wall with single material. If I understand https://github.com/IfcOpenShell/IfcOpenShell/pull/2503 correctly, it should return all four walls, right?
    I'm using ifcopenshell included in blenderbim, noticed there are some minor differences between that util/selector.py and the 'regular' one, but doesn't seem like that would make a difference?

Sign In or Register to comment.