BlenderBIM export ifc problem

Hello!

I tried to model geology and export to ifc. It was going well. I exported first example for check. First check was good. Then I added some more elements and when I tried to export again I've got some errors. Now I don't know what's the problem. I'm new to work with blender maybe sombody can help me.

I noticed that ifc material of new elements is not saved when I save the project. All new elements was added by shift-d shortcut. If I delete all new elements I still couldn't export to ifc. I really want to understand the essence of the problem in order to understand whether I can use blenderBIM for my own purposes.

Here is the export log, current file and well exported first example

Python: Traceback (most recent call last):
File "C:\Users\Konstantin\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\bim\module\project\operator.py", line 840, in execute
IfcStore.execute_ifc_operator(self, context)
File "C:\Users\Konstantin\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\bim\ifc.py", line 418, in execute_ifc_operator
result = getattr(operator, "_execute")(context)
File "C:\Users\Konstantin\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\bim\module\project\operator.py", line 871, in _execute
ifc_exporter.export()
File "C:\Users\Konstantin\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\bim\export_ifc.py", line 49, in export
self.sync_all_objects()
File "C:\Users\Konstantin\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\bim\export_ifc.py", line 115, in sync_all_objects
result = self.sync_object_material(obj)
File "C:\Users\Konstantin\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\bim\export_ifc.py", line 145, in sync_object_material
bpy.ops.bim.update_representation(obj=obj.name)
File "C:\Program Files\Blender Foundation\Blender 3.4\3.4\scripts\modules\bpy\ops.py", line 113, in call
ret = _op_call(self.idname_py(), None, kw)
RuntimeError: Error: Python: Traceback (most recent call last):
File "C:\Users\Konstantin\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\bim\module\geometry\operator.py", line 167, in execute
return IfcStore.execute_ifc_operator(self, context)
File "C:\Users\Konstantin\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\bim\ifc.py", line 418, in execute_ifc_operator
result = getattr(operator, "_execute")(context)
File "C:\Users\Konstantin\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\bim\module\geometry\operator.py", line 186, in _execute
self.update_obj_mesh_representation(context, obj)
File "C:\Users\Konstantin\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\bim\module\geometry\operator.py", line 212, in update_obj_mesh_representation
old_representation = self.file.by_id(obj.data.BIMMeshProperties.ifc_definition_id)
File "C:\Users\Konstantin\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\libs\site\packages\ifcopenshell\file.py", line 317, in by_id
return self[id]
File "C:\Users\Konstantin\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\libs\site\packages\ifcopenshell\file.py", line 305, in getitem
return entity_instance(self.wrapped_data.by_id(key), self)
File "C:\Users\Konstantin\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\libs\site\packages\ifcopenshell\ifcopenshell_wrapper.py", line 4481, in by_id
return _ifcopenshell_wrapper.file_by_id(self, id)
RuntimeError: Instance #9,509 not found
Location: C:\Program Files\Blender Foundation\Blender 3.4\3.4\scripts\modules\bpy\ops.py:113

Comments

  • Hi!
    It doesn’t seem that the duplicated objects have their own Ifc classes assigned:

  • Yes, you are right. Every time I assign a class to the duplicated objects, save the file and then reopen it, it resets. If you reassign classes in the project and export the file, errors still occur. Even if you remove all elements with an unassigned class, errors occur during export.

  • edited January 2023

    To salvage, i would recommend importing your IFC into a new blender file and starting from there.
    I would recommend saving the project quite frequently as you work.

    I would also recommend using a syncing software like Dropbox, or the like, because it would allow you to version track the file(s), if you need to reset to previous versions.
    Although I don't think the following is the main problem. I would also recommend assiging the IfcMaterial to the object, as well.

  • I tried to add my objects to a new project with "append" tool and create ifc again. Then I had new errors occured during assigning ifc types to objects. Maybe you know another way to relocate all my objects to new clean blender project?

    I think it is a Blender or BlenderBIM bug and I don't know the cause of it. I started drawing model again in new file and everything is ok. But I want to know how can I recover my drawings if this bug will appear again when model will be finished.

    Can I create group of objects with ifcGeographicElements types which will be recognizable in another BIM software?

  • edited January 2023

    You can run this script in the corrupt blender file, and it will remove all IFC data.
    Afterwich you can simply copy/paste objects from one blender session to another, and then reassign the ifcclass and ifcmaterial
    Video here:
    https://www.dropbox.com/s/svn4xb45j6a6in8/2023-01-13_13-16-02_Blender_blender.mp4?dl=0

    Can I create group of objects with ifcGeographicElements types which will be recognizable in another BIM software?

    there are multiple ways to 'group'. A few:

    Not knowing your usecase, i would think Aggregation could work potentially...

  • this is an old video, but shows how to create an aggregate:
    https://www.dropbox.com/s/uvmn82vo62c3ir3/2021-06-05_11-48-41.mp4?dl=0

  • Thank you so much!!! Your method with script works great! Now I can repair my file.
    Will try to group elements, thanks again!

  • @theoryshaw said:
    You can run this script in the corrupt blender file, and it will remove all IFC data.
    Afterwich you can simply copy/paste objects from one blender session to another, and then reassign the ifcclass and ifcmaterial
    Video here:
    https://www.dropbox.com/s/svn4xb45j6a6in8/2023-01-13_13-16-02_Blender_blender.mp4?dl=0

    Hi! I'm sorry but I have such problem again.

    I changed geometry of some objects in my project but when I opened it in BIMVision I realized that I have two objects with the same name in the ifc file. The old one that was deleted in Blrnder still appeared in the ifc file. But I didn’t see it in Blender.

    I decided to remove all ifc data with your script and make a new file. But when I did it and started to reassign ifc classes nothing was exported to ifc. There is a bug report in BIMVision :”1 or more items was not included to file”

    Also, I tried to reinstall Blender and BlenderBIM. But it didn’t help me.
    Now I don’t know how can I repair my file

  • Does this file work?
    I basically had (2) sessions of BB open. One with the old file, and one with a fresh new BB IFC file.
    I copied pasted your objects from one to the other and then assigned a new class.
    Some objects, namely the upper GL_1 did not work, for whatever reason... but i got most of it.

  • @theoryshaw said:
    Does this file work?
    I basically had (2) sessions of BB open. One with the old file, and one with a fresh new BB IFC file.
    I copied pasted your objects from one to the other and then assigned a new class.
    Some objects, namely the upper GL_1 did not work, for whatever reason... but i got most of it.

    Yes, it works! Thank you!
    Don't know why this didn't work for me...

Sign In or Register to comment.