ansys-pyensight-core 0.11.0__py3-none-any.whl
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/pyensight/core/__init__.py +41 -0
- ansys/pyensight/core/common.py +341 -0
- ansys/pyensight/core/deep_pixel_view.html +98 -0
- ansys/pyensight/core/dockerlauncher.py +1124 -0
- ansys/pyensight/core/dvs.py +872 -0
- ansys/pyensight/core/enscontext.py +345 -0
- ansys/pyensight/core/enshell_grpc.py +641 -0
- ansys/pyensight/core/ensight_grpc.py +874 -0
- ansys/pyensight/core/ensobj.py +515 -0
- ansys/pyensight/core/launch_ensight.py +296 -0
- ansys/pyensight/core/launcher.py +388 -0
- ansys/pyensight/core/libuserd.py +2110 -0
- ansys/pyensight/core/listobj.py +280 -0
- ansys/pyensight/core/locallauncher.py +579 -0
- ansys/pyensight/core/py.typed +0 -0
- ansys/pyensight/core/renderable.py +880 -0
- ansys/pyensight/core/session.py +1923 -0
- ansys/pyensight/core/sgeo_poll.html +24 -0
- ansys/pyensight/core/utils/__init__.py +21 -0
- ansys/pyensight/core/utils/adr.py +111 -0
- ansys/pyensight/core/utils/dsg_server.py +1220 -0
- ansys/pyensight/core/utils/export.py +606 -0
- ansys/pyensight/core/utils/omniverse.py +769 -0
- ansys/pyensight/core/utils/omniverse_cli.py +614 -0
- ansys/pyensight/core/utils/omniverse_dsg_server.py +1196 -0
- ansys/pyensight/core/utils/omniverse_glb_server.py +848 -0
- ansys/pyensight/core/utils/parts.py +1221 -0
- ansys/pyensight/core/utils/query.py +487 -0
- ansys/pyensight/core/utils/readers.py +300 -0
- ansys/pyensight/core/utils/resources/Materials/000_sky.exr +0 -0
- ansys/pyensight/core/utils/support.py +128 -0
- ansys/pyensight/core/utils/variables.py +2019 -0
- ansys/pyensight/core/utils/views.py +674 -0
- ansys_pyensight_core-0.11.0.dist-info/METADATA +309 -0
- ansys_pyensight_core-0.11.0.dist-info/RECORD +37 -0
- ansys_pyensight_core-0.11.0.dist-info/WHEEL +4 -0
- ansys_pyensight_core-0.11.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
let last_rev_ITEMID = "";
|
|
3
|
+
function reload_src(text) {
|
|
4
|
+
if (last_rev_ITEMID !== text) {
|
|
5
|
+
const viewer = document.getElementById("ITEMID");
|
|
6
|
+
viewer.src = viewer.src;
|
|
7
|
+
last_rev_ITEMID = text;
|
|
8
|
+
}
|
|
9
|
+
setTimeout(check_revision, 100);
|
|
10
|
+
}
|
|
11
|
+
function check_revision() {
|
|
12
|
+
const url = "REVURL_ITEMID";
|
|
13
|
+
fetch(url).then((response) => {
|
|
14
|
+
if (response.status === 200) {
|
|
15
|
+
return response.text();
|
|
16
|
+
} else {
|
|
17
|
+
setTimeout(check_revision, 100);
|
|
18
|
+
}
|
|
19
|
+
}).then(reload_src).catch((error) => {
|
|
20
|
+
setTimeout(check_revision, 100);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
let id_ITEMID = setTimeout(check_revision, 100);
|
|
24
|
+
</script>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Copyright (C) 2022 - 2026 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.
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Copyright (C) 2022 - 2026 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
|
+
from types import ModuleType
|
|
24
|
+
from typing import Optional, Union
|
|
25
|
+
|
|
26
|
+
try:
|
|
27
|
+
import ensight
|
|
28
|
+
except ImportError:
|
|
29
|
+
from ansys.api.pyensight import ensight_api
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class Adr:
|
|
33
|
+
"""Provides the ``ensight.utils.adr`` interface.
|
|
34
|
+
|
|
35
|
+
The methods in this class implement simplified interfaces connect EnSight
|
|
36
|
+
to an existing ADR report.
|
|
37
|
+
With connect_to_existing_adr_report() the connection is done, while with
|
|
38
|
+
generate_adr_report() the report is generated.
|
|
39
|
+
|
|
40
|
+
Parameters
|
|
41
|
+
----------
|
|
42
|
+
interface :
|
|
43
|
+
Entity that provides the ``ensight`` namespace. In the case of
|
|
44
|
+
EnSight Python, the ``ensight`` module is passed. In the case
|
|
45
|
+
of PyEnSight, ``Session.ensight`` is passed.
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
def __init__(self, interface: Union["ensight_api.ensight", "ensight"]):
|
|
49
|
+
self._ensight = interface
|
|
50
|
+
self._adr_report_connected = False
|
|
51
|
+
self._url: Optional[str] = None
|
|
52
|
+
|
|
53
|
+
def connect_to_existing_adr_report(
|
|
54
|
+
self, url: str, username: str = "nexus", password: str = "cei"
|
|
55
|
+
) -> None:
|
|
56
|
+
"""Connect to an existing ADR report
|
|
57
|
+
|
|
58
|
+
Parameters
|
|
59
|
+
----------
|
|
60
|
+
url: string
|
|
61
|
+
the url of the ADR report
|
|
62
|
+
username: string
|
|
63
|
+
the username to connect to the ADR report
|
|
64
|
+
password: string
|
|
65
|
+
the password to connect to the ADR report
|
|
66
|
+
"""
|
|
67
|
+
ret = None
|
|
68
|
+
if self._adr_report_connected is True:
|
|
69
|
+
raise RuntimeError(
|
|
70
|
+
f"The PyEnSight session is already connected to the ADR server {self._url}."
|
|
71
|
+
)
|
|
72
|
+
if isinstance(self._ensight, ModuleType):
|
|
73
|
+
self._ensight.core.nexus.ReportServer.get_server().set_URL(url)
|
|
74
|
+
self._ensight.core.nexus.ReportServer.get_server().set_username(username)
|
|
75
|
+
self._ensight.core.nexus.ReportServer.get_server().set_password(password)
|
|
76
|
+
ret = self._ensight.core.nexus.ReportServer.get_server().validate() == 1.0
|
|
77
|
+
else:
|
|
78
|
+
self._ensight._session.cmd(
|
|
79
|
+
f"ensight.core.nexus.ReportServer.get_server().set_URL('{url}')"
|
|
80
|
+
)
|
|
81
|
+
self._ensight._session.cmd(
|
|
82
|
+
f"ensight.core.nexus.ReportServer.get_server().set_username('{username}')"
|
|
83
|
+
)
|
|
84
|
+
self._ensight._session.cmd(
|
|
85
|
+
f"ensight.core.nexus.ReportServer.get_server().set_password('{password}')"
|
|
86
|
+
)
|
|
87
|
+
ret = self._ensight._session.cmd(
|
|
88
|
+
"ensight.core.nexus.ReportServer.get_server().validate() == 1.0"
|
|
89
|
+
)
|
|
90
|
+
if ret is True:
|
|
91
|
+
self._adr_report_connected = True
|
|
92
|
+
self._url = url
|
|
93
|
+
else:
|
|
94
|
+
raise RuntimeError("Couldn't connect to the ADR report server.")
|
|
95
|
+
|
|
96
|
+
def generate_adr_report(self):
|
|
97
|
+
"""Generate the ADR report with the current states."""
|
|
98
|
+
if self._adr_report_connected is False:
|
|
99
|
+
raise RuntimeError(
|
|
100
|
+
"No ADR report is connected to the PyEnSight session. Please generated one and connect with connect_to_existing_adr_report()"
|
|
101
|
+
)
|
|
102
|
+
if len(self._ensight.objs.core.STATES) > 0:
|
|
103
|
+
self._ensight.objs.core.STATES[0].generate_report()
|
|
104
|
+
else:
|
|
105
|
+
raise RuntimeError("No states are available to generate the report with.")
|
|
106
|
+
|
|
107
|
+
def is_connected_to_adr_report(self):
|
|
108
|
+
"""True if the PyEnSight session is already connected to an ADR report server."""
|
|
109
|
+
if self._adr_report_connected is True:
|
|
110
|
+
print(f"The PyEnSight session is connected to the ADR report server {self._url}")
|
|
111
|
+
return self._adr_report_connected
|