You can now remove cost quantities in bulk.

This commit is contained in:
Dion Moult
2021-08-12 10:03:58 +10:00
parent f600186496
commit 5af0d65306
2 changed files with 14 additions and 3 deletions
@@ -341,11 +341,19 @@ class UnassignCostItemProduct(bpy.types.Operator):
def _execute(self, context):
self.file = IfcStore.get_file()
if self.related_object:
products = [self.file.by_id(self.related_object)]
else:
products = [
self.file.by_id(o.BIMObjectProperties.ifc_definition_id)
for o in bpy.context.selected_objects
if o.BIMObjectProperties.ifc_definition_id
]
ifcopenshell.api.run(
"cost.unassign_cost_item_product",
self.file,
cost_item=self.file.by_id(self.cost_item),
products=[self.file.by_id(self.related_object)],
products=products,
)
Data.load(self.file)
bpy.ops.bim.load_cost_item_quantities()
@@ -309,11 +309,14 @@ class BIM_PT_cost_item_quantities(Panel):
"active_cost_item_product_index",
)
row = self.layout.row(align=True)
row = self.layout.row()
row2 = row.row(align=True)
row2.prop(self.props, "quantity_names", text="")
op = row.operator("bim.assign_cost_item_product", text="", icon="ADD")
op = row2.operator("bim.unassign_cost_item_product", text="", icon="REMOVE")
op.cost_item = cost_item.ifc_definition_id
op.related_object = 0
op = row2.operator("bim.assign_cost_item_product", text="", icon="ADD")
op.cost_item = cost_item.ifc_definition_id
row2 = row.row(align=True)