Experimental get_inverse_cardinality proposal. See #1904.

This commit is contained in:
Dion Moult
2021-11-30 13:25:02 +11:00
committed by Thomas Krijnen
parent d1caa3242f
commit cef1c86f6d
4 changed files with 33 additions and 0 deletions
@@ -391,6 +391,16 @@ class file(object):
return inverses
return set(inverses)
def get_inverse_cardinality(self, inst):
"""Returns the number of entities that reference this entity
:param inst: The entity instance to get inverse relationships
:type inst: ifcopenshell.entity_instance.entity_instance
:returns: 0 if no references, 1 if one reference, or 2 if more than one reference
:rtype: int
"""
return self.wrapped_data.get_inverse_cardinality(inst.wrapped_data)
def remove(self, inst):
"""Deletes an IFC object in the file.