save_ansys_path#
- ansys.mapdl.core.save_ansys_path(exe_loc=None)#
Find MAPDL’s path or query user.
If no
exe_loc
argument is supplied, this function attempt to obtain the MAPDL executable from (and in order):The default ansys paths (i.e.
'C:/Program Files/Ansys Inc/vXXX/ansys/bin/ansysXXX'
)The configuration file
User input
If
exe_loc
is supplied, this function does some checks. If successful, it will write thatexe_loc
into the config file.- Parameters:
- exe_loc
str
,optional
Path of the MAPDL executable (‘ansysXXX’), by default
None
.
- exe_loc
- Returns:
str
Path of the MAPDL executable.
Notes
The configuration file location (
config.txt
) can be found inappdirs.user_data_dir("ansys_mapdl_core")
. For example:>>> import appdirs >>> import os >>> print(os.path.join(appdirs.user_data_dir("ansys_mapdl_core"), "config.txt")) C:/Users/user/AppData/Local/ansys_mapdl_core/ansys_mapdl_core/config.txt
Examples
You can change the default
exe_loc
either by modifying the mentionedconfig.txt
file or by executing:>>> from ansys.mapdl.core import save_ansys_path >>> save_ansys_path('/new/path/to/executable')