diff --git a/src/blenderbim/blenderbim/tool/style.py b/src/blenderbim/blenderbim/tool/style.py index 0ddac3d0a5..43416fe1e9 100644 --- a/src/blenderbim/blenderbim/tool/style.py +++ b/src/blenderbim/blenderbim/tool/style.py @@ -103,6 +103,7 @@ class Style(blenderbim.core.tool.Style): @classmethod def import_surface_attributes(cls, style, obj): + obj.BIMStyleProperties.attributes.clear() blenderbim.bim.helper.import_attributes2(style, obj.BIMStyleProperties.attributes) @classmethod diff --git a/src/blenderbim/test/tool/test_style.py b/src/blenderbim/test/tool/test_style.py index 029892026a..6b2fc509bb 100644 --- a/src/blenderbim/test/tool/test_style.py +++ b/src/blenderbim/test/tool/test_style.py @@ -163,6 +163,19 @@ class TestImportSurfaceAttributes(NewFile): assert obj.BIMStyleProperties.attributes.get("Name").string_value == "Name" assert obj.BIMStyleProperties.attributes.get("Side").enum_value == "BOTH" + def test_importing_surface_attributes_twice(self): + ifc = ifcopenshell.file() + style = ifc.createIfcSurfaceStyle("Name", "BOTH") + obj = bpy.data.materials.new("Material") + subject.import_surface_attributes(style, obj) + assert len(obj.BIMStyleProperties.attributes) == 2 + assert obj.BIMStyleProperties.attributes.get("Name").string_value == "Name" + assert obj.BIMStyleProperties.attributes.get("Side").enum_value == "BOTH" + subject.import_surface_attributes(style, obj) + assert len(obj.BIMStyleProperties.attributes) == 2 + assert obj.BIMStyleProperties.attributes.get("Name").string_value == "Name" + assert obj.BIMStyleProperties.attributes.get("Side").enum_value == "BOTH" + class TestLink(NewFile): def test_run(self):