Management models are used for modifying SIMO data hierarchies, such as removing objects constructing new objects and grouping objects.
All management model functions should have the following parameters:
Below is a simple example of a management model for removing each object from current simulation level. The model implementation can utilize the public object attributes and methods of simulator and data handler:
def remove_objects_from_current_level(sim, depthind, params, tind, toremove):
"""Remove objects from current evaluation level
sim -- simulator instance
depthind -- current model chain depth index as int
params -- management model parameters
tind -- target index
"""
# get the level that all objects should be removed from
level = sim.level
for i in range(tind.shape[0]):
it, br, o = tind[i,0:3]
sim.data.del_objects(it, br, level, [o])