Model.hm_getcrossreferencedentities_byname#

Model.hm_getcrossreferencedentities_byname(entity_type, entity_name, reference_flag, outputCollectionSet, string_array=0, exclude_regions=0)#

Finds entities that reference the specified entity. This includes 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 then placed on the specified collection for those entity types. See the list of supported entities for this function.

Parameters:
  • entity_type (EntityFullType) – The type of entity to query.

  • entity_name (hwString) – The name of 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 use. Must be set to 0.

  • exclude_regions (int) –

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

    1 - Exclude region entities in the search.

Returns:

Example#

Get all entities that cross-reference component with name “comp1” 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_byname(
    entity_name=ent.Component,
    entity_type="comp1",
    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")