You can now select all products that are part of a group

This commit is contained in:
Dion Moult
2021-05-16 11:24:51 +10:00
parent ff06f452d5
commit e0b3a87fdb
5 changed files with 30 additions and 5 deletions
@@ -109,7 +109,7 @@ class BIM_PT_cost_schedules(Panel):
value = quantity[[k for k in quantity.keys() if "Value" in k][0]]
row = self.layout.row(align=True)
row.label(text=quantity["Name"])
row.label(text=str(value))
row.label(text="{0:.2f}".format(value))
if self.props.active_cost_item_quantity_id and self.props.active_cost_item_quantity_id == quantity_id:
op = row.operator("bim.edit_cost_item_quantity", text="", icon="CHECKMARK")
op.physical_quantity = quantity_id
@@ -262,12 +262,12 @@ class BIM_UL_cost_items(UIList):
op = row.operator("bim.enable_editing_cost_item_quantities", text="", icon="PROPERTIES")
op.cost_item = item.ifc_definition_id
row.label(text=str("{0:.2f}".format(cost_item["TotalCostQuantity"])) + " (M3)")
row.label(text="{0:.2f}".format(cost_item["TotalCostQuantity"]) + " (M3)")
op = row.operator("bim.enable_editing_cost_item_values", text="", icon="DISC")
op.cost_item = item.ifc_definition_id
row.label(text=str("{0:.2f}".format(cost_item["TotalAppliedValue"])))
row.label(text=str("{0:.2f}".format(cost_item["TotalCostValue"])), icon="CON_TRANSLIKE")
row.label(text="{0:.2f}".format(cost_item["TotalAppliedValue"]))
row.label(text="{0:.2f}".format(cost_item["TotalCostValue"]), icon="CON_TRANSLIKE")
if context.active_object:
oprops = context.active_object.BIMObjectProperties
@@ -11,6 +11,7 @@ classes = (
operator.UnassignGroup,
operator.EnableEditingGroup,
operator.DisableEditingGroup,
operator.SelectGroupProducts,
prop.Group,
prop.BIMGroupProperties,
ui.BIM_PT_groups,
@@ -152,3 +152,20 @@ class UnassignGroup(bpy.types.Operator):
)
Data.load(IfcStore.get_file())
return {"FINISHED"}
class SelectGroupProducts(bpy.types.Operator):
bl_idname = "bim.select_group_products"
bl_label = "Select Group Products"
group: bpy.props.IntProperty()
def execute(self, context):
self.file = IfcStore.get_file()
for obj in bpy.context.visible_objects:
obj.select_set(False)
if not obj.BIMObjectProperties.ifc_definition_id:
continue
product_groups = Data.products.get(obj.BIMObjectProperties.ifc_definition_id, [])
if self.group in product_groups:
obj.select_set(True)
return {"FINISHED"}
@@ -69,11 +69,17 @@ class BIM_UL_groups(UIList):
op.group = item.ifc_definition_id
if context.scene.BIMGroupProperties.active_group_id == item.ifc_definition_id:
op = row.operator("bim.select_group_products", text="", icon="RESTRICT_SELECT_OFF")
op.group = item.ifc_definition_id
row.operator("bim.edit_group", text="", icon="CHECKMARK")
row.operator("bim.disable_editing_group", text="", icon="X")
row.operator("bim.disable_editing_group", text="", icon="CANCEL")
elif context.scene.BIMGroupProperties.active_group_id:
op = row.operator("bim.select_group_products", text="", icon="RESTRICT_SELECT_OFF")
op.group = item.ifc_definition_id
row.operator("bim.remove_group", text="", icon="X").group = item.ifc_definition_id
else:
op = row.operator("bim.select_group_products", text="", icon="RESTRICT_SELECT_OFF")
op.group = item.ifc_definition_id
op = row.operator("bim.enable_editing_group", text="", icon="GREASEPENCIL")
op.group = item.ifc_definition_id
row.operator("bim.remove_group", text="", icon="X").group = item.ifc_definition_id
@@ -90,6 +90,7 @@ class QuantifyObjects(bpy.types.Operator):
result = helper.calculate_volume(obj)
if not result:
continue
result = round(result, 3)
qto = ifcopenshell.api.run(
"pset.add_qto",
self.file,