Add API documentation for group module

This commit is contained in:
Dion Moult
2022-12-06 16:42:47 +11:00
parent b34caa1b5f
commit 45953c6b49
6 changed files with 127 additions and 29 deletions
@@ -21,14 +21,30 @@ import ifcopenshell.api
class Usecase:
def __init__(self, file, **settings):
def __init__(self, file, products=None, group=None):
"""Assigns products to a group
If a product is already assigned to the group, it will not be assigned
twice.
:param products: A list of IfcProduct elements to assign to the group
:type products: list[ifcopenshell.entity_instance.entity_instance]
:param group: The IfcGroup to assign the products to
:type group: ifcopenshell.entity_instance.entity_instance
:return: The IfcRelAssignsToGroup relationship
:rtype: ifcopenshell.entity_instance.entity_instance
Example::
group = ifcopenshell.api.run("group.add_group", model, Name="Furniture")
ifcopenshell.api.run("group.assign_group", model,
products=model.by_type("IfcFurniture"), group=group)
"""
self.file = file
self.settings = {
"products": None,
"group": None,
"products": products,
"group": group,
}
for key, value in settings.items():
self.settings[key] = value
def execute(self):
if not self.settings["group"].IsGroupedBy: