ansys.mapdl.core.Mapdl.use#
- Mapdl.use(name='', arg1='', arg2='', arg3='', arg4='', arg5='', arg6='', arg7='', arg8='', arg9='', ar10='', ar11='', ar12='', ar13='', ar14='', ag15='', ar16='', ar17='', ar18='', **kwargs)#
Executes a macro file.
Mechanical APDL Command: *USE
- Parameters:
- name
str
Name (32 characters maximum, beginning with a letter) identifying the macro file or a macro block on a macro library file.
- arg1
str
Values passed into the file or block where the parameters ARG1 through ARG9 and AR10 through AR18 are referenced. Values may be numbers, alphanumeric character strings (up to 32 characters enclosed in single quotes), parameters (numeric or character) or parametric expressions. See below for additional details.
- arg2
str
Values passed into the file or block where the parameters ARG1 through ARG9 and AR10 through AR18 are referenced. Values may be numbers, alphanumeric character strings (up to 32 characters enclosed in single quotes), parameters (numeric or character) or parametric expressions. See below for additional details.
- arg3
str
Values passed into the file or block where the parameters ARG1 through ARG9 and AR10 through AR18 are referenced. Values may be numbers, alphanumeric character strings (up to 32 characters enclosed in single quotes), parameters (numeric or character) or parametric expressions. See below for additional details.
- arg4
str
Values passed into the file or block where the parameters ARG1 through ARG9 and AR10 through AR18 are referenced. Values may be numbers, alphanumeric character strings (up to 32 characters enclosed in single quotes), parameters (numeric or character) or parametric expressions. See below for additional details.
- arg5
str
Values passed into the file or block where the parameters ARG1 through ARG9 and AR10 through AR18 are referenced. Values may be numbers, alphanumeric character strings (up to 32 characters enclosed in single quotes), parameters (numeric or character) or parametric expressions. See below for additional details.
- arg6
str
Values passed into the file or block where the parameters ARG1 through ARG9 and AR10 through AR18 are referenced. Values may be numbers, alphanumeric character strings (up to 32 characters enclosed in single quotes), parameters (numeric or character) or parametric expressions. See below for additional details.
- arg7
str
Values passed into the file or block where the parameters ARG1 through ARG9 and AR10 through AR18 are referenced. Values may be numbers, alphanumeric character strings (up to 32 characters enclosed in single quotes), parameters (numeric or character) or parametric expressions. See below for additional details.
- arg8
str
Values passed into the file or block where the parameters ARG1 through ARG9 and AR10 through AR18 are referenced. Values may be numbers, alphanumeric character strings (up to 32 characters enclosed in single quotes), parameters (numeric or character) or parametric expressions. See below for additional details.
- arg9
str
Values passed into the file or block where the parameters ARG1 through ARG9 and AR10 through AR18 are referenced. Values may be numbers, alphanumeric character strings (up to 32 characters enclosed in single quotes), parameters (numeric or character) or parametric expressions. See below for additional details.
- ar10
str
The description of the argument is missing in the Python function. Please, refer to the command documentation for further information.
- ar11
str
The description of the argument is missing in the Python function. Please, refer to the command documentation for further information.
- ar12
str
The description of the argument is missing in the Python function. Please, refer to the command documentation for further information.
- ar13
str
The description of the argument is missing in the Python function. Please, refer to the command documentation for further information.
- ar14
str
The description of the argument is missing in the Python function. Please, refer to the command documentation for further information.
- ag15
str
The description of the argument is missing in the Python function. Please, refer to the command documentation for further information.
- ar16
str
The description of the argument is missing in the Python function. Please, refer to the command documentation for further information.
- ar17
str
The description of the argument is missing in the Python function. Please, refer to the command documentation for further information.
- ar18
str
The description of the argument is missing in the Python function. Please, refer to the command documentation for further information.
- name
Notes
Warning
This function contains specificities regarding the argument definitions. Please refer to the command documentation for further explanations.
Argument Descriptions
name : str
- Name (32 characters maximum, beginning with a letter) identifying the macro file or a macro block on a macro library file.arg1, arg2, arg3,..., ar18 : str
- Values passed into the file or block where the parameters ARG1 through ARG9 and AR10 through AR18 are referenced. Values may be numbers, alphanumeric character strings (up to 32 characters enclosed in single quotes), parameters (numeric or character) or parametric expressions. See below for additional details.
Causes execution of a macro file called
Name
, or, if not found, a macro block “Name
“ on the macro library file ( ulib ). Argument values (numeric or character) are passed into the file or block and substituted for local parameters ARG1, ARG2,…, AR18. The fileName
may also be executed as an “unknown command” (that is, without the use command name) as described below.A macro is a sequence of Mechanical APDL commands (as many as needed) recorded in a file or in a macro block in a library file (specified with the ulib command). The file or block is typically executed via use. In addition to command, numerical and alphanumeric data, the macro can include parameters which will be assigned numerical or alphanumerical character values when the macro is used. Use of the macro can be repeated (within a do-loop, for example) with the parameters incremented.
A macro is defined within a run by enclosing a sequence of data input commands between create and end commands. The data input commands are passive (not executed) while being written to the macro file. The macro file (without create and end ) can also be created external to Mechanical APDL.
Up to 99 specially named scalar parameters, ARG1 to AR99, are locally available to each macro:
The prefix for the first nine parameters is ARG, and the prefix for the remaining 90 parameters is AR.
A local parameter is not affected by, nor does it affect, other parameters, even those of the same name, which are used outside of the macro. The only way a local parameter can affect, or be affected by, parameters outside the macro is if values are passed out of, or into, the macro by an argument list.
Parameters ARG1 through AR18 can have their values (numeric or character) passed via the argument list on use. (ARG1 through AR19 can be passed as arguments on the unknown-command macro.) Parameters AR19 through AR99 (AR20 through AR99 in the unknown-command macro) are available solely for use within the macro; they cannot be passed via an argument list.
Local parameters are available to do-loops and to input files processed within the macro. In addition to an ARG1–AR99 set for each macro, another ARG1–AR99 set is available external to all macros, local to “non-macro” space.
A macro is exited after its last line is executed. Macros may be nested (such as a use or an unknown command within a macro). Each nested macro has its own set of 99 local parameters. Only one set of local parameters can be active at a time and that is the set corresponding to the macro currently being executed or to the set external to all macros (if any). When a nested macro completes execution, the previous set of local parameters once again becomes available. Issue starstatus,ARGX to view current macro parameter values.
An alternate way of executing a macro file is via the unknown-command route. If a command unknown to Mechanical APDL is entered, a search for a file of that name (plus a
.MAC
suffix) is made. If the file exists, it is executed, if not, the “unknown command” message is output. Thus, you can write your own commands in terms of other Mechanical APDL commands. The procedure is similar to issuing use with the unknown command in theName
field. For example, the command CMD ,10,20,30 is internally similar to use,CMD,10,20,30. The macro file namedCMD.MAC
is executed with the three parameters. The use macro description also applies to the unknown- command macro, except that various directories are searched and a suffix (.MAC
) is assumed. Also, a macro library file is not searched.A three-level directory search for the unknown-command macro file may be available. The search order may be: 1) a high-level system directory, 2) the log-in directory, and 3) the local (working) directory. Issue psearch to change the directory search path. For an unknown command CMD, the first file named
CMD.MAC
found to exist in the search order is executed. The command can be input in lower-, upper-, or mixed-case; however, it converts to uppercase automatically before the file name search occurs. On systems that preserve the case as it was input, a file matching the upper-case name is used first, followed by a file with the matching the lower-case name, and finally a file matching the mixed-case name. All macro files placed in theapdl
directory must be upper-case.Because undocumented commands exist in Mechanical APDL, you should issue the command intended for the macro file name to ensure that the unknown-command message is output in the processor where it is to be used. If the macro is to be used in other processors, the other processors must also be checked.
This command is valid in any processor.