Model.hm_entityincollector_byname#

Model.hm_entityincollector_byname(collector, collector_name, entity_type, config_num, type_num)#

Returns the number of entities in a collector.

Parameters:
  • collector (EntityFullType) – The entity type of the queried collector.

  • collector_name (hwString) – The name of the queried collector.

  • entity_type (EntityFullType) – The type of the entity to be counted.

  • config_num (int) – The configuration number of the entities to be counted. If set to zero, the entities are counted regardless of their configuration.

  • type_num (int) – The type number of the entities to be counted. If set to zero, all of the entities are counted regardless of their type.

Returns:

Example#

Get the number of solid entities in component with name “ solid “#
import hm
import hm.entities as ent

model = hm.Model()

_, result = model.hm_entityincollector_byname(
    collector=ent.Component,
    collector_name="solid",
    entity_type=ent.Solid,
    config_num=0,
    type_num=0
)

print("Number of Entities: ", result.num_of_entities)