mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
Minor fix to "select multiple IFC class" implementation
This commit is contained in:
@@ -62,8 +62,7 @@ class BIM_PT_class(Panel):
|
||||
else:
|
||||
row = self.layout.row(align=True)
|
||||
row.label(text=IfcClassData.data["name"])
|
||||
op = row.operator("bim.select_ifc_class", text="", icon="RESTRICT_SELECT_OFF")
|
||||
op.ifc_class = IfcClassData.data["ifc_class"]
|
||||
row.operator("bim.select_ifc_class", text="", icon="RESTRICT_SELECT_OFF")
|
||||
row.operator("bim.unlink_object", icon="UNLINKED", text="")
|
||||
if IfcClassData.data["can_reassign_class"]:
|
||||
row.operator("bim.enable_reassign_class", icon="GREASEPENCIL", text="")
|
||||
|
||||
@@ -431,15 +431,17 @@ class SelectIfcClass(Operator):
|
||||
bl_idname = "bim.select_ifc_class"
|
||||
bl_label = "Select IFC Class"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
ifc_class: StringProperty()
|
||||
|
||||
def execute(self, context):
|
||||
objects = bpy.context.selected_objects
|
||||
for object in objects:
|
||||
element = tool.Ifc.get_entity(object)
|
||||
element_class = element.is_a()
|
||||
for elem in tool.Ifc.get().by_type(element_class):
|
||||
obj = tool.Ifc.get_object(elem)
|
||||
classes = set()
|
||||
for obj in objects:
|
||||
element = tool.Ifc.get_entity(obj)
|
||||
if element:
|
||||
classes.add(element.is_a())
|
||||
for cls in classes:
|
||||
for element in tool.Ifc.get().by_type(cls):
|
||||
obj = tool.Ifc.get_object(element)
|
||||
if obj:
|
||||
obj.select_set(True)
|
||||
return {"FINISHED"}
|
||||
|
||||
Reference in New Issue
Block a user