Model.hm_entityincollector_byentity#

Model.hm_entityincollector_byentity(collector_entity, entity_type, config_num, type_num)#

Returns the number of entities in a collector.

Parameters:
  • collector_entity (Entity) – The object describing the entity 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 ID 1#
import hm
import hm.entities as ent

model = hm.Model()

_, result = model.hm_entityincollector_byentity(
    collector_entity=ent.Component(model, 5),
    entity_type=ent.Property,
    config_num=0,
    type_num=0
)

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