Model.hm_getoccupiedentitiesinrange#

Model.hm_getoccupiedentitiesinrange(entity_type, pool_id, range)#

Returns the list of occupied IDs in a specific range. The values are returned as a compacted list using ranges and commas where applicable.

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

  • pool_id (int) – The ID of the entity pool to query.

  • range (hwString) – The ID range within the specified pool to query. This should be encapsulated in quotes.

Returns:

  • hwReturnStatus - Status object

  • HmQueryResult - Result object containing the output values:

    • occupiedIds (str) - A string representing a compacted list of occupied IDs in a specific range.

Example#

Get the element IDs in use in pool 2 for the range 100 - 200#
import hm
import hm.entities as ent

model = hm.Model()

component_collection = hm.Collection(model, ent.Component, [100])
out_node_collection = hm.Collection(model, ent.Node, populate=False)

_, result = model.hm_getoccupiedentitiesinrange(
    entity_type=ent.Element, pool_id=2, range="100-200"
)
print("Occupied ids:", result.occupiedIds)