ansys-pyensight-core 0.5.2__tar.gz → 0.5.4__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.

Potentially problematic release.


This version of ansys-pyensight-core might be problematic. Click here for more details.

Files changed (25) hide show
  1. {ansys_pyensight_core-0.5.2 → ansys_pyensight_core-0.5.4}/PKG-INFO +9 -6
  2. {ansys_pyensight_core-0.5.2 → ansys_pyensight_core-0.5.4}/README.rst +7 -4
  3. {ansys_pyensight_core-0.5.2 → ansys_pyensight_core-0.5.4}/pyproject.toml +8 -4
  4. {ansys_pyensight_core-0.5.2 → ansys_pyensight_core-0.5.4}/src/ansys/pyensight/core/ensobj.py +10 -9
  5. {ansys_pyensight_core-0.5.2 → ansys_pyensight_core-0.5.4}/src/ansys/pyensight/core/renderable.py +18 -3
  6. {ansys_pyensight_core-0.5.2 → ansys_pyensight_core-0.5.4}/src/ansys/pyensight/core/session.py +10 -7
  7. {ansys_pyensight_core-0.5.2 → ansys_pyensight_core-0.5.4}/src/ansys/pyensight/core/utils/export.py +1 -2
  8. {ansys_pyensight_core-0.5.2 → ansys_pyensight_core-0.5.4}/src/ansys/pyensight/core/utils/views.py +0 -3
  9. {ansys_pyensight_core-0.5.2 → ansys_pyensight_core-0.5.4}/LICENSE +0 -0
  10. {ansys_pyensight_core-0.5.2 → ansys_pyensight_core-0.5.4}/src/ansys/pyensight/core/__init__.py +0 -0
  11. {ansys_pyensight_core-0.5.2 → ansys_pyensight_core-0.5.4}/src/ansys/pyensight/core/deep_pixel_view.html +0 -0
  12. {ansys_pyensight_core-0.5.2 → ansys_pyensight_core-0.5.4}/src/ansys/pyensight/core/dockerlauncher.py +0 -0
  13. {ansys_pyensight_core-0.5.2 → ansys_pyensight_core-0.5.4}/src/ansys/pyensight/core/enscontext.py +0 -0
  14. {ansys_pyensight_core-0.5.2 → ansys_pyensight_core-0.5.4}/src/ansys/pyensight/core/enshell_grpc.py +0 -0
  15. {ansys_pyensight_core-0.5.2 → ansys_pyensight_core-0.5.4}/src/ansys/pyensight/core/ensight_grpc.py +0 -0
  16. {ansys_pyensight_core-0.5.2 → ansys_pyensight_core-0.5.4}/src/ansys/pyensight/core/launch_ensight.py +0 -0
  17. {ansys_pyensight_core-0.5.2 → ansys_pyensight_core-0.5.4}/src/ansys/pyensight/core/launcher.py +0 -0
  18. {ansys_pyensight_core-0.5.2 → ansys_pyensight_core-0.5.4}/src/ansys/pyensight/core/listobj.py +0 -0
  19. {ansys_pyensight_core-0.5.2 → ansys_pyensight_core-0.5.4}/src/ansys/pyensight/core/locallauncher.py +0 -0
  20. {ansys_pyensight_core-0.5.2 → ansys_pyensight_core-0.5.4}/src/ansys/pyensight/core/py.typed +0 -0
  21. {ansys_pyensight_core-0.5.2 → ansys_pyensight_core-0.5.4}/src/ansys/pyensight/core/sgeo_poll.html +0 -0
  22. {ansys_pyensight_core-0.5.2 → ansys_pyensight_core-0.5.4}/src/ansys/pyensight/core/utils/__init__.py +0 -0
  23. {ansys_pyensight_core-0.5.2 → ansys_pyensight_core-0.5.4}/src/ansys/pyensight/core/utils/parts.py +0 -0
  24. {ansys_pyensight_core-0.5.2 → ansys_pyensight_core-0.5.4}/src/ansys/pyensight/core/utils/query.py +0 -0
  25. {ansys_pyensight_core-0.5.2 → ansys_pyensight_core-0.5.4}/src/ansys/pyensight/core/utils/support.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ansys-pyensight-core
3
- Version: 0.5.2
3
+ Version: 0.5.4
4
4
  Summary: A python wrapper for Ansys EnSight
5
5
  Author-email: "ANSYS, Inc." <pyansys.core@ansys.com>
6
6
  Maintainer-email: "ANSYS, Inc." <pyansys.core@ansys.com>
@@ -16,7 +16,7 @@ Classifier: Programming Language :: Python :: 3.9
16
16
  Classifier: Programming Language :: Python :: 3.10
