Model.hm_getcrossreferencedentities#

Model.hm_getcrossreferencedentities(entity, reference_flag, outputCollectionSet, string_array=0, exclude_regions=0)#

Finds entities that reference the specified entity, including collected references, data name references, and attribute entity references. Each type of entity that references the specified input entity 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 this function.

Parameters:
  • entity (Entity) – The object describing the entity to query.

  • reference_flag (int) –

    The type of cross-reference entities to find.

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

    Bit0

    Consideration of collected entity cross-references. Valid values are:

    0 - Do not consider collected entity cross-references.

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

    Bit1

    Consideration of data name entity cross-references. Valid values are:

    0 - Do not consider data name entity cross-references.

    1 - Consider data name entity cross-references. If the specified entity is not referenced by any data names, nothing will be returned for this bit.

    Bit2

    Consideration of attribute entity cross-references. Valid values are:

    0 - Do not consider attribute entity cross-references.

    1 - Consider attribute entity cross-references. If the specified entity is not referenced by any entity attributes, 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
    Consideration of collected entity cross-references (Bit0)
    Consideration of data name entity cross-references (Bit1)
    Consideration of attribute entity cross-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.

  • exclude_regions (int) –

    0 - Include region entities in the search. (default)

    1 - Exclude region entities in the search.

Returns:

Examples#

Get all entities that cross-reference component with ID 100 on outputCollectionSet and highlight them on the screen#
import hm
import hm.entities as ent

model = hm.Model()

out_col_set = hm.CollectionSet(model)

_, result = model.hm_getcrossreferencedentities(
    entity=ent.Component(model, 100), reference_flag=7, outputCollectionSet=out_col_set
)

print("Cross-referenced entities: ", result.entityTypes)

for col in out_col_set:
    model.hm_highlightmark(collection=col, highlight="h")
Get only collected entity cross-references for component with ID 100 on outputCollectionSet#
import hm
import hm.entities as ent

model = hm.Model()

out_col_set = hm.CollectionSet(model)

_, result = model.hm_getcrossreferencedentities(
    entity=ent.Component(model, 100), reference_flag=1, outputCollectionSet=out_col_set
)

print("Cross-referenced entities: ", result.entityTypes)
Get only data name entity cross-references for component with ID 100 on outputCollectionSet#
import hm
import hm.entities as ent

model = hm.Model()

out_col_set = hm.CollectionSet(model)

_, result = model.hm_getcrossreferencedentities(
    entity=ent.Component(model, 100), reference_flag=2, outputCollectionSet=out_col_set
)

print("Cross-referenced entities: ", result.entityTypes)
Get only attribute entity cross-references for component with ID 100 on outputCollectionSet#
import hm
import hm.entities as ent

model = hm.Model()

out_col_set = hm.CollectionSet(model)

_, result = model.hm_getcrossreferencedentities(
    entity=ent.Component(model, 100), reference_flag=4, outputCollectionSet=out_col_set
)

print("Cross-referenced entities: ", result.entityTypes)