Mechanical#

This section describes the methods for working with a Mechanical gRPC server using the following class: Mechanical

class ansys.mechanical.core.mechanical.Mechanical(ip=None, port=None, timeout=60.0, loglevel='WARNING', log_file=False, log_mechanical=None, cleanup_on_exit=False, channel=None, remote_instance=None, keep_connection_alive=True, **kwargs)#

Connects to a gRPC Mechanical server and allows commands to be passed.

Mechanical.clear()

Clear the database.

Mechanical.download(files[, target_dir, ...])

Download files from the working directory of the Mechanical instance.

Mechanical.download_project([extensions, ...])

Download all project files in the working directory of the Mechanical instance.

Mechanical.exit([force])

Exit Mechanical.

Mechanical.list_files()

List the files in the working directory of Mechanical.

Mechanical.log_message(log_level, message)

Log the message using the given log level.

Mechanical.project_directory

Get the project directory for the currently connected Mechanical instance.

Mechanical.run_python_script(script_block[, ...])

Run a Python script block inside Mechanical.

Mechanical.run_python_script_from_file(file_path)

Run the contents a python file inside Mechanical.

Mechanical.upload(file_name[, ...])

Upload a file to the Mechanical instance.

Mechanical.version

Get the Mechanical version based on the instance.