system.assign_system - support batching #4474

This commit is contained in:
Andrej730
2024-04-11 15:54:06 +05:00
parent 3d243b5eee
commit 6b48e8b4b9
13 changed files with 119 additions and 48 deletions
@@ -18,6 +18,7 @@
import ifcopenshell
import ifcopenshell.api
from typing import Union
class Usecase:
@@ -34,7 +35,8 @@ class Usecase:
: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
or `None` if `products` was empty list.
:rtype: Union[ifcopenshell.entity_instance.entity_instance, None]
Example:
@@ -50,7 +52,10 @@ class Usecase:
"group": group,
}
def execute(self) -> ifcopenshell.entity_instance:
def execute(self) -> Union[ifcopenshell.entity_instance, None]:
if not self.settings["products"]:
return
if not self.settings["group"].IsGroupedBy:
return self.file.create_entity(
"IfcRelAssignsToGroup",