ansys-mechanical-core


Nameansys-mechanical-core JSON
Version 0.11.7 PyPI version JSON
download
home_pageNone
SummaryA python wrapper for Ansys Mechanical
upload_time2024-08-29 14:27:37
maintainerNone
docs_urlNone
authorNone
requires_python<4.0,>=3.9
licenseNone
keywords pymechanical mechanical ansys pyansys
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. image:: https://raw.githubusercontent.com/ansys/pymechanical/main/doc/source/_static/logo/pymechanical-logo.png
   :alt: PyMechanical logo
   :width: 580px


|pyansys| |pypi| |python| |GH-CI| |codecov| |MIT| |black|

.. |pyansys| image:: https://img.shields.io/badge/Py-Ansys-ffc107.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABDklEQVQ4jWNgoDfg5mD8vE7q/3bpVyskbW0sMRUwofHD7Dh5OBkZGBgW7/3W2tZpa2tLQEOyOzeEsfumlK2tbVpaGj4N6jIs1lpsDAwMJ278sveMY2BgCA0NFRISwqkhyQ1q/Nyd3zg4OBgYGNjZ2ePi4rB5loGBhZnhxTLJ/9ulv26Q4uVk1NXV/f///////69du4Zdg78lx//t0v+3S88rFISInD59GqIH2esIJ8G9O2/XVwhjzpw5EAam1xkkBJn/bJX+v1365hxxuCAfH9+3b9/+////48cPuNehNsS7cDEzMTAwMMzb+Q2u4dOnT2vWrMHu9ZtzxP9vl/69RVpCkBlZ3N7enoDXBwEAAA+YYitOilMVAAAAAElFTkSuQmCC
   :target: https://docs.pyansys.com/
   :alt: PyAnsys

.. |pypi| image:: https://img.shields.io/pypi/v/ansys-mechanical-core.svg?logo=python&logoColor=white
   :target: https://pypi.org/project/ansys-mechanical-core
   :alt: PyPI

.. |python| image:: https://img.shields.io/pypi/pyversions/ansys-mechanical-core?logo=pypi
   :target: https://pypi.org/project/ansys-mechanical-core
   :alt: Python

.. |codecov| image:: https://codecov.io/gh/ansys/pymechanical/branch/main/graph/badge.svg
   :target: https://app.codecov.io/gh/ansys/pymechanical
   :alt: Codecov

.. |GH-CI| image:: https://github.com/ansys/pymechanical/actions/workflows/ci_cd.yml/badge.svg
   :target: https://github.com/ansys/pymechanical/actions/workflows/ci_cd.yml
   :alt: GH-CI

.. |MIT| image:: https://img.shields.io/badge/License-MIT-yellow.svg
   :target: https://opensource.org/licenses/MIT
   :alt: MIT

.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg?style=flat
   :target: https://github.com/psf/black
   :alt: Black

.. |pre-commit| image:: https://results.pre-commit.ci/badge/github/ansys/pymechanical/main.svg?style=flat
   :target: https://results.pre-commit.ci/latest/github/ansys/pymechanical/main
   :alt: pre-commit

Overview
--------

PyMechanical brings Ansys Mechanical to Python. It enables your Python programs to use
Mechanical within Python's ecosystem. It includes the ability to:

- Connect to a remote Mechanical session
- Embed an instance of Mechanical directly as a Python object


Install the package
-------------------

Install PyMechanical using ``pip`` with::

   pip install ansys-mechanical-core

For more information, see `Install the package <https://mechanical.docs.pyansys.com/version/stable/getting_started/index.html>`_
in the PyMechanical documentation.


Dependencies
------------

You must have a licensed copy of `Ansys Mechanical <https://www.ansys.com/products/structures/ansys-mechanical>`_
installed. When using an embedded instance, that installation must be runnable from the
same computer as your Python program. When using a remote session, a connection to that
session must be reachable from your Python program.

Getting started
---------------

PyMechanical uses the built-in scripting capabilities of Mechanical. For information on the
scripting APIs available, see the `Scripting in Mechanical Guide
<https://ansyshelp.ansys.com/Views/Secured/corp/v242/en/act_script/act_script.html>`_ in the
Ansys Help.

Configuring the mechanical installation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

