PRIMER 22.1

Command-Line Arguments to PRIMER

Command-Line Arguments to PRIMER

"Command-line" arguments are added to the execution line itself as extra arguments to the code. Where they conflict with settings in the "oa_pref" file the command-line arguments take precedence.

Command-line arguments are a sequence of one or more character strings following the basic PRIMER execution line, for example:

C:\executables\primer22_x64.exe arg1 arg2 ... argn

Most, but not all, command-line arguments take the form:

< -keyword > = < argument > for example -d=opengl

Command-line argument syntax

  • Each argument should be a discrete string with no white space, which means that there must be no spaces between keyword, "=" and argument.

    For example " -d=opengl " is valid, but " -d= opengl " is not.

  • Fixed arguments (such as opengl) are not case sensitive.

    Filenames are case-sensitive on Linux and Unix operating systems, but not on Windows. However if you are working on Windows and accessing files on a remote disk mounted on a Unix / Linux system it is recommended that you honour the case of filenames in order to avoid confusion.


  • All command-line arguments start with " - ", except the name of a keyword file to be processed.

    For example: primer22_64.exe -d=opengl -start_in=c:\temp\example.key


  • Command-line arguments may appear in any order.

    However it is conventional practice to make any input (keyword) file to be processed the last argument on the line. This is what most readers will expect and it makes the meaning clearer.

Directory and Filename arguments containing white space characters

Problems can arise if arguments are file or directory names that contain white space, for example "Documents and Settings". This requires quotes ".." to placed around such names in order to make them discrete character strings. For example

C:\executables\primer22_x64.exe C:\home\example files\test.key

Will not not work because of the white space character between example and files . In order to turn this into a single string you must place quotes around that argument, for example:

C:\executables\primer22_x64.exe " C:\home\example files\test.key "

A further problem can arise on Windows when using cmd.exe to run things indirectly as the rules for quoting arguments there are arcane to say the least, and research on MSDN may be required to get the syntax right for a given example.

It is much easier to avoid using directory and file names that contain white space! (If you want to separate names then use the underscore character "_", for example C:\home\example_files .)

Command-line arguments valid in PRIMER

Function Format Options
Setting the graphics device

By default no graphics device is defined, and the device selection panel is mapped.

These options can be especially useful if you want to bypass the device selection panel and always start PRIMER with a particular graphics driver.
-d=< device >
-d=opengl Use OpenGL 3D graphics
-d=x24 24 bit-plane X-Windows graphics
-d=x8 8 bit-plane X-Windows graphics
-d=x X24 if available, otherwise X8
-d=default Whichever is available in the order OpenGL , X24 , X8
-d=batch
-d=tty
No graphics - text-only mode
Specifying "full screen" mode on startup

Normally PRIMER occupies about 70% of the display when it starts, the "maximise" argument changes this to become the full screen.
-maximise
Specifying window placement on a multi-display desktop

By default the top right corner of the desktop is used.

The most common arrangement is two screens side by side, for which "left" and "right" may be used. However "top" and "bottom" are also available for the case of two screens one above the other, and the options may be concatenated for a 2x2 display.

These options can be combined with -maximise to fill the relevant screen.

Users on Windows platforms where tools such as NVidia's "NView" are available may find that it is better to leave window placement to that tool, so that PRIMER's windows behave in a fashion consistent with other application windows.
-placement=< where > This option is intended for use where the desktop is spread as a "Single Logical Screen" over multiple monitors.

< where > values Meaning
left Left hand monitor
right Right hand monitor
top Upper monitor
bottom Bottom monitor
The above may be concatenated for a 2x2 display, for example
top_left Top left monitor
bottom_right Bottom right monitor
Defining a command file name

By default no command file is assumed.
-cf=< filename > < filename > can be any text file containing valid commands.
Defining a macro file name

By default no macro file is assumed.
-macro=< filename > < filename > can be any text file containing valid macro commands.

More information about macros can be found in MACROS
Defining a file of variables to be used in macro files

By default no variables are defined
-macro_var=< filename > < filename > can be any text file containing valid macro variable defintions.

The syntax of this file is any number of lines formatted:

variable_name, value (The comma is required)

Both variable_name and value are treated as text strings, and the effect when the macro is run is to replace any occurrence of $variable_name with the string value .

Comment lines may be added to the file by placing a $ in their first column.
Defining a JavaScript file name

By default no JavaScript file is assumed.
-js=< filename > < filename > can be any text file containing a valid JavaScript.

More information about scripts can be found in Scripting .
Defining an argument to be used in JavaScript files

By default no arguments are defined
-js_arg=< argument > < argument > can be any text string.
The arguments can be accessed in the script by using the global arguments array.
Multiple arguments can be given to a script by using more than one -js_arg command line argument.
Defining a JavaScript file to encrypt

By default no arguments are defined
-js_encrypt=< filename >

< filename > can be any text file containing a valid JavaScript.

Encrypts the script, writing a new file with the suffix '_encrypted.js'
Defining when a JavaScript is executed -js_after_cf If a JavaScript is given on the command line using the -js argument and a command file is given using the -cf argument then by default the script is executed first and then the commands in the command file are executed.
If this argument is given then the script will be executed after the command file.

Requesting termination at the end of a command or macro file

This is ignored if no command or macro file is defined

