mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 06:39:13 +00:00
fix smart clash group selection
This commit is contained in:
@@ -450,20 +450,16 @@ class SelectSmartGroup(bpy.types.Operator):
|
|||||||
return IfcStore.get_file() and context.visible_objects and context.scene.BIMClashProperties.active_smart_group
|
return IfcStore.get_file() and context.visible_objects and context.scene.BIMClashProperties.active_smart_group
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
self.file = IfcStore.get_file()
|
|
||||||
# Select smart group in view
|
|
||||||
selected_smart_group = context.scene.BIMClashProperties.active_smart_group
|
selected_smart_group = context.scene.BIMClashProperties.active_smart_group
|
||||||
# print(selected_smart_group.number)
|
products = []
|
||||||
|
for global_id in selected_smart_group.global_ids:
|
||||||
for obj in context.visible_objects:
|
try:
|
||||||
if not obj.BIMObjectProperties.ifc_definition_id:
|
products.append(tool.Ifc.get().by_guid(global_id.guid))
|
||||||
|
except:
|
||||||
continue
|
continue
|
||||||
element = self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)
|
tool.Spatial.select_products(products, unhide=True)
|
||||||
for id in selected_smart_group.global_ids:
|
context_override = tool.Blender.get_viewport_context()
|
||||||
# print("Id: ", id)
|
with bpy.context.temp_override(**context_override):
|
||||||
# print("Global id: ", element.GlobalId)
|
bpy.ops.view3d.view_selected()
|
||||||
if element.GlobalId in id.name:
|
|
||||||
# print("object match: ", global_id)
|
|
||||||
obj.select_set(True)
|
|
||||||
|
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user