ansys.mapdl.core.convert_script(filename_in, filename_out, loglevel='WARNING', auto_exit=True, line_ending=None, exec_file=None, macros_as_functions=True, use_function_names=True, show_log=False)

Converts an ANSYS input file to a python PyMAPDL script.


Filename of the ansys input file to read in.


Filename of the python script to write a translation to.

loglevelstr, optional

Logging level of the ansys object within the script.

auto_exitbool, optional

Adds a line to the end of the script to exit MAPDL. Default True.

line_endingstr, optional

When None, automatically determined by OS being used.

macros_as_functionsbool, optional

Attempt to convert MAPDL macros to python functions.

use_function_namesbool, optional

Convert MAPDL functions to ansys.mapdl.core.Mapdl class methods. When True, the MAPDL command “K” will be converted to mapdl.k. When False, it will be converted to'k').

show_logbool, optional

Print the converted commands using a logger (from logging Python module).


List of lines translated.


>>> from ansys.mapdl import core as pymapdl
>>> from ansys.mapdl.core import examples
>>> clines = pymapdl.convert_script(examples.vmfiles['vm1'], '')