ansys-pyensight-core 0.9.11__py3-none-any.whl → 0.9.13__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.

Potentially problematic release.


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

@@ -234,7 +234,7 @@ class Launcher:
234
234
  for process in psutil.process_iter():
235
235
  try:
236
236
  process_cmdline = process.cmdline()
237
- except (psutil.AccessDenied, psutil.ZombieProcess, OSError):
237
+ except (psutil.AccessDenied, psutil.ZombieProcess, OSError, psutil.NoSuchProcess):
238
238
  continue
239
239
  if not process_cmdline:
240
240
  continue
@@ -1058,6 +1058,11 @@ class Session:
1058
1058
  except RuntimeError: # pragma: no cover
1059
1059
  # handle some intermediate EnSight builds.
1060
1060
  pass
1061
+ except IOError: # pragma: no cover
1062
+ # The session might already have been closed via another
1063
+ # session object. If grpc is inactive, there's no sense
1064
+ # in raising an exception since we are closing it anyway
1065
+ pass
1061
1066
  if self._launcher and self._halt_ensight_on_close:
1062
1067
  self._launcher.close(self)
1063
1068
  else:
@@ -12,6 +12,13 @@ from ansys.api.pyensight.v0 import dynamic_scene_graph_pb2
12
12
  from ansys.pyensight.core import ensight_grpc
13
13
  import numpy
14
14
 
15
+ try:
16
+ import dsgutils
17
+
18
+ dsgutils_loaded = True
19
+ except ModuleNotFoundError:
20
+ dsgutils_loaded = False
21
+
15
22
  if TYPE_CHECKING:
16
23
  from ansys.pyensight.core import Session
17
24
 
@@ -238,36 +245,51 @@ class Part(object):
238
245
  self.session.log("Warning: zero length normals!")
239
246
  else:
240
247
  new_normals = numpy.ndarray((num_prims * verts_per_prim * 3,), dtype="float32")
241
- j = 0
242
- for i0 in range(num_prims):
243
- for i1 in range(verts_per_prim):
244
- idx = conn[i0 * verts_per_prim + i1]
245
- # new connectivity (identity)
246
- new_conn[j] = j
247
- # copy the vertex
248
- new_verts[j * 3 + 0] = verts[idx * 3 + 0]
249
- new_verts[j * 3 + 1] = verts[idx * 3 + 1]
250
- new_verts[j * 3 + 2] = verts[idx * 3 + 2]
251
- if new_normals is not None:
252
- if self.normals_elem:
253
- # copy the normal associated with the face
254
- new_normals[j * 3 + 0] = normals[i0 * 3 + 0]
255
- new_normals[j * 3 + 1] = normals[i0 * 3 + 1]
256
- new_normals[j * 3 + 2] = normals[i0 * 3 + 2]
257
- else:
258
- # copy the same normal as the vertex
259
- new_normals[j * 3 + 0] = normals[idx * 3 + 0]
260
- new_normals[j * 3 + 1] = normals[idx * 3 + 1]
261
- new_normals[j * 3 + 2] = normals[idx * 3 + 2]
262
- if new_tcoords is not None:
263
- # remember, 1D texture coords at this point
264
- if self.tcoords_elem:
265
- # copy the texture coord associated with the face
266
- new_tcoords[j] = tcoords[i0]
267
- else:
268
- # copy the same texture coord as the vertex
269
- new_tcoords[j] = tcoords[idx]
270
- j += 1
248
+ if dsgutils_loaded:
249
+ dsgutils.build_nodal_surface_rep(
250
+ verts_per_prim,
251
+ self.normals_elem,
252
+ self.tcoords_elem,
253
+ conn,
254
+ verts,
255
+ normals,
256
+ tcoords,
257
+ new_conn,
258
+ new_verts,
259
+ new_normals,
260
+ new_tcoords,
261
+ )
262
+ else:
263
+ j = 0
264
+ for i0 in range(num_prims):
265
+ for i1 in range(verts_per_prim):
266
+ idx = conn[i0 * verts_per_prim + i1]
267
+ # new connectivity (identity)
268
+ new_conn[j] = j
269
+ # copy the vertex
270
+ new_verts[j * 3 + 0] = verts[idx * 3 + 0]
271
+ new_verts[j * 3 + 1] = verts[idx * 3 + 1]
272
+ new_verts[j * 3 + 2] = verts[idx * 3 + 2]
273
+ if new_normals is not None:
274
+ if self.normals_elem:
275
+ # copy the normal associated with the face
276
+ new_normals[j * 3 + 0] = normals[i0 * 3 + 0]
277
+ new_normals[j * 3 + 1] = normals[i0 * 3 + 1]
278
+ new_normals[j * 3 + 2] = normals[i0 * 3 + 2]
279
+ else:
280
+ # copy the same normal as the vertex
281
+ new_normals[j * 3 + 0] = normals[idx * 3 + 0]
282
+ new_normals[j * 3 + 1] = normals[idx * 3 + 1]
283
+ new_normals[j * 3 + 2] = normals[idx * 3 + 2]
284
+ if new_tcoords is not None:
285
+ # remember, 1D texture coords at this point
286
+ if self.tcoords_elem:
287
+ # copy the texture coord associated with the face
288
+ new_tcoords[j] = tcoords[i0]
289
+ else:
290
+ # copy the same texture coord as the vertex
291
+ new_tcoords[j] = tcoords[idx]
292
+ j += 1
271
293
  # new arrays.
