merge

UniformGrid.merge(grid=None, merge_points=True, inplace=False, main_has_priority=True, progress_bar=False)

Join one or many other grids to this grid.

Grid is updated in-place by default.

Can be used to merge points of adjacent cells when no grids are input.

Note

The + operator between two meshes uses this filter with the default parameters.

Parameters
gridvtk.UnstructuredGrid or list of vtk.UnstructuredGrids

Grids to merge to this grid.

merge_pointsbool, optional

Points in exactly the same location will be merged between the two meshes. Warning: this can leave degenerate point data.

inplacebool, optional

Updates grid inplace when True if the input type is an pyvista.UnstructuredGrid.

main_has_prioritybool, optional

When this parameter is true and merge_points is true, the arrays of the merging grids will be overwritten by the original main mesh.

progress_barbool, optional

Display a progress bar to indicate progress.

Returns
pyvista.UnstructuredGrid

Merged grid.

Notes

When two or more grids are joined, the type and name of each array must match or the arrays will be ignored and not included in the final merged mesh.

Examples

Merge three separate spheres into a single mesh.

>>> import pyvista
>>> sphere_a = pyvista.Sphere(center=(1, 0, 0))
>>> sphere_b = pyvista.Sphere(center=(0, 1, 0))
>>> sphere_c = pyvista.Sphere(center=(0, 0, 1))
>>> merged = sphere_a.merge([sphere_b, sphere_c])
>>> merged.plot()
../../../_images/pyvista-UniformGrid-merge-1_00_00.png