Enable selecting group elements

This commit is contained in:
Sigma Dimensions
2023-06-14 09:35:54 +01:00
parent 81fd84223a
commit fb02ac34d4
3 changed files with 18 additions and 0 deletions
@@ -33,6 +33,7 @@ classes = (
operator.ToggleGroup,
operator.UnassignGroup,
operator.UpdateGroup,
operator.SelectGroupElements,
prop.ExpandedGroups,
prop.Group,
prop.BIMGroupProperties,
@@ -275,3 +275,19 @@ class UpdateGroup(bpy.types.Operator, tool.Ifc.Operator):
)
bpy.ops.bim.load_groups()
return {"FINISHED"}
class SelectGroupElements(bpy.types.Operator):
bl_idname = "bim.select_group_elements"
bl_label = "Select Group elements"
bl_options = {"REGISTER", "UNDO"}
group: bpy.props.IntProperty()
@classmethod
def poll(cls, context):
return bool(tool.Ifc.get() and context.active_object)
def execute(self, context):
elements = tool.Drawing.get_group_elements(tool.Ifc.get().by_id(self.group))
tool.Spatial.select_products(elements)
return {"FINISHED"}
@@ -107,6 +107,7 @@ class BIM_PT_object_groups(Panel):
for group in ObjectGroupsData.data["groups"]:
row = self.layout.row(align=True)
row.label(text=group["name"])
row.operator("bim.select_group_elements", text="", icon="RESTRICT_SELECT_OFF").group = group["id"]
op = row.operator("bim.unassign_group", text="", icon="X")
op.group = group["id"]