convert_script

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)

Converts an ANSYS input file to a python PyMAPDL script.

Parameters
  • filename_in (str) – Filename of the ansys input file to read in.

  • filename_out (str) – Filename of the python script to write a translation to.

  • loglevel (str, optional) – Logging level of the ansys object within the script.

  • auto_exit (bool, optional) – Adds a line to the end of the script to exit MAPDL. Default True.

  • line_ending (str, optional) – When None, automatically determined by OS being used.

  • macros_as_functions (bool, optional) – Attempt to convert MAPDL macros to python functions.

  • use_function_names (bool, 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 mapdl.run('k').

Returns

clines (list) – List of lines translated.

Examples

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