ifcopenshell.api.material.remove_list_item

Module Contents

ifcopenshell.api.material.remove_list_item.remove_list_item(file: ifcopenshell.file, material_list: ifcopenshell.entity_instance, material_index: int = 0) None

Removes an item in an material list

Note that it is invalid to have zero items in a list, so you should leave at least one item to ensure a valid IFC dataset.

Parameters:
  • material_list (ifcopenshell.entity_instance) – The IfcMaterialList entity you want to remove an item from.

  • material_index (int, optional) – The index of the material you want to remove from the list. Starts counting at 0. Defaults to 0.

Returns:

None

Return type:

None

Example:

# Create a material list for aluminium windows.
material_set = ifcopenshell.api.material.add_material_set(model,
    name="Window", set_type="IfcMaterialMaterialList")

aluminium = ifcopenshell.api.material.add_material(model, name="AL01", category="aluminium")
glass = ifcopenshell.api.material.add_material(model, name="GLZ01", category="glass")

# Now let's use those materials as two items in our list.
ifcopenshell.api.material.add_list_item(model, material_list=material_set, material=aluminium)
ifcopenshell.api.material.add_list_item(model, material_list=material_set, material=glass)

# Let's remove the glass
ifcopenshell.api.material.remove_list_item(model, material_list=material_set, material_index=1)