save_mechanical_path#
- ansys.tools.path.save_mechanical_path(exe_loc=None, allow_prompt=True)#
Find the Mechanical path or query user.
- Parameters:
- exe_loc
str
,optional
Path for the Mechanical executable file (
AnsysWBU.exe
). The default isNone
, in which case an attempt is made to obtain the path from the following sources in this order:The default Mechanical paths (for example,
C:/Program Files/Ansys Inc/vXXX/aiso/bin/AnsysWBU.exe
)The configuration file
User input
If a path is supplied, this method performs some checks. If the checks are successful, it writes this path to the configuration file.
- exe_loc
- Returns:
str
Path for the Mechanical executable file.
- Return type:
Notes
The location of the configuration file
config.txt
can be found inansys.tools.path.SETTINGS_DIR
. For example:>>> from ansys.tools.path import SETTINGS_DIR >>> import os >>> print(os.path.join(SETTINGS_DIR, "config.txt")) C:/Users/[username]]/AppData/Local/Ansys/ansys_tools_path/config.txt
You can change the default for the
exe_loc
parameter either by modifying theconfig.txt
file or by running this code:>>> from ansys.tools.path import save_mechanical_path >>> save_mechanical_path("/new/path/to/executable")