272
294
  verts = new_verts
273
295
  conn = new_conn
@@ -349,24 +371,27 @@ class Part(object):
349
371
  var_minmax: List[float] = [v_min, v_max] # type: ignore
350
372
  # build a power of two x 1 texture
351
373
  num_texels = len(var_cmd.texture) // 4
352
- half_texel = 1 / (num_texels * 2.0)
353
- tmp = numpy.ndarray((num_verts * 2,), dtype="float32")
354
- tmp.fill(0.5) # fill in the T coordinate...
355
- tex_width = half_texel * 2 * (num_texels - 1) # center to center of num_texels
356
- # if the range is 0, adjust the min by -1. The result is that the texture
357
- # coords will get mapped to S=1.0 which is what EnSight does in this situation
358
- if (var_minmax[1] - var_minmax[0]) == 0.0:
359
- var_minmax[0] = var_minmax[0] - 1.0
360
- var_width = var_minmax[1] - var_minmax[0]
361
- for idx in range(num_verts):
362
- # normalized S coord value (clamp)
363
- s = (tcoords[idx] - var_minmax[0]) / var_width
364
- if s < 0.0:
365
- s = 0.0
366
- if s > 1.0:
367
- s = 1.0
368
- # map to the texture range and set the S value
369
- tmp[idx * 2] = s * tex_width + half_texel
374
+ if dsgutils_loaded:
375
+ tmp = dsgutils.build_st_coords(tcoords, v_min, v_max, num_texels)
376
+ else:
377
+ half_texel = 1 / (num_texels * 2.0)
378
+ tmp = numpy.ndarray((num_verts * 2,), dtype="float32")
379
+ tmp.fill(0.5) # fill in the T coordinate...
380
+ tex_width = half_texel * 2 * (num_texels - 1) # center to center of num_texels
381
+ # if the range is 0, adjust the min by -1. The result is that the texture
382
+ # coords will get mapped to S=1.0 which is what EnSight does in this situation
383
+ if (var_minmax[1] - var_minmax[0]) == 0.0:
384
+ var_minmax[0] = var_minmax[0] - 1.0
385
+ var_width = var_minmax[1] - var_minmax[0]
386
+ for idx in range(num_verts):
387
+ # normalized S coord value (clamp)
388
+ s = (tcoords[idx] - var_minmax[0]) / var_width
389
+ if s < 0.0:
390
+ s = 0.0
391
+ if s > 1.0:
392
+ s = 1.0
393
+ # map to the texture range and set the S value
394
+ tmp[idx * 2] = s * tex_width + half_texel
370
395
  return tmp, var_cmd
371
396
 
372
397
  def line_rep(self):
@@ -925,7 +950,7 @@ class DSGSession(object):
925
950
  except Exception:
926
951
  self._shutdown = True
927
952
  self.log("DSG connection broken, calling exit")
928
- os._exit(0)
953
+ sys.exit(0)
929
954
 
930
955
  def _get_next_message(self, wait: bool = True) -> Any:
