AnswerHub Upload Issue
Our AnswerHub community currently has a bug that prevents you from attaching your model or other files to your questions. AnswerHub is aware of this issue and they are working on a fix. Until we receive their patch, you can upload your models and other files to FlexSim's file share site. Include the file name in your question so that we know which upload to reference.


Jonathan avatar image
Jonathan asked Felix Möhlmann edited

Loop an Animation

I want an operator to loop the UseTablet animation for the duration of the time they're processing at a machine.
Thus far I've created a Person Flow with a triggered source on process start. Custom code starts the animation and then a Decide is supposed to determine whether or not the animation is still running (simply spamming the start animation interrupts and restarts the animation so that is visually unappealing). If the animation is not running then loop back to the animation start code, otherwise send the token to a sink.

The problem I'm having with this approach is finding the appropriate value to check to determine if the person is still running the animation.


Model.find("InsertOperator3").find(">visual/animationinfo/animations").value == "UseTablet"

doesn't work because there's no data in that '.value'

Am I on the right track? Is there a better way? If I want to use this flow (once working) on other operators, how do I do that?

Here's a screenshot of my flow. The delays off the Decide are only there for debugging to see where my token is going:

FlexSim 22.1.1
animationsperson flow
1659792789503.png (20.3 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Felix Möhlmann avatar image
Felix Möhlmann answered

You can specify how fast the animation should run and how often it is repeated directly in the start() command. To have the animation repeat indefinitely until stopped you'd use REPEAT_TYPE_TIME_AFTER_END as the repeatType and 0 as the repeatValue.

An easy to use the flow for multiple operators is to add them all to a group. This allows you to listen for an event on all members of the groups at once in the event-triggered source. With the 'Assign Event Object To' field, you can get a reference to the object on which the event fired and use it later in the flow to refer to the correct operator.


1659871046561.png (20.0 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jonathan avatar image
Jonathan answered Felix Möhlmann edited

I added an onEntry trigger to my machine to start the animation. But I can't get the animation to repeat using:

{ // ************* PickOption Start ************* //


/***tag:title*//**Start Animation*/

if (/** \nCondition: *//***tag:condition*//**/true/**/) {

Object object = /** \nObject: *//***tag:object*//**/current.centerObjects[1]/**/;

object.animations[/** \nAnimation: *//***tag:animation*//**/"UseTablet"/**/].start(0,0,REPEAT_TYPE_TIME_AFTER_END,0);


} // ******* PickOption End ******* //

What am I doing wrong? There's no examples of this.

· 3
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

That's weird, this works fine on my end.

Just to be sure; did you 'Apply' the changes to the code before you ran the model again after adding the parameters to the code?

Do you maybe start the animation a second time at some other point in your model without the repeat type set?
0 Likes 0 ·
Jonathan avatar image Jonathan Felix Möhlmann ·

There it goes. Now it's working. I'd applied the changes but it didn't do it the first time. Strange. But it's working now. Thank you.

0 Likes 0 ·

Yes, I tried that exact scenario. The source only creates a single item (a different source creates more to keep the clock going). And the operator is still doing the animation over 300s later.


Does the animation just stop in your model or does the operator go back to a different animation (walk or idle)?

0 Likes 0 ·
1659982296401.png (388.3 KiB)

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.