OSArch Community

patch visible (not hided) elements into a new ifc in Bonsai

  1. B
    • load a IFC into Bonsai

    • hide elements either by the use of the tree or by the use of Colour By Property and Select by Property and H-Button or some other workflow

    • How is it possible to use patch of all visible elements and save a new ifc out of them?

    • A temporary workaround could be to get all GUID from all visible elements. With a small code snippet this could be transfered to a query to be used in patch. The question here would be how to get all GUID from all visible elements.

    cheers bernd

  2. B

    There is a "Load from Memory" checkbox already on Patch GUI in Bonsai, but it uses all elements from the loaded ifc and not the visible ones.

  3. B

    Noone an idea ... How to get all GUID from all visible objects in Bonsai by python?

  4. S

    not sure this is correct (just trying to guess here)

    visible object can be found with

    
    import bpy
    
    import ifcopenshell
    
    from bonsai import tool
    
    model = tool.Ifc.get()
    
    objlst = bpy.data.objects
    
    for obj in objlst:
    
        if obj.name.startswith("Ifc") and obj.visible_get():
    
            print(obj.name)
    

    which prints a list of Blender "turned on" objects in the model returning IfcClass/name, you can make a dictionary out of it or a list

    from there maybe you could use ifcopenshell.util.selector(model, query) that accepts name and type in it to narrow them down to valid IfcBuildingElement

    after that the GUID comes with element.id()

    sorry I am not much of an expert in python, just curious to see how this can be achieved

  5. M

Login or Register to reply.