931
956
  """Get the next queued up protobuffer message
@@ -844,7 +844,8 @@ class OmniverseUpdateHandler(UpdateHandler):
844
844
  if part.cmd.render == part.cmd.CONNECTIVITY:
845
845
  has_triangles = False
846
846
  command, verts, conn, normals, tcoords, var_cmd = part.nodal_surface_rep()
847
- verts = numpy.multiply(verts, self._omni._units_per_meter)
847
+ if verts is not None:
848
+ verts = numpy.multiply(verts, self._omni._units_per_meter)
848
849
  if command is not None:
849
850
  has_triangles = True
850
851
  # Generate the mesh block
@@ -865,7 +866,8 @@ class OmniverseUpdateHandler(UpdateHandler):
865
866
  mat_info=mat_info,
866
867
  )
867
868
  command, verts, tcoords, var_cmd = part.line_rep()
868
- verts = numpy.multiply(verts, self._omni._units_per_meter)
869
+ if verts is not None:
870
+ verts = numpy.multiply(verts, self._omni._units_per_meter)
869
871
  if command is not None:
870
872
  # If there are no triangle (ideally if these are not hidden line
871
873
  # edges), then use the base color for the part. If there are
@@ -921,8 +923,8 @@ class OmniverseUpdateHandler(UpdateHandler):
921
923
 
922
924
  elif part.cmd.render == part.cmd.NODES:
923
925
  command, verts, sizes, colors, var_cmd = part.point_rep()
924
- verts = numpy.multiply(verts, self._omni._units_per_meter)
925
-
926
+ if verts is not None:
927
+ verts = numpy.multiply(verts, self._omni._units_per_meter)
926
928
  if sizes is not None:
927
929
  sizes = numpy.multiply(sizes, self._omni._units_per_meter)
928
930
  if command is not None:
@@ -1,17 +1,16 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ansys-pyensight-core
3
- Version: 0.9.11
3
+ Version: 0.9.13
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>
7
- Requires-Python: >=3.9,<4
7
+ Requires-Python: >=3.10,<3.14
8
8
  Description-Content-Type: text/x-rst
9
9
  Classifier: Development Status :: 4 - Beta
10
10
  Classifier: Intended Audience :: Science/Research
11
11
  Classifier: Topic :: Scientific/Engineering :: Information Analysis
12
12
  Classifier: License :: OSI Approved :: MIT License
13
13
  Classifier: Operating System :: OS Independent
14
- Classifier: Programming Language :: Python :: 3.9
15
14
  Classifier: Programming Language :: Python :: 3.10
16
15
  Classifier: Programming Language :: Python :: 3.11
17
16
  Classifier: Programming Language :: Python :: 3.12
@@ -140,7 +139,7 @@ Installation
140
139
  ------------
141
140
  To use PyEnSight, you must have a locally installed and licensed copy of
142
141
  Ansys EnSight 2022 R2 or later. The ``ansys-pyensight-core`` package supports
143
- Python 3.9 through Python 3.12 on Windows and Linux.
142
+ Python 3.10 through Python 3.12 on Windows and Linux.
144
143
 
145
144
  Two modes of installation are available:
146
145
 
@@ -8,21 +8,21 @@ ansys/pyensight/core/enshell_grpc.py,sha256=-OxSdFI_p3DmQnqh1jT_a_aSh_w-EUD2IaWG
8
8
  ansys/pyensight/core/ensight_grpc.py,sha256=IitEgMzBJTyTgQff0sXPvGkVnC2E9qRKw-HXCF-mVvA,29713
9
9
  ansys/pyensight/core/ensobj.py,sha256=uDtM2KHcAwd4hu5pcUYWbSD729ApHGIvuqZhEq8PxTI,18558
10
10
  ansys/pyensight/core/launch_ensight.py,sha256=iZJM6GdpzGRDLzrv1V2QZ5veIOpNSB5xPpJUFY7rBuo,10254
11
- ansys/pyensight/core/launcher.py,sha256=OFwQKQ5kqQWM8Qqr3VgSLoVML6DexdmWLauei5mncYI,13121
11
+ ansys/pyensight/core/launcher.py,sha256=x6L1E6OGpqL2jrDdIGI0p4BxQZhHt93yl1Pwj_2lAiQ,13143
12
12
  ansys/pyensight/core/libuserd.py,sha256=YKXY1aaaTBT2uwcyhPEW-f93KLtCYQNMJXTlBsenWDI,75459
13
13
  ansys/pyensight/core/listobj.py,sha256=Trw87IxIMXtmUd1DzywRmMzORU704AG4scX4fqYmO6M,9340
14
14
  ansys/pyensight/core/locallauncher.py,sha256=ptvbVoGYrb9OHawMpi9RRj_KVxR60mMaZaIPW4CPERI,17122
15
15
  ansys/pyensight/core/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  ansys/pyensight/core/renderable.py,sha256=KidVTVCZ4hKYq54pP9KoJ8OCxeWBXNUJYyKSwMZ2Sls,36362
17
- ansys/pyensight/core/session.py,sha256=w9aYXVW5q8czsruUoxdPF8_d723M6aJJ5-1yABzw5ss,73807
17
+ ansys/pyensight/core/session.py,sha256=6UEMn6X_08JzaAhmpIi4TQfv8zdONDG1cH8UaO7MQR8,74114
18
18
  ansys/pyensight/core/sgeo_poll.html,sha256=1M4BIc5CZpYA3b40qzk22NcPCLhjFnWdoS2PrS6Rhn4,752
19
19
  ansys/pyensight/core/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  ansys/pyensight/core/utils/adr.py,sha256=XslZhlwcrSGzOlnhzprOv3ju_ppxxsWBjCnQL5KiNms,3570
21
- ansys/pyensight/core/utils/dsg_server.py,sha256=olSRP_M3PWVPxnJbSGAcDk5zu9KrcmYekjJ2y6gEXnE,45489
21
+ ansys/pyensight/core/utils/dsg_server.py,sha256=C1rNlL5M36Ee5kMroQrqAykGICpjJsx_qhJspQ0x4LE,46381
22
22
  ansys/pyensight/core/utils/export.py,sha256=UAJQcrElo3esQD0CWdxxjMQ8yE1vB4cdAhF33_uZfQw,22605
23
23
  ansys/pyensight/core/utils/omniverse.py,sha256=irghU1wcIvo_lHhZV2VxYKCSQkNWCF8njJjWfExiFgI,18455
24
24
  ansys/pyensight/core/utils/omniverse_cli.py,sha256=aVYu4HsSZBl7A9_xU3DfItNB-hpxCdMPXm_oMAOU_HQ,20261
25
- ansys/pyensight/core/utils/omniverse_dsg_server.py,sha256=Ht6pLhxiLqa8zAleCdu3xAz3udns3y_1Iaauoy8NNyk,39882
25
+ ansys/pyensight/core/utils/omniverse_dsg_server.py,sha256=JCklPQC4xqwnvB7zVdLW80RpB9DlKN3hgs_Sj4sPhFY,39995
26
26
  ansys/pyensight/core/utils/omniverse_glb_server.py,sha256=aWAsGTxSl0w6VYRXCx8FaKGlLtfii2OUm_wBmP2Ay0I,30100
27
27
  ansys/pyensight/core/utils/parts.py,sha256=222XFRCjLgH7hho-cK9JrGCg3-KlTf54KIgc7y50sTE,52173
28
28
  ansys/pyensight/core/utils/query.py,sha256=OXKDbf1sOTX0sUvtKcp64LhVl-BcrEsE43w8uMxLOYI,19828
@@ -31,7 +31,7 @@ ansys/pyensight/core/utils/support.py,sha256=QI3z9ex7zJxjFbkCPba9DWqWgPFIThORqr0
31
31
  ansys/pyensight/core/utils/variables.py,sha256=ZUiJdDIeRcowrnLXaJQqGwA0RbrfXhc1s4o4v9A4PiY,95133
32
32
  ansys/pyensight/core/utils/views.py,sha256=ZKhJ6vMT7Rdd4bwJ0egMYTV7-D7Q7I19fF2_j_CMQ0o,12489
33
33
  ansys/pyensight/core/utils/resources/Materials/000_sky.exr,sha256=xAR1gFd2uxPZDnvgfegdhEhRaqKtZldQDiR_-1rHKO0,8819933
34
- ansys_pyensight_core-0.9.11.dist-info/licenses/LICENSE,sha256=K6LiJHOa9IbWFelXmXNRzFr3zG45SOGZIN7vdLdURGU,1097
35
- ansys_pyensight_core-0.9.11.dist-info/WHEEL,sha256=_2ozNFCLWc93bK4WKHCO-eDUENDlo-dgc9cU3qokYO4,82
36
- ansys_pyensight_core-0.9.11.dist-info/METADATA,sha256=OQWRp2Ssxi-jwxNmfKY9Ag86CCNhjxMLeG5jjPFSnjA,12166
37
- ansys_pyensight_core-0.9.11.dist-info/RECORD,,
34
+ ansys_pyensight_core-0.9.13.dist-info/licenses/LICENSE,sha256=K6LiJHOa9IbWFelXmXNRzFr3zG45SOGZIN7vdLdURGU,1097
35
+ ansys_pyensight_core-0.9.13.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
36
+ ansys_pyensight_core-0.9.13.dist-info/METADATA,sha256=D3oXbr-Xj7-093QZxVTSNCjLhMnbmpgbi1CtBaK6fRM,12121
37
+ ansys_pyensight_core-0.9.13.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: flit 3.11.0
2
+ Generator: flit 3.12.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any