Model.hm_entityrecorder#

Model.hm_entityrecorder(entity_type, option)#

Records the IDs of the entities created while the recorder is enabled. This is useful for finding the IDs of multiple entities created during various processes.

The recorder must be turned on to enable recording. It is also important to make sure to turn off the recorder. See the option argument below.

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

  • option (hwString) –

    ids - Get the list of IDs recorded while the recorder is on.

    count - Get the number of IDs recorded while the recorder is on.

Returns:

  • hwReturnStatus - Status object

  • HmQueryResult - Result object containing the output values:

    • Keys valid for option="ids"

      • entities (EntityList)

    • Keys valid for option="count"

      • numberOfEntities (int)

Example#

Record the created components and get the number and list of recorded IDs#
import hm
import hm.entities as ent

model = hm.Model()

_, result = model.hm_entityrecorder(entity_type=ent.Component, option="ids")

comp_ids = result.entities
print("comp_ids", comp_ids)

_, result = model.hm_entityrecorder(entity_type=ent.Component, option="count")

num_comps = result.numberOfEntities
print("num_comps", num_comps)