Add documentation for cost module

This commit is contained in:
Dion Moult
2022-11-21 12:05:30 +09:00
parent 412cf7c6cb
commit 11f772b5a3
19 changed files with 621 additions and 74 deletions
@@ -18,11 +18,32 @@
class Usecase:
def __init__(self, file, **settings):
def __init__(self, file, cost_item=None, physical_quantity=None):
"""Removes a quantity assigned to a cost item
If the quantity is part of a product (e.g. wall), then the quantity will
still exist and merely the relationship to the cost item will be
removed.
:param cost_item: The IfcCostItem that the quantity is assigned to
:type cost_item: ifcopenshell.entity_instance.entity_instance
:param physical_quantity: The IfcPhysicalQuantity to remove
:type physical_quantity: ifcopenshell.entity_instance.entity_instance
:return: None
:rtype: None
Example::
schedule = ifcopenshell.api.run("cost.add_cost_schedule", model)
item = ifcopenshell.api.run("cost.add_cost_item", model, cost_schedule=schedule)
quantity = ifcopenshell.api.run("cost.add_cost_item_quantity", model,
cost_item=item, ifc_class="IfcQuantityVolume")
# Let's change our mind and delete it
ifcopenshell.api.run("cost.remove_cost_item", model,
cost_item=item, physical_quantity=quantity)
"""
self.file = file
self.settings = {"cost_item": None, "physical_quantity": None}
for key, value in settings.items():
self.settings[key] = value
self.settings = {"cost_item": cost_item, "physical_quantity": physical_quantity}
def execute(self):
if len(self.file.get_inverse(self.settings["physical_quantity"])) == 1: