Skip to Content

How to write command script to export data in PostProcessing into other files?

Hi all,

I built my own human model in LifeMOD, run simulations and save these analyses. Then, in PostProcessing interface, corresponding to each analysis, I start to display data (displacement, velocity so on) of human components (vertebrae, head, joints....) under plots. After that, I export these data into files (numeric data, table...) and move on next analysis. This process is repeated until the last analysis is done. Since the data is quite large, doing these steps manually is time consuming. Hence, I want to write command script (not write line by line on the Command Window) to do this work automatically. Unfortunately, I don't know where I can start. Is there anyone who knows this thing to help me? If possible, please instruct me step by step. Thanks so much in advance.

Best regards,

Kim Tho

command scripting

Running models through command scripts is a great way to build (nearly) version independance into your process while reducing the amount of manual work through the GUI that is needed.

Post processing is no different than the modeling itself when it comes to scripting.  All the commands that you do manually, both from a pure Adams/View and for LifeMOD specific, are recorded directly into the AView.log file.  Or you can leave the command window (F3) active and see the commands scroll by as you do post processing steps manually.  It is just a matter of then pasting them into a command file, and the next time importing it (F2).

Command Scripting

Thank you for your help. It really helps me much. My work now is simplified a lot.

Create a macro in Adams following this format:

This method will take your data from the post-processor, and then export files of your format choice (I have .xls here).

 

 interface plot window open
 interface window undisplay window=.gui.main
 undo flush
 interface plot window set_mode mode=Plotting
 xy_plot template modify plot=.plot_1 auto_title=yes auto_subtitle=yes auto_date=yes auto_analysis_name=yes table=no
 xy_plot curve create curve=.plot_1.curve_1 create_page=no calculate_axis_limits=no dmeasure=.World.YOUR_MEASURE_NAME run=.World.Last_Run auto_axis=UNITS
 
 xy_plot template calculate_axis_limits plot_name=.plot_1
 interface plot window update_toolbar
 
 file table write  &
    file_name = "YOUR_FILENAME.xls"
    plot_name = .plot_1 &
    format = spreadsheet

 animation pause page_name=.gui.ppt_main.sash1.sash2.gfx.page_1
 animation record stop
 interface win disp win=.gui.main
 interface plot window close
 undo flush
 if  cond = (db_count( "select_list","objects") == 0)
    group object add group=select_list &
          objects = .plot_1
    if cond = (db_count("select_list", "objects") == 0)
       return
    end
 end
 mdi delete_macro

 

 

Create this macro in Adams, and then you can execute it in the command line if you'd like, by typing the macro name into the Command Window (your macro is called MACRO_1, for example).

 

Hope this answered your question?

 

Kim