question

Abhijeet P avatar image
0 Likes"
Abhijeet P asked Ryan Clark commented

How to crate animation of flow item for multiple pass through processor ?

How to create animation for flow item as it is passes three times in to & fro direction over processor length during cycle time? Thanks in advance for reply.

FlexSim 18.0.10
flexsim 18.0.10animation creator
· 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.

1 Answer

Felix Möhlmann avatar image
2 Likes"
Felix Möhlmann answered Ryan Clark commented

I built a small sample model to demonstrate how this can be done.

AnimationOnProcessor_18_0_fm.fsm

I took the following steps:

- Add a simple setup of Source -> Processor -> Sink

- Duplicate the basic "Box" item in the FlowItem Bin. I renamed it "BoxAnimated".

- Open the properties and click "Edit" under "Visuals/Animations" in the General tab.

1630924306144.png

- In the window that opens, drag a "Cube" from the library into the model and resize it to be the same size as the original item and place it in the same location as well. This shape will visually replace the actual item later on.

- In the "Animations and Components" bar at the bottom add a new animation.

- With the cube selected, add a new "keyframe" at time 0.

1630924503191.png

- Now move the item as far as it should travel on the processor and add a new keyframe at a later time (I chose 1s).

- Then, I move the cube back and add a third keyframe at 2s. When you hit run now, the cube should move back and forth between the two positions.

1630924815951.png

- In the properties on the right, under "Animation1" (or whatever else you named your animation), set the repeat type to "Repeat Set Number" and set the value to 3.

1630924782870.png

- Back in the properties window of the flow item, delete the path under "3D Shape", so only the cube you just added is drawn.

1630925946481.png

- Now we switch to the properties window of the processor. First, uncheck the "Convey Items Across Processor Length" option in the top right.

- Next, add two things to the "OnEntry" trigger: Set the x-position of the item to 0, and the other two values to the middle of the respective axis of the processor (Set Location). And tell the animation you defined to start (Start Animation).

1630925130947.png

If you now choose to create the newly defined FlowItem in the source, it will run its animation when entering the processor. The time the animation takes will probably not align with the process time though. This could be fixed by moving the keyframes of the animations, so its total time is equal to the process time, but there is an easier way.

When you open the code window of the "OnEntry" trigger, you will find the line

  1. object.animations[/** \nAnimation: *//***tag:animation*//**/"Animation1"/**/].start();

near the bottom. You can add parameters to this command to influence the speed of the animation.

  1. object.animations[/** \nAnimation: *//***tag:animation*//**/"Animation1"/**/].start(SPEED_TYPE_DURATION, getvarnode(current, "cycletime").evaluate()/3);

will set the speed will set the speed so the animation can run exactly 3 times during the process time of the processor.

More info in the documentation:

https://docs.flexsim.com/en/20.2/Reference/CodingInFlexSim/FlexScriptAPIReference/Data/Animation.html#Method-start


· 4
5 |100000

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