Iterating through the agents of an agent group
Maya
from AtomsMaya.hostbridge.atomsgroup import MayaAtomsGroupHostBridge
nh = MayaAtomsGroupHostBridge()
nh.set_app_obj("tcAgentGroupNodeShape1")
ag = nh.get_agent_group()
# returns the group local ids of the agents
ids = ag.agentLocalIds()
print(ids)
for agent_id in ids:
# to double check the ids correspond to the right agent, get the agents with the '.agent' method and print the 'groupId'
agent = ag.agent(agent_id)
print(agent.metadata()["groupId"].value())Houdini
from AtomsHoudini.hostbridge.atomsgroup import HoudiniAtomsGroupHostBridge
nh = HoudiniAtomsGroupHostBridge()
nh.set_app_obj("/obj/AgentGroupName")
ag = nh.get_agent_group()
# returns the group local ids of the agents
ids = ag.agentLocalIds()
print(ids)
for agent_id in ids:
# to double check the ids correspond to the right agent, get the agents with the '.agent' method and print the 'groupId'
agent = ag.agent(agent_id)
print(agent.metadata()["groupId"].value())