Model.hm_getreferencedentitiesmark#

Model.hm_getreferencedentitiesmark(collection, reference_flag, outputCollectionSet, string_array=0, number_of_strings=0, exclude_regions=0)#

Finds entities that are referenced by the entities on the specified collection. This includes collected references, data name references and attribute entity references. Each type of entity that is referenced by the specified input entities is returned in a list, and the found entities are placed on the specified collection for those entity types. See the list of supported entities for Model.hm_getreferencedentities().

Parameters:
  • collection (Collection) – The collection containing the input entities.

  • reference_flag (int) –

    The type of referenced entities to find.

    Bit values are used and the value is calculated as (Bit0 + 2*Bit1 + 4*Bit2). Valid Bit options are:

    Bit0

    Consider collected entity references. Valid values are:

    0 - Do not consider collected entity references.

    1 - Consider collected entity references. If the specified entity is not a collector or is empty, nothing will be returned for this bit.

    Bit1

    Consider data name entity references. Valid values are:

    0 - Do not consider data name entity references.

    1 - Consider data name entity references. If the specified entity does not have any data name references, nothing will be returned for this bit.

    Bit2

    Consider attribute entity references. Valid values are:

    0 - Do not consider attribute entity references.

    1 - Consider attribute entity references. If the specified entity does not have any attribute entity references, nothing will be returned for this bit. Only entities for the currently loaded template are considered.

    Show Bit value calculator
    Radio Button Table
    Option Name Value
    Consider collected entity references (Bit0)
    Consider data name entity references (Bit1)
    Consider attribute entity references (Bit2)
    Calculated argument value: 0

  • outputCollectionSet (CollectionSet) – The set of collections containing possibly multiple type of entities.

  • string_array (int) – Reserved for future development. Must be set to 0.

  • number_of_strings (int) – Reserved for future development. Must be set to 0.

  • exclude_regions (int) – Reserved for future development. Must be set to 0.

Returns:

Examples#

Get all entities referenced by component with IDs 100 - 110 on collection set 1#
import hm
import hm.entities as ent

model = hm.Model()

output = hm.CollectionSet(model)

_ ,result = model.hm_getreferencedentitiesmark(
  collection=hm.Collection(model, ent.Component, list(range(100,111))),
  reference_flag=7,
  outputCollectionSet=output
)

print("entityTypes", result.entityTypes)
Get only collected entity references for component with IDs 100 - 110#
import hm
import hm.entities as ent

model = hm.Model()

output = hm.CollectionSet(model)

_ ,result = model.hm_getreferencedentitiesmark(
  collection=hm.Collection(model, ent.Component, list(range(100,111))),
  reference_flag=1,
  outputCollectionSet=output
)

print("entityTypes", result.entityTypes)
Get only data name entity references for component with IDs 100 - 110#
import hm
import hm.entities as ent

model = hm.Model()

output = hm.CollectionSet(model)

_ ,result = model.hm_getreferencedentitiesmark(
  collection=hm.Collection(model, ent.Component, list(range(100,111))),
  reference_flag=2,
  outputCollectionSet=output
)

print("entityTypes", result.entityTypes)
Get only attribute entity references for component with IDs 100 - 110#
import hm
import hm.entities as ent

model = hm.Model()

output = hm.CollectionSet(model)

_ ,result = model.hm_getreferencedentitiesmark(
  collection=hm.Collection(model, ent.Component, list(range(100,111))),
  reference_flag=4,
  outputCollectionSet=output
)

print("entityTypes", result.entityTypes)