[PyVista] – Mesh data structure

发布于 2022-08-22  603 次阅读


Please refresh the page if equations are not rendered correctly.
---------------------------------------------------------------

Cells and nodes

import pyvista as pv
from polykriging import utility

mesh_file = utility.choose_file("Choose the labelled mesh file (.vtu)")
mesh = pv.read(mesh_file)

#surface_mesh_file = utility.choose_file("Choose the surface mesh file (.stl)")
#surface_mesh = pv.read(surface_mesh_file)

# Get the point coordinates of a cell in UnstructuredGrid
cell_pts = mesh.cell_points(0)
# the point id of a cell in UnstructuredGrid
cell_pts_id = mesh.cell_point_ids(0)

dx = np.max(cell_pts[:,0]) - np.min(cell_pts[:,0])
dy = np.max(cell_pts[:,1]) - np.min(cell_pts[:,1])
dz = np.max(cell_pts[:,2]) - np.min(cell_pts[:,2])

VTK: read grid cells' lenth, width and height in Paraview

python - VTK : how to read grid cells' lenth, width and height? - Stack Overflow

Everything not saved will be lost.
最后更新于 2022-08-22