On a Windows system, the environment variable ``AWP_ROOT<ver>`` is configured when Mechanical is
installed, where ``<ver>`` is the Mechanical release number, such as ``242`` for release 2024 R2.
PyMechanical automatically uses this environment variable (or variables if there are multiple
installations of different versions) to locate the latest Mechanical installation. On a Linux
system, you must configure the ``AWP_ROOT<ver>`` environment variable to point to the
absolute path of a Mechanical installation.

Starting a remote session
^^^^^^^^^^^^^^^^^^^^^^^^^

To start a remote session of Mechanical on your computer from Python, use the ``launch_mechanical()``
method. This methods returns an object representing the connection to the session:

.. code:: python

   import ansys.mechanical.core as pymechanical

   mechanical = pymechanical.launch_mechanical()

Running commands on the remote session
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Given a connection to a remote session, you can send an IronPython script. This uses the built-in
scripting capabilities of Mechanical. Here is an example:

.. code:: python

    result = mechanical.run_python_script("2+3")
    result = mechanical.run_python_script("ExtAPI.DataModel.Project.ProjectDirectory")


Using an embedded instance of Mechanical as a Python object
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

PyMechanical also supports directly embedding an instance of Mechanical as a Python object.
In this mode, there is no externally running instance of Mechanical. This feature is supported
on Windows and Linux for version 2023 R2 and later. Here is an example:

.. code:: python

   import ansys.mechanical.core as pymechanical

   app = pymechanical.App()
   app.update_globals(globals())
   project_dir = DataModel.Project.ProjectDirectory

Documentation and issues
------------------------

Documentation for the latest stable release of PyMechanical is hosted at `PyMechanical documentation
<https://mechanical.docs.pyansys.com/>`_.

In the upper right corner of the documentation's title bar, there is an option for switching from
viewing the documentation for the latest stable release to viewing the documentation for the
development version or previously released versions.

You can also `view <https://cheatsheets.docs.pyansys.com/pymechanical_cheat_sheet.png>`_ or
`download <https://cheatsheets.docs.pyansys.com/pymechanical_cheat_sheet.pdf>`_ the
PyMechanical cheat sheet. This one-page reference provides syntax rules and commands
for using PyMechanical.

