mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 10:57:49 +00:00
Add API documentation for group module
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user