We have seen in a previous class that it is possible to create an animation by manually moving instances and generating configurations. The configurations are then used to create a sequence which can be animated.
In this lecture I will provide an approach to creating a program which generates configurations. If you have the knowledge of how to calculate the position and orientation of a components, you will be able to write a program to automatically generate configurations.
While animation of a projectile is the subject of this lecture, the approach presented is general. This process can be used on a variety of topics. It represent one method in which your knowledge as engineers can be brought into the CAD environment to develop custom applications.
The approach presented is based on the capability that I-DEAS can run program files from within a program file. This effectively allows the program developer to create subroutines to perform tasks, which can be called whenever required.
I-DEAS does not present a formal argument passing mechanism, however all variables are global. This means that any variable defined in one program is accessible in another. Since I-DEAS handles variable in this way, it is possible to communicate to other programs using pre-defined variables.
This subroutine approach, combined with I-DEAS ability to record commands, allows the program developer to generate a series of small programs which can be more easily tested. Once the programs are defined and working correctly, a main program can use those small programs to perform the final task.
Create a program within I-DEAS which will animate a rocket by using projectile motion. The program should prompt for,
The rocket should not only change position, but also change orientation to stay tangent to the path.
The equations for projectile motion under the effects of gravity are,
X(T) =X0+VX0*T Y(T) =Y0+VY0*T-0.5*32.2*T*T VX(T) =VX0 VY(T) =VY0-0.5*32.2*T
T = Time VX(T) = X velocity with respect to time VX0 = Initial X Velocity VY(T) = Y velocity with respect to time VY0 = Initial Y Velocity X(T) = X position with respect to time X0 = Initial X position Y(T) = Y position with respect to time Y0 = Initial Y position
An assembly will be used with two instances:
For this example, the rocket with be a single instance. However, it is no different if the object to be animated were to be an assembly.
At some point you will need to translate and rotate your instances. One way to make this convenient for programming, is to position your instances point of interest (center of gravity, rotation point, etc.) about the origin. This is a default location that the transformation commands will reference. If you set you instances up accordingly, you will be able to take advantage of this feature.
The approach presented is one based on calculating the absolute position and orientation of the object. As a result a configuration represents the zero orientation will be created. That configuration will be copied and transformed (rotated and translated) into each of the required configurations.
Since I-DEAS is capable of executing programs within a program, you have the opportunity of recording commands that perform a specific task, and then calling that program whenever you need that task. This subroutine approach makes developing programs for I-DEAS significantly easier than attempting to write (or record) a single program.
Steps 1 and 2 in the algorithm section represent model "prep" work that you would manually perform only once.
Step 3 represents the place where you bring your knowledge of the physical problem into play.
Steps 4a, 4b and 4c represent a copy configuration process. These steps should be recorded into a program file. The file will then be altered in reference variables for the position number. See Example: newconfigR5-pos.
Step 4d is the rotation process. This should be recorded and modified to reference the orientation variables. See Example: rotateR5-rockangle.
Step 4e is the translation process. This too should be recorded and modified to reference the translation variables. See Example: translate-xposypos.
The following main program was created using the previously recorded programs. Commands for control structures can be found in Programming The run program command was obtained by recording a program file while executing the stored programs (running the three programs in the order they must appear in the main program).
A word of warning regarding executing programs while recording a program.
When recording a program that executes another program, both the run commands and the commands being executed by the running program are recorded. You should delete the commands created by the executed program, or the resulting required action will take place twice. Once for the run command and once for the previously recorded commands.
See Example rocket-a.
Programs that you may wish to give to someone (on another computer) may not have access to your programs. Even if you give them your programs, they will have to edit in their path names to them.
Once you have a working program, you can insert the contents of your called programs into the main programs. In EMACS, the insert file command is (cntrl-X) (i). Such a program will stand alone, and does not require the support of external files. Just remember to delete the run program commands and the E : from the inserted file.
See Example rocket-b.
An archive file of the rocket model can be loaded from, "~langrana/me488/rocket.arc".
The program files listed in this lecture can also be loaded from,
"~langrana/me488/". Don't forget the ".prg" extensions!
Return to Syllabus
Return to ME488 Homepage