pyvista.merge#

merge(datasets, merge_points=True, main_has_priority=True, progress_bar=False)[source]#

Merge several datasets.

Note

The behavior of this filter varies from the PolyDataFilters.boolean_union() filter. This filter does not attempt to create a manifold mesh and will include internal surfaces when two meshes overlap.

Parameters:
datasetssequence[pyvista.Dataset]

Sequence of datasets. Can be of any pyvista.Dataset.

merge_pointsbool, default: True

Merge equivalent points when True.

main_has_prioritybool, default: True

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

progress_barbool, default: False

Display a progress bar to indicate progress.

Returns:
pyvista.DataSet

pyvista.PolyData if all items in datasets are pyvista.PolyData, otherwise returns a pyvista.UnstructuredGrid.

Examples

Merge two polydata datasets.

>>> import pyvista as pv
>>> sphere = pv.Sphere(center=(0, 0, 1))
>>> cube = pv.Cube()
>>> mesh = pv.merge([cube, sphere])
>>> mesh.plot()
../../../_images/pyvista-merge-1_00_00.png