From 91c6fb402d12507cf3bc4c6fb67b887fd51f0e39 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Fri, 29 Jan 2021 15:14:31 +1100 Subject: [PATCH] Sync blender and IFC names. See #1222. --- .../blenderbim/bim/module/attribute/operator.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ifcblenderexport/blenderbim/bim/module/attribute/operator.py b/src/ifcblenderexport/blenderbim/bim/module/attribute/operator.py index ddd03797b7..531c5a6797 100644 --- a/src/ifcblenderexport/blenderbim/bim/module/attribute/operator.py +++ b/src/ifcblenderexport/blenderbim/bim/module/attribute/operator.py @@ -94,12 +94,19 @@ class EditAttributes(bpy.types.Operator): attributes[attribute["name"]] = blender_attribute.float_value elif attribute["type"] == "enum": attributes[attribute["name"]] = blender_attribute.enum_value + product = self.file.by_id(oprops.ifc_definition_id) edit_attributes.Usecase(self.file, { - "product": self.file.by_id(oprops.ifc_definition_id), + "product": product, "attributes": attributes }).execute() + if "Name" in attributes: + new_name = "{}/{}".format(product.is_a(), product.Name or "Unnamed") + collection = bpy.data.collections.get(obj.name) + if collection: + collection.name = new_name + obj.name = new_name Data.load(oprops.ifc_definition_id) - bpy.ops.bim.disable_editing_attributes(obj=self.obj, obj_type=self.obj_type) + bpy.ops.bim.disable_editing_attributes(obj=obj.name, obj_type=self.obj_type) return {"FINISHED"}