OSArch Community

Workflow of loading an IFC in BlenderBIM when scripting

  1. C

    There is this convenient extension for VS Code from Jacques Lucke to have a connection between Blender and VS Code with instant updates.

    When working with geometry using the python ifcopenshell.api. I would like to see the IFC results of the code I run in BlenderBIM instantly.

    Is there any decent workflow for this? Or is there already something in place for this I don't know about? Is there a need?

  2. M

    The IFC Debug panel has "create shape" functions you can use to see what the new geometry is like, perhaps that helps?

  3. C

    @Moult

    Thanks for you answer, that helps. But I mean more like a development environment. I just named geometry as a visual example. But I would like to able to load an IfcProject with IfcSite and IfBuilding etc. straight into BlenderBIM after running a python script. For example this is being done from the python console within Blender:

    It uses very hacky code to load the created IFC with ifcopenshell in BlenderBIM. I would like something more streamlined and more professional.

    This is the code used to load the IFC in BlenderBIM

    
    def load_ifc(self, ifc_file, file_path):
    
    
            if (bool(ifc_file)) == True:
    
                project = ifc_file.by_type('IfcProject')
    
    
    
                if project is not None:
    
                    for i in project:
    
                        collection_name = 'IfcProject/' + i.Name
    
    
    
                    collection = bpy.data.collections.get(str(collection_name))
    
    
    
                    if collection is not None:
    
                        for obj in collection.objects:
    
                            bpy.data.objects.remove(obj, do_unlink=True)
    
    
    
                        bpy.data.collections.remove(collection)
    
    
    
                bpy.ops.outliner.orphans_purge(do_local_ids=True, do_linked_ids=True, do_recursive=True)         
    
                bpy.ops.bim.load_project(filepath=file_path)
    

    But in this workflow you need to add this snippet to your code. I was thinking if there is a need of a Blender-addon in which the end user can interact with ifcopenshell and see the ifc which is being created straight into BlenderBIM.

  4. C
  5. G

Login or Register to reply.