Model.hm_entitylist#

Model.hm_entitylist(entity, listType, mode='active')#

Returns a list of names or IDs of all entities of the requested type.

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

  • listType (hwString) –

    The type of list to generate. Valid values are:

    name - Return the list of names. Only named entity types support this option.

    id - Return the list of IDs. All entity types support this option.

    solvername - Returns the list of solver names for entity types enabled for name pool.

  • mode (hwString) –

    An optional argument that specifies which entity types are returned:

    active - Return only the active entities. This is the default if not specified.

    all - Return both active and inactive entities.

    inactive - Return only the inactive entities.

Returns:

  • hwReturnStatus - Status object

  • HmQueryResult - Result object containing the output values:

    • Keys valid for listType="name"

      • entityList (list of strings)

    • Keys valid for listType="id"

      • entityList (numpy.ndarray)

    • Keys valid for listType="solvername"

      • entityList (list of strings)

Examples#

Get the list of node IDs#
import hm
import hm.entities as ent

model = hm.Model()

_, result = model.hm_entitylist(entity=ent.Node, listType="id")

print(result.entityList)
Get the list of of component names#
import hm
import hm.entities as ent

model = hm.Model()

_, result = model.hm_entitylist(entity=ent.Component, listType="name")

print(result.entityList)