ansys-pyensight-core 0.10.7__tar.gz → 0.10.9__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 (37) hide show
  1. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/PKG-INFO +3 -3
  2. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/pyproject.toml +3 -3
  3. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/common.py +1 -1
  4. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/dvs.py +3 -1
  5. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/enshell_grpc.py +1 -1
  6. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/libuserd.py +2 -2
  7. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/session.py +2 -2
  8. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/utils/omniverse.py +1 -1
  9. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/utils/views.py +43 -10
  10. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/LICENSE +0 -0
  11. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/README.rst +0 -0
  12. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/__init__.py +0 -0
  13. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/deep_pixel_view.html +0 -0
  14. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/dockerlauncher.py +0 -0
  15. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/enscontext.py +0 -0
  16. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/ensight_grpc.py +0 -0
  17. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/ensobj.py +0 -0
  18. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/launch_ensight.py +0 -0
  19. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/launcher.py +0 -0
  20. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/listobj.py +0 -0
  21. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/locallauncher.py +0 -0
  22. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/py.typed +0 -0
  23. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/renderable.py +0 -0
  24. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/sgeo_poll.html +0 -0
  25. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/utils/__init__.py +0 -0
  26. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/utils/adr.py +0 -0
  27. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/utils/dsg_server.py +0 -0
  28. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/utils/export.py +0 -0
  29. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/utils/omniverse_cli.py +0 -0
  30. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/utils/omniverse_dsg_server.py +0 -0
  31. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/utils/omniverse_glb_server.py +0 -0
  32. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/utils/parts.py +0 -0
  33. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/utils/query.py +0 -0
  34. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/utils/readers.py +0 -0
  35. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/utils/resources/Materials/000_sky.exr +0 -0
  36. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/utils/support.py +0 -0
  37. {ansys_pyensight_core-0.10.7 → ansys_pyensight_core-0.10.9}/src/ansys/pyensight/core/utils/variables.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ansys-pyensight-core
3
- Version: 0.10.7
3
+ Version: 0.10.9
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>
@@ -17,10 +17,10 @@ Classifier: Programming Language :: Python :: 3.12
17
17
  Classifier: Programming Language :: Python :: 3.13
18
18
  License-File: LICENSE
19
19
  Requires-Dist: importlib-metadata>=4.0; python_version<='3.8'
20
- Requires-Dist: ansys-api-pyensight==0.4.8
20
+ Requires-Dist: ansys-api-pyensight==0.4.9
21
21
  Requires-Dist: requests>=2.28.2
22
22
  Requires-Dist: docker>=6.1.0
23
- Requires-Dist: urllib3<2.4.0
23
+ Requires-Dist: urllib3<3
24
24
  Requires-Dist: numpy>=1.21.0,<3
25
25
  Requires-Dist: Pillow>=9.3.0
26
26
  Requires-Dist: pypng>=0.0.20
@@ -6,7 +6,7 @@ build-backend = "flit_core.buildapi"
6
6
 
7
7
  [project]
8
8
  name = "ansys-pyensight-core"
9
- version = "0.10.7"
9
+ version = "0.10.9"
10
10
  description = "A python wrapper for Ansys EnSight"
11
11
  readme = "README.rst"
12
12
  requires-python = ">=3.10,<3.14"
