Fix bpy.ops.bim.select_by_material() for layersets

This operator assumes all material definitions have a Name attribute,
mostly they do except that Material Layer Sets have a LayerSetName
attribute for reasons.
This commit is contained in:
Bruno Postle
2025-03-02 11:24:07 +00:00
parent 945099b817
commit e240ae2669
@@ -67,7 +67,10 @@ class SelectByMaterial(bpy.types.Operator):
core.select_by_material(tool.Material, tool.Spatial, material=material)
# copy selection query to clipboard
material_name = material.Name
if material.is_a("IfcMaterialLayerSet"):
material_name = material.LayerSetName
else:
material_name = material.Name
result = f'material="{material_name}"'
bpy.context.window_manager.clipboard = result
self.report({"INFO"}, f"({result}) was copied to the clipboard.")