From 0e24d4411f0ae8a56de5e212a96cde20c8543f1c Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Thu, 8 Jul 2021 13:02:30 +1000 Subject: [PATCH] Fix #1556. Ensure that styles are always present when updating a representation. --- src/blenderbim/blenderbim/bim/module/geometry/operator.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/blenderbim/blenderbim/bim/module/geometry/operator.py b/src/blenderbim/blenderbim/bim/module/geometry/operator.py index a49a21eef6..2a51ab4de2 100644 --- a/src/blenderbim/blenderbim/bim/module/geometry/operator.py +++ b/src/blenderbim/blenderbim/bim/module/geometry/operator.py @@ -102,7 +102,7 @@ class AddRepresentation(bpy.types.Operator): "should_force_faceted_brep": context.scene.BIMGeometryProperties.should_force_faceted_brep, "should_force_triangulation": context.scene.BIMGeometryProperties.should_force_triangulation, "ifc_representation_class": self.ifc_representation_class, - "profile_set_usage": self.file.by_id(self.profile_set_usage) if self.profile_set_usage else None + "profile_set_usage": self.file.by_id(self.profile_set_usage) if self.profile_set_usage else None, } result = ifcopenshell.api.run("geometry.add_representation", self.file, **representation_data) @@ -324,6 +324,12 @@ class UpdateRepresentation(bpy.types.Operator): new_representation = ifcopenshell.api.run("geometry.add_representation", self.file, **representation_data) + [ + bpy.ops.bim.add_style(material=s.material.name) + for s in obj.material_slots + if s.material and not s.material.BIMMaterialProperties.ifc_style_id + ] + ifcopenshell.api.run( "geometry.assign_styles", self.file,