mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 06:58:56 +00:00
Select multiple arrays at one time, from various parts. Deselect non-compliant objects.
This commit is contained in:
@@ -248,23 +248,30 @@ class SelectAllArrayObjects(bpy.types.Operator):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
object = context.active_object
|
objects = context.selected_objects
|
||||||
element = tool.Ifc.get_entity(object)
|
for object in objects:
|
||||||
array_pset = ifcopenshell.util.element.get_pset(element, "BBIM_Array")
|
element = tool.Ifc.get_entity(object)
|
||||||
if not array_pset:
|
if not element:
|
||||||
self.report({"ERROR"}, f"Object is not part of an array.")
|
self.report({"ERROR"}, f"Non IFC objects, were deselected.")
|
||||||
return {"CANCELLED"}
|
object.select_set(False)
|
||||||
|
|
||||||
try:
|
if element:
|
||||||
parent_element = tool.Ifc.get().by_guid(array_pset["Parent"])
|
array_pset = ifcopenshell.util.element.get_pset(element, "BBIM_Array")
|
||||||
except RuntimeError:
|
if not array_pset:
|
||||||
self.report({"ERROR"}, f"Couldn't find array parent by guid '{array_pset['Parent']}'")
|
self.report({"ERROR"}, f"Objects not part of an array, were deselected.")
|
||||||
return {"CANCELLED"}
|
object.select_set(False)
|
||||||
|
|
||||||
array_objects = tool.Blender.Modifier.Array.get_all_objects(parent_element)
|
if array_pset:
|
||||||
tool.Blender.set_objects_selection(
|
try:
|
||||||
context, active_object=array_objects[0], selected_objects=array_objects, clear_previous_selection=False
|
parent_element = tool.Ifc.get().by_guid(array_pset["Parent"])
|
||||||
)
|
except RuntimeError:
|
||||||
|
self.report({"ERROR"}, f"Objects that don't have an array parent, were deselected.")
|
||||||
|
object.select_set(False)
|
||||||
|
|
||||||
|
array_objects = tool.Blender.Modifier.Array.get_all_objects(parent_element)
|
||||||
|
tool.Blender.set_objects_selection(
|
||||||
|
context, active_object=array_objects[0], selected_objects=array_objects, clear_previous_selection=False
|
||||||
|
)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user