ansys-mechanical-core 0.11.12__tar.gz → 0.11.13__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.
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/PKG-INFO +35 -23
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/README.rst +161 -153
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/pyproject.toml +21 -14
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/_version.py +48 -48
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/app.py +610 -610
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/background.py +11 -2
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/logger/__init__.py +219 -219
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/resolver.py +48 -41
- ansys_mechanical_core-0.11.13/src/ansys/mechanical/core/embedding/rpc/__init__.py +36 -0
- ansys_mechanical_core-0.11.13/src/ansys/mechanical/core/embedding/rpc/client.py +237 -0
- ansys_mechanical_core-0.11.13/src/ansys/mechanical/core/embedding/rpc/server.py +382 -0
- ansys_mechanical_core-0.11.13/src/ansys/mechanical/core/embedding/rpc/utils.py +120 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/runtime.py +22 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/feature_flags.py +1 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/ide_config.py +212 -212
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/mechanical.py +2343 -2324
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/misc.py +176 -176
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/pool.py +712 -712
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/run.py +321 -321
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/LICENSE +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/__init__.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/__init__.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/addins.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/app_libraries.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/appdata.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/cleanup_gui.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/enum_importer.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/imports.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/initializer.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/loader.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/logger/environ.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/logger/linux_api.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/logger/sinks.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/logger/windows_api.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/poster.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/shims.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/ui.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/utils.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/viz/__init__.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/viz/embedding_plotter.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/viz/usd_converter.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/viz/utils.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/embedding/warnings.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/errors.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/examples/__init__.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/examples/downloads.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/launcher.py +0 -0
- {ansys_mechanical_core-0.11.12 → ansys_mechanical_core-0.11.13}/src/ansys/mechanical/core/logging.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: ansys-mechanical-core
|
3
|
-
Version: 0.11.
|
3
|
+
Version: 0.11.13
|
4
4
|
Summary: A python wrapper for Ansys Mechanical
|
5
5
|
Keywords: pymechanical,mechanical,ansys,pyansys
|
6
6
|
Author-email: "ANSYS, Inc." <pyansys.core@ansys.com>
|
@@ -19,42 +19,44 @@ Classifier: Operating System :: OS Independent
|
|
19
19
|
Requires-Dist: ansys-api-mechanical==0.1.2
|
20
20
|
Requires-Dist: ansys-mechanical-env==0.1.9
|
21
21
|
Requires-Dist: ansys-mechanical-stubs==0.1.6
|
22
|
-
Requires-Dist: ansys-
|
23
|
-
Requires-Dist: ansys-pythonnet>=3.1.0rc2
|
22
|
+
Requires-Dist: ansys-pythonnet>=3.1.0rc6
|
24
23
|
Requires-Dist: ansys-tools-path>=0.3.1
|
25
24
|
Requires-Dist: appdirs>=1.4.0
|
26
25
|
Requires-Dist: click>=8.1.3
|
27
|
-
Requires-Dist: clr-loader
|
26
|
+
Requires-Dist: clr-loader>=0.2.6
|
28
27
|
Requires-Dist: grpcio>=1.30.0
|
29
28
|
Requires-Dist: protobuf>=3.12.2,<6
|
30
|
-
Requires-Dist: psutil
|
29
|
+
Requires-Dist: psutil>=6
|
31
30
|
Requires-Dist: tqdm>=4.45.0
|
32
31
|
Requires-Dist: requests>=2,<3
|
33
32
|
Requires-Dist: sphinx==8.1.3 ; extra == "doc"
|
34
|
-
Requires-Dist: ansys-sphinx-theme[autoapi]==1.
|
35
|
-
Requires-Dist: grpcio==1.
|
36
|
-
Requires-Dist: imageio-ffmpeg==0.
|
37
|
-
Requires-Dist: imageio==2.
|
33
|
+
Requires-Dist: ansys-sphinx-theme[autoapi, changelog]==1.3.1 ; extra == "doc"
|
34
|
+
Requires-Dist: grpcio==1.70.0 ; extra == "doc"
|
35
|
+
Requires-Dist: imageio-ffmpeg==0.6.0 ; extra == "doc"
|
36
|
+
Requires-Dist: imageio==2.37.0 ; extra == "doc"
|
38
37
|
Requires-Dist: jupyter_sphinx==0.5.3 ; extra == "doc"
|
39
38
|
Requires-Dist: jupyterlab>=3.2.8 ; extra == "doc"
|
40
39
|
Requires-Dist: matplotlib==3.10.0 ; extra == "doc"
|
41
|
-
Requires-Dist: numpy==2.2.
|
40
|
+
Requires-Dist: numpy==2.2.2 ; extra == "doc"
|
42
41
|
Requires-Dist: numpydoc==1.8.0 ; extra == "doc"
|
43
42
|
Requires-Dist: pandas==2.2.3 ; extra == "doc"
|
44
|
-
Requires-Dist: panel==1.
|
45
|
-
Requires-Dist: plotly==
|
43
|
+
Requires-Dist: panel==1.6.0 ; extra == "doc"
|
44
|
+
Requires-Dist: plotly==6.0.0 ; extra == "doc"
|
46
45
|
Requires-Dist: pypandoc==1.15 ; extra == "doc"
|
47
46
|
Requires-Dist: pytest-sphinx==0.6.3 ; extra == "doc"
|
48
47
|
Requires-Dist: pythreejs==2.4.2 ; extra == "doc"
|
49
48
|
Requires-Dist: pyvista>=0.39.1 ; extra == "doc"
|
50
49
|
Requires-Dist: sphinx-autobuild==2024.10.3 ; extra == "doc"
|
51
|
-
Requires-Dist: sphinx-autodoc-typehints==3.0.
|
50
|
+
Requires-Dist: sphinx-autodoc-typehints==3.0.1 ; extra == "doc"
|
52
51
|
Requires-Dist: sphinx-copybutton==0.5.2 ; extra == "doc"
|
53
52
|
Requires-Dist: sphinx_design==0.6.1 ; extra == "doc"
|
54
53
|
Requires-Dist: sphinx-gallery==0.18.0 ; extra == "doc"
|
55
|
-
Requires-Dist: sphinx-notfound-page==1.0
|
54
|
+
Requires-Dist: sphinx-notfound-page==1.1.0 ; extra == "doc"
|
56
55
|
Requires-Dist: sphinxcontrib-websupport==2.0.0 ; extra == "doc"
|
57
56
|
Requires-Dist: sphinxemoji==0.3.1 ; extra == "doc"
|
57
|
+
Requires-Dist: ansys-platform-instancemanagement>=1.0.1 ; extra == "pim"
|
58
|
+
Requires-Dist: rpyc==6.0.1 ; extra == "rpc"
|
59
|
+
Requires-Dist: toolz==1.0.0 ; extra == "rpc"
|
58
60
|
Requires-Dist: pytest==8.3.4 ; extra == "tests"
|
59
61
|
Requires-Dist: pytest-cov==6.0.0 ; extra == "tests"
|
60
62
|
Requires-Dist: pytest-print==1.0.2 ; extra == "tests"
|
@@ -67,6 +69,8 @@ Project-URL: Homepage, https://github.com/ansys/pymechanical
|
|
67
69
|
Project-URL: Issues, https://github.com/ansys/pymechanical/issues
|
68
70
|
Project-URL: Repository, https://github.com/ansys/pymechanical
|
69
71
|
Provides-Extra: doc
|
72
|
+
Provides-Extra: pim
|
73
|
+
Provides-Extra: rpc
|
70
74
|
Provides-Extra: tests
|
71
75
|
Provides-Extra: viz
|
72
76
|
|
@@ -196,8 +200,23 @@ on Windows and Linux for version 2023 R2 and later. Here is an example:
|
|
196
200
|
app.update_globals(globals())
|
197
201
|
project_dir = DataModel.Project.ProjectDirectory
|
198
202
|
|
199
|
-
|
200
|
-
|
203
|
+
How to report issues
|
204
|
+
--------------------
|
205
|
+
|
206
|
+
If you encounter any issues or limitations with PyMechanical that hinder your work, please create
|
207
|
+
an issue or discussion so our team can address them promptly:
|
208
|
+
|
209
|
+
* `PyMechanical Issues <https://github.com/ansys/pymechanical/issues>`_: Report bugs and request new features.
|
210
|
+
* `PyMechanical Discussions <https://github.com/ansys/pymechanical/discussions>`_: Post questions, share ideas, and get community feedback.
|
211
|
+
|
212
|
+
For issues pertaining to `Mechanical scripting <https://mechanical.docs.pyansys.com/version/stable/user_guide_scripting/index.html>`_,
|
213
|
+
please make a post on the `Developer Portal <https://forum.ansys.com/categories/structures>`_.
|
214
|
+
|
215
|
+
If you have general questions about PyAnsys or are unsure which repository to place an issue in,
|
216
|
+
email `pyansys.core@ansys.com <pyansys.core@ansys.com>`_.
|
217
|
+
|
218
|
+
Documentation resources
|
219
|
+
-----------------------
|
201
220
|
|
202
221
|
Documentation for the latest stable release of PyMechanical is hosted at `PyMechanical documentation
|
203
222
|
<https://mechanical.docs.pyansys.com/>`_.
|
@@ -211,13 +230,6 @@ You can also `view <https://cheatsheets.docs.pyansys.com/pymechanical_cheat_shee
|
|
211
230
|
PyMechanical cheat sheet. This one-page reference provides syntax rules and commands
|
212
231
|
for using PyMechanical.
|
213
232
|
|
214
|
-
On the `PyMechanical Issues <https://github.com/ansys/pymechanical/issues>`_ page,
|
215
|
-
you can create issues to report bugs and request new features. On the `PyMechanical Discussions
|
216
|
-
<https://github.com/ansys/pymechanical/discussions>`_ page or the `Discussions <https://discuss.ansys.com/>`_
|
217
|
-
page on the Ansys Developer portal, you can post questions, share ideas, and get community feedback.
|
218
|
-
|
219
|
-
To reach the project support team, email `pyansys.core@ansys.com <pyansys.core@ansys.com>`_.
|
220
|
-
|
221
233
|
Testing and development
|
222
234
|
-----------------------
|
223
235
|
|
@@ -1,154 +1,162 @@
|
|
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
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
`
|
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
|
+
How to report issues
|
128
|
+
--------------------
|
129
|
+
|
130
|
+
If you encounter any issues or limitations with PyMechanical that hinder your work, please create
|
131
|
+
an issue or discussion so our team can address them promptly:
|
132
|
+
|
133
|
+
* `PyMechanical Issues <https://github.com/ansys/pymechanical/issues>`_: Report bugs and request new features.
|
134
|
+
* `PyMechanical Discussions <https://github.com/ansys/pymechanical/discussions>`_: Post questions, share ideas, and get community feedback.
|
135
|
+
|
136
|
+
For issues pertaining to `Mechanical scripting <https://mechanical.docs.pyansys.com/version/stable/user_guide_scripting/index.html>`_,
|
137
|
+
please make a post on the `Developer Portal <https://forum.ansys.com/categories/structures>`_.
|
138
|
+
|
139
|
+
If you have general questions about PyAnsys or are unsure which repository to place an issue in,
|
140
|
+
email `pyansys.core@ansys.com <pyansys.core@ansys.com>`_.
|
141
|
+
|
142
|
+
Documentation resources
|
143
|
+
-----------------------
|
144
|
+
|
145
|
+
Documentation for the latest stable release of PyMechanical is hosted at `PyMechanical documentation
|
146
|
+
<https://mechanical.docs.pyansys.com/>`_.
|
147
|
+
|
148
|
+
In the upper right corner of the documentation's title bar, there is an option for switching from
|
149
|
+
viewing the documentation for the latest stable release to viewing the documentation for the
|
150
|
+
development version or previously released versions.
|
151
|
+
|
152
|
+
You can also `view <https://cheatsheets.docs.pyansys.com/pymechanical_cheat_sheet.png>`_ or
|
153
|
+
`download <https://cheatsheets.docs.pyansys.com/pymechanical_cheat_sheet.pdf>`_ the
|
154
|
+
PyMechanical cheat sheet. This one-page reference provides syntax rules and commands
|
155
|
+
for using PyMechanical.
|
156
|
+
|
157
|
+
Testing and development
|
158
|
+
-----------------------
|
159
|
+
|
160
|
+
If you would like to test or contribute to the development of PyMechanical, see
|
161
|
+
`Contribute <https://mechanical.docs.pyansys.com/version/stable/contributing.html>`_ in
|
154
162
|
the PyMechanical documentation.
|
@@ -5,7 +5,7 @@ build-backend = "flit_core.buildapi"
|
|
5
5
|
[project]
|
6
6
|
# Check https://flit.readthedocs.io/en/latest/pyproject_toml.html for all available sections
|
7
7
|
name = "ansys-mechanical-core"
|
8
|
-
version = "0.11.
|
8
|
+
version = "0.11.13"
|
9
9
|
description = "A python wrapper for Ansys Mechanical"
|
10
10
|
readme = "README.rst"
|
11
11
|
requires-python = ">=3.10,<4.0"
|
@@ -29,15 +29,14 @@ dependencies = [
|
|
29
29
|
"ansys-api-mechanical==0.1.2",
|
30
30
|
"ansys-mechanical-env==0.1.9",
|
31
31
|
"ansys-mechanical-stubs==0.1.6",
|
32
|
-
"ansys-
|
33
|
-
"ansys-pythonnet>=3.1.0rc2",
|
32
|
+
"ansys-pythonnet>=3.1.0rc6",
|
34
33
|
"ansys-tools-path>=0.3.1",
|
35
34
|
"appdirs>=1.4.0",
|
36
35
|
"click>=8.1.3", # for CLI interface
|
37
|
-
"clr-loader
|
36
|
+
"clr-loader>=0.2.6",
|
38
37
|
"grpcio>=1.30.0",
|
39
38
|
"protobuf>=3.12.2,<6",
|
40
|
-
"psutil
|
39
|
+
"psutil>=6",
|
41
40
|
"tqdm>=4.45.0",
|
42
41
|
"requests>=2,<3",
|
43
42
|
]
|
@@ -58,28 +57,28 @@ tests = [
|
|
58
57
|
]
|
59
58
|
doc = [
|
60
59
|
"sphinx==8.1.3",
|
61
|
-
"ansys-sphinx-theme[autoapi]==1.
|
62
|
-
"grpcio==1.
|
63
|
-
"imageio-ffmpeg==0.
|
64
|
-
"imageio==2.
|
60
|
+
"ansys-sphinx-theme[autoapi,changelog]==1.3.1",
|
61
|
+
"grpcio==1.70.0",
|
62
|
+
"imageio-ffmpeg==0.6.0",
|
63
|
+
"imageio==2.37.0",
|
65
64
|
"jupyter_sphinx==0.5.3",
|
66
65
|
"jupyterlab>=3.2.8",
|
67
66
|
"matplotlib==3.10.0",
|
68
|
-
"numpy==2.2.
|
67
|
+
"numpy==2.2.2",
|
69
68
|
"numpydoc==1.8.0",
|
70
69
|
"pandas==2.2.3",
|
71
|
-
"panel==1.
|
72
|
-
"plotly==
|
70
|
+
"panel==1.6.0",
|
71
|
+
"plotly==6.0.0",
|
73
72
|
"pypandoc==1.15",
|
74
73
|
"pytest-sphinx==0.6.3",
|
75
74
|
"pythreejs==2.4.2",
|
76
75
|
"pyvista>=0.39.1",
|
77
76
|
"sphinx-autobuild==2024.10.3",
|
78
|
-
"sphinx-autodoc-typehints==3.0.
|
77
|
+
"sphinx-autodoc-typehints==3.0.1",
|
79
78
|
"sphinx-copybutton==0.5.2",
|
80
79
|
"sphinx_design==0.6.1",
|
81
80
|
"sphinx-gallery==0.18.0",
|
82
|
-
"sphinx-notfound-page==1.0
|
81
|
+
"sphinx-notfound-page==1.1.0",
|
83
82
|
"sphinxcontrib-websupport==2.0.0",
|
84
83
|
"sphinxemoji==0.3.1",
|
85
84
|
]
|
@@ -87,6 +86,13 @@ viz = [
|
|
87
86
|
"ansys-tools-visualization-interface>=0.2.6",
|
88
87
|
"usd-core==24.11",
|
89
88
|
]
|
89
|
+
rpc = [
|
90
|
+
"rpyc==6.0.1",
|
91
|
+
"toolz==1.0.0",
|
92
|
+
]
|
93
|
+
pim = [
|
94
|
+
"ansys-platform-instancemanagement>=1.0.1",
|
95
|
+
]
|
90
96
|
|
91
97
|
[project.scripts]
|
92
98
|
ansys-mechanical = "ansys.mechanical.core.run:cli"
|
@@ -133,6 +139,7 @@ addopts = """-ra -s --durations=0 --cov=ansys.mechanical --cov-report html:.cov/
|
|
133
139
|
# addopts = """-ra -s -m 'remote_session_launch or remote_session_connect or embedding' --durations=0
|
134
140
|
# --cov=ansys.mechanical --cov-report html:.cov/html --cov-report xml:.cov/xml --cov-report \
|
135
141
|
# term -vv --print --print-relative-time"""
|
142
|
+
|
136
143
|
testpaths = [
|
137
144
|
"tests",
|
138
145
|
]
|
@@ -1,48 +1,48 @@
|
|
1
|
-
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
|
2
|
-
# SPDX-License-Identifier: MIT
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
10
|
-
# furnished to do so, subject to the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
13
|
-
# copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
# SOFTWARE.
|
22
|
-
|
23
|
-
"""Version of ansys-mechanical-core module.
|
24
|
-
|
25
|
-
On the ``main`` branch, use 'dev0' to denote a development version.
|
26
|
-
For example:
|
27
|
-
|
28
|
-
# major, minor, patch
|
29
|
-
version_info = 0, 58, 'dev0'
|
30
|
-
|
31
|
-
"""
|
32
|
-
|
33
|
-
try:
|
34
|
-
import importlib.metadata as importlib_metadata
|
35
|
-
except ModuleNotFoundError: # pragma: no cover
|
36
|
-
import importlib_metadata
|
37
|
-
|
38
|
-
# Read from the pyproject.toml
|
39
|
-
# major, minor, patch
|
40
|
-
__version__ = importlib_metadata.version("ansys-mechanical-core")
|
41
|
-
|
42
|
-
SUPPORTED_MECHANICAL_VERSIONS = {
|
43
|
-
251: "2025R1",
|
44
|
-
242: "2024R2",
|
45
|
-
241: "2024R1",
|
46
|
-
232: "2023R2",
|
47
|
-
}
|
48
|
-
"""Supported mechanical versions in descending order."""
|
1
|
+
# Copyright (C) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
|
2
|
+
# SPDX-License-Identifier: MIT
|
3
|
+
#
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
"""Version of ansys-mechanical-core module.
|
24
|
+
|
25
|
+
On the ``main`` branch, use 'dev0' to denote a development version.
|
26
|
+
For example:
|
27
|
+
|
28
|
+
# major, minor, patch
|
29
|
+
version_info = 0, 58, 'dev0'
|
30
|
+
|
31
|
+
"""
|
32
|
+
|
33
|
+
try:
|
34
|
+
import importlib.metadata as importlib_metadata
|
35
|
+
except ModuleNotFoundError: # pragma: no cover
|
36
|
+
import importlib_metadata
|
37
|
+
|
38
|
+
# Read from the pyproject.toml
|
39
|
+
# major, minor, patch
|
40
|
+
__version__ = importlib_metadata.version("ansys-mechanical-core")
|
41
|
+
|
42
|
+
SUPPORTED_MECHANICAL_VERSIONS = {
|
43
|
+
251: "2025R1",
|
44
|
+
242: "2024R2",
|
45
|
+
241: "2024R1",
|
46
|
+
232: "2023R2",
|
47
|
+
}
|
48
|
+
"""Supported mechanical versions in descending order."""
|