@@ -27,10 +27,10 @@ classifiers = [
27
27
 
28
28
  dependencies = [
29
29
  "importlib-metadata>=4.0; python_version<='3.8'",
30
- "ansys-api-pyensight==0.4.8",
30
+ "ansys-api-pyensight==0.4.9",
31
31
  "requests>=2.28.2",
32
32
  "docker>=6.1.0",
33
- "urllib3<2.4.0",
33
+ "urllib3<3",
34
34
  "numpy>=1.21.0,<3",
35
35
  "Pillow>=9.3.0",
36
36
  "pypng>=0.0.20",
@@ -97,7 +97,7 @@ def get_host_port(uri: str) -> Tuple[str, int]:
97
97
  port = (
98
98
  parse_results.port
99
99
  if parse_results.port
100
- else (443 if re.search("^https|wss$", parse_results.scheme) else None)
100
+ else (443 if re.search(r"^https|wss$", parse_results.scheme) else None)
101
101
  )
102
102
  return (parse_results.host, port)
103
103
 
@@ -156,7 +156,9 @@ class DVS(dvs_base):
156
156
  arch = "win64" if self._is_windows() else "linux_2.6_64"
157
157
  apex_libs = os.path.join(apex_path, "machines", arch)
158
158
  python_path = glob.glob(os.path.join(apex_libs, "Python-3.*"))[-1]
159
- apex_py_version = re.search("Python-3.([0-9]+).([0-9]+)", os.path.basename(python_path))
159
+ apex_py_version = re.search(
160
+ r"Python-3.([0-9]+).([0-9]+)", os.path.basename(python_path)
161
+ )
160
162
  apex_py_major_version = apex_py_version.group(1)
161
163
  lib_path = os.path.join(python_path, "lib", f"python3.{apex_py_major_version}")
162
164
  if self._is_windows():
@@ -455,7 +455,7 @@ class EnShellGRPC(object):
455
455
  "Error getting CEI_HOME env var from the Docker container.\n{ret}\n"
456
456
  ) # pragma: no cover
457
457
  self._cei_home = cei_home_line[equal_sign_loc + 1 :]
458
- m = re.search("/v(\d\d\d)/", self._cei_home)
458
+ m = re.search(r"/v(\d\d\d)/", self._cei_home)
459
459
  if not m: # pragma: no cover
460
460
  self.stop_server() # pragma: no cover
461
461
  raise RuntimeError(
@@ -1138,8 +1138,8 @@ class LibUserd(object):
1138
1138
  >>> from ansys.pyensight.core import libuserd
1139
1139
  >>> l = libuserd.LibUserd()
1140
1140
  >>> l.initialize()
1141
- >>> readers = l.query_format(r"D:\data\Axial_001.res")
1142
- >>> data = readers[0].read_dataset(r"D:\data\Axial_001.res")
1141
+ >>> readers = l.query_format("D:\\data\\Axial_001.res")
1142
+ >>> data = readers[0].read_dataset("D:\\data\\Axial_001.res")
1143
1143
  >>> part = data.parts[0]
1144
1144
  >>> print(part, part.nodes())
1145
1145
  >>> l.shutdown()
@@ -1164,7 +1164,7 @@ class Session:
1164
1164
  --------
1165
1165
  >>> from ansys.pyensight.core import LocalLauncher
1166
1166
  >>> session = LocalLauncher().start()
1167
- >>> session.load_data(r'D:\data\CFX\example_data.res')
1167
+ >>> session.load_data('D:\\data\\CFX\\example_data.res')
1168
1168
 
1169
1169
  """
1170
1170
  self._establish_connection()
@@ -1431,7 +1431,7 @@ class Session:
1431
1431
  >>> def cb(v: str):
1432
1432
  >>> print("Event:", v)
1433
1433
  >>> s.add_callback("ensight.objs.core", "partlist", ["PARTS"], cb)
1434
- >>> s.load_data(r"D:\ANSYSDev\data\CFX\HeatingCoil_001.res")
1434
+ >>> s.load_data("D:\\ANSYSDev\\data\\CFX\\HeatingCoil_001.res")
1435
1435
  """
1436
1436
  self._establish_connection()
1437
1437
  # shorten the tag up to the query block. Macros are only legal in the query block.
@@ -396,7 +396,7 @@ class Omniverse:
396
396
  >>> from ansys.pyensight.core import LocalLauncher
397
397
  >>> session = LocalLauncher().start()
398
398
  >>> ov = session.ensight.utils.omniverse
399
- >>> ov.create_connection(r"D:\Omniverse\Example")
399
+ >>> ov.create_connection("D:\\Omniverse\\Example")
400
400
  >>> ov.update()
401
401
  >>> ov.close_connection()
402
402
 
@@ -78,6 +78,7 @@ class _Simba:
78
78
 
79
79
  def auto_scale(self):
80
80
  """Auto scale view."""
81
+ self.ensight.view_transf.function("global")
81
82
  self.ensight.view_transf.fit()
82
83
  self._initialize_simba_view()
83
84
  self.render()
@@ -85,6 +86,7 @@ class _Simba:
85
86
 
86
87
  def set_view(self, value: str):
87
88
  """Set the view."""
89
+ self.ensight.view_transf.function("global")
88
90
  if value != "isometric":
89
91
  new_value = value[1].upper() + value[0]
90
92
  self.ensight.view_transf.view_recall(new_value)
@@ -207,9 +209,10 @@ class _Simba:
207
209
  return camera_position, focal_point, self.views._normalize_vector(view_up), parallel_scale
208
210
 
209
211
  def set_camera(
210
- self, orthographic, view_up=None, position=None, focal_point=None, view_angle=None
212
+ self, orthographic, view_up=None, position=None, focal_point=None, view_angle=None, pan=None
211
213
  ):
212
214
  """Set the EnSight camera settings from the VTK input."""
215
+ self.ensight.view_transf.function("global")
213
216
  perspective = "OFF" if orthographic else "ON"
214
217
  if orthographic:
215
218
  self.ensight.view.perspective(perspective)
@@ -218,18 +221,22 @@ class _Simba:
218
221
  vport.PERSPECTIVEANGLE = view_angle / 2
219
222
 
220
223
  if view_up and position and focal_point:
221
- q_current = self.normalize(np.array(vport.ROTATION.copy()))
222
- q_target = self.normalize(
223
- self.compute_model_rotation_quaternion(position, focal_point, view_up)
224
- )
225
- q_relative = self.quaternion_multiply(
226
- q_target, np.array([-q_current[0], -q_current[1], -q_current[2], q_current[3]])
227
- )
228
- angles = self.quaternion_to_euler(q_relative)
229
- self.ensight.view_transf.rotate(*angles)
224
+ if not pan:
225
+ q_current = self.normalize(np.array(vport.ROTATION.copy()))
226
+ q_target = self.normalize(
227
+ self.compute_model_rotation_quaternion(position, focal_point, view_up)
228
+ )
229
+ q_relative = self.quaternion_multiply(
230
+ q_target, np.array([-q_current[0], -q_current[1], -q_current[2], q_current[3]])
231
+ )
232
+ angles = self.quaternion_to_euler(q_relative)
233
+ self.ensight.view_transf.rotate(*angles)
234
+ else:
235
+ self.ensight.view_transf.translate(*pan)
230
236
  self.render()
231
237
 
232
238
  def set_perspective(self, value):
239
+ self.ensight.view_transf.function("global")
233
240
  vport = self.ensight.objs.core.VPORTS[0]
234
241
  self.ensight.view.perspective(value)
235
242
  vport.PERSPECTIVE = value == "ON"
@@ -253,9 +260,35 @@ class _Simba:
253
260
  return {"model_point": model_point, "camera": self.get_camera()}
254
261
 
255
262
  def render(self):
263
+ """Force render update in EnSight."""
264
+ self.ensight.view_transf.zoom(1)
256
265
  self.ensight.render()
257
266
  self.ensight.refresh(1)
258
267
 
268
+ def drag_allowed(self, mousex, mousey, invert_y=False):
269
+ """Return True if the picked object is allowed dragging in the interactor."""
270
+ mousex = int(mousex)
271
+ mousey = int(mousey)
272
+ if isinstance(self.ensight, ModuleType):
273
+ part_id, tool_id = self.ensight.objs.core.VPORTS[0].simba_what_is_picked(
274
+ mousex, mousey, invert_y
275
+ )
276
+ else:
277
+ part_id, tool_id = self.ensight._session.cmd(
278
+ f"ensight.objs.core.VPORTS[0].simba_what_is_picked({mousex}, {mousey}, {invert_y})"
279
+ )
280
+ if tool_id > -1:
281
+ return True
282
+ part_types_allowed = [
283
+ self.ensight.objs.enums.PART_CLIP_PLANE,
284
+ self.ensight.objs.enums.PART_ISO_SURFACE,
285
+ self.ensight.objs.enums.PART_CONTOUR,
286
+ ]
287
+ if part_id > -1:
288
+ part_obj = self.ensight.objs.core.PARTS.find(part_id, "PARTNUMBER")[0]
289
+ return part_obj.PARTTYPE in part_types_allowed
290
+ return False
291
+
259
292
 
260
293
  class Views:
261
294
  """Controls the view in the current EnSight ``Session`` instance."""