Write documentation for resource API module

This commit is contained in:
Dion Moult
2022-12-16 15:07:02 +11:00
parent d2fee728f2
commit 436482532d
13 changed files with 386 additions and 56 deletions
@@ -18,11 +18,29 @@
class Usecase:
def __init__(self, file, **settings):
def __init__(self, file, resource=None, attributes=None):
"""Edits the attributes of an IfcResource
For more information about the attributes and data types of an
IfcResource, consult the IFC documentation.
:param resource: The IfcResource entity you want to edit
:type resource: ifcopenshell.entity_instance.entity_instance
:param attributes: a dictionary of attribute names and values.
:type attributes: dict, optional
:return: None
:rtype: None
Example::
# Add our own crew
crew = ifcopenshell.api.run("resource.add_resource", model, ifc_class="IfcCrewResource")
# Change the name of the resource to "Zone A Crew"
ifcopenshell.api.run("resource.edit_resource", model, resource=resource, attributes={"Name": "Foo"})
"""
self.file = file
self.settings = {"resource": None, "attributes": {}}
for key, value in settings.items():
self.settings[key] = value
self.settings = {"resource": resource, "attributes": attributes or {}}
def execute(self):
for name, value in self.settings["attributes"].items():