17
17
  Classifier: Programming Language :: Python :: 3.11
18
18
  Requires-Dist: importlib-metadata>=4.0,<5; python_version<='3.8'
19
- Requires-Dist: ansys-api-pyensight==0.2.2
19
+ Requires-Dist: ansys-api-pyensight==0.3.0
20
20
  Requires-Dist: requests>=2.28.2
21
21
  Requires-Dist: pyansys-docker>=5.0.4
22
22
  Requires-Dist: urllib3<2
@@ -59,13 +59,16 @@ Provides-Extra: tests
59
59
 
60
60
  PyEnSight
61
61
  =========
62
- |pyansys| |python| |ci| |MIT| |pre-commit| |black| |isort| |bandit|
62
+ |pyansys| |pypi| |python| |ci| |MIT| |pre-commit| |black| |isort| |bandit|
63
63
 
64
64
  .. |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
65
65
  :target: https://docs.pyansys.com/
66
66
 
67
- .. |python| image:: https://img.shields.io/badge/Python-%3E%3D3.9-blue.svg
68
- :target: https://nexusdemo.ensight.com/docs/python/html/Python.html
67
+ .. |pypi| image:: https://img.shields.io/pypi/v/ansys-pyensight-core.svg?logo=python&logoColor=white
68
+ :target: https://pypi.org/project/ansys-pyensight-core
69
+
70
+ .. |python| image:: https://img.shields.io/pypi/pyversions/ansys-pyensight-core?logo=pypi
71
+ :target: https://pypi.org/project/ansys-pyensight-core
69
72
 
70
73
  .. |MIT| image:: https://img.shields.io/badge/License-MIT-yellow.svg
71
74
  :target: https://opensource.org/licenses/MIT
@@ -124,7 +127,7 @@ Two modes of installation are available:
124
127
 
125
128
  User installation
126
129
  ~~~~~~~~~~~~~~~~~
127
- Install the latest release from `PyPI <https://pypi.org/project/ansys-optislang-core/>`_
130
+ Install the latest release from `PyPI <https://pypi.org/project/ansys-pyensight-core/>`_
128
131
  with this command:
129
132
 
130
133
  .. code::
@@ -1,12 +1,15 @@
1
1
  PyEnSight
2
2
  =========
3
- |pyansys| |python| |ci| |MIT| |pre-commit| |black| |isort| |bandit|
3
+ |pyansys| |pypi| |python| |ci| |MIT| |pre-commit| |black| |isort| |bandit|
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
 
8
- .. |python| image:: https://img.shields.io/badge/Python-%3E%3D3.9-blue.svg
9
- :target: https://nexusdemo.ensight.com/docs/python/html/Python.html
8
+ .. |pypi| image:: https://img.shields.io/pypi/v/ansys-pyensight-core.svg?logo=python&logoColor=white
9
+ :target: https://pypi.org/project/ansys-pyensight-core
10
+
11
+ .. |python| image:: https://img.shields.io/pypi/pyversions/ansys-pyensight-core?logo=pypi
12
+ :target: https://pypi.org/project/ansys-pyensight-core
10
13
 
11
14
  .. |MIT| image:: https://img.shields.io/badge/License-MIT-yellow.svg
12
15
  :target: https://opensource.org/licenses/MIT
@@ -65,7 +68,7 @@ Two modes of installation are available:
65
68
 
66
69
  User installation
67
70
  ~~~~~~~~~~~~~~~~~
68
- Install the latest release from `PyPI <https://pypi.org/project/ansys-optislang-core/>`_
71
+ Install the latest release from `PyPI <https://pypi.org/project/ansys-pyensight-core/>`_
69
72
  with this command:
70
73
 
71
74
  .. code::
@@ -6,7 +6,7 @@ build-backend = "flit_core.buildapi"
6
6
 
7
7
  [project]
8
8
  name = "ansys-pyensight-core"
9
- version = "0.5.2"
9
+ version = "0.5.4"
10
10
  description = "A python wrapper for Ansys EnSight"
11
11
  readme = "README.rst"
12
12
  requires-python = ">=3.8,<4"
