pyvista.merge#
- merge(
- datasets,
- merge_points: bool = True,
- main_has_priority: bool | None = None,
- progress_bar: bool = False,
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.Warning
The merge order of this filter depends on the installed version of VTK. For example, if merging meshes
a,b, andc, the merged order isbcafor VTK<9.5 andabcfor VTK>=9.5. This may be a breaking change for some applications. If only merging two meshes, it may be possible to maintain some backwards compatibility by swapping the input order of the two meshes, though this may also affect the merged arrays and is therefore not fully backwards-compatible.- 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
Trueandmerge_points=True, the arrays of the merging grids will be overwritten by the original main mesh.Deprecated since version 0.46: This keyword will be removed in a future version. The main mesh always has priority with VTK 9.5.0 or later.
- progress_barbool, default:
False Display a progress bar to indicate progress.
- datasetssequence[
- Returns:
pyvista.DataSetpyvista.PolyDataif all items in datasets arepyvista.PolyData, otherwise returns apyvista.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()