pyvista.DataSet.points#

property DataSet.points: pyvista_ndarray[source]#

Return a reference to the points as a numpy object.

Returns:
pyvista_ndarray

Reference to the points as a numpy object.

Examples

Create a mesh and return the points of the mesh as a numpy array.

>>> import pyvista as pv
>>> cube = pv.Cube()
>>> points = cube.points
>>> points
pyvista_ndarray([[-0.5, -0.5, -0.5],
                 [-0.5, -0.5,  0.5],
                 [-0.5,  0.5,  0.5],
                 [-0.5,  0.5, -0.5],
                 [ 0.5, -0.5, -0.5],
                 [ 0.5,  0.5, -0.5],
                 [ 0.5,  0.5,  0.5],
                 [ 0.5, -0.5,  0.5]], dtype=float32)

Shift these points in the z direction and show that their position is reflected in the mesh points.

>>> points[:, 2] += 1
>>> cube.points
pyvista_ndarray([[-0.5, -0.5,  0.5],
                 [-0.5, -0.5,  1.5],
                 [-0.5,  0.5,  1.5],
                 [-0.5,  0.5,  0.5],
                 [ 0.5, -0.5,  0.5],
                 [ 0.5,  0.5,  0.5],
                 [ 0.5,  0.5,  1.5],
                 [ 0.5, -0.5,  1.5]], dtype=float32)

You can also update the points in-place:

>>> cube.points[...] = 2 * points
>>> cube.points
pyvista_ndarray([[-1., -1.,  1.],
                 [-1., -1.,  3.],
                 [-1.,  1.,  3.],
                 [-1.,  1.,  1.],
                 [ 1., -1.,  1.],
                 [ 1.,  1.,  1.],
                 [ 1.,  1.,  3.],
                 [ 1., -1.,  3.]], dtype=float32)