|
The Model View window is the system's graphical representation of the model. You can open a Model View window by the Window->Model View (new) command.
The Model View displays a special type of model elements that we usually call "Draw Objects". These are the objects you can attach to the segments, muscles, nodes, surfaces and such on the model. Most classes in AnyScript have corresponding draw classes, and the library of draw classes is constantly being extended and improved.
When active, the Model View updates the model as the computation proceeds. The update can involve the elements moving on the screen or colors or shapes changing to reflect the state of the model such as, for instance, muscle forces.
If the model is not too big and the computer is not too slow, the computation runs fast enough to create a dynamic animation in real time or close to that. However, for many larger models, the computation is too slow to give you a dynamic impression of the model's movement. The model view then provides the opportunity to save the individual frames for subsequent processing into a video animation that you can play at any speed you like.
This lesson looks into the functionality of the Model View, and even though you can probably use it intuitively, you may also pick up a useful trick or two you did not know about.
As usual, we need a model to work on. For this tutorial you can pick any model you may have, or you can download the familiar dumbbell example here: demo.arm2d.any. You will also need the accompanying STL file: dumbbell.stl.
Load the model into the AnyBody Modeling System and click Window -> Model View (new). You should get a window looking like this:

- The model is centered in the window, and you should be able to see all its elements. When you open a new Model View, the window automatically applies a Zoom All function that shrinks the view until all elements are visible.
- The model is not necessarily assembled correctly. All the segments at load time are positioned where they are defined in the AnyScript model. These positions rarely comply with the kinematical constraints such as joints. In fact, you might want to assemble the model above correctly by running the SetINitialConditions operation in the ArmStudy at the lower left corner of the screen.

This resolves the kinematical constraints and puts the model into the position defined by its drivers at time step 0. It produces the picture shown below.

Notice that we are looking at the model directly from the side. The default viewing direction is the xy plane. This coincides well with the International Society of Biomechanics standard of letting the saggital plane coincide with the global xy plane.
The Toolbar
The Model View has its own toolbar with following button functions:

- On/Off: This button switches automatic update of the window on and off. When switched off, the window does not update when the model is moving, and it is not possible to rotate, scale and pan the view. The advantage of switching the update off is that it makes the analysis run faster, especially on computers without a separate graphics processor.
- Properties
: Button that opens the properties window (equivalent to menu item Windows -> GUI Properties). In the properties, you have options for setting properties more specifically. We shall not go into details about these options here, see below. - Pan tool: Selecting this tool causes the cursor to change shape to a hand. When you drag the mouse over the screen with the left button down, the picture moves with it.
- Zoom tool: When this tool is active, the cursor resembles a small magnifying glass. When you drag the mouse over the picture with the left button down, it zooms in or out for upward or downward movements respectively.
- Spin tool: This tool allows you to spin the model dynamically on the screen by dragging the mouse with the left button down. The function is very intuitive and you will soon get the hang of it. It works like the model is attached to an imaginative sphere centered on the screen. When you hold down the left mouse button, you are grabbing the surface of the sphere and spinning it with the movement of the mouse.
- Default views: These three buttons represent predefined viewing directions: the xy plane (standard), the yz plane, and the xz plane respectively.
- Zoom all: This button refits the view to contain all the drawing elements.
- Record: This button starts video frame capturing explained in more detail below.
- Frame count: This panel displaying the number of captured frames during a recording.
- Stop recording: This button stops a video frame capturing session. The function is explained in detail below.
Model View Properties
The Model View properties accessible to the user contains three groups: - View point settings that are also set by the typical interaction with Model View. Through Pan, Zoom and Spin operations. These settings in the Properties be set directly or they can be grapped for use in a camera implemented into your model. The view point definition in the properties of Model View is using the AnyScript class AnyCameraModelView. This is done to enable easy exchange of view point properties between model and Model View. The individual properties is introduced in the AnyScript Reference Manual.
- Viewer properties that control viewer behavior.
- Scene properties that control general scene properties, such as back ground color, that are not given in the model definition.
Recording video
You may want to save a video file of you simulation for a presentation or simply to be able to show a large model running in real time. The model view provides the opportunity to save the individual graphics frames for subsequent processing into a video animation that you can play at any speed you like.
The function works much like a video tape recorder in the sense that you can push the red record button any time you like, and what happens in the window is subsequently saved for further processing. Let's see how it works. Try clicking the record button. A file manager will pop up and request you to select a location and a naming of the files you make. The name you select will be appended with _nnn where nnn if the frame number of each image. You can also select the image type, and jpeg is usually a good choice to limit the size of the images on the disk.
You will notice that the frame counter lights up, the "Rec" letters flashes, the record button becomes inactive indicating that you cannot push it twice, and the stop button becomes active indicating that you can push it.
Everything that takes place in the window will now be recorded. Try spinning the model around a little with the mouse and notice how the frame counter adds up. Notice that the system is intelligent enough to not record anything when nothing is happening. This means that you are in no hurry when you have pushed the Record button. The system only grabs frames when the picture actually changes. This happens either when you manipulate the picture manually as you did here, or when an analysis is running and producing new pictures as it proceeds. If you record an analysis with 100 time steps, then you will get 100 frames saved.
When you have 50-100 frames, push the "Stop recording" button. The system will ask you whether you really want to save the frames. If you answer no, they will be erased. If you save the frames you will be left with a bunch of image files like this:

The AnyBody Modeling System does not provide a video editing facility to process these files into an AVI, MPEG or similar video file format. However, many really good and cheap utilities are available for this purpose. We at AnyBody Technology use a very good and inexpensive tool called VideoMach available from www.Gromada.com.
Size matters
Regardless of how videos are processed, they are rather data intensive, and it is a really good idea to plan the recording well. Depending a little on the image format, the size of the frames you are saving is proportional to the area of the Model View. This means that it is more rational (and usually gives a better result) to resize the shape of the Model View to the animation you want in the end, than it is to change the size or crop the video afterwards.
The next lesson deals with the two different Chart Views for investigating analysis results.
|