-exit
Run PRIMER in "batch" mode where the main application window is not displayed on the screen.
-batch
For the -batch option to work you must also specify a command file " -cf= filename ", or a macro " -macro= filename " or a JavaScript " -js= filename "

This option will automatically set " -exit " so that PRIMER terminates after playing the command file, macro or script.
You may also wish to use " -auto_confirm " as described below.
Requesting that "auto confirm" should apply when -batch is used.

-auto_confirm Note!! Only meaningful when used in conjunction with -batch

For historical reasons used of " -batch " on its own will not "auto confirm" (ie give the default response) any "stop and ask what to do next" messages. This can result in batch scripts appearing to lock up because they are waiting for a user resonse, but this is not visible on the screen.

Using -auto_confirm in conjunction with -batch will restore this behaviour, meaning that scripts will not lock up for this reason.

Requesting batch creation of ZTF and group files

This generates both < filename >.ztf and groups < filename >.bin files for subsequent post-processing in D3PLOT.
When combined with " -d=batch " then:

  • ZTF and group (.bin) files are created, then PRIMER exits
  • No licence to run PRIMER is required
  • -ztf=< filename > < filename > must be a valid Ansys LS-Dyna keyword (.key) file, with or without the ".key" extension.

    Specifying the directory in which to start.

    PRIMER will make this your "current working directory", so that all files which do not have explicit pathname prefixes are assumd to be in this directory.

    -start_in=< directory > < directory > must be a valid directory name on your system.
    Specifying the directory to receive the keyword read log file.

    This copies all messages normally written to the dialogue box during keyword input to a file primer_readlog.txt in the directory of your choice.

    This output file can also be specified via a preference, and interactively from the keyword read Options panel. See Options : Save Keyin log to file for more details.
    -rlog_dir=< directory > < directory > must be a valid directory name on your system.
    Inhibiting user "oa_pref" files -ignore_user_pref This argument will inhibit reading of oa_pref file in home area and in the current working directory. Thus only the system/admin oa_pref files will apply and any file specified with -pref argument.
    Inhibiting user "oa_pref" files -ignore_oa_pref This argument will inhibit reading of oa_pref file in system area, home area and in the current working directory. Thus only the admin oa_pref files will apply and any file specified with -pref argument.
    Specifying a custom preference file

    This causes an extra, optional preference file to be read on the final pass.
    -pref=< filename > <filename> must be a valid preference file (any name is allowed though oa_pref should be avoided). The filename must be pre-fixed with the full directory path.
    Redirecting console output to a file

    This option is only available on Windows.

    On Unix / Linux use standard shell redirection instead, for example:

    primer 18 _64.exe -d=opengl > filename
    -eo
    -eo=default
    -eo=< filename >
    If <filename> is given then it is used as the filename to write the output to. In order to permit multiple sessions to coexist on the same machine the process id will be appended to the main part of the filename. For example if <filename> is "primer_output.log" then the actual filename will be "primer_output_<pid>.log.

    If no filename is given or the filename is "default" then filename generation is automatic, and the first valid of:

    %TEMP%\primer_log_<pid>.txt
    %TMP%\primer_log_<pid>.txt
    %HOMESHARE%\primer_log_<pid>.txt
    %USERPROFILE%\primer_log_<pid>.txt

    will be used.
    Defining a list of filenames to be opened

    By default no list of files is assumed
    -ml=< filename > If <filename> is defined it should be a list of filenames, each on a new line.

    These are assumed to be Ansys LS-DYNA keyword files (regardless of any extension) and will be opened as models 1 to N.

    There is a limit of 255 models in PRIMER , so the number of models should not exceed 255.

    An Ansys LS-DYNA keyword filename

    By default no filename is assumed

    < filename > If <filename> is defined it is assumed to be an Ansys LS-DYNA keyword file and will be opened as model 1.
    A design variable file

    By default no filename is assumed
    -ls_opt=< filename > If this is defined, the design variables are applied. This applies to morphing from PRIMER 16.0 onwards as described in the mesh morphing section.
    Read/Write checkpoint files

    Start writing the checkpoint files upon PRIMER startup

    Read checkpoint files and Show checkpoint playback panel upon PRIMER startup

    Directory path to write checkpoint files
    write_checkpoint_files=< TRUE/FALSE >

    show_checkpoint_files=< TRUE/FALSE >

    &#8209checkpoint_dir=< directory >
    TRUE/FALSE, turn on/off the writing of the checkpoint files (default is FALSE)

    TRUE/FALSE, turn on/off the initial checkpoint files panel (default is FALSE)

    If the writing of the checkpoint files is OFF, the reading will also be OFF

    < directory > must be a valid directory name on your system.

    If the value is <none> then the checkpoint files are not recorded for the PRIMER session.
    An optional argument when calling -ls_opt

    By default no argument is assumed

    ls_opt_arg=< filename > ls_opt_arg= "OUTPUT: < filename > " ls_opt_arg= "REMAKE_CONX: < TRUE/FALSE > " ls_opt_arg= "REMAKE_CONX_ERROR: < TRUE/FALSE > " blank or OUTPUT - filename is the output filename.

    REMAKE_CONX - TRUE/FALSE, turning the remaking of connections after morphing On/Off. (default is TRUE)

    REMAKE_CONX_ERROR - TRUE/FALSE, classing a failure to remake an initially realized connection as an Error/Normal termination. (default is TRUE)