Workflow of loading an IFC in BlenderBIM when scripting

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?

Comments

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

  • @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.

  • https://community.osarch.org/discussion/1523/blenderbim-python-flow-of-adding-an-removing-an-ifc-element-to-an-existing-ifc#latest

    This is related, I would also like to know a decent workflow when editing/modifying an existing IFC with ifcopenshell python and loading the results directly into BlenderBIM

  • There is a "reload ifc" operator you might find useful bpy.ops.bim.reload_ifc_file() https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.7.0/src/blenderbim/blenderbim/bim/operator.py#L596-L665

    Coen
Sign In or Register to comment.