The utils.py module#

Summary#

bgr_to_rgb_tuple

Convert bgr integer to rgb tuple.

get_line_nodes_and_coords

Extract the nodes and coordinates from the LineTessellationNode.

get_tri_nodes_and_coords

Extract the nodes and coordinates from the TriTessellationNode.

get_tri_result_disp_and_results

Extract the defomation and results from the TriTessellationResultNode.

get_scene

Get the scene of the model.

get_scene_for_object

Get the scene for the given object.

Description#

Common plotting utilities.

Module detail#

utils.bgr_to_rgb_tuple(bgr_int: int) Tuple[int, int, int]#

Convert bgr integer to rgb tuple.

utils.get_line_nodes_and_coords(line_tessellation: Ansys.Mechanical.Scenegraph.LineTessellationNode)#

Extract the nodes and coordinates from the LineTessellationNode.

The TriTessellationNode contains “Coordinates” and “Indices” that are flat arrays. This function converts them to numpy arrays

utils.get_tri_nodes_and_coords(tri_tessellation: Ansys.Mechanical.Scenegraph.TriTessellationNode)#

Extract the nodes and coordinates from the TriTessellationNode.

The TriTessellationNode contains “Coordinates” and “Indices” that are flat arrays. This function converts them to numpy arrays of the appropriate shape.

utils.get_tri_result_disp_and_results(tri_tessellation: Ansys.Mechanical.Scenegraph.TriTessellationResultNode)#

Extract the defomation and results from the TriTessellationResultNode.

The TriTessellationResultNode contains “Displacements” and “Results” that are flat arrays. This function converts them to numpy arrays of the appropriate shape.

utils.get_scene(app: ansys.mechanical.core.embedding.App) Ansys.Mechanical.Scenegraph.GroupNode#

Get the scene of the model.

utils.get_scene_for_object(app: ansys.mechanical.core.embedding.App, obj) Ansys.Mechanical.Scenegraph.Node#

Get the scene for the given object.

2025R2 and before: only geometry is supported later, Mesh and some Results will be supported.