Selects all the instances from selected instances that have different types

This commit is contained in:
Ryan Schultz
2024-02-23 12:51:16 -06:00
parent a04542dfd1
commit d83924b73e
@@ -166,15 +166,17 @@ class SelectSimilarType(bpy.types.Operator):
def execute(self, context): def execute(self, context):
self.file = IfcStore.get_file() self.file = IfcStore.get_file()
related_object = bpy.data.objects.get(self.related_object) if self.related_object else context.active_object objects = bpy.context.selected_objects
relating_type = ifcopenshell.util.element.get_type(tool.Ifc.get_entity(related_object)) for related_object in objects:
if not relating_type: relating_type = ifcopenshell.util.element.get_type(tool.Ifc.get_entity(related_object))
return {"FINISHED"} if not relating_type:
related_objects = ifcopenshell.util.element.get_types(relating_type) related_object.select_set(False)
for obj in context.visible_objects: continue
element = tool.Ifc.get_entity(obj) related_objects = ifcopenshell.util.element.get_types(relating_type)
if element and element in related_objects: for obj in context.visible_objects:
obj.select_set(True) element = tool.Ifc.get_entity(obj)
if element and element in related_objects:
obj.select_set(True)
return {"FINISHED"} return {"FINISHED"}