|
The AnyBody Modeling System comes with a command line version included. It is named AnyBodyCon.exe ("Con" for console application), and you will find it in the directory where you install AnyBody. The command line version is - as the name indicates - a version of the AnyBody Modeling System with the user interface stripped off. This means that it is executed from a DOS command prompt or - more importantly - by a batch file or another software application.

As you may suspect from that introduction, the command line version is mostly designed for technical users wishing to set up their own data processing application by piecing different types of software together.
The console application can either work interactively and accepts commands that you type in response to its command prompt, or it can take its input from a file containing macro commands. Let us try the interactive mode. We need a model to work on, so please download and save Demo.outputfile.any in some working directory.
Here's a tricky part: AnyBodyCon does currently not have any commands for changing the working directory after it has been started. Therefore, it must be started in a way so that it can find the model files you intend to load. You can basically do this in two ways from a DOS prompt: - You change directory to wherever you saved Demo.outputfile.any and from here you run the console program using its full path, e.g. "C:\Program Files\AnyBody Technology\AnyBody.3.0\AnyBodyCon.exe".
- You open AnyBody with a /d argument that sets the working directory of console. You can either change the directory to the place of AnyBodyCon.exe first or you can use the full path from anywhere, e.g. "C:\Program Files\AnyBody Technology\AnyBody.3.0\AnyBodyCon.exe" /d "c:\...\My Documents"
Naturally, you can add the path of AnyBodyCon.exe to the path of your DOS command prompt environment, but be aware that this can cause confusion in case of multiple installations of AnyBody. We shall cover this issue of using DOS PATH in more details in a separate section later in this lesson.
You are now ready to use the console application. The application is rather primitive. It only understands eight different commands. You also always get help by using the 'help' command or by calling AnyBodyCon with /? argument. The latter approach will give you the full help including descriptions of the possible program arguments. The table below contain a description of the commands accepted by the AnyBody console.
Command name | Functionality | load "filename.any" | Example: load "demo.outputfile.any"
This command loads an AnyScript model into the system and compiles it. Don't forget to put the filename between double quotes. | operation <op.name> | Example: operation Main.ArmStudyInverseDynamicAnalysis
This command sets the active operation. This is what you must do as the first thing after you load a model. All the remaining commands except exit require an active operation to work on. | run | Example: run
This command takes no arguments. It simply runs the active operation. | step | Example: step
This command takes no arguments. It performs a single step of the active operation. | reset | Example: reset
This command takes no arguments. It resets the active operation. | print <object> | Example: print Main.ArmModel.Jnts.Shoulder.Pos
This command prints the value of a single variable. If the variable is a folder, it just lists the names of the element of the folder. | printdown <object> | Example: printdown Main.ArmModel.Jnts
This command recursively prints the values of all elements in an entire folder. | exit | Example: Exit
This command exits anybodycon.exe and returns to the dos command prompt. |
Now let us try the console application. Start AnyBodyCon.exe from the command prompt and issue the command sequence:
load "demo.outputfile.any" operation Main.ArmStudy.InverseDynamicAnalysis run exit
You will see the system write a whole lot of messages about the progress of the computation. It is not nearly as interesting as running the Windows version of the AnyBody Modeling System. So why bother?
Well, the command line version of the AnyBody Modeling System faithfully performs all the computations you ask it to through the command line. But what good does it do you, and how can you access the results? You could issue print or printdown commands and have the results listed on the screen. It would give you a whole lot of probably completely useless numbers to look at.
A more clever way to use the command line version is to insert AnyOutputFile objects into the AnyScript model. If you load the demo.outputfile.any model you have just worked on into the Windows version of the AnyBody Modeling System, you will notice that it contains two definitions of AnyOutputFile objects inside the ArmStudy.
// The study: Operations to be performed on the model
AnyBodyStudy ArmStudy = {
AnyFolder &Model = .ArmModel;
RecruitmentSolver = MinMaxSimplex;
Gravity = {0.0, -9.81, 0.0};
AnyOutputFile OutFile1 = {
FileName = "out1.csv";
AnyVar MaxAct = .MaxMuscleActivity;
AnyFloat TestTensorConst = {
{1, 2, 3},
{1, 2, 3}
};
AnyFloat TestTensor = {
{
{1, 2, 3},
{1, 2, 3}*2,
{1, 2, 3}*3,
{1, 2, 3}*MaxAct
},
{
{1, 2, 3},
{1, 2, 3}*2,
{1, 2, 3}*3,
{1, 2, 3}*MaxAct
}
};
};
AnyOutputFile OutFile2 = {
FileName = "out2.csv";
Search = {"ArmModel.Muscles.*.Act*", "ArmModel.Muscles.*.Ft"};
SepSign = ";";
};
};
Furthermore, if you open a file manager and look at the contents of the directory where you are running the problem, you will notice that two new files have been generated: out1.csv and out2.csv. They are comma-separated files with a semicolon as separator between numbers as defined in the AnyOutputFile above.
If you have software on your computer that is associated with csv files, such as Microsoft Excel, then you can double-click any of the two files and open it. You will notice that it contains columns of data dumped from the analysis. The precise nature of the data is defined in the file's header, and it has been determined by the variables defined inside the corresponding AnyOutputFile object. Please refer to the reference manual for further information.
As you can see, the command line version can produce output data that can be formatted according to your desire and processed further by other types of software. But the really great thing about the console application is that you can execute it from other software such as Matlab or Visual Basic and as such build it into an integrated system for large-scale biomechanical data processing such as response surface-based optimization. Instead of typing the commands into the application by hand, you can store them in a macro file. Such files usually have the extension ".anymcr". The command line application can be given such a file as its command line argument, and it will perform the commands in it. Don't forget to make "exit" the final command of the macro file if you want the application to end after processing the macro file.
You are now ready to let the command line application be a part of a system for biomechanical data processing of your own design.
Path specification
As mentioned earlier, you can add the path of AnyBodyCon.exe to the path enviromental variable for your DOS prompt to ease the call to AnyBodyCon.exe from anywhere. This you can do from the DOS prompt with a statement such as
path c:\Program Files\AnyBody Technology\AnyBody.3.0\;
or
path %path%;c:\Program Files\AnyBody Technology\AnyBody.3.0\;
if you want to add the AnyBodyCon.exe's path to the exisitng path definition. Notice that you cannot have any space between ';' and the following path "c:\..." and that you can see the resulting path by simply calling the internal path command again without arguments.
These statements will only take effect until the current DOS prompt is closed, but you can also add the path of AnyBodyCon.exe permanently to the path for all DOS prompts. In Windows XP for instance, you do this from Control Panel -> System under the Advanced tab. You should however be aware that multiple versions of AnyBody may be installed on the computer at the same time, and therefore, multiple versions of AnyBodyCon.exe may exist in different locations. Thus, your path specification not only make it easy to call AnyBodyCon.exe; it will also specify which version that will be used. This can make unclear which one you are actually using if you need several of them.
To be in full control with multiple installations of AnyBody, you can define aliases by the following procedure - Make a directory with .bat files or shortcut to the AnyBodyCon.exe version you will need. Name the bat-files properly, so you can recognize the different version, e.g. AnyBodyCon201.bat and AnyBodyCon30.bat. The bat files contain a single statement, the call of AnyBodyCon.exe with its full path.
- Add this directory to the permanent path of the DOS prompt.
- You can now call the different versions of AnyBodyCon via the bat files, so the bat file names are working as aliases for the real exe files.
|