PyMechanical Logo PyMechanical

PyAnsys PyPI Python GH-CI Codecov MIT Black

Introduction#

PyMechanical is part of the broader PyAnsys initiative, enabling the use of Ansys technologies directly from Python. This allows users to integrate the Mechanical multiphysics solver into custom applications. The ansys-mechanical-core package presents a Python-friendly interface to drive the software that facilitates the use of Mechanical scripting commands.

Install the latest package from PyPi with command:

pip install ansys-mechanical-core

Mechanical scripting#

You can already perform scripting of Mechanical with Python from inside Mechanical. PyMechanical leverages the same APIs as Mechanical but allows you to run your automation from outside Mechanical. For more information on using these APIs, see Mechanical scripting.

Background#

PyMechanical contains two interfaces: a remote session and an embedded instance. For information on the application architecture of Mechanical and why there are two Python interfaces, see PyMechanical architecture.

Remote session#

PyMechanical’s remote session is based on gRPC. Mechanical runs as a server, ready to respond to any clients. PyMechanical provides a client to connect and make API calls to this Mechanical server. For information on using a remote session, see Remote sessions.

Embedded instance#

PyMechanical’s embedded instance is based on Python.NET. Rather than starting a new process for Mechanical, a Mechanical object (which is implemented in .NET) is directly loaded into Python memory using Python.NET. From there, Mechanical’s entire data model is available for use from Python code. For information on using an embedded instance, see Embedded instances.

Documentation and issues#

In the top right corner of the title bar, you can switch between the latest stable release, development version, and previous versions of the documentation.

On the PyMechanical Issues page, you can create issues to report bugs and request new features. On the PyMechanical Discussions page or the Discussions page on the Ansys Developer portal, you can post questions, share ideas, and get community feedback.

To reach the project support team, email pyansys.core@ansys.com.

Contributions to this open source library are welcome. For more information, see Contribute.