ifcopenshell.api.root.remove_product

Module Contents

ifcopenshell.api.root.remove_product.remove_product(file: ifcopenshell.file, product: ifcopenshell.entity_instance) None

Removes a product

This is effectively a smart delete function that not only removes a product, but also all of its relationships. It is always recommended to use this function to prevent orphaned data in your IFC model.

This is intended to be used for removing:

  • IfcAnnotation

  • IfcElement

  • IfcElementType

  • IfcSpatialElement

  • IfcSpatialElementType

For example, geometric representations are removed. Placement coordinates are also removed. Properties are removed. Material, type, containment, aggregation, and nesting relationships are removed (but naturally, the materials, types, containers, etc themselves remain).

Parameters:

product (ifcopenshell.entity_instance) – The element to remove.

Returns:

None

Return type:

None

Example:

# We have a wall.
wall = ifcopenshell.api.run("root.create_entity", model, ifc_class="IfcWall")

# No we don't.
ifcopenshell.api.run("root.remove_product", model, product=wall)