parameters: (instance)
docstring: This is based on ifcopenshell.app.geom
docstring_summary: This is based on ifcopenshell.app.geom
docstring_tokens: This is based on ifcopenshell . app . geom
function: def _get_parent(instance):
      """This is based on ifcopenshell.app.geom"""
      if instance.is_a("IfcOpeningElement"):
          # We skip opening elements as they are nameless.
          # We use this function to get usable collections.
          return _get_parent(instance.VoidsElements[0].RelatingBuildingElement)
      if instance.is_a("IfcElement"):
          fills = instance.FillsVoids
          if len(fills):
              return fills[0].RelatingOpeningElement
          containments = instance.ContainedInStructure
          if len(containments):
              return containments[0].RelatingStructure
      if instance.is_a("IfcObjectDefinition"):
          decompositions = instance.Decomposes
          if len(decompositions):
              return decompositions[0].RelatingObject
function_tokens: def _get_parent ( instance ) : if instance . is_a ( "IfcOpeningElement" ) : # We skip opening elements as they are nameless. # We use this function to get usable collections. return _get_parent ( instance . VoidsElements [ 0 ] . RelatingBuildingElement ) if instance . is_a ( "IfcElement" ) : fills = instance . FillsVoids if len ( fills ) : return fills [ 0 ] . RelatingOpeningElement containments = instance . ContainedInStructure if len ( containments ) : return containments [ 0 ] . RelatingStructure if instance . is_a ( "IfcObjectDefinition" ) : decompositions = instance . Decomposes if len ( decompositions ) : return decompositions [ 0 ] . RelatingObject