mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 06:21:40 +00:00
You can now remove cost quantities in bulk.
This commit is contained in:
@@ -341,11 +341,19 @@ class UnassignCostItemProduct(bpy.types.Operator):
|
|||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
self.file = IfcStore.get_file()
|
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(
|
ifcopenshell.api.run(
|
||||||
"cost.unassign_cost_item_product",
|
"cost.unassign_cost_item_product",
|
||||||
self.file,
|
self.file,
|
||||||
cost_item=self.file.by_id(self.cost_item),
|
cost_item=self.file.by_id(self.cost_item),
|
||||||
products=[self.file.by_id(self.related_object)],
|
products=products,
|
||||||
)
|
)
|
||||||
Data.load(self.file)
|
Data.load(self.file)
|
||||||
bpy.ops.bim.load_cost_item_quantities()
|
bpy.ops.bim.load_cost_item_quantities()
|
||||||
|
|||||||
@@ -309,11 +309,14 @@ class BIM_PT_cost_item_quantities(Panel):
|
|||||||
"active_cost_item_product_index",
|
"active_cost_item_product_index",
|
||||||
)
|
)
|
||||||
|
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row()
|
||||||
|
|
||||||
row2 = row.row(align=True)
|
row2 = row.row(align=True)
|
||||||
row2.prop(self.props, "quantity_names", text="")
|
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
|
op.cost_item = cost_item.ifc_definition_id
|
||||||
|
|
||||||
row2 = row.row(align=True)
|
row2 = row.row(align=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user