mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-20 20:22:09 +00:00
You can now copy cost values from one cost item to another
This commit is contained in:
@@ -30,6 +30,7 @@ classes = (
|
||||
operator.RemoveCostItemQuantity,
|
||||
operator.AddCostValue,
|
||||
operator.RemoveCostItemValue,
|
||||
operator.CopyCostItemValues,
|
||||
prop.CostItem,
|
||||
prop.BIMCostProperties,
|
||||
ui.BIM_PT_cost_schedules,
|
||||
|
||||
@@ -458,11 +458,7 @@ class RemoveCostItemValue(bpy.types.Operator):
|
||||
|
||||
def execute(self, context):
|
||||
self.file = IfcStore.get_file()
|
||||
ifcopenshell.api.run(
|
||||
"cost.remove_cost_item_value",
|
||||
self.file,
|
||||
cost_value=self.file.by_id(self.cost_value),
|
||||
)
|
||||
ifcopenshell.api.run("cost.remove_cost_item_value", self.file, cost_value=self.file.by_id(self.cost_value))
|
||||
Data.load(self.file)
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -519,3 +515,20 @@ class EditCostValue(bpy.types.Operator):
|
||||
Data.load(IfcStore.get_file())
|
||||
bpy.ops.bim.disable_editing_cost_item_value()
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class CopyCostItemValues(bpy.types.Operator):
|
||||
bl_idname = "bim.copy_cost_item_values"
|
||||
bl_label = "Copy Cost Item Values"
|
||||
source: bpy.props.IntProperty()
|
||||
destination: bpy.props.IntProperty()
|
||||
|
||||
def execute(self, context):
|
||||
self.file = IfcStore.get_file()
|
||||
ifcopenshell.api.run(
|
||||
"cost.copy_cost_item_values",
|
||||
self.file,
|
||||
**{"source": self.file.by_id(self.source), "destination": self.file.by_id(self.destination)},
|
||||
)
|
||||
Data.load(IfcStore.get_file())
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -260,9 +260,14 @@ class BIM_UL_cost_items(UIList):
|
||||
op.cost_item = item.ifc_definition_id
|
||||
|
||||
if props.active_cost_item_id == item.ifc_definition_id:
|
||||
row.operator("bim.edit_cost_item", text="", icon="CHECKMARK")
|
||||
if props.cost_item_editing_type == "ATTRIBUTES":
|
||||
row.operator("bim.edit_cost_item", text="", icon="CHECKMARK")
|
||||
row.operator("bim.disable_editing_cost_item", text="", icon="CANCEL")
|
||||
elif props.active_cost_item_id:
|
||||
if props.cost_item_editing_type == "VALUES":
|
||||
op = row.operator("bim.copy_cost_item_values", text="", icon="COPYDOWN")
|
||||
op.source = props.active_cost_item_id
|
||||
op.destination = item.ifc_definition_id
|
||||
row.operator("bim.add_cost_item", text="", icon="ADD").cost_item = item.ifc_definition_id
|
||||
row.operator("bim.remove_cost_item", text="", icon="X").cost_item = item.ifc_definition_id
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user