article

Paul Toone avatar image
0 Likes"
Paul Toone posted anon-user edited

Tutorial - Advanced Animation Creator Concepts   

This tutorial is designed to give you examples of how the animation creator will work in context. In this tutorial, you'll learn some of the advanced concepts of the animation creator. Before completing this tutorial, you should consider completing the Basic Animation Creator Concepts tutorial.

In this tutorial, you will create a surrogate item for flowitems that will enter a Processor. Using this surrogate item, you'll make the items appear to rotate as they move through the Processor.

Tasks Covered

This tutorial will include the following tasks:

  1. Creating a basic model
  2. Adding a component
  3. Animating the component
  4. Creating a surrogate and animation variable
  5. Triggering an animation in a simulation model

For More Information

This tutorial will provide hands-on experience with the animation creator. But if you would like more detailed information about this tool, please refer to:

Advanced Animation Creator Tutorial

Complete the following steps:

Step 1 - Create a Basic Model

You'll start by creating a simple model that will have three different types of flowitems that will each have three different colors.

  1. With a blank model open, drag out a Source, a Queue, a Processor, and a Sink. Move them in the model so they are in the approximate positions shown in the following image:

  1. Next you'll need to connect the objects in the model. Make 'A' connections between:
    • The Source and the Queue
    • The Queue and the Processor
    • The Processor and the Sink
  2. Double-click the Source to open its Properties dialog box.
  3. In the Triggers tab, click the Add button next to the OnCreation trigger to open a menu.
  4. Select Data then Set Item Type and Color from the menu to open up the Set Item Type and Color picklist options, as shown in the following image:

  1. You can just use the default settings, which randomly creates 3 different flowitem types and assigns it one of three colors based on its item type.

You can now test your animation by running your simulation model. Click the Reset and Run buttons on the simulation control panel. When your simulation runs, you'll see flowitems with three different colors moving through the model.

Step 2 - Add a Component

Now you're going to create a component on the Processor that will eventually be used as a surrogate. A surrogate is a special kind of component that will be replaced visually by another object (such as a flowitem) when an animation is running in the simulation model. It acts like a placeholder for another object in an animation.

  1. Right-click on the Processor and select Edit, then Animations to open the animation creator.
  2. On the animation toolbar, find the Add Component button to add a new component to the Processor animation.
  3. Make sure the new component is selected. In Quick Properties, under General Properties, change the component's name to MyItem (in the top-most box).
  4. Now you'll change the component so that it is the same shape as the default flowitem (a box). Change the X-size to 0.61, the Y-size to 0.61, and the Z-size to 0.30. NOTE: If you were to look at the dimensions of a box in the Flowitem Bin, it would have these settings.
  5. Now you'll add an animation to the Processor object. On the animation toolbar, find the Animation box and click the Add button next to it to add a new animation.
  6. The Animation box should now read Animation1. Click inside the box to highlight the text and change it to ProcessItems for easier reference.

Step 3 - Animate the Component

Now you'll animate the MyItem component so that it will rotate as it moves through the Processor. You'll set the initial position of the MyItem component. Then, you'll add two keyframes and change the position and rotation of the MyItem component in the two different keyframes.

  1. Using the preview windows, move the component so that it is on the beginnging of the Processor, as shown in the following image:

  1. Click the Add Keyframe button to add a keyframe at time 0.
  2. Repeat this step to add a second keyframe.
  3. Click the second keyframe and drag it approximately to time 8 on the timeline.
  4. With the keyframes in place, you will now change the component's animation. Click the arrow next to MyItem in the timeline header to expand the list of properties for the MyItem component, as shown in the following image:

  1. Click the second keyframe so that all the keyframes turn red. Check to make sure the component is selected in the preview windows as well.
  2. Using the preview windows, move the component so that it is at the other end of the Processor, as shown in the following image:

  1. In Quick Properties, under General Properties, change the component's Z-rotation to 360.

Now when the animation runs, the MyItem component will rotate 360 degrees on its z-axis in 8 seconds, meaning it will complete a full rotation in 8 seconds. Test your animation by clicking the Play button on the animation toolbar. You should see the MyItem component continuously spin around, as shown in the following image:

Step 4 - Create a Surrogate and Animation Variable

Now you will change the MyItem component into a surrogate. A surrogate is a special kind of component that will be replaced visually by another object (such as a flowitem) when an animation is running in the simulation model. It acts like a placeholder for another object in an animation. In this case, the MyItem component will be replaced by the default flowitem shape: a box.

  1. Click the MyItem component in one of the preview windows to select it.
  2. In Quick Properties, under MyItem: Component Properties, open the Draw Surrogate menu and select Flow Item: Box. Now the surrogate will change visually to look like a flowitem box during the animation.
  3. Right below the Draw Surrogate menu, a window will appear that will prompt you to create an animation variable, as shown in the following image:

  1. If this window doesn't appear, it's possible that you outside the Quick Properties pane and closed the window. To make the window re-appear, open the Draw Surrogate menu and select Flow Item: Box again.
  2. Click the Add button to add a new animation variable called MyItemSurrogate. Notice that this animation variable now appears in Quick Properties under ProcessItems in the Animation Variables box, as shown in the following image:

Step 5 - Trigger an Animation in a Simulation Model

By default, surrogates are hidden in the 3D model until it is assigned a valid 3D object. In this step, you will change the Processor's settings to display the surrogate when a flowitem enters it.

  1. Return to the 3D model by clicking the Model tab on the center pane.
  2. Double-click the Processor to open its Properties dialog box.
  3. In the Triggers tab, click the Add button next to the OnEntry trigger to open a menu.
  4. Select Visual then Start Animation from the menu to open up the Start Animation picklist options, as shown in the following image:

  1. Click the arrow next to the Animation box to open a menu. Select ProcessItems (the animation you just created).
  2. Click the Add button underneath the Start Animation picklist options to open another menu.
  3. Select Visual then Set Animation Variable from the menu to open up the Set Animation Variable picklist options, as shown in the following image:

  1. Click the arrow next to the Animation box to open a menu. Select ProcessItems.
  2. Click the arrow next to the Variable box to open a menu. Select MyItemSurrogate (the animation variable you created for the surrogate).
  3. Click the arrow nex to the Value to open a menu. Select item so that it will replace the flowitem in the animation.
  4. Click outside of the box to save the changes.
  5. With the Processor's Propertues dialog box still open, click in the General tab. Under Flags, clear the Show Contents checkbox so that the surrogate will replace the incoming flowitems in the Processor.
  6. Click the OK button to save the changes and close the Properties dialog box.

Starting Animations with FlexScript
If you want to create custom codes that start an animation, you can use the following Flexscript code on the OnEntry trigger:

setanimationvar(current, "Process", "MyItemSurrogate", item); startanimation(current, "Process");

And the following code on the OnExit trigger:

setanimationvar(current, "Process", "MyItemSurrogate", 0); stopanimation(current, "Process");

You can now test your animation by running your simulation model. Click the Reset and Run buttons on the simulation control panel. When your simulation runs, the flowitems will rotate inside the Processor, as shown in the following image:

This completes this the Advanced Animation Creator Concepts tutorial.

flexsim users manualusers manual
· 1
5 |100000

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

anon-user avatar image anon-user commented ·

The Tutorial is excellent, but I have a doubt if I put the capacity in the processor of 2 in the place of 1 the animation is restarted when the second object what can I do that in the place that happens, these two rotate inside the processor??

0 Likes 0 ·

Article

Contributors

paul.t contributed to this article

Navigation

FlexSim 2016.1