Sample Script

Use this sample script to run the model checker in batch mode.

set altairHome [hm_info -appinfo ALTAIR_HOME];
#name of file to run checks from
set CHECKS_FILE_PATH "$altairHome/hm/scripts/ModelCheck/LsDyna/dyna.xml"
#set output file path
set OUTPUT_FILE_PATH "D:/report.txt" 
set OUTPUT_FILE1_PATH "D:/report1.txt"

#read solver deck
set MODEL_FILE_PATH "$altairHome/demos/hm/bumper.hm"
"ls-dyna" {
      set feinputPath "ls-dyna\\dynakey"
}
*displayimporterrors 0;
if { [file extension $MODEL_FILE_PATH] == ".hm" } {
      hm_answernext "yes"
      *readfile "$MODEL_FILE_PATH"
} else {
     *feinputpreserveincludefiles
     *feinputwithdata2 "#$feinputPath" "$MODEL_FILE_PATH" 0 0 0 0 0 1 2 1 0
}

#read model checker config file
*modelcheck_createchecks $CHECKS_FILE_PATH 0;
#run all the checks in the file
*modelcheck_runchecks "" "ALL" "ALL" 0

#run only certain checks
set checkList "{Unused Materials} {Empty Components} {Unused Properties}"
foreach checkname $checkList {
      *modelcheck_runchecks "$checkname" "ALL" "ALL" 0
}
#write output to a file
*writemodelcheckresultfile "$OUTPUT_FILE_PATH" 1

#perform auto correction, re-run checks and write results to output file
hm_modelcheckapplyautocorrection "";
*modelcheck_runchecks "" "ALL" "ALL" 0
*writemodelcheckresultfile "$OUTPUT_FILE1_PATH" 1

#close session
*quit 1