pyvista.RectilinearGrid

class RectilinearGrid(*args, **kwargs)

Dataset with variable spacing in the three coordinate directions.

Can be initialized in several ways:

  • Create empty grid

  • Initialize from a vtk.vtkRectilinearGrid object

  • Initialize directly from the point arrays

See _from_arrays in the documentation for more details on initializing from point arrays

Examples

>>> import pyvista
>>> import vtk
>>> import numpy as np

Create an empty grid

>>> grid = pyvista.RectilinearGrid()

Initialize from a vtk.vtkRectilinearGrid object

>>> vtkgrid = vtk.vtkRectilinearGrid()
>>> grid = pyvista.RectilinearGrid(vtkgrid)

Create from NumPy arrays

>>> xrng = np.arange(-10, 10, 2)
>>> yrng = np.arange(-10, 10, 5)
>>> zrng = np.arange(-10, 10, 1)
>>> grid = pyvista.RectilinearGrid(xrng, yrng, zrng)

Methods

RectilinearGrid.add_field_array(scalars, name)

Add field data.

RectilinearGrid.add_field_data(array, name)

Add field data.

RectilinearGrid.cast_to_structured_grid()

Cast this rectilinear grid to a structured grid.

RectilinearGrid.cast_to_unstructured_grid()

Get a new representation of this object as a pyvista.UnstructuredGrid.

RectilinearGrid.cell_bounds(ind)

Return the bounding box of a cell.

RectilinearGrid.cell_centers([vertex, ...])

Generate points at the center of the cells in this dataset.

RectilinearGrid.cell_data_to_point_data([...])

Transform cell data into point data.

RectilinearGrid.cell_n_points(ind)

Return the number of points in a cell.

RectilinearGrid.cell_points(ind)

Return the points in a cell.

RectilinearGrid.cell_type(ind)

Return the type of a cell.

RectilinearGrid.clear_arrays()

Remove all arrays from point/cell/field data.

RectilinearGrid.clear_cell_arrays()

Remove all cell data.

RectilinearGrid.clear_cell_data()

Remove all cell arrays.

RectilinearGrid.clear_data()

Remove all arrays from point/cell/field data.

RectilinearGrid.clear_field_arrays()

Remove all field data.

RectilinearGrid.clear_field_data()

Remove all field data.

RectilinearGrid.clear_point_arrays()

Remove all point data.

RectilinearGrid.clear_point_data()

Remove all point arrays.

RectilinearGrid.clear_textures()

Clear the textures from this mesh.

RectilinearGrid.clip([normal, origin, ...])

Clip a dataset by a plane by specifying the origin and normal.

RectilinearGrid.clip_box([bounds, invert, ...])

Clip a dataset by a bounding box defined by the bounds.

RectilinearGrid.clip_scalar([scalars, ...])

Clip a dataset by a scalar.

RectilinearGrid.clip_surface(surface[, ...])

Clip any mesh type using a pyvista.PolyData surface mesh.

RectilinearGrid.compute_cell_quality([...])

Compute a function of (geometric) quality for each cell of a mesh.

RectilinearGrid.compute_cell_sizes([length, ...])

Compute sizes for 1D (length), 2D (area) and 3D (volume) cells.

RectilinearGrid.compute_derivative([...])

Compute derivative-based quantities of point/cell scalar field.

RectilinearGrid.compute_implicit_distance(surface)

Compute the implicit distance from the points to a surface.

RectilinearGrid.connectivity([largest, ...])

Find and label connected bodies/volumes.

RectilinearGrid.contour([isosurfaces, ...])

Contour an input self by an array.

RectilinearGrid.copy([deep])

Return a copy of the object.

RectilinearGrid.copy_attributes(dataset)

Copy the data attributes of the input dataset object.

RectilinearGrid.copy_meta_from(ido)

Copy pyvista meta data onto this object from another object.

RectilinearGrid.copy_structure(dataset)

Copy the structure (geometry and topology) of the input dataset object.

RectilinearGrid.ctp([pass_cell_data, ...])

Transform cell data into point data.

RectilinearGrid.decimate_boundary([...])

Return a decimated version of a triangulation of the boundary.

RectilinearGrid.deep_copy(to_copy)

Overwrite this data object with another data object as a deep copy.

RectilinearGrid.delaunay_3d([alpha, tol, ...])

Construct a 3D Delaunay triangulation of the mesh.

RectilinearGrid.elevation([low_point, ...])

Generate scalar values on a dataset.

RectilinearGrid.extract_all_edges([progress_bar])

Extract all the internal/external edges of the dataset as PolyData.

RectilinearGrid.extract_cells(ind[, ...])

Return a subset of the grid.

RectilinearGrid.extract_feature_edges([...])

Extract edges from the surface of the mesh.

