Fix bug where objects created with the same name fail to sync geometry on export

This commit is contained in:
Dion Moult
2021-05-24 21:22:50 +10:00
parent 22d9bce591
commit 92054b1999
3 changed files with 8 additions and 6 deletions
+5 -3
View File
@@ -94,11 +94,13 @@ class IfcExporter:
ifcopenshell.api.run("root.remove_product", self.file, **{"product": product})
def sync_edited_objects(self):
for obj_name in IfcStore.edited_objs.copy():
obj = bpy.data.objects.get(obj_name)
for obj in IfcStore.edited_objs.copy():
if not obj:
continue
bpy.ops.bim.update_representation(obj=obj.name)
try:
bpy.ops.bim.update_representation(obj=obj.name)
except ReferenceError:
pass # The object is likely deleted
IfcStore.edited_objs.clear()
def sync_object_placement(self, obj):
+2 -2
View File
@@ -21,9 +21,9 @@ def mode_callback(obj, data):
if obj.data.BIMMeshProperties.ifc_definition_id:
representation = IfcStore.get_file().by_id(obj.data.BIMMeshProperties.ifc_definition_id)
if representation.RepresentationType in ["Tessellation", "Brep", "Annotation2D"]:
IfcStore.edited_objs.add(obj.name)
IfcStore.edited_objs.add(obj)
elif IfcStore.get_file().by_id(obj.BIMObjectProperties.ifc_definition_id).is_a("IfcGridAxis"):
IfcStore.edited_objs.add(obj.name)
IfcStore.edited_objs.add(obj)
def name_callback(obj, data):
@@ -262,7 +262,7 @@ class UpdateRepresentation(bpy.types.Operator):
for obj in objs:
self.update_obj_mesh_representation(context, obj)
IfcStore.edited_objs.discard(obj.name)
IfcStore.edited_objs.discard(obj)
return {"FINISHED"}
def update_obj_mesh_representation(self, context, obj):