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,35 @@
class Usecase:
def __init__(self, file, **settings):
def __init__(self, file, physical_quantity=None, attributes=None):
"""Edits the attributes of an IfcPhysicalQuantity
For more information about the attributes and data types of an
IfcPhysicalQuantity, consult the IFC documentation.
:param physical_quantity: The IfcPhysicalQuantity entity you want to edit
:type physical_quantity: ifcopenshell.entity_instance.entity_instance
:param attributes: a dictionary of attribute names and values.
:type attributes: dict, optional
: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)
# This cost item will have a unit cost of 5 and a volume of 3
value = ifcopenshell.api.run("cost.add_cost_value", model, parent=item)
ifcopenshell.api.run("cost.edit_cost_value", model, cost_value=value,
attributes={"AppliedValue": 5.0})
quantity = ifcopenshell.api.run("cost.add_cost_item_quantity", model,
cost_item=item, ifc_class="IfcQuantityVolume")
ifcopenshell.api.run("cost.edit_cost_item_quantity", model,
physical_quantity=quantity, "attributes": {"VolumeValue": 3.0})
"""
self.file = file
self.settings = {"physical_quantity": None, "attributes": {}}
for key, value in settings.items():
self.settings[key] = value
self.settings = {"physical_quantity": physical_quantity, "attributes": attributes or {}}
def execute(self):
for name, value in self.settings["attributes"].items():