RectilinearGrid.extract_geometry([progress_bar])

Extract the outer surface of a volume or structured grid dataset.

RectilinearGrid.extract_largest([inplace, ...])

Extract largest connected set in mesh.

RectilinearGrid.extract_points(ind[, ...])

Return a subset of the grid (with cells) that contains any of the given point indices.

RectilinearGrid.extract_surface([...])

Extract surface mesh of the grid.

RectilinearGrid.find_closest_cell(point)

Find index of closest cell in this mesh to the given point.

RectilinearGrid.find_closest_point(point[, n])

Find index of closest point in this mesh to the given point.

RectilinearGrid.flip_normal(normal[, point, ...])

Flip mesh about the normal.

RectilinearGrid.flip_x([point, ...])

Flip mesh about the x-axis.

RectilinearGrid.flip_y([point, ...])

Flip mesh about the y-axis.

RectilinearGrid.flip_z([point, ...])

Flip mesh about the z-axis.

RectilinearGrid.get_array(name[, preference])

Search both point, cell and field data for an array.

RectilinearGrid.get_array_association(name)

Get the association of an array.

RectilinearGrid.get_data_range([arr_var, ...])

Get the non-NaN min and max of a named array.

RectilinearGrid.glyph([orient, scale, ...])

Copy a geometric representation (called a glyph) to the input dataset.

RectilinearGrid.head([display, html])

Return the header stats of this dataset.

RectilinearGrid.interpolate(target[, ...])

Interpolate values onto this mesh from a given dataset.

RectilinearGrid.merge([grid, merge_points, ...])

Join one or many other grids to this grid.

RectilinearGrid.outline([generate_faces, ...])

Produce an outline of the full extent for the input dataset.

RectilinearGrid.outline_corners([factor, ...])

Produce an outline of the corners for the input dataset.

RectilinearGrid.overwrite(mesh)

Overwrite this dataset inplace with the new dataset's geometries and data.

RectilinearGrid.plot([off_screen, ...])

Plot a vtk or numpy object.

RectilinearGrid.plot_over_circular_arc(...)

Sample a dataset along a circular arc and plot it.

RectilinearGrid.plot_over_circular_arc_normal(center)

Sample a dataset along a resolution circular arc defined by a normal and polar vector and plot it.

RectilinearGrid.plot_over_line(pointa, pointb)

Sample a dataset along a high resolution line and plot.

RectilinearGrid.point_data_to_cell_data([...])

Transform point data into cell data.

RectilinearGrid.points_to_double()

Convert the points datatype to double precision.

RectilinearGrid.probe(points[, tolerance, ...])

Sample data values at specified point locations.

RectilinearGrid.ptc([pass_point_data, ...])

Transform point data into cell data.

RectilinearGrid.reconstruct_surface([...])

Reconstruct a surface from the points in this dataset.

RectilinearGrid.reflect(normal[, point, ...])

Reflect a dataset across a plane.

RectilinearGrid.rename_array(old_name, new_name)

Change array name by searching for the array then renaming it.

RectilinearGrid.rotate_vector(vector, angle)

Rotate mesh about a vector.

RectilinearGrid.rotate_x(angle[, point, ...])

Rotate mesh about the x-axis.

RectilinearGrid.rotate_y(angle[, point, ...])

Rotate mesh about the y-axis.

RectilinearGrid.rotate_z(angle[, point, ...])

Rotate mesh about the z-axis.

RectilinearGrid.sample(target[, tolerance, ...])

Resample array data from a passed mesh onto this mesh.

RectilinearGrid.sample_over_circular_arc(...)

Sample a dataset over a circular arc.

RectilinearGrid.sample_over_circular_arc_normal(center)

Sample a dataset over a circular arc defined by a normal and polar vector and plot it.

RectilinearGrid.sample_over_line(pointa, pointb)

Sample a dataset onto a line.

RectilinearGrid.save(filename[, binary, texture])

Save this vtk object to file.

RectilinearGrid.scale(xyz)

Scale the mesh.

RectilinearGrid.select_enclosed_points(surface)

Mark points as to whether they are inside a closed surface.

RectilinearGrid.set_active_scalars(name[, ...])

Find the scalars by name and appropriately sets it as active.

RectilinearGrid.set_active_tensors(name[, ...])

Find the tensors by name and appropriately sets it as active.

RectilinearGrid.set_active_vectors(name[, ...])

Find the vectors by name and appropriately sets it as active.

RectilinearGrid.shallow_copy(to_copy)

Shallow copy the given mesh to this mesh.

RectilinearGrid.shrink([shrink_factor, ...])

Shrink the individual faces of a mesh.

RectilinearGrid.slice([normal, origin, ...])

Slice a dataset by a plane at the specified origin and normal vector orientation.

