ifcopenshell.api.geometry.add_boolean

Module Contents

ifcopenshell.api.geometry.add_boolean.add_boolean(file: ifcopenshell.file, first_item: ifcopenshell.entity_instance, second_items: list[ifcopenshell.entity_instance], operator: Literal['DIFFERENCE', 'INTERSECTION', 'UNION'] = 'DIFFERENCE') list[ifcopenshell.entity_instance]

Adds a boolean operation to two or more representation items

If an IfcBooleanOperand is part of the top level items in an IfcShapeRepresentation, it will be removed from that level whilst being added to the IfcBooleanResult. This is because it is generally intuitive that an item is either participating in a boolean operation, or being an item in its own right, but not both.

However, if an IfcBooleanOperand is part of another boolean operation already, it will not be removed from the existing operation. A new operation will be created, and therefore it will participate in two operations.

This function protects against recursive booleans.

After a boolean operation is made, since the items of IfcShapeRepresentation may be modified, it is not guaranteed that the RepresentationType is still valid. After performing all your booleans, it is recommended to run ifcopenshell.api.geometry.validate_csg() to ensure correctness.

Parameters:
  • first_item – The IfcBooleanOperand that the operation is performed upon

  • second_items – The IfcBooleanOperands that the operation will be performed with, in the order given of the list.

  • operator – The type of boolean operation to perform

Returns:

A list of newly created IfcBooleanResult in the order of boolean operations (based on the order of second items). If nothing was created, the list will be empty.