ansys-mechanical-core 0.10.10__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.
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/LICENSE +7 -7
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/PKG-INFO +57 -56
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/README.rst +154 -158
- ansys_mechanical_core-0.11.12/pyproject.toml +279 -0
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/__init__.py +11 -4
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/_version.py +48 -47
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/__init__.py +1 -1
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/addins.py +1 -7
- ansys_mechanical_core-0.11.12/src/ansys/mechanical/core/embedding/app.py +610 -0
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/app_libraries.py +24 -5
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/appdata.py +16 -4
- ansys_mechanical_core-0.11.12/src/ansys/mechanical/core/embedding/background.py +106 -0
- ansys_mechanical_core-0.11.12/src/ansys/mechanical/core/embedding/cleanup_gui.py +61 -0
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/enum_importer.py +2 -2
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/imports.py +27 -7
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/initializer.py +105 -53
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/loader.py +19 -9
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/logger/__init__.py +219 -216
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/logger/environ.py +1 -1
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/logger/linux_api.py +1 -1
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/logger/sinks.py +1 -1
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/logger/windows_api.py +2 -2
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/poster.py +38 -4
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/resolver.py +41 -44
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/runtime.py +1 -1
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/shims.py +9 -8
- ansys_mechanical_core-0.11.12/src/ansys/mechanical/core/embedding/ui.py +228 -0
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/utils.py +1 -1
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/viz/__init__.py +1 -1
- ansys_mechanical_core-0.10.10/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 -8
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/viz/usd_converter.py +59 -25
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/viz/utils.py +32 -2
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/embedding/warnings.py +1 -1
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/errors.py +2 -1
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/examples/__init__.py +1 -1
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/examples/downloads.py +10 -5
- ansys_mechanical_core-0.11.12/src/ansys/mechanical/core/feature_flags.py +51 -0
- ansys_mechanical_core-0.11.12/src/ansys/mechanical/core/ide_config.py +212 -0
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/launcher.py +9 -9
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/logging.py +14 -2
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/mechanical.py +2324 -2237
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/misc.py +176 -176
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/pool.py +712 -712
- {ansys_mechanical_core-0.10.10 → ansys_mechanical_core-0.11.12}/src/ansys/mechanical/core/run.py +321 -246
- ansys_mechanical_core-0.10.10/pyproject.toml +0 -176
- ansys_mechanical_core-0.10.10/src/ansys/mechanical/core/embedding/app.py +0 -281
@@ -1,13 +1,13 @@
|
|
1
1
|
MIT License
|
2
2
|
|
3
|
-
Copyright (c)
|
3
|
+
Copyright (c) 2022 - 2025 ANSYS, Inc. and/or its affiliates.
|
4
4
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
9
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
10
|
+
so, subject to the following conditions:
|
11
11
|
|
12
12
|
The above copyright notice and this permission notice shall be included in all
|
13
13
|
copies or substantial portions of the Software.
|
@@ -1,71 +1,78 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.3
|
2
2
|
Name: ansys-mechanical-core
|
3
|
-
Version: 0.
|
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.
|
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
|
-
Requires-Dist:
|
19
|
-
Requires-Dist: ansys-mechanical-env==0.1.
|
19
|
+
Requires-Dist: ansys-api-mechanical==0.1.2
|
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.
|
27
|
+
Requires-Dist: clr-loader==0.2.7.post0
|
26
28
|
Requires-Dist: grpcio>=1.30.0
|
27
|
-
Requires-Dist: protobuf>=3.12.2
|
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:
|
30
|
-
Requires-Dist:
|
31
|
-
Requires-Dist:
|
32
|
-
Requires-Dist:
|
33
|
-
Requires-Dist: imageio==
|
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.
|
37
|
-
Requires-Dist: numpy==
|
38
|
-
Requires-Dist: numpydoc==1.
|
39
|
-
Requires-Dist: pandas==2.2.
|
40
|
-
Requires-Dist: panel==1.
|
41
|
-
Requires-Dist: plotly==5.
|
42
|
-
Requires-Dist: pypandoc==1.
|
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
|
46
|
-
Requires-Dist: sphinx-autobuild==2024.
|
47
|
-
Requires-Dist: sphinx-autodoc-typehints==
|
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.
|
50
|
-
Requires-Dist: sphinx-gallery==0.
|
51
|
-
Requires-Dist: sphinx-notfound-page==1.0.
|
52
|
-
Requires-Dist: sphinxcontrib-websupport==
|
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.
|
55
|
-
Requires-Dist: pytest-cov==
|
56
|
-
Requires-Dist: pytest-print==1.0.
|
57
|
-
Requires-Dist:
|
58
|
-
Requires-Dist:
|
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:
|
62
|
-
Project-URL:
|
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
|
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/
|
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
|
-
|
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 ``
|
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
|
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
|
-
|
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
|
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
|
2
|
-
:alt: PyMechanical logo
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
:
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
:
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
:
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
:
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
:
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
:
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
:
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
for
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
the
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
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.
|