Have you ever wondered how to create an animation that included a component that deformed? The technique involves creating a part in the context of an assembly, which you may already know how to do. In our example, we will show how a spring can be compressed and uncompressed during the animation sequence.
Figure 1: The completed piston assembly.
For the sake of adhering to the topic at hand, and for the sake of brevity, this article assumes you know how to create components in the context of an assembly. We will also assume a basic understanding of swept features and using the motion manager to create simple animations.
Figure 2: In-context sweep path.
Looking at Figure 2, we can see the sweep path, which is the most critical part of this demonstration. The ends of the piston (the blocky shapes) have already been mated into position. The piston component itself has a distance mate (not shown) which controls how far the piston face is from the face of the block on the right. The right endpoint of the line is coincident with the face of the block. The small .1” construction line on the left is collinear with the line and its left endpoint is coincident with the face of the piston. The reason for the construction line is to control where the sweep path ends. This allows room for the sweep to exist so it doesn’t embed itself into the piston. To rephrase for clarity, consider the position of the sweep profile with relation to the start of the sweep path. The position of the sweep profile will be the same relative to the end of the sweep path. The .1” construction line creates room for the .1” diameter sweep profile.
Figure 3: Sweep path and completed spring.
Figure 3 shows the sketch used for the sweep profile. It also shows what the completed spring looks like after cleaning things up with a couple revolved features. After creating the initial in-context sweep path sketch, feel free to open the spring in its own window to finish working on it. Not only does this cut down on screen clutter, it helps to keep extra, unnecessary external references from being accidentally created. It may also be noteworthy to mention a helical path was not used for the sweep path. Rather, twist was added during the sweep operation (a total of 6 turns) to quickly and easily generate the spring.
Figure 4: Creating key frames for the piston distance mate.
The next critical factor in getting our spring to compress is to create key frames for the distance mate that controls the piston position. Figure 4 shows an example of this. It is necessary to expand the mates folder and locate the appropriate distance mate. Renaming the mate to “Piston Distance” made this task easier. Next, key frames are created at 1 second intervals for 6 seconds. This is all done via the right mouse button in the Motion Manager (again, we are assuming a basic understanding of animation within SOLIDWORKS at this point).
Once the key frames are in position, move the time bar to the first key frame and set the mate distance to the desired value. Repeat this process for all key frames. In our example, the key frame at 1 second sets the distance between the piston face and the face of the block to .8”. At 2 seconds, the distance is set back to the original value of 2.25”. At 3 seconds, the distance returns to .8”, and so on. The end result is the spring compressing and expanding a total of 3 times.
Calculating the Animation and Playback
During the calculation phase of the animation, any time the in-context component requires a rebuild to display properly, SOLIDWORKS will go ahead and rebuild the assembly. Unfortunately, there is no internal limiting factor that will force rendering to pause each frame while the rebuild is taking place. Therefore, segments of the animation where components are being moved or rotated will play back fine, while segments of the animation where components are being rebuilt will appear choppy. Frame rates will suffer terribly.
To get around the choppy frame rate issue, it is necessary to save the animation as a movie file, typically an AVI. The informational message shown in Figure 5 will ask if you would like to use “accelerated rendered animation processing”. It will be necessary to click No, forcing the renderer to use the slower animation processing, which allows a rebuild to occur at every frame. This is precisely what we need to obtain the “deformation” of our component.
Figure 5: Clicking No uses standard animation processing.
Here is a short clip of the piston in action, showing the spring deforming.