pyvista_cad.CadMultiBlockAccessor.split_by_label#
- CadMultiBlockAccessor.split_by_label(label_array='cad.label')[source]#
Combine the assembly, then split by per-cell label value.
Combines every leaf into one mesh and partitions it by the distinct values of the
label_arraycell-data array, one block per unique value. Value-based partition, not a pattern match.- Parameters:
- label_arraystr, default: ‘cad.label’
Name of the per-cell array whose distinct values define the partition.
- Returns:
- pyvista.MultiBlock
One block per unique label value.
- Parameters:
label_array (str)
- Return type:
Examples
>>> import numpy as np >>> import pyvista as pv >>> import pyvista_cad >>> a, b = pv.Cube().triangulate(), pv.Sphere() >>> a.cell_data['cad.label'] = np.array(['a'] * a.n_cells) >>> b.cell_data['cad.label'] = np.array(['b'] * b.n_cells) >>> parts = pv.MultiBlock([a, b]).cad.split_by_label() >>> sorted(parts.keys()) ['a', 'b']