ansys-mechanical-core 0.10.11__tar.gz → 0.11.12__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/LICENSE +1 -1
  2. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/PKG-INFO +55 -54
  3. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/README.rst +154 -158
  4. ansys_mechanical_core-0.11.12/pyproject.toml +279 -0
  5. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/__init__.py +11 -4
  6. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/_version.py +48 -47
  7. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/__init__.py +1 -1
  8. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/addins.py +1 -7
  9. ansys_mechanical_core-0.11.12/src/ansys/mechanical/core/embedding/app.py +610 -0
  10. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/app_libraries.py +2 -2
  11. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/appdata.py +11 -4
  12. ansys_mechanical_core-0.11.12/src/ansys/mechanical/core/embedding/background.py +106 -0
  13. ansys_mechanical_core-0.11.12/src/ansys/mechanical/core/embedding/cleanup_gui.py +61 -0
  14. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/enum_importer.py +2 -2
  15. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/imports.py +27 -7
  16. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/initializer.py +104 -51
  17. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/loader.py +1 -1
  18. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/logger/__init__.py +219 -216
  19. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/logger/environ.py +1 -1
  20. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/logger/linux_api.py +1 -1
  21. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/logger/sinks.py +1 -1
  22. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/logger/windows_api.py +2 -2
  23. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/poster.py +34 -2
  24. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/resolver.py +41 -44
  25. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/runtime.py +1 -1
  26. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/shims.py +9 -8
  27. ansys_mechanical_core-0.11.12/src/ansys/mechanical/core/embedding/ui.py +228 -0
  28. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/utils.py +1 -1
  29. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/viz/__init__.py +1 -1
  30. ansys_mechanical_core-0.10.11/src/ansys/mechanical/core/embedding/viz/pyvista_plotter.py → ansys_mechanical_core-0.11.12/src/ansys/mechanical/core/embedding/viz/embedding_plotter.py +24 -12
  31. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/viz/usd_converter.py +59 -25
  32. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/viz/utils.py +32 -2
  33. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/warnings.py +1 -1
  34. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/errors.py +2 -1
  35. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/examples/__init__.py +1 -1
  36. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/examples/downloads.py +10 -5
  37. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/feature_flags.py +1 -1
  38. ansys_mechanical_core-0.11.12/src/ansys/mechanical/core/ide_config.py +212 -0
  39. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/launcher.py +9 -9
  40. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/logging.py +14 -2
  41. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/mechanical.py +2324 -2237
  42. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/misc.py +176 -176
  43. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/pool.py +712 -712
  44. {ansys_mechanical_core-0.10.11 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/run.py +321 -291
  45. ansys_mechanical_core-0.10.11/pyproject.toml +0 -177
  46. ansys_mechanical_core-0.10.11/src/ansys/mechanical/core/embedding/app.py +0 -281
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 - 2024 ANSYS, Inc. and/or its affiliates.
3
+ Copyright (c) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
@@ -1,71 +1,78 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: ansys-mechanical-core
3
- Version: 0.10.11
3
+ Version: 0.11.12
4
4
  Summary: A python wrapper for Ansys Mechanical
5
+ Keywords: pymechanical,mechanical,ansys,pyansys
5
6
  Author-email: "ANSYS, Inc." <pyansys.core@ansys.com>
6
7
  Maintainer-email: "ANSYS, Inc." <pyansys.core@ansys.com>
7
- Requires-Python: >=3.9,<4.0
8
+ Requires-Python: >=3.10,<4.0
8
9
  Description-Content-Type: text/x-rst
9
10
  Classifier: Development Status :: 4 - Beta
10
11
  Classifier: Intended Audience :: Science/Research
11
12
  Classifier: Topic :: Scientific/Engineering :: Information Analysis
12
- Classifier: Programming Language :: Python :: 3.9
13
13
  Classifier: Programming Language :: Python :: 3.10
14
14
  Classifier: Programming Language :: Python :: 3.11
15
15
  Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
16
17
  Classifier: License :: OSI Approved :: MIT License
17
18
  Classifier: Operating System :: OS Independent
18
19
  Requires-Dist: ansys-api-mechanical==0.1.2
19
- Requires-Dist: ansys-mechanical-env==0.1.6
20
+ Requires-Dist: ansys-mechanical-env==0.1.9
21
+ Requires-Dist: ansys-mechanical-stubs==0.1.6
20
22
  Requires-Dist: ansys-platform-instancemanagement>=1.0.1
21
23
  Requires-Dist: ansys-pythonnet>=3.1.0rc2
22
24
  Requires-Dist: ansys-tools-path>=0.3.1
23
25
  Requires-Dist: appdirs>=1.4.0
24
26
  Requires-Dist: click>=8.1.3
25
- Requires-Dist: clr-loader==0.2.6
27
+ Requires-Dist: clr-loader==0.2.7.post0
26
28
  Requires-Dist: grpcio>=1.30.0
27
29
  Requires-Dist: protobuf>=3.12.2,<6
30
+ Requires-Dist: psutil==6.1.1
28
31
  Requires-Dist: tqdm>=4.45.0
29
- Requires-Dist: sphinx==7.3.7 ; extra == "doc"
30
- Requires-Dist: ansys-sphinx-theme==0.16.0 ; extra == "doc"
31
- Requires-Dist: grpcio==1.64.0 ; extra == "doc"
32
- Requires-Dist: imageio-ffmpeg==0.4.9 ; extra == "doc"
33
- Requires-Dist: imageio==2.34.1 ; extra == "doc"
32
+ Requires-Dist: requests>=2,<3
33
+ Requires-Dist: sphinx==8.1.3 ; extra == "doc"
34
+ Requires-Dist: ansys-sphinx-theme[autoapi]==1.2.6 ; extra == "doc"
35
+ Requires-Dist: grpcio==1.69.0 ; extra == "doc"
36
+ Requires-Dist: imageio-ffmpeg==0.5.1 ; extra == "doc"
37
+ Requires-Dist: imageio==2.36.1 ; extra == "doc"
34
38
  Requires-Dist: jupyter_sphinx==0.5.3 ; extra == "doc"
35
39
  Requires-Dist: jupyterlab>=3.2.8 ; extra == "doc"
36
- Requires-Dist: matplotlib==3.9.0 ; extra == "doc"
37
- Requires-Dist: numpy==1.26.4 ; extra == "doc"
38
- Requires-Dist: numpydoc==1.7.0 ; extra == "doc"
39
- Requires-Dist: pandas==2.2.2 ; extra == "doc"
40
- Requires-Dist: panel==1.4.2 ; extra == "doc"
41
- Requires-Dist: plotly==5.22.0 ; extra == "doc"
42
- Requires-Dist: pypandoc==1.13 ; extra == "doc"
40
+ Requires-Dist: matplotlib==3.10.0 ; extra == "doc"
41
+ Requires-Dist: numpy==2.2.1 ; extra == "doc"
42
+ Requires-Dist: numpydoc==1.8.0 ; extra == "doc"
43
+ Requires-Dist: pandas==2.2.3 ; extra == "doc"
44
+ Requires-Dist: panel==1.5.5 ; extra == "doc"
45
+ Requires-Dist: plotly==5.24.1 ; extra == "doc"
46
+ Requires-Dist: pypandoc==1.15 ; extra == "doc"
43
47
  Requires-Dist: pytest-sphinx==0.6.3 ; extra == "doc"
44
48
  Requires-Dist: pythreejs==2.4.2 ; extra == "doc"
45
- Requires-Dist: pyvista==0.43.8 ; extra == "doc"
46
- Requires-Dist: sphinx-autobuild==2024.4.16 ; extra == "doc"
47
- Requires-Dist: sphinx-autodoc-typehints==2.1.0 ; extra == "doc"
49
+ Requires-Dist: pyvista>=0.39.1 ; extra == "doc"
50
+ Requires-Dist: sphinx-autobuild==2024.10.3 ; extra == "doc"
51
+ Requires-Dist: sphinx-autodoc-typehints==3.0.0 ; extra == "doc"
48
52
  Requires-Dist: sphinx-copybutton==0.5.2 ; extra == "doc"
49
- Requires-Dist: sphinx_design==0.5.0 ; extra == "doc"
50
- Requires-Dist: sphinx-gallery==0.16.0 ; extra == "doc"
51
- Requires-Dist: sphinx-notfound-page==1.0.0 ; extra == "doc"
52
- Requires-Dist: sphinxcontrib-websupport==1.2.7 ; extra == "doc"
53
+ Requires-Dist: sphinx_design==0.6.1 ; extra == "doc"
54
+ Requires-Dist: sphinx-gallery==0.18.0 ; extra == "doc"
55
+ Requires-Dist: sphinx-notfound-page==1.0.4 ; extra == "doc"
56
+ Requires-Dist: sphinxcontrib-websupport==2.0.0 ; extra == "doc"
53
57
  Requires-Dist: sphinxemoji==0.3.1 ; extra == "doc"
54
- Requires-Dist: pytest==8.2.1 ; extra == "tests"
55
- Requires-Dist: pytest-cov==5.0.0 ; extra == "tests"
56
- Requires-Dist: pytest-print==1.0.0 ; extra == "tests"
57
- Requires-Dist: pyvista>=0.39.1 ; extra == "viz"
58
- Requires-Dist: usd-core==24.3 ; extra == "viz"
58
+ Requires-Dist: pytest==8.3.4 ; extra == "tests"
59
+ Requires-Dist: pytest-cov==6.0.0 ; extra == "tests"
60
+ Requires-Dist: pytest-print==1.0.2 ; extra == "tests"
61
+ Requires-Dist: psutil==6.1.1 ; extra == "tests"
62
+ Requires-Dist: ansys-tools-visualization-interface>=0.2.6 ; extra == "viz"
63
+ Requires-Dist: usd-core==24.11 ; extra == "viz"
64
+ Project-URL: Changelog, https://mechanical.docs.pyansys.com/version/stable/changelog.html
59
65
  Project-URL: Documentation, https://mechanical.docs.pyansys.com
60
66
  Project-URL: Homepage, https://github.com/ansys/pymechanical
61
- Project-URL: Source, https://github.com/ansys/pymechanical
62
- Project-URL: Tracker, https://github.com/ansys/pymechanical/issues
67
+ Project-URL: Issues, https://github.com/ansys/pymechanical/issues
68
+ Project-URL: Repository, https://github.com/ansys/pymechanical
63
69
  Provides-Extra: doc
64
70
  Provides-Extra: tests
65
71
  Provides-Extra: viz
66
72
 
67
- .. image:: https://raw.githubusercontent.com/ansys/pymechanical/main/doc/source/_static/logo/pymechanical-logo-light.png
73
+ .. image:: https://raw.githubusercontent.com/ansys/pymechanical/main/doc/source/_static/logo/pymechanical-logo.png
68
74
  :alt: PyMechanical logo
75
+ :width: 580px
69
76
 
70
77
 
71
78
  |pyansys| |pypi| |python| |GH-CI| |codecov| |MIT| |black|
@@ -83,7 +90,7 @@ Provides-Extra: viz
83
90
  :alt: Python
84
91
 
85
92
  .. |codecov| image:: https://codecov.io/gh/ansys/pymechanical/branch/main/graph/badge.svg
86
- :target: https://codecov.io/gh/ansys/ansys-mechanical-core
93
+ :target: https://app.codecov.io/gh/ansys/pymechanical
87
94
  :alt: Codecov
88
95
 
89
96
  .. |GH-CI| image:: https://github.com/ansys/pymechanical/actions/workflows/ci_cd.yml/badge.svg
@@ -98,9 +105,13 @@ Provides-Extra: viz
98
105
  :target: https://github.com/psf/black
99
106
  :alt: Black
100
107
 
108
+ .. |pre-commit| image:: https://results.pre-commit.ci/badge/github/ansys/pymechanical/main.svg?style=flat
109
+ :target: https://results.pre-commit.ci/latest/github/ansys/pymechanical/main
110
+ :alt: pre-commit
101
111
 
102
112
  Overview
103
113
  --------
114
+
104
115
  PyMechanical brings Ansys Mechanical to Python. It enables your Python programs to use
105
116
  Mechanical within Python's ecosystem. It includes the ability to:
106
117
 
@@ -110,7 +121,8 @@ Mechanical within Python's ecosystem. It includes the ability to:
110
121
 
111
122
  Install the package
112
123
  -------------------
113
- Install PyMechanical using `pip` with::
124
+
125
+ Install PyMechanical using ``pip`` with::
114
126
 
115
127
  pip install ansys-mechanical-core
116
128
 
@@ -129,16 +141,17 @@ session must be reachable from your Python program.
129
141
  Getting started
130
142
  ---------------
131
143
 
144
+ .. _scripting_guide: https://ansyshelp.ansys.com/Views/Secured/corp/v251/en/act_script/act_script.html
145
+
132
146
  PyMechanical uses the built-in scripting capabilities of Mechanical. For information on the
133
- scripting APIs available, see the `Scripting in Mechanical Guide
134
- <https://ansyshelp.ansys.com/Views/Secured/corp/v241/en/act_script/act_script.html>`_ in the
147
+ scripting APIs available, see the `Scripting in Mechanical Guide <_scripting_guide>`_ in the
135
148
  Ansys Help.
136
149
 
137
150
  Configuring the mechanical installation
138
151
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
139
152
 
140
153
  On a Windows system, the environment variable ``AWP_ROOT<ver>`` is configured when Mechanical is
141
- installed, where ``<ver>`` is the Mechanical release number, such as ``231`` for release 2023 R1.
154
+ installed, where ``<ver>`` is the Mechanical release number, such as ``251`` for release 2025 R1.
142
155
  PyMechanical automatically uses this environment variable (or variables if there are multiple
143
156
  installations of different versions) to locate the latest Mechanical installation. On a Linux
144
157
  system, you must configure the ``AWP_ROOT<ver>`` environment variable to point to the
@@ -173,21 +186,21 @@ Using an embedded instance of Mechanical as a Python object
173
186
 
174
187
  PyMechanical also supports directly embedding an instance of Mechanical as a Python object.
175
188
  In this mode, there is no externally running instance of Mechanical. This feature is supported
176
- on Windows for version 2023 R1 and later, and on Linux for version 2023 R2
177
- and later. Here is an example:
189
+ on Windows and Linux for version 2023 R2 and later. Here is an example:
178
190
 
179
191
  .. code:: python
180
192
 
181
193
  import ansys.mechanical.core as pymechanical
182
194
 
183
195
  app = pymechanical.App()
184
- project_dir = app.ExtAPI.DataModel.Project.ProjectDirectory
196
+ app.update_globals(globals())
197
+ project_dir = DataModel.Project.ProjectDirectory
185
198
 
186
199
  Documentation and issues
187
200
  ------------------------
188
201
 
189
202
  Documentation for the latest stable release of PyMechanical is hosted at `PyMechanical documentation
190
- <https://mechanical.docs.pyansys.com/version/stable/>`_.
203
+ <https://mechanical.docs.pyansys.com/>`_.
191
204
 
192
205
  In the upper right corner of the documentation's title bar, there is an option for switching from
193
206
  viewing the documentation for the latest stable release to viewing the documentation for the
@@ -211,15 +224,3 @@ Testing and development
211
224
  If you would like to test or contribute to the development of PyMechanical, see
212
225
  `Contribute <https://mechanical.docs.pyansys.com/version/stable/contributing.html>`_ in
213
226
  the PyMechanical documentation.
214
-
215
- .. LINKS AND REFERENCES
216
- .. _black: https://github.com/psf/black
217
- .. _flake8: https://flake8.pycqa.org/en/latest/
218
- .. _isort: https://github.com/PyCQA/isort
219
- .. _pip: https://pypi.org/project/pip/
220
- .. _pre-commit: https://pre-commit.com/
221
- .. _PyAnsys Developer's Guide: https://dev.docs.pyansys.com/
222
- .. _pytest: https://docs.pytest.org/en/stable/
223
- .. _Sphinx: https://www.sphinx-doc.org/en/master/
224
- .. _tox: https://tox.wiki/
225
-
@@ -1,158 +1,154 @@
1
- .. image:: https://raw.githubusercontent.com/ansys/pymechanical/main/doc/source/_static/logo/pymechanical-logo-light.png
2
- :alt: PyMechanical logo
3
-
4
-
5
- |pyansys| |pypi| |python| |GH-CI| |codecov| |MIT| |black|
6
-
7
- .. |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
8
- :target: https://docs.pyansys.com/
9
- :alt: PyAnsys
10
-
11
- .. |pypi| image:: https://img.shields.io/pypi/v/ansys-mechanical-core.svg?logo=python&logoColor=white
12
- :target: https://pypi.org/project/ansys-mechanical-core
13
- :alt: PyPI
14
-
15
- .. |python| image:: https://img.shields.io/pypi/pyversions/ansys-mechanical-core?logo=pypi
16
- :target: https://pypi.org/project/ansys-mechanical-core
17
- :alt: Python
18
-
19
- .. |codecov| image:: https://codecov.io/gh/ansys/pymechanical/branch/main/graph/badge.svg
20
- :target: https://codecov.io/gh/ansys/ansys-mechanical-core
21
- :alt: Codecov
22
-
23
- .. |GH-CI| image:: https://github.com/ansys/pymechanical/actions/workflows/ci_cd.yml/badge.svg
24
- :target: https://github.com/ansys/pymechanical/actions/workflows/ci_cd.yml
25
- :alt: GH-CI
26
-
27
- .. |MIT| image:: https://img.shields.io/badge/License-MIT-yellow.svg
28
- :target: https://opensource.org/licenses/MIT
29
- :alt: MIT
30
-
31
- .. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg?style=flat
32
- :target: https://github.com/psf/black
33
- :alt: Black
34
-
35
-
36
- Overview
37
- --------
38
- PyMechanical brings Ansys Mechanical to Python. It enables your Python programs to use
39
- Mechanical within Python's ecosystem. It includes the ability to:
40
-
41
- - Connect to a remote Mechanical session
42
- - Embed an instance of Mechanical directly as a Python object
43
-
44
-
45
- Install the package
46
- -------------------
47
- Install PyMechanical using `pip` with::
48
-
49
- pip install ansys-mechanical-core
50
-
51
- For more information, see `Install the package <https://mechanical.docs.pyansys.com/version/stable/getting_started/index.html>`_
52
- in the PyMechanical documentation.
53
-
54
-
55
- Dependencies
56
- ------------
57
-
58
- You must have a licensed copy of `Ansys Mechanical <https://www.ansys.com/products/structures/ansys-mechanical>`_
59
- installed. When using an embedded instance, that installation must be runnable from the
60
- same computer as your Python program. When using a remote session, a connection to that
61
- session must be reachable from your Python program.
62
-
63
- Getting started
64
- ---------------
65
-
66
- PyMechanical uses the built-in scripting capabilities of Mechanical. For information on the
67
- scripting APIs available, see the `Scripting in Mechanical Guide
68
- <https://ansyshelp.ansys.com/Views/Secured/corp/v241/en/act_script/act_script.html>`_ in the
69
- Ansys Help.
70
-
71
- Configuring the mechanical installation
72
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
73
-
74
- On a Windows system, the environment variable ``AWP_ROOT<ver>`` is configured when Mechanical is
75
- installed, where ``<ver>`` is the Mechanical release number, such as ``231`` for release 2023 R1.
76
- PyMechanical automatically uses this environment variable (or variables if there are multiple
77
- installations of different versions) to locate the latest Mechanical installation. On a Linux
78
- system, you must configure the ``AWP_ROOT<ver>`` environment variable to point to the
79
- absolute path of a Mechanical installation.
80
-
81
- Starting a remote session
82
- ^^^^^^^^^^^^^^^^^^^^^^^^^
83
-
84
- To start a remote session of Mechanical on your computer from Python, use the ``launch_mechanical()``
85
- method. This methods returns an object representing the connection to the session:
86
-
87
- .. code:: python
88
-
89
- import ansys.mechanical.core as pymechanical
90
-
91
- mechanical = pymechanical.launch_mechanical()
92
-
93
- Running commands on the remote session
94
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
95
-
96
- Given a connection to a remote session, you can send an IronPython script. This uses the built-in
97
- scripting capabilities of Mechanical. Here is an example:
98
-
99
- .. code:: python
100
-
101
- result = mechanical.run_python_script("2+3")
102
- result = mechanical.run_python_script("ExtAPI.DataModel.Project.ProjectDirectory")
103
-
104
-
105
- Using an embedded instance of Mechanical as a Python object
106
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
107
-
108
- PyMechanical also supports directly embedding an instance of Mechanical as a Python object.
109
- In this mode, there is no externally running instance of Mechanical. This feature is supported
110
- on Windows for version 2023 R1 and later, and on Linux for version 2023 R2
111
- and later. Here is an example:
112
-
113
- .. code:: python
114
-
115
- import ansys.mechanical.core as pymechanical
116
-
117
- app = pymechanical.App()
118
- project_dir = app.ExtAPI.DataModel.Project.ProjectDirectory
119
-
120
- Documentation and issues
121
- ------------------------
122
-
123
- Documentation for the latest stable release of PyMechanical is hosted at `PyMechanical documentation
124
- <https://mechanical.docs.pyansys.com/version/stable/>`_.
125
-
126
- In the upper right corner of the documentation's title bar, there is an option for switching from
127
- viewing the documentation for the latest stable release to viewing the documentation for the
128
- development version or previously released versions.
129
-
130
- You can also `view <https://cheatsheets.docs.pyansys.com/pymechanical_cheat_sheet.png>`_ or
131
- `download <https://cheatsheets.docs.pyansys.com/pymechanical_cheat_sheet.pdf>`_ the
132
- PyMechanical cheat sheet. This one-page reference provides syntax rules and commands
133
- for using PyMechanical.
134
-
135
- On the `PyMechanical Issues <https://github.com/ansys/pymechanical/issues>`_ page,
136
- you can create issues to report bugs and request new features. On the `PyMechanical Discussions
137
- <https://github.com/ansys/pymechanical/discussions>`_ page or the `Discussions <https://discuss.ansys.com/>`_
138
- page on the Ansys Developer portal, you can post questions, share ideas, and get community feedback.
139
-
140
- To reach the project support team, email `pyansys.core@ansys.com <pyansys.core@ansys.com>`_.
141
-
142
- Testing and development
143
- -----------------------
144
-
145
- If you would like to test or contribute to the development of PyMechanical, see
146
- `Contribute <https://mechanical.docs.pyansys.com/version/stable/contributing.html>`_ in
147
- the PyMechanical documentation.
148
-
149
- .. LINKS AND REFERENCES
150
- .. _black: https://github.com/psf/black
151
- .. _flake8: https://flake8.pycqa.org/en/latest/
152
- .. _isort: https://github.com/PyCQA/isort
153
- .. _pip: https://pypi.org/project/pip/
154
- .. _pre-commit: https://pre-commit.com/
155
- .. _PyAnsys Developer's Guide: https://dev.docs.pyansys.com/
156
- .. _pytest: https://docs.pytest.org/en/stable/
157
- .. _Sphinx: https://www.sphinx-doc.org/en/master/
158
- .. _tox: https://tox.wiki/
1
+ .. image:: https://raw.githubusercontent.com/ansys/pymechanical/main/doc/source/_static/logo/pymechanical-logo.png
2
+ :alt: PyMechanical logo
3
+ :width: 580px
4
+
5
+
6
+ |pyansys| |pypi| |python| |GH-CI| |codecov| |MIT| |black|
7
+
8
+ .. |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
9
+ :target: https://docs.pyansys.com/
10
+ :alt: PyAnsys
11
+
12
+ .. |pypi| image:: https://img.shields.io/pypi/v/ansys-mechanical-core.svg?logo=python&logoColor=white
13
+ :target: https://pypi.org/project/ansys-mechanical-core
14
+ :alt: PyPI
15
+
16
+ .. |python| image:: https://img.shields.io/pypi/pyversions/ansys-mechanical-core?logo=pypi
17
+ :target: https://pypi.org/project/ansys-mechanical-core
18
+ :alt: Python
19
+
20
+ .. |codecov| image:: https://codecov.io/gh/ansys/pymechanical/branch/main/graph/badge.svg
21
+ :target: https://app.codecov.io/gh/ansys/pymechanical
22
+ :alt: Codecov
23
+
24
+ .. |GH-CI| image:: https://github.com/ansys/pymechanical/actions/workflows/ci_cd.yml/badge.svg
25
+ :target: https://github.com/ansys/pymechanical/actions/workflows/ci_cd.yml
26
+ :alt: GH-CI
27
+
28
+ .. |MIT| image:: https://img.shields.io/badge/License-MIT-yellow.svg
29
+ :target: https://opensource.org/licenses/MIT
30
+ :alt: MIT
31
+
32
+ .. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg?style=flat
33
+ :target: https://github.com/psf/black
34
+ :alt: Black
35
+
36
+ .. |pre-commit| image:: https://results.pre-commit.ci/badge/github/ansys/pymechanical/main.svg?style=flat
37
+ :target: https://results.pre-commit.ci/latest/github/ansys/pymechanical/main
38
+ :alt: pre-commit
39
+
40
+ Overview
41
+ --------
42
+
43
+ PyMechanical brings Ansys Mechanical to Python. It enables your Python programs to use
44
+ Mechanical within Python's ecosystem. It includes the ability to:
45
+
46
+ - Connect to a remote Mechanical session
47
+ - Embed an instance of Mechanical directly as a Python object
48
+
49
+
50
+ Install the package
51
+ -------------------
52
+
53
+ Install PyMechanical using ``pip`` with::
54
+
55
+ pip install ansys-mechanical-core
56
+
57
+ For more information, see `Install the package <https://mechanical.docs.pyansys.com/version/stable/getting_started/index.html>`_
58
+ in the PyMechanical documentation.
59
+
60
+
61
+ Dependencies
62
+ ------------
63
+
64
+ You must have a licensed copy of `Ansys Mechanical <https://www.ansys.com/products/structures/ansys-mechanical>`_
65
+ installed. When using an embedded instance, that installation must be runnable from the
66
+ same computer as your Python program. When using a remote session, a connection to that
67
+ session must be reachable from your Python program.
68
+
69
+ Getting started
70
+ ---------------
71
+
72
+ .. _scripting_guide: https://ansyshelp.ansys.com/Views/Secured/corp/v251/en/act_script/act_script.html
73
+
74
+ PyMechanical uses the built-in scripting capabilities of Mechanical. For information on the
75
+ scripting APIs available, see the `Scripting in Mechanical Guide <_scripting_guide>`_ in the
76
+ Ansys Help.
77
+
78
+ Configuring the mechanical installation
79
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
80
+
81
+ On a Windows system, the environment variable ``AWP_ROOT<ver>`` is configured when Mechanical is
82
+ installed, where ``<ver>`` is the Mechanical release number, such as ``251`` for release 2025 R1.
83
+ PyMechanical automatically uses this environment variable (or variables if there are multiple
84
+ installations of different versions) to locate the latest Mechanical installation. On a Linux
85
+ system, you must configure the ``AWP_ROOT<ver>`` environment variable to point to the
86
+ absolute path of a Mechanical installation.
87
+
88
+ Starting a remote session
89
+ ^^^^^^^^^^^^^^^^^^^^^^^^^
90
+
91
+ To start a remote session of Mechanical on your computer from Python, use the ``launch_mechanical()``
92
+ method. This methods returns an object representing the connection to the session:
93
+
94
+ .. code:: python
95
+
96
+ import ansys.mechanical.core as pymechanical
97
+
98
+ mechanical = pymechanical.launch_mechanical()
99
+
100
+ Running commands on the remote session
101
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
102
+
103
+ Given a connection to a remote session, you can send an IronPython script. This uses the built-in
104
+ scripting capabilities of Mechanical. Here is an example:
105
+
106
+ .. code:: python
107
+
108
+ result = mechanical.run_python_script("2+3")
109
+ result = mechanical.run_python_script("ExtAPI.DataModel.Project.ProjectDirectory")
110
+
111
+
112
+ Using an embedded instance of Mechanical as a Python object
113
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
114
+
115
+ PyMechanical also supports directly embedding an instance of Mechanical as a Python object.
116
+ In this mode, there is no externally running instance of Mechanical. This feature is supported
117
+ on Windows and Linux for version 2023 R2 and later. Here is an example:
118
+
119
+ .. code:: python
120
+
121
+ import ansys.mechanical.core as pymechanical
122
+
123
+ app = pymechanical.App()
124
+ app.update_globals(globals())
125
+ project_dir = DataModel.Project.ProjectDirectory
126
+
127
+ Documentation and issues
128
+ ------------------------
129
+
130
+ Documentation for the latest stable release of PyMechanical is hosted at `PyMechanical documentation
131
+ <https://mechanical.docs.pyansys.com/>`_.
132
+
133
+ In the upper right corner of the documentation's title bar, there is an option for switching from
134
+ viewing the documentation for the latest stable release to viewing the documentation for the
135
+ development version or previously released versions.
136
+
137
+ You can also `view <https://cheatsheets.docs.pyansys.com/pymechanical_cheat_sheet.png>`_ or
138
+ `download <https://cheatsheets.docs.pyansys.com/pymechanical_cheat_sheet.pdf>`_ the
139
+ PyMechanical cheat sheet. This one-page reference provides syntax rules and commands
140
+ for using PyMechanical.
141
+
142
+ On the `PyMechanical Issues <https://github.com/ansys/pymechanical/issues>`_ page,
143
+ you can create issues to report bugs and request new features. On the `PyMechanical Discussions
144
+ <https://github.com/ansys/pymechanical/discussions>`_ page or the `Discussions <https://discuss.ansys.com/>`_
145
+ page on the Ansys Developer portal, you can post questions, share ideas, and get community feedback.
146
+
147
+ To reach the project support team, email `pyansys.core@ansys.com <pyansys.core@ansys.com>`_.
148
+
149
+ Testing and development
150
+ -----------------------
151
+
152
+ If you would like to test or contribute to the development of PyMechanical, see
153
+ `Contribute <https://mechanical.docs.pyansys.com/version/stable/contributing.html>`_ in
154
+ the PyMechanical documentation.