3.5. Communicating with the Program

The easiest way to communicate with the program is by using the menu system, called the Graphical User Interface (GUI).

3.5.1. Communicating Via the Graphical User Interface (GUI)

The GUI consists of windows, menus, dialog boxes, and other components that allow you to enter input data and execute functions simply by picking buttons with a mouse or typing in responses to prompts. All users, both beginner and advanced, should use the GUI for interactive work. See Using Interactive Mode for an extensive discussion of how to use the GUI. The rest of this section describes other topics related to communication with commands, abbreviations, etc.

3.5.2. Communicating Via Commands

Commands are the instructions that direct the program. The program offers numerous commands, each designed for a specific function. Most commands are associated with specific (one or more) processors, and work only with that processor or those processors.

To use a function, you can either type in the appropriate command or access that function from the GUI (which internally issues the appropriate command). The Command Reference describes all commands in detail, and also tells you whether each command has an equivalent GUI path. (A few commands do not.)

Program commands have a specific format. A typical command consists of a command name in the first field, usually followed by a comma and several more fields (containing arguments). A comma separates each field. For example, the F command, which applies a force at a node, looks like this:

F,NODE,Lab,VALUE

To apply an X-direction force of 2000 at node number 376, the F command would read as follows:

F,376,FX,2000

You can abbreviate command names to their first four characters (except as noted in the Command Reference). For example, FINISH, FINIS, and FINI all have the same meaning. Some "commands" (such as RACE) are actually macros. You must enter macro names in their entirety.


Note:  If you are not sure whether an instruction is a command or a macro, see the Command Reference.


Commands that begin with a slash ( / ) usually perform general program control tasks, such as entry to routines, file management, and graphics controls. Commands that begin with a star ( * ) are part of APDL. See the Ansys Parametric Design Language Guide for details.

Command arguments may take a number or an alphanumeric label, depending on their purpose. In the F command example described previously, NODE and VALUE are numeric arguments, but Lab is an alphanumeric argument. In this and other documentation, numeric arguments appear in all uppercase italic letters (as in NODE and VALUE), and alphanumeric arguments appear in initial uppercase italic format (as in Lab). Some commands (for example, /PREP7, /POST1, FINISH, etc.) have no arguments, so the entire command consists of just the command name.

Some general rules and guidelines for commands are listed below:

  • When you enter commands, the arguments do not have to be in specific columns.

  • You can use successive commas to skip arguments. When you do so, the program uses default values for the omitted arguments (as discussed in the individual command descriptions).

  • You can string together multiple commands on the same line by using the $ character as the delimiter for each command. (For restrictions on use of the $ delimiter, see the Command Reference.)

  • The maximum number of characters allowed per line is 2048, including commas, blank spaces, $ delimiters, and any other special characters.


    Note:  Other software programs and printers may wrap text to the next line or truncate the text after a certain character.


  • Real number values input to integer data fields will be rounded to the nearest integer. The absolute value of integer data must fall between zero and 2,000,000,000.

  • The acceptable range of values for real data is +/-1.0E+200 to +/-1.0E-200. No exponent can exceed +200 or be less than -200. The program accepts real numbers in integer fields, but rounds them to the nearest integer. You can specify a real number using a decimal point (such as 327.58) or an exponent (such as 3.2758E2). The E (or D) character, used to indicate an exponent, may be in upper or lower case. This limit applies to all input commands, regardless of platform.

Even though all input must be within the allowed range, all numeric operations, including parametric operations, can produce numbers to machine precision, which may exceed the input range.

  • The program interprets numbers entered for Angle arguments as degrees. Functions are available that could use radians if the *AFUN command had been used.

  • The following special characters are not allowed in alphanumeric arguments:

     !   @   #    $   %    ^   &   *   (     )   _    -   +  
     =   |   \   {  }   [  ]    "     '   /    <     >   ~    `

    Exceptions are filename and directory arguments, where some of these characters may be required to specify system-dependent pathnames. However, using special characters in filename and directory arguments could result in a misreading the argument. We strongly recommend that you limit filename and directory arguments to A-Z, a-z, 0-9, -, _, and spaces. Any text prefaced by an exclamation mark (!) is treated as a comment.

  • Avoid using tabs (to line up comments, for instance) or other control (Ctrl) sequences. They usually generate device-dependent characters that the program cannot recognize.

  • If you are a longtime user, avoid using commands that have been removed from the currently documented command set. Such commands are obsolete and may cause difficulties.

3.5.3. Command Defaults

For information about command and argument default behavior, see Defaults in the Command Reference.

3.5.4. Abbreviations

If you use a command or a GUI function frequently, you can rename it or abbreviate it to a string of up to eight alphanumeric characters using one of the following:

Command(s): *ABBR
GUI: Utility Menu> Macro> Edit Abbreviations
Utility Menu> MenuCtrls> Edit Toolbar

For example, the following command defines ISO as an abbreviation for the command /VIEW,,1,1,1 (which specifies isometric view for subsequent graphics displays):

*ABBR,ISO,/VIEW,,1,1,1

Keep the following rules and guidelines in mind when creating abbreviations:

  • The abbreviation must begin with a letter and should not have any spaces.

  • If an abbreviation that you set matches a command, the abbreviation overrides the command. Therefore, use caution in choosing abbreviation names.

  • You can abbreviate up to 60 characters, and up to 100 abbreviations are allowed per session.

In the GUI, abbreviations appear as push buttons on the Toolbar, which you can execute with a quick click of the mouse. For details, see the section on using the toolbar in Using Interactive Mode.

3.5.5. Command Macro Files

You can record a frequently used sequence of commands in a macro file, thus creating a custom command. If you enter an unrecognized command, the program searches for a macro file by that name (with an extension of .mac or .mac).

On Linux and Windows systems, the program searches for macro files in the following order:

  • The program searches first in the ANSYS APDL directory.

  • It then looks at the directories that have been defined for the environmental variable ANSYS_MACROLIB. You can set up the ANSYS_MACROLIB variable after product installation and before starting the program.

    On Linux, the structure for ANSYS_MACROLIB is:

    dir1/:dir2/:dir3/

    On Windows, the structure is:

    c:\dir1\;d:\dir2\;e:\dir3

    The letter to the left of the colon indicates the drive where the directory is stored.

    Enter up to 2048 characters for the entire string. Dir1 is searched first, followed by dir2, dir3, etc. These files provide customization at both the site and user levels.

  • Next, on Linux systems, the program searches in /PSEARCH or in the login directory. On Windows systems, it looks in /PSEARCH or in the home directory.

  • Finally, the program looks in the current or working directory.

The program searches for both upper and lower case macro file names in each search directory, except /apdl on Linux systems. If both exist in the search directory, the upper case file is used. Only upper case is used in the /apdl directory on Linux systems.

The installation media provide many macro files that reside in the /apdl subdirectory. If you cannot use the Mechanical APDL-provided macro files, contact your system administrator.

To access any macro, you simply enter its file name. For instance, to access the LSSOLVE.MAC file, you enter LSSOLVE. You can also access macros you created via the Utility Menu> Macro> Execute Macro menu path. However, this menu path will not work for any macros containing function granules (such as a call to a dialog box) or picking commands. Macros with these functions must be accessed by entering the macro name in the Input Window.

Specifying File Names in Windows

In the Windows environment, some devices/ports have specific names, such as PRN, COM1, COM2, LPT1, LPT2, and CON. The device/port names resemble files in that they can be opened, read from, written to, and closed. Entering the names of these devices/ports in Mechanical APDL, however, causes unpredictable behavior, including system freezes or fatal error conditions; therefore, do not issue PC device/port names as commands.