diff --git a/src/blenderbim/blenderbim/bim/module/drawing/operator.py b/src/blenderbim/blenderbim/bim/module/drawing/operator.py index 83f7e1cfc4..63fd5106e2 100644 --- a/src/blenderbim/blenderbim/bim/module/drawing/operator.py +++ b/src/blenderbim/blenderbim/bim/module/drawing/operator.py @@ -2624,6 +2624,9 @@ class AddReferenceImage(bpy.types.Operator, Operator): obj.material_slots[0].material = material bpy.ops.bim.add_style() + style = ifc_file.by_id(material.BIMMaterialProperties.ifc_style_id) + tool.Style.assign_style_to_object(style, obj) + material.diffuse_color = (0.031379, 0, 0.801157, 1) material.BIMStyleProperties.diffuse_path = self.filepath material.BIMStyleProperties.uv_mode = "Generated" diff --git a/src/blenderbim/blenderbim/tool/style.py b/src/blenderbim/blenderbim/tool/style.py index 7448dcd84f..271a521067 100644 --- a/src/blenderbim/blenderbim/tool/style.py +++ b/src/blenderbim/blenderbim/tool/style.py @@ -506,3 +506,9 @@ class Style(blenderbim.core.tool.Style): else: items.append(item) return items + + @classmethod + def assign_style_to_object(cls, style, obj): + """assigns `style` to `object` current representation""" + representation = tool.Geometry.get_active_representation(obj) + tool.Ifc.run("style.assign_representation_styles", shape_representation=representation, styles=[style])