ifcopenshell.api.material.remove_constituent#

Module Contents#

class ifcopenshell.api.material.remove_constituent.Usecase(file, constituent=None)#

Removes a constituent from a constituent set

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

Parameters

constituent (ifcopenshell.entity_instance.entity_instance) – The IfcMaterialConstituent entity you want to remove

Returns

None

Return type

None

Example:

# Create a material set for windows made out of aluminium and glass.
material_set = ifcopenshell.api.run("material.add_material_set", model,
    name="Window", set_type="IfcMaterialConstituentSet")

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

# Now let's use those materials as two constituents in our set.
framing = ifcopenshell.api.run("material.add_constituent", model,
    constituent_set=material_set, material=aluminium)
glazing = ifcopenshell.api.run("material.add_constituent", model,
    constituent_set=material_set, material=glass)

# Let's remove the glass constituent. Note that we should not remove
# the framing, at this would mean there are no constituents which is
# invalid.
ifcopenshell.api.run("material.remove_constituent", model, constituent=glazing)
execute(self)#