Model.hm_getreferencedentities#
- Model.hm_getreferencedentities(entity, reference_flag, outputCollectionSet, string_array=0, exclude_regions=0)#
Finds entities that are referenced by the specified entity, including collected references, data name references, and attribute entity references. Each type of referenced 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 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.
exclude_regions (int) – Reserved for future development. Must be set to 0.
- Returns:
hwReturnStatus- Status objectHmQueryResult- Result object containing the output values:entityTypes (list of strings)
Examples#
Get all entities referenced by component with ID 100 on collection set and highlight them on the screen#import hm import hm.entities as ent model = hm.Model() output = hm.CollectionSet(model) _ ,result = model.hm_getreferencedentities( entity=ent.Component(model,100), reference_flag=7, outputCollectionSet=output, ) print("entityTypes", result.entityTypes)
Get only collected entity references for component with ID 100#import hm import hm.entities as ent model = hm.Model() output = hm.CollectionSet(model) _ ,result = model.hm_getreferencedentities( entity=ent.Component(model,100), reference_flag=1, outputCollectionSet=output, ) print("entityTypes", result.entityTypes)
Get only data name entity references for component with ID 100#import hm import hm.entities as ent model = hm.Model() output = hm.CollectionSet(model) _ ,result = model.hm_getreferencedentities( entity=ent.Component(model,100), reference_flag=2, outputCollectionSet=output, ) print("entityTypes", result.entityTypes)
Get only attribute entity references for component with ID 100#import hm import hm.entities as ent model = hm.Model() output = hm.CollectionSet(model) _ ,result = model.hm_getreferencedentities( entity=ent.Component(model,100), reference_flag=4, outputCollectionSet=output, ) print("entityTypes", result.entityTypes)