hm_getreferencedentities

Finds entities that are referenced by the specified entity.

Syntax

hm_getreferencedentities entity_type entity_name_or_id reference_flag output_mark_id string_array number_of_strings ?search_type?

Type

HyperMesh Tcl Query Command

Description

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

Inputs

entity_type
The type of entity to query.
entity_name_or_id
The name or ID of the entity.
reference_flag
The type of referenced entities to find. Bit values are used and the value is calculated as (Bit0 + 2*Bit1 + 4*Bit2).
Bit0
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
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
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.
output_mark_id
The ID of the mark to place the found referenced entities on.Valid values are 1 and 2.
string_array
Reserved for future use. Must be set to 0.
number_of_strings
Reserved for future use. Must be set to 0.
search_type
By default, HyperMesh searches for entities by name, and if the name is not found, it then searches by ID. This option allows you to specify how the search for an entity should be conducted. Valid values are:
  • -byname - Search only by name.
  • -byid - Search only by ID.

Examples

To get all entities referenced by component with ID 100 on mark 1 and highlight them on the screen:

foreach entity_type [hm_getreferencedentities comps 100 7 1 0 0 -byid] {
    hm_highlightmark $entity_type 1 h
}

To get only collected entity references for component with ID 100 on mark 2:

hm_getreferencedentities comps 100 1 2 0 0 -byid

To get only data name entity references for component with ID 100 on mark 1:

hm_getreferencedentities comps 100 2 1 0 0 -byid

To get only attribute entity references for component with ID 100 on mark 1:

hm_getreferencedentities comps 100 4 1 0 0 -byid

Errors

Incorrect usage results in a Tcl error. To detect errors, you can use the catch command:
if { [ catch {command_name...} ] } {
   # Handle error
}

Version History

10-SA1-130