ansys-pyensight-core 0.10.8__tar.gz → 0.10.10__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.
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/PKG-INFO +1 -1
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/pyproject.toml +1 -1
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/utils/views.py +141 -13
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/LICENSE +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/README.rst +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/__init__.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/common.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/deep_pixel_view.html +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/dockerlauncher.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/dvs.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/enscontext.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/enshell_grpc.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/ensight_grpc.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/ensobj.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/launch_ensight.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/launcher.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/libuserd.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/listobj.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/locallauncher.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/py.typed +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/renderable.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/session.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/sgeo_poll.html +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/utils/__init__.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/utils/adr.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/utils/dsg_server.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/utils/export.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/utils/omniverse.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/utils/omniverse_cli.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/utils/omniverse_dsg_server.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/utils/omniverse_glb_server.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/utils/parts.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/utils/query.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/utils/readers.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/utils/resources/Materials/000_sky.exr +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/utils/support.py +0 -0
- {ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/utils/variables.py +0 -0
{ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/utils/views.py
RENAMED
|
@@ -94,8 +94,7 @@ class _Simba:
|
|
|
94
94
|
self.views.set_view_direction(
|
|
95
95
|
1, 1, 1, perspective=self.ensight.objs.core.vports[0].PERSPECTIVE
|
|
96
96
|
)
|
|
97
|
-
self.auto_scale()
|
|
98
|
-
return self.get_camera()
|
|
97
|
+
return self.auto_scale()
|
|
99
98
|
|
|
100
99
|
def get_camera(self):
|
|
101
100
|
"""Get EnSight camera settings in VTK format."""
|
|
@@ -208,8 +207,49 @@ class _Simba:
|
|
|
208
207
|
parallel_scale = 1 / data[9]
|
|
209
208
|
return camera_position, focal_point, self.views._normalize_vector(view_up), parallel_scale
|
|
210
209
|
|
|
210
|
+
def get_camera_axes(self):
|
|
211
|
+
"""
|
|
212
|
+
Returns the camera's local axes: right, up, and forward vectors.
|
|
213
|
+
These are useful for applying transformations in view space.
|
|
214
|
+
|
|
215
|
+
Parameters:
|
|
216
|
+
camera (dict): A dictionary with keys 'position', 'focal_point', and 'view_up'.
|
|
217
|
+
|
|
218
|
+
Returns:
|
|
219
|
+
right (np.ndarray): Right vector (X axis in view space).
|
|
220
|
+
up (np.ndarray): Up vector (Y axis in view space).
|
|
221
|
+
forw ard (np.ndarray): Forward vector (Z axis in view space, pointing from position to focal point).
|
|
222
|
+
"""
|
|
223
|
+
camera = self.get_camera()
|
|
224
|
+
position = np.array(camera["position"])
|
|
225
|
+
focal_point = np.array(camera["focal_point"])
|
|
226
|
+
view_up = np.array(camera["view_up"])
|
|
227
|
+
|
|
228
|
+
# Forward vector: from camera position to focal point
|
|
229
|
+
forward = focal_point - position
|
|
230
|
+
forward /= np.linalg.norm(forward)
|
|
231
|
+
|
|
232
|
+
# Right vector: cross product of forward and view_up
|
|
233
|
+
right = np.cross(forward, view_up)
|
|
234
|
+
right /= np.linalg.norm(right)
|
|
235
|
+
|
|
236
|
+
# Recompute up vector to ensure orthogonality
|
|
237
|
+
up = np.cross(right, forward)
|
|
238
|
+
up /= np.linalg.norm(up)
|
|
239
|
+
|
|
240
|
+
return right, up, forward
|
|
241
|
+
|
|
211
242
|
def set_camera(
|
|
212
|
-
self,
|
|
243
|
+
self,
|
|
244
|
+
orthographic,
|
|
245
|
+
view_up=None,
|
|
246
|
+
position=None,
|
|
247
|
+
focal_point=None,
|
|
248
|
+
view_angle=None,
|
|
249
|
+
pan=None,
|
|
250
|
+
mousex=None,
|
|
251
|
+
mousey=None,
|
|
252
|
+
invert_y=False,
|
|
213
253
|
):
|
|
214
254
|
"""Set the EnSight camera settings from the VTK input."""
|
|
215
255
|
self.ensight.view_transf.function("global")
|
|
@@ -219,17 +259,29 @@ class _Simba:
|
|
|
219
259
|
vport = self.ensight.objs.core.VPORTS[0]
|
|
220
260
|
if view_angle:
|
|
221
261
|
vport.PERSPECTIVEANGLE = view_angle / 2
|
|
222
|
-
|
|
223
262
|
if view_up and position and focal_point:
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
self.
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
263
|
+
if not pan:
|
|
264
|
+
q_current = self.normalize(np.array(vport.ROTATION.copy()))
|
|
265
|
+
q_target = self.normalize(
|
|
266
|
+
self.compute_model_rotation_quaternion(position, focal_point, view_up)
|
|
267
|
+
)
|
|
268
|
+
q_relative = self.quaternion_multiply(
|
|
269
|
+
q_target, np.array([-q_current[0], -q_current[1], -q_current[2], q_current[3]])
|
|
270
|
+
)
|
|
271
|
+
angles = self.quaternion_to_euler(q_relative)
|
|
272
|
+
self.ensight.view_transf.rotate(*angles)
|
|
273
|
+
else:
|
|
274
|
+
if mousex and mousey:
|
|
275
|
+
self.screen_to_world(
|
|
276
|
+
mousex=mousex, mousey=mousey, invert_y=invert_y, set_center=True
|
|
277
|
+
)
|
|
278
|
+
current_camera = self.get_camera()
|
|
279
|
+
right, up, _ = self.get_camera_axes()
|
|
280
|
+
translation_vector = np.array(position) - np.array(current_camera["position"])
|
|
281
|
+
dx = np.dot(translation_vector, right)
|
|
282
|
+
dy = np.dot(translation_vector, up)
|
|
283
|
+
self.ensight.view_transf.translate(-dx, -dy, 0)
|
|
284
|
+
|
|
233
285
|
self.render()
|
|
234
286
|
|
|
235
287
|
def set_perspective(self, value):
|
|
@@ -257,9 +309,85 @@ class _Simba:
|
|
|
257
309
|
return {"model_point": model_point, "camera": self.get_camera()}
|
|
258
310
|
|
|
259
311
|
def render(self):
|
|
312
|
+
"""Force render update in EnSight."""
|
|
313
|
+
self.ensight.view_transf.zoom(1)
|
|
260
314
|
self.ensight.render()
|
|
261
315
|
self.ensight.refresh(1)
|
|
262
316
|
|
|
317
|
+
def _probe_setup(self, part_obj, get_probe_data=False):
|
|
318
|
+
self.ensight.query_interact.number_displayed(100)
|
|
319
|
+
self.ensight.query_interact.query("surface")
|
|
320
|
+
self.ensight.query_interact.display_id("OFF")
|
|
321
|
+
self.ensight.query_interact.label_always_on_top("ON")
|
|
322
|
+
self.ensight.query_interact.marker_size_normalized(2)
|
|
323
|
+
if get_probe_data:
|
|
324
|
+
variable_string = """Coordinates 'X' 'Y' 'Z'"""
|
|
325
|
+
variable_list = [variable_string]
|
|
326
|
+
variable_name = part_obj.COLORBYPALETTE
|
|
327
|
+
if variable_name:
|
|
328
|
+
if isinstance(variable_name, str):
|
|
329
|
+
variable_list.append(variable_name)
|
|
330
|
+
else:
|
|
331
|
+
if isinstance(variable_name, list):
|
|
332
|
+
if variable_name[0]:
|
|
333
|
+
variable_name = variable_name[0].DESCRIPTION
|
|
334
|
+
variable_list.append(variable_name)
|
|
335
|
+
else:
|
|
336
|
+
variable_name = None
|
|
337
|
+
if isinstance(self.ensight, ModuleType):
|
|
338
|
+
self.ensight.query_interact.select_varname_begin(*variable_list)
|
|
339
|
+
else:
|
|
340
|
+
command = "ensight.query_interact.select_varname_begin("
|
|
341
|
+
for var in variable_list:
|
|
342
|
+
command += var + ","
|
|
343
|
+
command = command[:-1] + ")"
|
|
344
|
+
self.ensight._session.cmd(command)
|
|
345
|
+
self.render()
|
|
346
|
+
|
|
347
|
+
def drag_allowed(self, mousex, mousey, invert_y=False, probe=False, get_probe_data=False):
|
|
348
|
+
"""Return True if the picked object is allowed dragging in the interactor."""
|
|
349
|
+
mousex = int(mousex)
|
|
350
|
+
mousey = int(mousey)
|
|
351
|
+
if isinstance(self.ensight, ModuleType):
|
|
352
|
+
part_id, tool_id = self.ensight.objs.core.VPORTS[0].simba_what_is_picked(
|
|
353
|
+
mousex, mousey, invert_y
|
|
354
|
+
)
|
|
355
|
+
else:
|
|
356
|
+
part_id, tool_id = self.ensight._session.cmd(
|
|
357
|
+
f"ensight.objs.core.VPORTS[0].simba_what_is_picked({mousex}, {mousey}, {invert_y})"
|
|
358
|
+
)
|
|
359
|
+
coords = [None, None, None]
|
|
360
|
+
if probe:
|
|
361
|
+
screen_to_world = self.screen_to_world(
|
|
362
|
+
mousex=mousex, mousey=mousey, invert_y=invert_y, set_center=False
|
|
363
|
+
)
|
|
364
|
+
coords = screen_to_world["model_point"]
|
|
365
|
+
if tool_id > -1:
|
|
366
|
+
return True, coords[0], coords[1], coords[2], False
|
|
367
|
+
part_types_allowed = [
|
|
368
|
+
self.ensight.objs.enums.PART_CLIP_PLANE,
|
|
369
|
+
self.ensight.objs.enums.PART_ISO_SURFACE,
|
|
370
|
+
self.ensight.objs.enums.PART_CONTOUR,
|
|
371
|
+
]
|
|
372
|
+
if part_id > -1:
|
|
373
|
+
part_obj = self.ensight.objs.core.PARTS.find(part_id, "PARTNUMBER")[0]
|
|
374
|
+
if probe:
|
|
375
|
+
width, height = tuple(self.ensight.objs.core.WINDOWSIZE)
|
|
376
|
+
if invert_y:
|
|
377
|
+
mousey = height - mousey
|
|
378
|
+
self.ensight.query_interact.number_displayed(100)
|
|
379
|
+
self.ensight.query_interact.query("surface")
|
|
380
|
+
self.ensight.query_interact.display_id("OFF")
|
|
381
|
+
self.ensight.query_interact.create(mousex / width, mousey / height)
|
|
382
|
+
self._probe_setup(part_obj, get_probe_data=get_probe_data)
|
|
383
|
+
return part_obj.PARTTYPE in part_types_allowed, coords[0], coords[1], coords[2], True
|
|
384
|
+
if (
|
|
385
|
+
get_probe_data and self.ensight.objs.core.PROBES[0].PROBE_DATA
|
|
386
|
+
): # In case we have picked a probe point
|
|
387
|
+
for part in self.ensight.objs.core.PARTS:
|
|
388
|
+
self._probe_setup(part, get_probe_data=get_probe_data)
|
|
389
|
+
return False, coords[0], coords[1], coords[2], False
|
|
390
|
+
|
|
263
391
|
|
|
264
392
|
class Views:
|
|
265
393
|
"""Controls the view in the current EnSight ``Session`` instance."""
|
|
File without changes
|
|
File without changes
|
{ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/__init__.py
RENAMED
|
File without changes
|
{ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/common.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/dvs.py
RENAMED
|
File without changes
|
{ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/enscontext.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/ensobj.py
RENAMED
|
File without changes
|
|
File without changes
|
{ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/launcher.py
RENAMED
|
File without changes
|
{ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/libuserd.py
RENAMED
|
File without changes
|
{ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/listobj.py
RENAMED
|
File without changes
|
|
File without changes
|
{ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/py.typed
RENAMED
|
File without changes
|
{ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/renderable.py
RENAMED
|
File without changes
|
{ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/session.py
RENAMED
|
File without changes
|
{ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/sgeo_poll.html
RENAMED
|
File without changes
|
|
File without changes
|
{ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/utils/adr.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/utils/parts.py
RENAMED
|
File without changes
|
{ansys_pyensight_core-0.10.8 → ansys_pyensight_core-0.10.10}/src/ansys/pyensight/core/utils/query.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|