ifcopenshell.api.cost.assign_cost_value

Module Contents

ifcopenshell.api.cost.assign_cost_value.assign_cost_value(file: ifcopenshell.file, cost_item: ifcopenshell.entity_instance, cost_rate: ifcopenshell.entity_instance) None

Assigns a cost value to a cost item from a schedule of rates

Instead of assigning cost values from scratch for each cost item in a cost schedule, the cost values may instead be assigned from a schedule of rates.

A schedule of rates is just another cost schedule which have cost values but no quantities. This API will allow you to “copy” the values from a cost item in the schedule of rates into another cost item in your own cost schedule. When the schedule of rates value is updated, then your cost item values will also be updated. You can think of the schedule of rates as a “template” to quickly populate your rates from.

Parameters:
  • cost_item (ifcopenshell.entity_instance) – The IfcCostItem that you want to copy the values to

  • cost_rate (ifcopenshell.entity_instance) – The IfcCostItem that you want to copy the values from

Returns:

None

Return type:

None

Example:

# Let's create a schedule of rates with a single rate in it of 5.0
rate_tables = ifcopenshell.api.cost.add_cost_schedule(model,
    predefined_type="SCHEDULEOFRATES")
rate = ifcopenshell.api.cost.add_cost_item(model, cost_schedule=schedule)
value = ifcopenshell.api.cost.add_cost_value(model, parent=rate)
ifcopenshell.api.cost.edit_cost_value(model, cost_value=value,
    attributes={"AppliedValue": 5.0})

# And this schedule will be for our actual cost plan / estimate / etc
schedule = ifcopenshell.api.cost.add_cost_schedule(model)
item = ifcopenshell.api.cost.add_cost_item(model, cost_schedule=schedule)

# Now the cost item has the same rate as the one from the schedule of rate's item
ifcopenshell.api.cost.assign_cost_value(model, cost_item=item, cost_rate=rate)