Is there an expression to update an attribute on all objects inside a Container?

30 views
Skip to first unread message

Anthony Earl

unread,
Apr 25, 2024, 8:50:09 PMApr 25
to JaamSim Users Discussion Group
I've attached a trivial example to help express this question.

I've a model I'm working on that uses containers.  When an attribute on the container gets updated I would like to make a corresponding change to an attribute on each of its children.

I can't work out an expression to do that.

I know I'm able to make a copy of each of the children but just can't see how to update the items in the EntityList itself.

I know I can set these attributes when the children are first added to the container but in the more complex model I'm working on, that's not sufficient.

Any help would really be appreciated.

Thanks,
  Anthony.
understandContainers.cfg

Paul McIver

unread,
Apr 26, 2024, 7:05:46 AMApr 26
to JaamSim Users Discussion Group
Asked pretty much the same question in an older post, programmatically assigning a value to to attributes of entities within a container.

Harry King

unread,
Apr 26, 2024, 12:28:26 PMApr 26
to JaamSim Users Discussion Group
The solution is given in my post under "Assign attribute to Entity on EntityContainer".

Harry

Reply all
Reply to author
Forward
0 new messages