diff --git a/src/blenderbim/blenderbim/bim/module/sequence/ui.py b/src/blenderbim/blenderbim/bim/module/sequence/ui.py index 6f6bc44526..95dab6e938 100644 --- a/src/blenderbim/blenderbim/bim/module/sequence/ui.py +++ b/src/blenderbim/blenderbim/bim/module/sequence/ui.py @@ -503,6 +503,8 @@ class BIM_UL_task_inputs(UIList): def draw_item(self, context, layout, data, item, icon, active_data, active_propname): if item: row = layout.row(align=True) + op = row.operator("bim.select_product", text="", icon="RESTRICT_SELECT_OFF") + op.product = item.ifc_definition_id row.prop(item, "name", emboss=False, text="") # row.operator("bim.remove_task_column", text="", icon="X").name = item.name @@ -527,6 +529,8 @@ class BIM_UL_task_outputs(UIList): def draw_item(self, context, layout, data, item, icon, active_data, active_propname): if item: row = layout.row(align=True) + op = row.operator("bim.select_product", text="", icon="RESTRICT_SELECT_OFF") + op.product = item.ifc_definition_id row.prop(item, "name", emboss=False, text="") diff --git a/src/blenderbim/blenderbim/bim/module/spatial/__init__.py b/src/blenderbim/blenderbim/bim/module/spatial/__init__.py index ddbf5a0602..f72600a59b 100644 --- a/src/blenderbim/blenderbim/bim/module/spatial/__init__.py +++ b/src/blenderbim/blenderbim/bim/module/spatial/__init__.py @@ -30,6 +30,7 @@ classes = ( operator.RemoveContainer, operator.SelectContainer, operator.SelectSimilarContainer, + operator.SelectProduct, prop.SpatialElement, prop.BIMSpatialProperties, prop.BIMObjectSpatialProperties, diff --git a/src/blenderbim/blenderbim/bim/module/spatial/operator.py b/src/blenderbim/blenderbim/bim/module/spatial/operator.py index 2b9493e1d3..17358e3c2a 100644 --- a/src/blenderbim/blenderbim/bim/module/spatial/operator.py +++ b/src/blenderbim/blenderbim/bim/module/spatial/operator.py @@ -160,3 +160,14 @@ class SelectSimilarContainer(bpy.types.Operator, tool.Ifc.Operator): def _execute(self, context): core.select_similar_container(tool.Ifc, tool.Spatial, obj=context.active_object) + + +class SelectProduct(bpy.types.Operator): + bl_idname = "bim.select_product" + bl_label = "Select Product" + bl_options = {"REGISTER", "UNDO"} + product: bpy.props.IntProperty() + + def execute(self, context): + core.select_product(tool.Spatial, product=tool.Ifc.get().by_id(self.product)) + return {"FINISHED"} diff --git a/src/blenderbim/blenderbim/core/spatial.py b/src/blenderbim/blenderbim/core/spatial.py index 580c7e4099..d832d8cfff 100644 --- a/src/blenderbim/blenderbim/core/spatial.py +++ b/src/blenderbim/blenderbim/core/spatial.py @@ -92,3 +92,7 @@ def select_similar_container(ifc, spatial, obj=None): element = ifc.get_entity(obj) if element: spatial.select_products(spatial.get_decomposed_elements(spatial.get_container(element))) + + +def select_product(spatial, product): + spatial.select_products([product])