Model.EntityMoveUsingArray#

Model.EntityMoveUsingArray(collector_list, element_list)#

Organizes a different group of elements to their respective collectors.

Parameters:
  • collector_list (EntityList2) – A list of entity collector lists that hold the entity IDs.

  • element_list (EntityList) – A list of element entities to be organized into specific collectors.

Note

This function currently supports moving elements to components only. This is optimized for organizing a different group of elements to their respective collectors from a Tcl script. For example, elements with IDs 1 to 5 must be moved to component ID 1, elements with IDs 6 to 10 must be moved to comp ID 2 and elements with IDs 11 to 15 must be moved to comp ID 3.

Example#

Accepts a 3 X 2 matrix with its values specified in a single line. The number of rows is 3 and number of columns is 2. The rest of the parameter specifies that the first 5 elements from the entityIds array must be moved to comp ID 1, the next 5 elements moved to comp ID 2, and the last 5 elements moved to component with ID ID 3.#
import hm
import hm.entities as ent

model = hm.Model()

complist = [
    [ent.Component(model, 1), ent.Component(model, 5)],
    [ent.Component(model, 2), ent.Component(model, 5)],
    [ent.Component(model, 3), ent.Component(model, 5)]
]

elemlist = [ent.Element(model, el) for el in range(1, 16)]

model.EntityMoveUsingArray(
    collector_list=complist, element_list=elemlist
    )

Note

The number of elements to move in element_list MUST be equal to the sum of the values specified for the number of elements to move in the collector_list.