ansys-speos-core 0.5.2__tar.gz → 0.6.0__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_speos_core-0.5.2 → ansys_speos_core-0.6.0}/PKG-INFO +24 -12
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/README.rst +16 -4
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/pyproject.toml +8 -8
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/body.py +30 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/generic/general_methods.py +83 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/generic/visualization_methods.py +147 -14
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/kernel/face.py +156 -45
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/kernel/proto_message_utils.py +2 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/kernel/scene.py +16 -2
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/lxp.py +1 -52
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/project.py +278 -177
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/proto_message_utils.py +5 -2
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/sensor.py +732 -32
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/simulation.py +204 -5
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/source.py +828 -3
- ansys_speos_core-0.6.0/src/ansys/speos/core/workflow/open_result.py +404 -0
- ansys_speos_core-0.5.2/src/ansys/speos/core/workflow/open_result.py +0 -144
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/LICENSE +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/__init__.py +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/bsdf.py +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/face.py +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/generic/constants.py +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/geo_ref.py +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/intensity.py +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/kernel/__init__.py +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/kernel/body.py +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/kernel/client.py +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/kernel/crud.py +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/kernel/intensity_template.py +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/kernel/job.py +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/kernel/part.py +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/kernel/sensor_template.py +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/kernel/simulation_template.py +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/kernel/sop_template.py +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/kernel/source_template.py +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/kernel/spectrum.py +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/kernel/vop_template.py +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/launcher.py +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/logger.py +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/opt_prop.py +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/part.py +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/py.typed +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/spectrum.py +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/speos.py +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/workflow/__init__.py +0 -0
- {ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/workflow/combine_speos.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ansys-speos-core
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: A Python wrapper for Ansys Speos
|
|
5
5
|
Author-email: "ANSYS, Inc." <pyansys.core@ansys.com>
|
|
6
6
|
Maintainer-email: "ANSYS, Inc." <pyansys.core@ansys.com>
|
|
@@ -23,11 +23,11 @@ License-File: LICENSE
|
|
|
23
23
|
Requires-Dist: protobuf>=3.20,<7
|
|
24
24
|
Requires-Dist: grpcio>=1.50.0,<1.71
|
|
25
25
|
Requires-Dist: grpcio-health-checking>=1.45.0,<1.68
|
|
26
|
-
Requires-Dist: ansys-api-speos==0.
|
|
26
|
+
Requires-Dist: ansys-api-speos==0.15.2
|
|
27
27
|
Requires-Dist: ansys-tools-path>=0.3.1
|
|
28
28
|
Requires-Dist: numpy>=1.20.3,<3
|
|
29
29
|
Requires-Dist: comtypes>=1.4,<1.5
|
|
30
|
-
Requires-Dist: ansys-sphinx-theme==1.
|
|
30
|
+
Requires-Dist: ansys-sphinx-theme==1.5.2 ; extra == "doc"
|
|
31
31
|
Requires-Dist: numpydoc==1.8.0 ; extra == "doc"
|
|
32
32
|
Requires-Dist: Sphinx==8.1.3 ; extra == "doc"
|
|
33
33
|
Requires-Dist: sphinx-copybutton==0.5.2 ; extra == "doc"
|
|
@@ -37,8 +37,8 @@ Requires-Dist: sphinx-jinja==2.0.2 ; extra == "doc"
|
|
|
37
37
|
Requires-Dist: sphinxcontrib-mermaid==1.0.0 ; extra == "doc"
|
|
38
38
|
Requires-Dist: myst-parser==4.0.1 ; extra == "doc"
|
|
39
39
|
Requires-Dist: nbsphinx==0.9.7 ; extra == "doc"
|
|
40
|
-
Requires-Dist: jupytext==1.17.
|
|
41
|
-
Requires-Dist: jupyterlab==4.4.
|
|
40
|
+
Requires-Dist: jupytext==1.17.2 ; extra == "doc"
|
|
41
|
+
Requires-Dist: jupyterlab==4.4.3 ; extra == "doc"
|
|
42
42
|
Requires-Dist: jupyter-server==2.16.0 ; extra == "doc"
|
|
43
43
|
Requires-Dist: nbconvert==7.16.6 ; extra == "doc"
|
|
44
44
|
Requires-Dist: pyvista[jupyter]>=0.43,<0.46 ; extra == "doc"
|
|
@@ -50,13 +50,13 @@ Requires-Dist: jupyterlab>=3 ; extra == "jupyter"
|
|
|
50
50
|
Requires-Dist: ipywidgets ; extra == "jupyter"
|
|
51
51
|
Requires-Dist: pyvista[jupyter]>=0.43,<0.46 ; extra == "jupyter"
|
|
52
52
|
Requires-Dist: ansys-tools-visualization-interface>=0.8.3 ; extra == "jupyter"
|
|
53
|
-
Requires-Dist: notebook==7.4.
|
|
53
|
+
Requires-Dist: notebook==7.4.3 ; extra == "jupyter"
|
|
54
54
|
Requires-Dist: psutil==7.0.0 ; extra == "tests"
|
|
55
|
-
Requires-Dist: pytest==8.
|
|
55
|
+
Requires-Dist: pytest==8.4.1 ; extra == "tests"
|
|
56
56
|
Requires-Dist: pyvista>=0.40.0,<0.46 ; extra == "tests"
|
|
57
57
|
Requires-Dist: ansys-tools-visualization-interface>=0.8.3 ; extra == "tests"
|
|
58
58
|
Requires-Dist: ansys-platform-instancemanagement>=1.0.3 ; extra == "tests"
|
|
59
|
-
Requires-Dist: pytest-cov==6.
|
|
59
|
+
Requires-Dist: pytest-cov==6.2.1 ; extra == "tests"
|
|
60
60
|
Project-URL: Changelog, https://github.com/ansys/pyspeos/blob/main/doc/source/changelog.rst
|
|
61
61
|
Project-URL: Discussions, https://github.com/ansys/pyspeos/discussions
|
|
62
62
|
Project-URL: Documentation, https://speos.docs.pyansys.com/
|
|
@@ -70,12 +70,24 @@ Provides-Extra: tests
|
|
|
70
70
|
|
|
71
71
|
PySpeos library
|
|
72
72
|
================
|
|
73
|
-
|pyansys| |GH-CI| |MIT| |ruff|
|
|
73
|
+
|pyansys| |python| |pypi| |codecov| |GH-CI| |MIT| |ruff|
|
|
74
74
|
|
|
75
75
|
.. |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
|
|
76
76
|
:target: https://docs.pyansys.com/
|
|
77
77
|
:alt: PyAnsys
|
|
78
78
|
|
|
79
|
+
.. |python| image:: https://img.shields.io/pypi/pyversions/ansys-speos-core?logo=pypi
|
|
80
|
+
:target: https://pypi.org/project/ansys-speos-core/
|
|
81
|
+
:alt: Python
|
|
82
|
+
|
|
83
|
+
.. |pypi| image:: https://img.shields.io/pypi/v/ansys-speos-core.svg?logo=python&logoColor=white&label=PyPI
|
|
84
|
+
:target: https://pypi.org/project/ansys-speos-core
|
|
85
|
+
:alt: PyPI
|
|
86
|
+
|
|
87
|
+
.. |codecov| image:: https://codecov.io/github/ansys/pyspeos/graph/badge.svg?token=34FKDS6ZKJ
|
|
88
|
+
:target: https://codecov.io/github/ansys/pyspeos
|
|
89
|
+
:alt: Codecov
|
|
90
|
+
|
|
79
91
|
.. |GH-CI| image:: https://github.com/ansys/pyspeos/actions/workflows/ci_cd.yml/badge.svg
|
|
80
92
|
:target: https://github.com/ansys/pyspeos/actions/workflows/ci_cd.yml
|
|
81
93
|
|
|
@@ -201,12 +213,12 @@ Then, to launch SpeosRPC server with product version 2025.1, you can run:
|
|
|
201
213
|
export LICENSE_SERVER=1055@XXX.XXX.XXX.XXX
|
|
202
214
|
|
|
203
215
|
cat GH_TOKEN.txt | docker login ghcr.io -u "$GH_USERNAME" --password-stdin
|
|
204
|
-
docker pull ghcr.io/ansys/speos-rpc:
|
|
205
|
-
docker run --detach --name speos-rpc -p 50098:50098 -e ANSYSLMD_LICENSE_FILE=$LICENSE_SERVER --entrypoint /app/SpeosRPC_Server.x ghcr.io/ansys/speos-rpc:
|
|
216
|
+
docker pull ghcr.io/ansys/speos-rpc:252
|
|
217
|
+
docker run --detach --name speos-rpc -p 50098:50098 -e ANSYSLMD_LICENSE_FILE=$LICENSE_SERVER --entrypoint /app/SpeosRPC_Server.x ghcr.io/ansys/speos-rpc:252
|
|
206
218
|
|
|
207
219
|
.. note::
|
|
208
220
|
|
|
209
|
-
To use the latest image in development, you can use `ghcr.io/ansys/speos-rpc:
|
|
221
|
+
To use the latest image in development, you can use `ghcr.io/ansys/speos-rpc:252`.
|
|
210
222
|
|
|
211
223
|
On the other hand, the SpeosRPC server can be started locally.
|
|
212
224
|
|
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
PySpeos library
|
|
2
2
|
================
|
|
3
|
-
|pyansys| |GH-CI| |MIT| |ruff|
|
|
3
|
+
|pyansys| |python| |pypi| |codecov| |GH-CI| |MIT| |ruff|
|
|
4
4
|
|
|
5
5
|
.. |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
|
|
6
6
|
:target: https://docs.pyansys.com/
|
|
7
7
|
:alt: PyAnsys
|
|
8
8
|
|
|
9
|
+
.. |python| image:: https://img.shields.io/pypi/pyversions/ansys-speos-core?logo=pypi
|
|
10
|
+
:target: https://pypi.org/project/ansys-speos-core/
|
|
11
|
+
:alt: Python
|
|
12
|
+
|
|
13
|
+
.. |pypi| image:: https://img.shields.io/pypi/v/ansys-speos-core.svg?logo=python&logoColor=white&label=PyPI
|
|
14
|
+
:target: https://pypi.org/project/ansys-speos-core
|
|
15
|
+
:alt: PyPI
|
|
16
|
+
|
|
17
|
+
.. |codecov| image:: https://codecov.io/github/ansys/pyspeos/graph/badge.svg?token=34FKDS6ZKJ
|
|
18
|
+
:target: https://codecov.io/github/ansys/pyspeos
|
|
19
|
+
:alt: Codecov
|
|
20
|
+
|
|
9
21
|
.. |GH-CI| image:: https://github.com/ansys/pyspeos/actions/workflows/ci_cd.yml/badge.svg
|
|
10
22
|
:target: https://github.com/ansys/pyspeos/actions/workflows/ci_cd.yml
|
|
11
23
|
|
|
@@ -131,12 +143,12 @@ Then, to launch SpeosRPC server with product version 2025.1, you can run:
|
|
|
131
143
|
export LICENSE_SERVER=1055@XXX.XXX.XXX.XXX
|
|
132
144
|
|
|
133
145
|
cat GH_TOKEN.txt | docker login ghcr.io -u "$GH_USERNAME" --password-stdin
|
|
134
|
-
docker pull ghcr.io/ansys/speos-rpc:
|
|
135
|
-
docker run --detach --name speos-rpc -p 50098:50098 -e ANSYSLMD_LICENSE_FILE=$LICENSE_SERVER --entrypoint /app/SpeosRPC_Server.x ghcr.io/ansys/speos-rpc:
|
|
146
|
+
docker pull ghcr.io/ansys/speos-rpc:252
|
|
147
|
+
docker run --detach --name speos-rpc -p 50098:50098 -e ANSYSLMD_LICENSE_FILE=$LICENSE_SERVER --entrypoint /app/SpeosRPC_Server.x ghcr.io/ansys/speos-rpc:252
|
|
136
148
|
|
|
137
149
|
.. note::
|
|
138
150
|
|
|
139
|
-
To use the latest image in development, you can use `ghcr.io/ansys/speos-rpc:
|
|
151
|
+
To use the latest image in development, you can use `ghcr.io/ansys/speos-rpc:252`.
|
|
140
152
|
|
|
141
153
|
On the other hand, the SpeosRPC server can be started locally.
|
|
142
154
|
|
|
@@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "ansys-speos-core"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.6.0"
|
|
8
8
|
description = "A Python wrapper for Ansys Speos"
|
|
9
9
|
readme = "README.rst"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -30,7 +30,7 @@ dependencies=[
|
|
|
30
30
|
"protobuf>=3.20,<7",
|
|
31
31
|
"grpcio>=1.50.0,<1.71",
|
|
32
32
|
"grpcio-health-checking>=1.45.0,<1.68",
|
|
33
|
-
"ansys-api-speos==0.
|
|
33
|
+
"ansys-api-speos==0.15.2",
|
|
34
34
|
"ansys-tools-path>=0.3.1",
|
|
35
35
|
"numpy>=1.20.3,<3",
|
|
36
36
|
"comtypes>=1.4,<1.5",
|
|
@@ -43,11 +43,11 @@ graphics = [
|
|
|
43
43
|
]
|
|
44
44
|
tests = [
|
|
45
45
|
"psutil==7.0.0",
|
|
46
|
-
"pytest==8.
|
|
46
|
+
"pytest==8.4.1",
|
|
47
47
|
"pyvista>=0.40.0,<0.46",
|
|
48
48
|
"ansys-tools-visualization-interface>=0.8.3",
|
|
49
49
|
"ansys-platform-instancemanagement>=1.0.3",
|
|
50
|
-
"pytest-cov==6.
|
|
50
|
+
"pytest-cov==6.2.1",
|
|
51
51
|
]
|
|
52
52
|
jupyter = [
|
|
53
53
|
"matplotlib",
|
|
@@ -55,10 +55,10 @@ jupyter = [
|
|
|
55
55
|
"ipywidgets",
|
|
56
56
|
"pyvista[jupyter]>=0.43,<0.46",
|
|
57
57
|
"ansys-tools-visualization-interface>=0.8.3",
|
|
58
|
-
"notebook==7.4.
|
|
58
|
+
"notebook==7.4.3",
|
|
59
59
|
]
|
|
60
60
|
doc = [
|
|
61
|
-
"ansys-sphinx-theme==1.
|
|
61
|
+
"ansys-sphinx-theme==1.5.2",
|
|
62
62
|
"numpydoc==1.8.0",
|
|
63
63
|
"Sphinx==8.1.3",
|
|
64
64
|
"sphinx-copybutton==0.5.2",
|
|
@@ -68,8 +68,8 @@ doc = [
|
|
|
68
68
|
"sphinxcontrib-mermaid==1.0.0",
|
|
69
69
|
"myst-parser==4.0.1",
|
|
70
70
|
"nbsphinx==0.9.7",
|
|
71
|
-
"jupytext==1.17.
|
|
72
|
-
"jupyterlab==4.4.
|
|
71
|
+
"jupytext==1.17.2",
|
|
72
|
+
"jupyterlab==4.4.3",
|
|
73
73
|
"jupyter-server==2.16.0",
|
|
74
74
|
"nbconvert==7.16.6",
|
|
75
75
|
"pyvista[jupyter]>=0.43,<0.46",
|
|
@@ -29,6 +29,8 @@ from typing import List, Mapping, Optional, Union
|
|
|
29
29
|
|
|
30
30
|
from ansys.speos.core import proto_message_utils
|
|
31
31
|
import ansys.speos.core.face as face
|
|
32
|
+
import ansys.speos.core.generic.general_methods as general_methods
|
|
33
|
+
from ansys.speos.core.generic.visualization_methods import _VisualData
|
|
32
34
|
from ansys.speos.core.geo_ref import GeoRef
|
|
33
35
|
from ansys.speos.core.kernel.body import ProtoBody
|
|
34
36
|
from ansys.speos.core.kernel.client import SpeosClient
|
|
@@ -72,6 +74,7 @@ class Body:
|
|
|
72
74
|
self._parent_part = parent_part
|
|
73
75
|
self._name = name
|
|
74
76
|
self.body_link = None
|
|
77
|
+
self._visual_data = _VisualData() if general_methods._GRAPHICS_AVAILABLE else None
|
|
75
78
|
"""Link object for the body in database."""
|
|
76
79
|
|
|
77
80
|
if metadata is None:
|
|
@@ -82,6 +85,30 @@ class Body:
|
|
|
82
85
|
|
|
83
86
|
self._geom_features = []
|
|
84
87
|
|
|
88
|
+
@property
|
|
89
|
+
def visual_data(self):
|
|
90
|
+
"""Property containing irradiance sensor visualization data.
|
|
91
|
+
|
|
92
|
+
Returns
|
|
93
|
+
-------
|
|
94
|
+
VisualData
|
|
95
|
+
Instance of VisualData Class for pyvista.PolyData of feature faces, coordinate_systems.
|
|
96
|
+
|
|
97
|
+
"""
|
|
98
|
+
import numpy as np
|
|
99
|
+
|
|
100
|
+
if self._visual_data.updated is True:
|
|
101
|
+
return self._visual_data
|
|
102
|
+
for feature_face in self._geom_features:
|
|
103
|
+
vertices = np.array(feature_face._face.vertices).reshape(-1, 3)
|
|
104
|
+
facets = np.array(feature_face._face.facets).reshape(-1, 3)
|
|
105
|
+
temp = np.full(facets.shape[0], 3)
|
|
106
|
+
temp = np.vstack(temp)
|
|
107
|
+
facets = np.hstack((temp, facets))
|
|
108
|
+
self._visual_data.add_data_mesh(vertices, facets)
|
|
109
|
+
self._visual_data.updated = True
|
|
110
|
+
return self._visual_data
|
|
111
|
+
|
|
85
112
|
@property
|
|
86
113
|
def geo_path(self) -> GeoRef:
|
|
87
114
|
"""Geometry path to be used within other speos objects."""
|
|
@@ -159,6 +186,9 @@ class Body:
|
|
|
159
186
|
ansys.speos.core.body.Body
|
|
160
187
|
Body feature.
|
|
161
188
|
"""
|
|
189
|
+
if general_methods._GRAPHICS_AVAILABLE:
|
|
190
|
+
self._visual_data.updated = False
|
|
191
|
+
|
|
162
192
|
# Commit faces contained in this body
|
|
163
193
|
for g in self._geom_features:
|
|
164
194
|
g.commit()
|
{ansys_speos_core-0.5.2 → ansys_speos_core-0.6.0}/src/ansys/speos/core/generic/general_methods.py
RENAMED
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
this includes decorator and methods
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
|
+
from __future__ import annotations
|
|
29
|
+
|
|
28
30
|
from collections.abc import Collection
|
|
29
31
|
from functools import lru_cache, wraps
|
|
30
32
|
import os
|
|
@@ -44,6 +46,8 @@ GRAPHICS_ERROR = (
|
|
|
44
46
|
"You can install this using `pip install ansys-speos-core[graphics]`."
|
|
45
47
|
)
|
|
46
48
|
|
|
49
|
+
VERSION_ERROR = "The pySpeos feature : {feature_name} needs a Speos Version of {version} or higher."
|
|
50
|
+
|
|
47
51
|
|
|
48
52
|
def deprecate_kwargs(old_arguments: dict, removed_version="0.3.0"):
|
|
49
53
|
"""Issues deprecation warnings for arguments.
|
|
@@ -230,3 +234,82 @@ def retrieve_speos_install_dir(
|
|
|
230
234
|
if not speos_exec.is_file():
|
|
231
235
|
error_no_install(speos_rpc_path, int(version))
|
|
232
236
|
return speos_rpc_path
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
def wavelength_to_rgb(wavelength: float, gamma: float = 0.8) -> [int, int, int, int]:
|
|
240
|
+
"""Convert a given wavelength of light to an approximate RGB color value.
|
|
241
|
+
|
|
242
|
+
The wavelength must be given in nanometers in the range from 380 nm to 750 nm.
|
|
243
|
+
Based on the code from http://www.physics.sfasu.edu/astro/color/spectra.html
|
|
244
|
+
|
|
245
|
+
Parameters
|
|
246
|
+
----------
|
|
247
|
+
wavelength : float
|
|
248
|
+
Wavelength in nanometer between 380-750 nm
|
|
249
|
+
gamma : float
|
|
250
|
+
Gamma value.
|
|
251
|
+
By default : ``0.8``
|
|
252
|
+
"""
|
|
253
|
+
wavelength = float(wavelength)
|
|
254
|
+
if 380 <= wavelength <= 440:
|
|
255
|
+
attenuation = 0.3 + 0.7 * (wavelength - 380) / (440 - 380)
|
|
256
|
+
r = ((-(wavelength - 440) / (440 - 380)) * attenuation) ** gamma
|
|
257
|
+
g = 0.0
|
|
258
|
+
b = (1.0 * attenuation) ** gamma
|
|
259
|
+
elif 440 <= wavelength <= 490:
|
|
260
|
+
r = 0.0
|
|
261
|
+
g = ((wavelength - 440) / (490 - 440)) ** gamma
|
|
262
|
+
b = 1.0
|
|
263
|
+
elif 490 <= wavelength <= 510:
|
|
264
|
+
r = 0.0
|
|
265
|
+
g = 1.0
|
|
266
|
+
b = (-(wavelength - 510) / (510 - 490)) ** gamma
|
|
267
|
+
elif 510 <= wavelength <= 580:
|
|
268
|
+
r = ((wavelength - 510) / (580 - 510)) ** gamma
|
|
269
|
+
g = 1.0
|
|
270
|
+
b = 0.0
|
|
271
|
+
elif 580 <= wavelength <= 645:
|
|
272
|
+
r = 1.0
|
|
273
|
+
g = (-(wavelength - 645) / (645 - 580)) ** gamma
|
|
274
|
+
b = 0.0
|
|
275
|
+
elif 645 <= wavelength <= 750:
|
|
276
|
+
attenuation = 0.3 + 0.7 * (750 - wavelength) / (750 - 645)
|
|
277
|
+
r = (1.0 * attenuation) ** gamma
|
|
278
|
+
g = 0.0
|
|
279
|
+
b = 0.0
|
|
280
|
+
else:
|
|
281
|
+
r = 0.0
|
|
282
|
+
g = 0.0
|
|
283
|
+
b = 0.0
|
|
284
|
+
r *= 255
|
|
285
|
+
g *= 255
|
|
286
|
+
b *= 255
|
|
287
|
+
return [int(r), int(g), int(b), 255]
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
def min_speos_version(major: int, minor: int, service_pack: int):
|
|
291
|
+
"""Raise version warning.
|
|
292
|
+
|
|
293
|
+
Parameters
|
|
294
|
+
----------
|
|
295
|
+
major : int
|
|
296
|
+
Major release version, e.g. 25
|
|
297
|
+
minor : int
|
|
298
|
+
Minor release version e.g. 1
|
|
299
|
+
service_pack : int
|
|
300
|
+
Service Pack version e.g. 3
|
|
301
|
+
"""
|
|
302
|
+
version = f"20{major} R{minor} SP{service_pack}"
|
|
303
|
+
|
|
304
|
+
def decorator(function):
|
|
305
|
+
def wrapper(*args, **kwargs):
|
|
306
|
+
if function.__qualname__.endswith("__init__"):
|
|
307
|
+
name = function.__qualname__[:-9]
|
|
308
|
+
else:
|
|
309
|
+
name = function.__qualname__
|
|
310
|
+
warnings.warn(VERSION_ERROR.format(version=version, feature_name=name), stacklevel=2)
|
|
311
|
+
return function(*args, **kwargs)
|
|
312
|
+
|
|
313
|
+
return wrapper
|
|
314
|
+
|
|
315
|
+
return decorator
|
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
|
|
23
23
|
"""Provides the ``VisualData`` class."""
|
|
24
24
|
|
|
25
|
-
from typing import TYPE_CHECKING, List
|
|
25
|
+
from typing import TYPE_CHECKING, List, Tuple, Union
|
|
26
|
+
|
|
27
|
+
import numpy as np
|
|
26
28
|
|
|
27
29
|
from ansys.speos.core.generic.general_methods import (
|
|
28
30
|
graphics_required,
|
|
@@ -36,7 +38,7 @@ if TYPE_CHECKING: # pragma: no cover
|
|
|
36
38
|
|
|
37
39
|
@graphics_required
|
|
38
40
|
class _VisualCoordinateSystem:
|
|
39
|
-
"""Visualization data for the coordinate system
|
|
41
|
+
"""Visualization data for the coordinate system.
|
|
40
42
|
|
|
41
43
|
By default, there is empty visualization data.
|
|
42
44
|
|
|
@@ -52,21 +54,21 @@ class _VisualCoordinateSystem:
|
|
|
52
54
|
self.__x_axis = pv.Arrow(
|
|
53
55
|
start=self.__origin,
|
|
54
56
|
direction=[1.0, 0.0, 0.0],
|
|
55
|
-
scale=
|
|
57
|
+
scale=1.0,
|
|
56
58
|
tip_radius=0.05,
|
|
57
59
|
shaft_radius=0.01,
|
|
58
60
|
)
|
|
59
61
|
self.__y_axis = pv.Arrow(
|
|
60
62
|
start=self.__origin,
|
|
61
63
|
direction=[0.0, 1.0, 0.0],
|
|
62
|
-
scale=
|
|
64
|
+
scale=1.0,
|
|
63
65
|
tip_radius=0.05,
|
|
64
66
|
shaft_radius=0.01,
|
|
65
67
|
)
|
|
66
68
|
self.__z_axis = pv.Arrow(
|
|
67
69
|
start=self.__origin,
|
|
68
70
|
direction=[0.0, 0.0, 1.0],
|
|
69
|
-
scale=
|
|
71
|
+
scale=1.0,
|
|
70
72
|
tip_radius=0.05,
|
|
71
73
|
shaft_radius=0.01,
|
|
72
74
|
)
|
|
@@ -214,6 +216,72 @@ class _VisualCoordinateSystem:
|
|
|
214
216
|
)
|
|
215
217
|
|
|
216
218
|
|
|
219
|
+
@graphics_required
|
|
220
|
+
class _VisualArrow:
|
|
221
|
+
"""Visualization data for the line or arrow.
|
|
222
|
+
|
|
223
|
+
By default, there is empty visualization data.
|
|
224
|
+
|
|
225
|
+
Notes
|
|
226
|
+
-----
|
|
227
|
+
**Do not instantiate this class yourself**.
|
|
228
|
+
"""
|
|
229
|
+
|
|
230
|
+
def __init__(
|
|
231
|
+
self,
|
|
232
|
+
line_vertices: List[List[float]],
|
|
233
|
+
color: Tuple[float, float, float] = (0.643, 1.0, 0.0),
|
|
234
|
+
arrow: bool = False,
|
|
235
|
+
) -> None:
|
|
236
|
+
import pyvista as pv
|
|
237
|
+
|
|
238
|
+
if len(line_vertices) != 2 or any(len(point) != 3 for point in line_vertices):
|
|
239
|
+
raise ValueError(
|
|
240
|
+
"line_vertices is expected to be composed of 2 vertices with 3 elements each."
|
|
241
|
+
)
|
|
242
|
+
line_vertices = np.array(line_vertices)
|
|
243
|
+
if arrow:
|
|
244
|
+
self.__data = pv.Arrow(
|
|
245
|
+
start=line_vertices[0],
|
|
246
|
+
direction=line_vertices[1],
|
|
247
|
+
scale=1,
|
|
248
|
+
tip_radius=0.05,
|
|
249
|
+
shaft_radius=0.01,
|
|
250
|
+
)
|
|
251
|
+
else:
|
|
252
|
+
self.__data = pv.Line(line_vertices[0], line_vertices[0] + line_vertices[1])
|
|
253
|
+
if all(value < 1 for value in color):
|
|
254
|
+
self.__color = color + (255,)
|
|
255
|
+
else:
|
|
256
|
+
self.__color = tuple(value / 255 for value in color) + (255,)
|
|
257
|
+
|
|
258
|
+
@property
|
|
259
|
+
def data(self) -> "pv.PolyData":
|
|
260
|
+
"""
|
|
261
|
+
Returns the pyvista data of _VisualArrow.
|
|
262
|
+
|
|
263
|
+
Returns
|
|
264
|
+
-------
|
|
265
|
+
pv.PolyData
|
|
266
|
+
The pyvista data of _VisualArrow.
|
|
267
|
+
|
|
268
|
+
"""
|
|
269
|
+
return self.__data
|
|
270
|
+
|
|
271
|
+
@property
|
|
272
|
+
def color(self) -> Tuple[float, float, float]:
|
|
273
|
+
"""
|
|
274
|
+
Returns the color property of _VisualArrow.
|
|
275
|
+
|
|
276
|
+
Returns
|
|
277
|
+
-------
|
|
278
|
+
Tuple[float, float, float]
|
|
279
|
+
The color tuple of _VisualArrow.
|
|
280
|
+
|
|
281
|
+
"""
|
|
282
|
+
return self.__color
|
|
283
|
+
|
|
284
|
+
|
|
217
285
|
@graphics_required
|
|
218
286
|
class _VisualData:
|
|
219
287
|
"""Visualization data for the sensor.
|
|
@@ -225,25 +293,26 @@ class _VisualData:
|
|
|
225
293
|
**Do not instantiate this class yourself**
|
|
226
294
|
"""
|
|
227
295
|
|
|
228
|
-
def __init__(self, coordinate_system=True):
|
|
296
|
+
def __init__(self, ray: bool = False, coordinate_system: bool = True):
|
|
229
297
|
import pyvista as pv
|
|
230
298
|
|
|
231
|
-
self.
|
|
299
|
+
self._data = [] if ray else pv.PolyData()
|
|
232
300
|
self.coordinates = _VisualCoordinateSystem() if coordinate_system else None
|
|
233
301
|
self.updated = False
|
|
234
302
|
|
|
235
303
|
@property
|
|
236
|
-
def data(self) -> "pv.PolyData":
|
|
304
|
+
def data(self) -> Union["pv.PolyData", List[_VisualArrow]]:
|
|
237
305
|
"""
|
|
238
|
-
Returns the data of
|
|
306
|
+
Returns the pyvista data of _VisualData.
|
|
239
307
|
|
|
240
308
|
Returns
|
|
241
309
|
-------
|
|
242
|
-
pv.PolyData
|
|
243
|
-
The data of the surface visualization
|
|
310
|
+
Union["pv.PolyData", List[_VisualArrow]]
|
|
311
|
+
The data of the surface visualization if surface data,
|
|
312
|
+
else List[_VisualArrow] containing ray info.
|
|
244
313
|
|
|
245
314
|
"""
|
|
246
|
-
return self.
|
|
315
|
+
return self._data
|
|
247
316
|
|
|
248
317
|
def add_data_triangle(self, triangle_vertices: List[List[float]]) -> None:
|
|
249
318
|
"""
|
|
@@ -265,7 +334,7 @@ class _VisualData:
|
|
|
265
334
|
"triangle_vertices is expected to be composed of 3 vertices with 3 elements each."
|
|
266
335
|
)
|
|
267
336
|
faces = [[3, 0, 1, 2]]
|
|
268
|
-
self.
|
|
337
|
+
self._data = self._data.append_polydata(pv.PolyData(triangle_vertices, faces))
|
|
269
338
|
|
|
270
339
|
def add_data_rectangle(self, rectangle_vertices: List[List[float]]) -> None:
|
|
271
340
|
"""
|
|
@@ -286,4 +355,68 @@ class _VisualData:
|
|
|
286
355
|
raise ValueError(
|
|
287
356
|
"rectangle_vertices is expected to be composed of 3 vertices with 3 elements each."
|
|
288
357
|
)
|
|
289
|
-
self.
|
|
358
|
+
self._data = self._data.append_polydata(pv.Rectangle(rectangle_vertices))
|
|
359
|
+
|
|
360
|
+
def add_data_line(self, line: _VisualArrow) -> None:
|
|
361
|
+
"""
|
|
362
|
+
Add line data to Visualization data.
|
|
363
|
+
|
|
364
|
+
Parameters
|
|
365
|
+
----------
|
|
366
|
+
line: _VisualArrow
|
|
367
|
+
_VisualArrow presenting one line
|
|
368
|
+
|
|
369
|
+
Returns
|
|
370
|
+
-------
|
|
371
|
+
None
|
|
372
|
+
"""
|
|
373
|
+
self._data.append(line)
|
|
374
|
+
|
|
375
|
+
def add_data_mesh(self, vertices: np.ndarray, facets: np.ndarray) -> None:
|
|
376
|
+
"""
|
|
377
|
+
Add mesh data to Visualization data.
|
|
378
|
+
|
|
379
|
+
Parameters
|
|
380
|
+
----------
|
|
381
|
+
vertices: numpy.ndarray
|
|
382
|
+
The vertices of the mesh.
|
|
383
|
+
facets: numpy.ndarray
|
|
384
|
+
The facets of the mesh.
|
|
385
|
+
|
|
386
|
+
Returns
|
|
387
|
+
-------
|
|
388
|
+
None
|
|
389
|
+
"""
|
|
390
|
+
import pyvista as pv
|
|
391
|
+
|
|
392
|
+
if vertices.shape[1] != 3 or facets.shape[1] != 4:
|
|
393
|
+
raise ValueError(
|
|
394
|
+
"mesh vertices is expected to be composed of 3 elements each, and 4 for facets."
|
|
395
|
+
)
|
|
396
|
+
self._data = self._data.append_polydata(pv.PolyData(vertices, facets))
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
def local2absolute(local_vertice: np.ndarray, coordinates) -> np.ndarray:
|
|
400
|
+
"""Convert local coordinate to global coordinate.
|
|
401
|
+
|
|
402
|
+
Parameters
|
|
403
|
+
----------
|
|
404
|
+
coordinates: list
|
|
405
|
+
local coordinate in shape [1, 9],
|
|
406
|
+
coordinates[3:6] as x-axis,
|
|
407
|
+
coordinates[3:6] as y-axis,
|
|
408
|
+
coordinates[3:6] as z-axis.
|
|
409
|
+
local_vertice: np.ndarray
|
|
410
|
+
numpy array includes x, y, z info.
|
|
411
|
+
|
|
412
|
+
Returns
|
|
413
|
+
-------
|
|
414
|
+
np.ndarray
|
|
415
|
+
numpy array includes x, y, z info
|
|
416
|
+
|
|
417
|
+
"""
|
|
418
|
+
global_origin = np.array(coordinates[:3])
|
|
419
|
+
global_x = np.array(coordinates[3:6]) * local_vertice[0]
|
|
420
|
+
global_y = np.array(coordinates[6:9]) * local_vertice[1]
|
|
421
|
+
global_z = np.array(coordinates[9:]) * local_vertice[2]
|
|
422
|
+
return global_origin + global_x + global_y + global_z
|