ifcopenshell.api.pset.unshare_pset

Module Contents

ifcopenshell.api.pset.unshare_pset.unshare_pset(file: ifcopenshell.file, products: list[ifcopenshell.entity_instance], pset: ifcopenshell.entity_instance) list[ifcopenshell.entity_instance]

Copy a shared pset as linked only to the provided elements.

Note that method will create a copy of the pset for each element provided.

Parameters:
  • products – Elements (or element types) to link the pset to.

  • pset – Shared property set.

Returns:

List of copied property sets.

Example:

element1 = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcWall")
element2 = ifcopenshell.api.root.create_entity(self.file, ifc_class="IfcWall")
ifcopenshell.api.pset.assign_pset(self.file, [element1, element2], pset)

# Pset is now shared by 2 elements.
assert ifcopenshell.util.element.get_elements_by_pset(pset) == {element1, element2}

new_psets = ifcopenshell.api.pset.unshare_pset(self.file, [element2], pset)

# element2 was unassigned from the original pset.
assert ifcopenshell.util.element.get_elements_by_pset(pset) == {element1}
new_pset = new_psets[0]

# New pset was created and was assigned to element2.
assert new_pset != pset
assert ifcopenshell.util.element.get_elements_by_pset(new_pset) == {element2}