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
@@ -20,11 +20,36 @@ import ifcopenshell.api
class Usecase:
def __init__(self, file, **settings):
def __init__(self, file, cost_schedule=None, cost_item=None):
"""Add a new cost item
A cost item represents a single line item in a cost schedule. Cost items
may then be broken down into cost subitems.
:param cost_schedule: If the cost item is to be added as a root or top
level cost item to a cost schedule, the IfcCostSchedule may be
specified. This is mutually exlclusive to the cost_item parameter.
:type cost_schedule: ifcopenshell.entity_instance.entity_instance
:param cost_item: If the cost item is to be added as a subitem to an
existing cost item, the parent IfcCostItem may be specified. This is
mutually exclusive to the cost_schedule parameter.
:type cost_item: ifcopenshell.entity_instance.entity_instance
:return: The newly created IfcCostItem
:rtype: ifcopenshell.entity_instance.entity_instance
Example::
# The very first cost item must be in a cost schedule
schedule = ifcopenshell.api.run("cost.add_cost_schedule", model)
# You may add cost items as top level item in the schedule
item1 = ifcopenshell.api.run("cost.add_cost_item", model, cost_schedule=schedule)
# Alternatively you may add them as subitems
item2 = ifcopenshell.api.run("cost.add_cost_item", model, cost_item=item1)
"""
self.file = file
self.settings = {"cost_schedule": None, "cost_item": None}
for key, value in settings.items():
self.settings[key] = value
self.settings = {"cost_schedule": cost_schedule, "cost_item": cost_item}
def execute(self):
cost_item = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcCostItem")