Write API documentation for control module

This commit is contained in:
Dion Moult
2022-11-16 18:38:51 +09:00
parent 68838a37e5
commit 22eb0bf2e4
2 changed files with 74 additions and 10 deletions
@@ -21,14 +21,38 @@ import ifcopenshell.api
class Usecase:
def __init__(self, file, **settings):
def __init__(self, file, relating_control=None, related_object=None):
"""Unassigns a planning control or constraint to an object
:param relating_control: The IfcControl entity that is creating the
control or constraint
:type relating_control: ifcopenshell.entity_instance.entity_instance
:param related_object: The IfcObjectDefinition that is being controlled
:type related_object: ifcopenshell.entity_instance.entity_instance
:return: If the control still is related to other objects, the
IfcRelAssignsToControl is returned, otherwise None.
:rtype: ifcopenshell.entity_instance.entity_instance, None
Example::
# Let's relate a cost item and a product
wall = ifcopenshell.api.run("root.create_entity", model, ifc_class="IfcWall")
schedule = ifcopenshell.api.run("cost.add_cost_schedule", model)
cost_item = ifcopenshell.api.run("cost.add_cost_item", model,
cost_schedule=schedule)
ifcopenshell.api.run("control.assign_control", model,
relating_control=cost_item, related_object=wall)
# And now let's change our mind
ifcopenshell.api.run("control.unassign_control", model,
relating_control=cost_item, related_object=wall)
"""
self.file = file
self.settings = {
"relating_control": None,
"related_object": None,
"relating_control": relating_control,
"related_object": related_object,
}
for key, value in settings.items():
self.settings[key] = value
def execute(self):
for rel in self.settings["related_object"].HasAssignments or []: