How to use TASKTYPE_STARTANIMATION

How to use TASKTYPE_STARTANIMATION

ChoiHyunWoong
Not applicable
23 Views
6 Replies
Message 1 of 7

How to use TASKTYPE_STARTANIMATION

ChoiHyunWoong
Not applicable

[ FlexSim 24.1.0 ]

As always, thank you for your support!

I am trying to assign a task with a loading animation to a TaskExcuter through the TaskSequence.addTask() method.

Also, TaskExcuter has custom animation applied through Animation Creator.

I want to load the items after the TaskExcuter moves to the destination (10,0,0) and performs a custom animation.


TaskSequence ts = TaskSequence.create(Model.find("TaskExcuter1"), 0, 0);

ts.addTask(TASKTYPE_TRAVELTOLOC, NULL, NULL, 10, 0 , 0);

ts.addTask(TASKTYPE_STARTANIMATION, NULL, NULL, 1);

ts.addTask(TASKTYPE_LOAD, item, station, 1);

ts.dispatch();


When you run the code above, the TaskExcuter moves to the destination (10,0,0), starts the custom animation, and loads the item even though the animation has not ended.


Additionally, please check the durationtype parameter and durationtvalue parameter, which are the arguments of TASKTYPE_STARTANIMATION.

0 Likes
Accepted solutions (1)
24 Views
6 Replies
Replies (6)
Message 2 of 7

moehlmann_fe
Explorer
Explorer
Accepted solution

The task only starts the animation. It is finished in an instant. If you want to wait until the animation has finished, add a delay task with time equal to the animation duration to the task sequence.

For more information about the speed and duration parameters see the documentation on the Animation class.

https://docs.flexsim.com/en/24.0/Reference/CodingInFlexSim/FlexScriptAPIReference/Data/Animation.htm...

0 Likes
Message 3 of 7

ChoiHyunWoong
Not applicable

Thank you for reply.

How do I change the code that was written?

Are durationType and speedType parameter the same? Please write explicitly.


---------------------------------------------------------------------


TaskSequence ts = TaskSequence.create(Model.find("TaskExcuter1"), 0, 0);

ts.addTask(TASKTYPE_TRAVELTOLOC, NULL, NULL, 10, 0 , 0);

ts.addTask(TASKTYPE_STARTANIMATION, NULL, NULL, 1);

ts.addTask(TASKTYPE_LOAD, item, station, 1);

ts.dispatch();

0 Likes
Message 4 of 7

joerg_vogel_HsH
Mentor
Mentor

@Choi Hyun Woong, sure, you shown in your presented code a higher level of knowledge and Felix described it good enough to do it on your own from there.

..
ts.addTask(TASKTYPE_STARTANIMATION, NULL, NULL, 1);
ts.addTask(TASKTYPE_DELAY, NULL, NULL, timevar, statevar);
ts.addTask(TASKTYPE_LOAD, item, station, 1);
..

You need to assign to local variables timevar and statevar suitable values. timevar gets a value of animation properties, which is how long this animation takes.

You can test value behaviors in small models on your own. This is what I do to get sufficient results.

0 Likes
Message 5 of 7

ChoiHyunWoong
Not applicable

Thank you for reply.

The code you suggested loads after the custom animation ends.

I am curious about the var2 and var3 parameters of TASKTYPE_STARTANIMATION.

Additionally, can't the TASKTYPE_STARTANIMATION method delay while an animation is being performed?

https://docs.flexsim.com/en/23.2/Reference/TaskSequences/TaskTypes/TaskTypes.html#startAnimation

0 Likes
Message 6 of 7

moehlmann_fe
Explorer
Explorer

var2 and var3 are the optional speedType and speedValue parameters respectively that allow you to customize the duration of the animation. If the documentation is unclear, please be more specific about what you want to know about the parameters.

https://docs.flexsim.com/en/24.0/Reference/CodingInFlexSim/FlexScriptAPIReference/Data/Animation.htm...

And as I already noted in my original answer. No, the start animation task does not allow for a build-in delay.

0 Likes
Message 7 of 7

ChoiHyunWoong
Not applicable

Thank you for reply!

Your answer is very clear. It helped me a lot.

0 Likes