ifcopenshell.api.group.assign_group

Module Contents

ifcopenshell.api.group.assign_group.assign_group(file: ifcopenshell.file, products: list[ifcopenshell.entity_instance], group: ifcopenshell.entity_instance) ifcopenshell.entity_instance | None

Assigns products to a group

If a product is already assigned to the group, it will not be assigned twice.

Parameters:
  • products (list[ifcopenshell.entity_instance]) – A list of IfcProduct elements to assign to the group

  • group (ifcopenshell.entity_instance) – The IfcGroup to assign the products to

Returns:

The IfcRelAssignsToGroup relationship or None if products was empty list.

Return type:

Union[ifcopenshell.entity_instance, None]

Example:

group = ifcopenshell.api.group.add_group(model, name="Furniture")
ifcopenshell.api.group.assign_group(model,
    products=model.by_type("IfcFurniture"), group=group)