mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 18:43:26 +00:00
control.assign_control to support batching
This commit is contained in:
@@ -59,7 +59,7 @@ def add_cost_item(
|
||||
cost_item_ = ifcopenshell.api.root.create_entity(file, ifc_class="IfcCostItem")
|
||||
|
||||
if cost_schedule:
|
||||
ifcopenshell.api.control.assign_control(file, cost_schedule, cost_item_)
|
||||
ifcopenshell.api.control.assign_control(file, cost_schedule, [cost_item_])
|
||||
elif cost_item:
|
||||
ifcopenshell.api.nest.assign_object(file, related_objects=[cost_item_], relating_object=cost_item)
|
||||
return cost_item_
|
||||
|
||||
@@ -66,7 +66,7 @@ def add_cost_item_quantity(
|
||||
schedule = ifcopenshell.api.cost.add_cost_schedule(model)
|
||||
item = ifcopenshell.api.cost.add_cost_item(model, cost_schedule=schedule)
|
||||
ifcopenshell.api.control.assign_control(model,
|
||||
relating_control=item, related_object=chair)
|
||||
relating_control=item, related_objects=[chair])
|
||||
|
||||
# Let's assume we want to count the amount of chairs to calculate our cost item
|
||||
# Because this is an IfcQuantityCount the count will be automatically set to "1" chair
|
||||
|
||||
@@ -122,7 +122,7 @@ class Usecase:
|
||||
) -> ifcopenshell.entity_instance:
|
||||
return ifcopenshell.api.control.assign_control(
|
||||
self.file,
|
||||
related_object=related_object,
|
||||
related_objects=[related_object],
|
||||
relating_control=cost_item,
|
||||
)
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ def calculate_cost_item_resource_value(file: ifcopenshell.file, cost_item: ifcop
|
||||
concrete = ifcopenshell.api.resource.add_resource(model,
|
||||
ifc_class="IfcConstructionMaterialResource", parent_resource=crew)
|
||||
ifcopenshell.api.control.assign_control(model,
|
||||
relating_control=item, related_object=concrete)
|
||||
relating_control=item, related_objects=[concrete])
|
||||
# ... which has a unit price of 42.0 per m3
|
||||
value = ifcopenshell.api.cost.add_cost_value(model, parent=concrete)
|
||||
ifcopenshell.api.cost.edit_cost_value(model, cost_value=value,
|
||||
@@ -72,7 +72,7 @@ def calculate_cost_item_resource_value(file: ifcopenshell.file, cost_item: ifcop
|
||||
equipment = ifcopenshell.api.resource.add_resource(model,
|
||||
ifc_class="IfcConstructionEquipmentResource", parent_resource=crew)
|
||||
ifcopenshell.api.control.assign_control(model,
|
||||
relating_control=item, related_object=equipment)
|
||||
relating_control=item, related_objects=[equipment])
|
||||
# ... with a fixed price of 50,000
|
||||
value = ifcopenshell.api.cost.add_cost_value(model, parent=concrete)
|
||||
ifcopenshell.api.cost.edit_cost_value(model, cost_value=value,
|
||||
|
||||
@@ -45,5 +45,5 @@ def copy_cost_schedule(
|
||||
if isinstance(duplicated_cost_item, list):
|
||||
# All other nested items are not connected to the cost schedule explicitly.
|
||||
duplicated_cost_item = duplicated_cost_item[0]
|
||||
ifcopenshell.api.control.assign_control(file, new_schedule, duplicated_cost_item)
|
||||
ifcopenshell.api.control.assign_control(file, new_schedule, [duplicated_cost_item])
|
||||
return new_schedule
|
||||
|
||||
Reference in New Issue
Block a user