On the `PyMechanical Issues <https://github.com/ansys/pymechanical/issues>`_ page,
you can create issues to report bugs and request new features. On the `PyMechanical Discussions
<https://github.com/ansys/pymechanical/discussions>`_ page or the `Discussions <https://discuss.ansys.com/>`_
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 <pyansys.core@ansys.com>`_.

Testing and development
-----------------------

If you would like to test or contribute to the development of PyMechanical, see
`Contribute <https://mechanical.docs.pyansys.com/version/stable/contributing.html>`_ in
the PyMechanical documentation.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ansys-mechanical-core",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": "\"ANSYS, Inc.\" <pyansys.core@ansys.com>",
    "keywords": "pymechanical, mechanical, ansys, pyansys",
    "author": null,
    "author_email": "\"ANSYS, Inc.\" <pyansys.core@ansys.com>",
    "download_url": "https://files.pythonhosted.org/packages/ba/06/6a77be22266afabd40fd0c93a272e6b311a63f9f550c00bf2628ce653780/ansys_mechanical_core-0.11.7.tar.gz",
    "platform": null,
    "description": ".. image:: https://raw.githubusercontent.com/ansys/pymechanical/main/doc/source/_static/logo/pymechanical-logo.png\n   :alt: PyMechanical logo\n   :width: 580px\n\n\n|pyansys| |pypi| |python| |GH-CI| |codecov| |MIT| |black|\n\n.. |pyansys| image:: https://img.shields.io/badge/Py-Ansys-ffc107.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABDklEQVQ4jWNgoDfg5mD8vE7q/3bpVyskbW0sMRUwofHD7Dh5OBkZGBgW7/3W2tZpa2tLQEOyOzeEsfumlK2tbVpaGj4N6jIs1lpsDAwMJ278sveMY2BgCA0NFRISwqkhyQ1q/Nyd3zg4OBgYGNjZ2ePi4rB5loGBhZnhxTLJ/9ulv26Q4uVk1NXV/f///////69du4Zdg78lx//t0v+3S88rFISInD59GqIH2esIJ8G9O2/XVwhjzpw5EAam1xkkBJn/bJX+v1365hxxuCAfH9+3b9/+////48cPuNehNsS7cDEzMTAwMMzb+Q2u4dOnT2vWrMHu9ZtzxP9vl/69RVpCkBlZ3N7enoDXBwEAAA+YYitOilMVAAAAAElFTkSuQmCC\n   :target: https://docs.pyansys.com/\n   :alt: PyAnsys\n\n.. |pypi| image:: https://img.shields.io/pypi/v/ansys-mechanical-core.svg?logo=python&logoColor=white\n   :target: https://pypi.org/project/ansys-mechanical-core\n   :alt: PyPI\n\n.. |python| image:: https://img.shields.io/pypi/pyversions/ansys-mechanical-core?logo=pypi\n   :target: https://pypi.org/project/ansys-mechanical-core\n   :alt: Python\n\n.. |codecov| image:: https://codecov.io/gh/ansys/pymechanical/branch/main/graph/badge.svg\n   :target: https://app.codecov.io/gh/ansys/pymechanical\n   :alt: Codecov\n\n.. |GH-CI| image:: https://github.com/ansys/pymechanical/actions/workflows/ci_cd.yml/badge.svg\n   :target: https://github.com/ansys/pymechanical/actions/workflows/ci_cd.yml\n   :alt: GH-CI\n\n.. |MIT| image:: https://img.shields.io/badge/License-MIT-yellow.svg\n   :target: https://opensource.org/licenses/MIT\n   :alt: MIT\n\n.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg?style=flat\n   :target: https://github.com/psf/black\n   :alt: Black\n\n.. |pre-commit| image:: https://results.pre-commit.ci/badge/github/ansys/pymechanical/main.svg?style=flat\n   :target: https://results.pre-commit.ci/latest/github/ansys/pymechanical/main\n   :alt: pre-commit\n\nOverview\n--------\n\nPyMechanical brings Ansys Mechanical to Python. It enables your Python programs to use\nMechanical within Python's ecosystem. It includes the ability to:\n\n- Connect to a remote Mechanical session\n- Embed an instance of Mechanical directly as a Python object\n\n\nInstall the package\n-------------------\n\nInstall PyMechanical using ``pip`` with::\n\n   pip install ansys-mechanical-core\n\nFor more information, see `Install the package <https://mechanical.docs.pyansys.com/version/stable/getting_started/index.html>`_\nin the PyMechanical documentation.\n\n\nDependencies\n------------\n\nYou must have a licensed copy of `Ansys Mechanical <https://www.ansys.com/products/structures/ansys-mechanical>`_\ninstalled. When using an embedded instance, that installation must be runnable from the\nsame computer as your Python program. When using a remote session, a connection to that\nsession must be reachable from your Python program.\n\nGetting started\n---------------\n\nPyMechanical uses the built-in scripting capabilities of Mechanical. For information on the\nscripting APIs available, see the `Scripting in Mechanical Guide\n<https://ansyshelp.ansys.com/Views/Secured/corp/v242/en/act_script/act_script.html>`_ in the\nAnsys Help.\n\nConfiguring the mechanical installation\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nOn a Windows system, the environment variable ``AWP_ROOT<ver>`` is configured when Mechanical is\ninstalled, where ``<ver>`` is the Mechanical release number, such as ``242`` for release 2024 R2.\nPyMechanical automatically uses this environment variable (or variables if there are multiple\ninstallations of different versions) to locate the latest Mechanical installation. On a Linux\nsystem, you must configure the ``AWP_ROOT<ver>`` environment variable to point to the\nabsolute path of a Mechanical installation.\n\nStarting a remote session\n^^^^^^^^^^^^^^^^^^^^^^^^^\n\nTo start a remote session of Mechanical on your computer from Python, use the ``launch_mechanical()``\nmethod. This methods returns an object representing the connection to the session:\n\n.. code:: python\n\n   import ansys.mechanical.core as pymechanical\n\n   mechanical = pymechanical.launch_mechanical()\n\nRunning commands on the remote session\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nGiven a connection to a remote session, you can send an IronPython script. This uses the built-in\nscripting capabilities of Mechanical. Here is an example:\n\n.. code:: python\n\n    result = mechanical.run_python_script(\"2+3\")\n    result = mechanical.run_python_script(\"ExtAPI.DataModel.Project.ProjectDirectory\")\n\n\nUsing an embedded instance of Mechanical as a Python object\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nPyMechanical also supports directly embedding an instance of Mechanical as a Python object.\nIn this mode, there is no externally running instance of Mechanical. This feature is supported\non Windows and Linux for version 2023 R2 and later. Here is an example:\n\n.. code:: python\n\n   import ansys.mechanical.core as pymechanical\n\n   app = pymechanical.App()\n   app.update_globals(globals())\n   project_dir = DataModel.Project.ProjectDirectory\n\nDocumentation and issues\n------------------------\n\nDocumentation for the latest stable release of PyMechanical is hosted at `PyMechanical documentation\n<https://mechanical.docs.pyansys.com/>`_.\n\nIn the upper right corner of the documentation's title bar, there is an option for switching from\nviewing the documentation for the latest stable release to viewing the documentation for the\ndevelopment version or previously released versions.\n\nYou can also `view <https://cheatsheets.docs.pyansys.com/pymechanical_cheat_sheet.png>`_ or\n`download <https://cheatsheets.docs.pyansys.com/pymechanical_cheat_sheet.pdf>`_ the\nPyMechanical cheat sheet. This one-page reference provides syntax rules and commands\nfor using PyMechanical.\n\nOn the `PyMechanical Issues <https://github.com/ansys/pymechanical/issues>`_ page,\nyou can create issues to report bugs and request new features. On the `PyMechanical Discussions\n<https://github.com/ansys/pymechanical/discussions>`_ page or the `Discussions <https://discuss.ansys.com/>`_\npage on the Ansys Developer portal, you can post questions, share ideas, and get community feedback.\n\nTo reach the project support team, email `pyansys.core@ansys.com <pyansys.core@ansys.com>`_.\n\nTesting and development\n-----------------------\n\nIf you would like to test or contribute to the development of PyMechanical, see\n`Contribute <https://mechanical.docs.pyansys.com/version/stable/contributing.html>`_ in\nthe PyMechanical documentation.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A python wrapper for Ansys Mechanical",
    "version": "0.11.7",
    "project_urls": {
        "Changelog": "https://mechanical.docs.pyansys.com/version/stable/changelog.html",
        "Documentation": "https://mechanical.docs.pyansys.com",
        "Homepage": "https://github.com/ansys/pymechanical",
        "Issues": "https://github.com/ansys/pymechanical/issues",
        "Repository": "https://github.com/ansys/pymechanical"
    },
    "split_keywords": [
        "pymechanical",
        " mechanical",
        " ansys",
        " pyansys"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "95413a84b9a1b8dc5eeee0c44c31a5ca8657bf175d4f808ef56b2a37865ce54e",
                "md5": "86eb5ce26cc79f76edb2dd31db78207d",
                "sha256": "e13a98a87648ea80ad3c9d3901504d05c3500b359b0f88dfb06bc066e97783f1"
            },
            "downloads": -1,
            "filename": "ansys_mechanical_core-0.11.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "86eb5ce26cc79f76edb2dd31db78207d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 99587,
            "upload_time": "2024-08-29T14:27:34",
            "upload_time_iso_8601": "2024-08-29T14:27:34.406561Z",
            "url": "https://files.pythonhosted.org/packages/95/41/3a84b9a1b8dc5eeee0c44c31a5ca8657bf175d4f808ef56b2a37865ce54e/ansys_mechanical_core-0.11.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ba066a77be22266afabd40fd0c93a272e6b311a63f9f550c00bf2628ce653780",
                "md5": "78bc303a7d4ebbc80e3619880d431f97",
                "sha256": "6c54a5b4504ff3ffa3823e1c8e53c91b6d2f182c6fe4f6fd553f68a3e882f940"
            },
            "downloads": -1,
            "filename": "ansys_mechanical_core-0.11.7.tar.gz",
            "has_sig": false,
            "md5_digest": "78bc303a7d4ebbc80e3619880d431f97",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 65209,
            "upload_time": "2024-08-29T14:27:37",
            "upload_time_iso_8601": "2024-08-29T14:27:37.225872Z",
            "url": "https://files.pythonhosted.org/packages/ba/06/6a77be22266afabd40fd0c93a272e6b311a63f9f550c00bf2628ce653780/ansys_mechanical_core-0.11.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-29 14:27:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ansys",
    "github_project": "pymechanical",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "ansys-mechanical-core"
}
        
Elapsed time: 3.12203s