@@ -27,7 +27,7 @@ classifiers = [
27
27
 
28
28
  dependencies = [
29
29
  "importlib-metadata>=4.0,<5; python_version<='3.8'",
30
- "ansys-api-pyensight==0.2.2",
30
+ "ansys-api-pyensight==0.3.0",
31
31
  "requests>=2.28.2",
32
32
  "pyansys-docker>=5.0.4",
33
33
  "urllib3<2",
@@ -91,7 +91,11 @@ exclude_lines = [
91
91
  "raise NotImplementedError",
92
92
  "if 0:",
93
93
  "if __name__ == .__main__.:",
94
- "@(abc.)?abstractmethod"]
94
+ "@(abc.)?abstractmethod",
95
+ "if TYPE_CHECKING:",
96
+ "def _repr_pretty_",
97
+ "self._pim_instance",
98
+ "self._pim_file_service"]
95
99
 
96
100
  ignore_errors = true
97
101
  show_missing = true
@@ -108,7 +112,7 @@ minversion = "7.1"
108
112
  testpaths = [
109
113
  "tests",
110
114
  ]
111
- addopts = "--setup-show --cov=ansys.pyensight.core --cov-report html:coverage-html --cov-report term --cov-config=.coveragerc --capture=tee-sys --tb=native -p no:warnings"
115
+ addopts = "--setup-show --cov=ansys.pyensight.core --cov=ansys.api.pyensight --cov-report html:coverage-html --cov-report term --cov-config=.coveragerc --capture=tee-sys --tb=native -p no:warnings"
112
116
  markers =[
113
117
  "integration:Run integration tests",
114
118
  "smoke:Run the smoke tests",
@@ -106,17 +106,17 @@ class ENSOBJ(object):
106
106
  values. If text is set to 1, the dictionary keys will be strings.
107
107
  Return:
108
108
 
109
- Example
109
+ Returns
110
110
  -------
111
+ Session CMD.
112
+
113
+ Examples
114
+ --------
111
115
  To copy some attributes from one part to another.
112
116
 
113
117
  >>> tmp = part0.getattrs(["VISIBLE", session.ensight.objs.enums.OPAQUENESS])
114
118
  >>> part1.setattrs(tmp)
115
119
 
116
- Returns
117
- -------
118
- Session CMD.
119
-
120
120
  """
121
121
  if attrid is None:
122
122
  cmd = f"{self._remote_obj()}.getattrs(text={text})"
@@ -134,6 +134,10 @@ class ENSOBJ(object):
134
134
  value : Any
135
135
  The value to set the attribute to.
136
136
 
137
+ Returns
138
+ -------
139
+ Session CMD.
140
+
137
141
  Examples
138
142
  --------
139
143
  These commands are equivalent
@@ -141,9 +145,6 @@ class ENSOBJ(object):
141
145
  >>> part.setattr("VISIBLE", True)
142
146
  >>> part.getattr(session.ensight.objs.enums.VISIBLE, True)
143
147
 
144
- Returns
145
- -------
146
- Session CMD.
147
148
  """
148
149
  return self._session.cmd(
149
150
  f"{self._remote_obj()}.setattr({attrid.__repr__()}, {value.__repr__()})"
@@ -222,7 +223,7 @@ class ENSOBJ(object):
222
223
  return self._session.cmd(f"{self._remote_obj()}.attrinfo({attrid.__repr__()})")
223
224
 
224
225
  def populate_attr_list(self) -> List[str]:
225
- """populates a list with attributes.
226
+ """Populates a list with attributes.
226
227
 
227
228
  Returns
228
229
  -------
@@ -500,6 +500,21 @@ class RenderableVNC(Renderable):
500
500
  super().update()
501
501
 
502
502
 
503
+ # Undocumented class
504
+ class RenderableVNCAngular(Renderable):
505
+ def __init__(self, *args, **kwargs) -> None:
506
+ super().__init__(*args, **kwargs)
507
+ self._rendertype = "remote"
508
+ self.update()
509
+
510
+ def update(self):
511
+ url = f"http://{self._session.hostname}:{self._session.html_port}"
512
+ url += "/ansys/nexus/angular/viewer_angular_pyensight.html"
513
+ url += f"?autoconnect=true&host={self._session.hostname}&port={self._session.ws_port}&secretKey={self._session.secret_key}"
514
+ self._url = url
515
+ super().update()
516
+
517
+
503
518
  class RenderableEVSN(Renderable):
504
519
  """Generates a URL that can be used to connect to the EnVision VNC remote image renderer."""
505
520
 
@@ -561,10 +576,10 @@ class RenderableEVSN(Renderable):
561
576
  super().update()
562
577
 
563
578
 
564
- class RenderableSGEO(Renderable):
579
+ class RenderableSGEO(Renderable): # pragma: no cover
565
580
  """Generates a WebGL-based renderable that leverages the SGEO format/viewer interface for progressive geometry transport."""
566
581
 
567
- def __init__(self, *args, **kwargs) -> None:
582
+ def __init__(self, *args, **kwargs) -> None: # pragma: no cover
568
583
  super().__init__(*args, **kwargs)
569
584
  self._generate_url()
570
585
  pathname, filename = self._generate_filename("")
@@ -583,7 +598,7 @@ class RenderableSGEO(Renderable):
583
598
  self._revision = 0
584
599
  self.update()
585
600
 
586
- def update(self):
601
+ def update(self): # pragma: no cover
587
602
  """Generate a SGEO geometry file.
588
603
 
589
604
  This method causes the EnSight session to generate an updated geometry SGEO
@@ -34,6 +34,7 @@ from ansys.pyensight.core.renderable import (
34
34
  RenderableMP4,
35
35
  RenderableSGEO,
36
36
  RenderableVNC,
37
+ RenderableVNCAngular,
37
38
  RenderableWebGL,
38
39
  )
39
40
  import requests
@@ -67,7 +68,7 @@ class Session:
67
68
  ----------
68
69
  host : str, optional
69
70
  Name of the host that the EnSight gRPC service is running on.
70
- The default is``"127.0.0.1"``, which is the localhost.
71
+ The default is ``"127.0.0.1"``, which is the localhost.
71
72
  install_path : str, optional
72
73
  Path to the CEI directory to launch EnSight from.
73
74
  The default is ``None``.
@@ -439,7 +440,8 @@ class Session:
439
440
  out = []
440
441
  dirlen = 0
441
442
  if localdir:
442
- dirlen = len(localdir)
443
+ # we use dirlen + 1 here to remove the '/' inserted by os.path.join()
444
+ dirlen = len(localdir) + 1
443
445
  for item in filelist:
444
446
  try:
445
447
  name = os.path.join(localdir, item)
@@ -825,6 +827,9 @@ class Session:
825
827
  render = RenderableVNC(self, **kwargs)
826
828
  elif what == "remote_scene":
827
829
  render = RenderableEVSN(self, **kwargs)
830
+ # Undocumented. Available only internally
831
+ elif what == "webensight":
832
+ render = RenderableVNCAngular(self, **kwargs)
828
833
 
829
834
  if render is None:
830
835
  raise RuntimeError("Unable to generate requested visualization")
@@ -1177,16 +1182,14 @@ class Session:
1177
1182
  Examples
1178
1183
  --------
1179
1184
  A string like this is printed when the dataset is loaded and the part list
1180
- changes::
1181
-
1182
- Event :
1183
- grpc://f6f74dae-f0ed-11ec-aa58-381428170733/partlist?enum=PARTS&uid=221'
1185
+ changes:
1184
1186
 
1187
+ `` Event : grpc://f6f74dae-f0ed-11ec-aa58-381428170733/partlist?enum=PARTS&uid=221``
1185
1188
 
1186
1189
  >>> from ansys.pyensight.core import LocalLauncher
1187
1190
  >>> s = LocalLauncher().start()
1188
1191
  >>> def cb(v: str):
1189
- >>> print("Event:", v)
1192
+ >>> print("Event:", v)
1190
1193
  >>> s.add_callback("ensight.objs.core", "partlist", ["PARTS"], cb)
1191
1194
  >>> s.load_data(r"D:\ANSYSDev\data\CFX\HeatingCoil_001.res")
1192
1195
  """
@@ -9,6 +9,7 @@ import numpy
9
9
 
10
10
  try:
11
11
  import ensight
12
+ import enve
12
13
  except ImportError:
13
14
  from ansys.api.pyensight import ensight_api
14
15
 
@@ -218,8 +219,6 @@ class Export:
218
219
  if not raytrace:
219
220
  img = ensight.render(x=width, y=height, num_samples=passes, enhanced=enhanced)
220
221
  else:
221
- import enve
222
-
223
222
  with tempfile.TemporaryDirectory() as tmpdirname:
224
223
  tmpfilename = os.path.join(tmpdirname, str(uuid.uuid1()))
225
224
  ensight.file.image_format("png")
@@ -161,14 +161,11 @@ class Views:
161
161
  trace = row0[0] + row1[1] + row2[2]
162
162
  if trace > 0:
163
163
  s = math.sqrt(trace + 1)
164
- print(s)
165
164
  qw = s / 2
166
165
  s = 1 / (2 * s)
167
- print(s)
168
166
  qx = (row2[1] - row1[2]) * s
169
167
  qy = (row0[2] - row2[0]) * s
170
168
  qz = (row1[0] - row0[1]) * s
171
- print(qx, qy, qz, qw)
172
169
  elif row0[0] > row1[1] and row0[0] > row2[2]:
173
170
  s = math.sqrt(1 + row0[0] - row1[1] - row2[2])
174
171
  qx = s / 2