diff --git a/src/blenderbim/blenderbim/bim/module/material/operator.py b/src/blenderbim/blenderbim/bim/module/material/operator.py index a682a66e20..97b14b9334 100644 --- a/src/blenderbim/blenderbim/bim/module/material/operator.py +++ b/src/blenderbim/blenderbim/bim/module/material/operator.py @@ -34,6 +34,7 @@ from blenderbim.bim.ifc import IfcStore class LoadMaterials(bpy.types.Operator, tool.Ifc.Operator): bl_idname = "bim.load_materials" bl_label = "Load Materials" + bl_description = "Display list of named materials" bl_options = {"REGISTER", "UNDO"} def _execute(self, context): @@ -762,6 +763,11 @@ class EditMaterialStyle(bpy.types.Operator, tool.Ifc.Operator): ifcopenshell.api.run("style.assign_material_style", ifc_file, material=material, style=style, context=context) tool.Material.disable_editing_material() core.load_materials(tool.Material, props.material_type) + # NOTE: Update all elements that has this material and + # not just the ones that are using it in IfcMaterialConstituent, + # to handle cases where Style is connected to geometry implicitly: + # e.g. RepItem->IfcElement->IfcMaterial->Style + # instead of RepItem->ShapeAspect->Constituent->Style. tool.Material.update_elements_using_material(material) diff --git a/src/ifcopenshell-python/ifcopenshell/api/style/assign_material_style.py b/src/ifcopenshell-python/ifcopenshell/api/style/assign_material_style.py index 8cef77958a..aeef68c8e3 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/style/assign_material_style.py +++ b/src/ifcopenshell-python/ifcopenshell/api/style/assign_material_style.py @@ -17,6 +17,8 @@ # along with IfcOpenShell. If not, see . import ifcopenshell +import ifcopenshell.api +import ifcopenshell.util.element class Usecase: @@ -139,7 +141,7 @@ class Usecase: def modify_existing_definition_representation(self): # NOTE: while it's theoritically possible to have multiple styles per 1 material # (either with multiple styled items or multiple styles in 1 item) - # we use an implicit convention that + # we use an implicit convention that there is only 1 style per material. definition_representation = self.settings["material"].HasRepresentation[0] representation = self.get_styled_representation(definition_representation) if representation: