pyvista.PolyDataFilters.merge#
- PolyDataFilters.merge(
- dataset,
- merge_points: bool = True,
- tolerance=0.0,
- inplace: bool = False,
- main_has_priority: bool = True,
- progress_bar: bool = False,
Merge this mesh with one or more 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.Note
The
+
operator between two meshes uses this filter with the default parameters. When the other mesh is also apyvista.PolyData
, in-place merging via+=
is similarly possible.Changed in version 0.39.0: Before version
0.39.0
, if all input datasets were of typepyvista.PolyData
, the VTKvtkAppendPolyDataFilter
andvtkCleanPolyData
filters were used to perform merging. Otherwise,DataSetFilters.merge()
, which uses the VTKvtkAppendFilter
filter, was called. To enhance performance and coherence with merging operations available for other datasets in pyvista, the merging operation has been delegated in0.39.0
toDataSetFilters.merge()
only, irrespectively of input datasets types. This induced that points ordering can be altered compared to previous pyvista versions when merging only PolyData together. To obtain similar results as before0.39.0
for multiple PolyData, combinePolyDataFilters.append_polydata()
andPolyDataFilters.clean()
.See also
- Parameters:
- dataset
pyvista.DataSet
PyVista dataset to merge this mesh with.
- merge_pointsbool,
optional
Merge equivalent points when
True
.- tolerance
float
, default: 0.0 The absolute tolerance to use to find coincident points when
merge_points=True
.- inplacebool, default:
False
Updates grid inplace when
True
if the input type is apyvista.PolyData
. For other input meshes the result is apyvista.UnstructuredGrid
which makes in-place operation impossible.- main_has_prioritybool,
optional
When this parameter is
True
andmerge_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.
- dataset
- Returns:
pyvista.DataSet
pyvista.PolyData
ifdataset
is apyvista.PolyData
, otherwise apyvista.UnstructuredGrid
.
Examples
>>> import pyvista as pv >>> sphere_a = pv.Sphere() >>> sphere_b = pv.Sphere(center=(0.5, 0, 0)) >>> merged = sphere_a.merge(sphere_b) >>> merged.plot(style='wireframe', color='lightblue')