RectilinearGrid.slice_along_axis([n, axis, ...])

Create many slices of the input dataset along a specified axis.

RectilinearGrid.slice_along_line(line[, ...])

Slice a dataset using a polyline/spline as the path.

RectilinearGrid.slice_orthogonal([x, y, z, ...])

Create three orthogonal slices through the dataset on the three cartesian planes.

RectilinearGrid.split_bodies([label, ...])

Find, label, and split connected bodies/volumes.

RectilinearGrid.streamlines([vectors, ...])

Integrate a vector field to generate streamlines.

RectilinearGrid.streamlines_evenly_spaced_2D([...])

Generate evenly spaced streamlines on a 2D dataset.

RectilinearGrid.streamlines_from_source(source)

Generate streamlines of vectors from the points of a source mesh.

RectilinearGrid.surface_indices([progress_bar])

Return the surface indices of a grid.

RectilinearGrid.texture_map_to_plane([...])

Texture map this dataset to a user defined plane.

RectilinearGrid.texture_map_to_sphere([...])

Texture map this dataset to a user defined sphere.

RectilinearGrid.threshold([value, scalars, ...])

Apply a vtkThreshold filter to the input dataset.

RectilinearGrid.threshold_percent([percent, ...])

Threshold the dataset by a percentage of its range on the active scalars array.

RectilinearGrid.transform(trans[, ...])

Transform this mesh with a 4x4 transform.

RectilinearGrid.translate(xyz)

Translate the mesh.

RectilinearGrid.triangulate([inplace, ...])

Return an all triangle mesh.

RectilinearGrid.warp_by_scalar([scalars, ...])

Warp the dataset's points by a point data scalars array's values.

RectilinearGrid.warp_by_vector([vectors, ...])

Warp the dataset's points by a point data vectors array's values.

Attributes

RectilinearGrid.active_normals

Return the active normals as an array.

RectilinearGrid.active_scalars

Return the active scalars as an array.

RectilinearGrid.active_scalars_info

Return the active scalar's association and name.

RectilinearGrid.active_scalars_name

Return the name of the active scalars.

RectilinearGrid.active_t_coords

Return or set the active texture coordinates on the points.

RectilinearGrid.active_tensors

Return the active tensors array.

RectilinearGrid.active_tensors_info

Return the active tensor's field and name: [field, name].

RectilinearGrid.active_tensors_name

Return the name of the active tensor array.

RectilinearGrid.active_vectors

Return the active vectors array.

RectilinearGrid.active_vectors_info

Return the active vector's association and name.

RectilinearGrid.active_vectors_name

Return the name of the active vectors array.

RectilinearGrid.actual_memory_size

Return the actual size of the dataset object.

RectilinearGrid.array_names

Return a list of array names for the dataset.

RectilinearGrid.arrows

Return a glyph representation of the active vector data as arrows.

RectilinearGrid.bounds

Return the bounding box of this dataset.

RectilinearGrid.cell_arrays

Return vtkCellData as DataSetAttributes.

RectilinearGrid.cell_data

Return vtkCellData as DataSetAttributes.

RectilinearGrid.center

Return the center of the bounding box.

RectilinearGrid.dimensions

Return a length 3 tuple of the grid's dimensions.

RectilinearGrid.extent

Return the range of the bounding box.

RectilinearGrid.field_arrays

Return vtkFieldData as DataSetAttributes.

RectilinearGrid.field_data

Return FieldData as DataSetAttributes.

RectilinearGrid.length

Return the length of the diagonal of the bounding box.

RectilinearGrid.memory_address

Get address of the underlying VTK C++ object.

RectilinearGrid.meshgrid

Return a meshgrid of numpy arrays for this mesh.

RectilinearGrid.n_arrays

Return the number of arrays present in the dataset.

RectilinearGrid.n_cells

Return the number of cells in the entire dataset.

RectilinearGrid.n_points

Return the number of points in the entire dataset.

RectilinearGrid.number_of_cells

Return the number of cells.

RectilinearGrid.number_of_points

Return the number of points.

RectilinearGrid.point_arrays

Return vtkPointData as DataSetAttributes.

RectilinearGrid.point_data

Return vtkPointData as DataSetAttributes.

RectilinearGrid.points

Return a copy of the points as an n by 3 numpy array.

RectilinearGrid.t_coords

Return the active texture coordinates on the points.

RectilinearGrid.textures

Return a dictionary to hold compatible vtk.vtkTexture objects.

RectilinearGrid.vectors

Return active vectors.

RectilinearGrid.volume

Return the mesh volume.

RectilinearGrid.x

Get the coordinates along the X-direction.

RectilinearGrid.y

Get the coordinates along the Y-direction.

RectilinearGrid.z

Get the coordinates along the Z-direction.