Repository: pyvista/pyvista

Issue:
``Multiblock``.plot does not work when using ``PointSet``
### Describe the bug, what's wrong, and what you expected.

It seems ``MultiBlock`` entities made of ``PointSet`` plot nothing when using ``plot`` method.

### Steps to reproduce the bug.

```python
import pyvista as pv
import numpy as np

points_arr = np.array(
    [
        [0.0, 1.0, 0.0],
        [0.0, 0.0, 0.0],
        [1.0, 1.0, 0.0],
        [1.0, 0.0, 0.0],
        [0.0, 0.0, 1.0],
        [1.0, 0.0, 1.0],
        [1.0, 1.0, 1.0],
        [0.0, 1.0, 1.0],
    ]
)

points = pv.MultiBlock()
for each_kp in points_arr:
    points.append(pv.PointSet(each_kp))

points.plot()
```

### System Information

```shell
--------------------------------------------------------------------------------
  Date: Wed May 10 18:07:18 2023 CEST

                OS : Darwin
            CPU(s) : 8
           Machine : arm64
      Architecture : 64bit
               RAM : 16.0 GiB
       Environment : IPython
       File system : apfs
        GPU Vendor : Apple
      GPU Renderer : Apple M2
       GPU Version : 4.1 Metal - 83.1
  MathText Support : False

  Python 3.11.1 (main, Dec 23 2022, 09:28:24) [Clang 14.0.0
  (clang-1400.0.29.202)]

           pyvista : 0.39.0
               vtk : 9.2.6
             numpy : 1.24.3
        matplotlib : 3.7.1
            scooby : 0.7.1
             pooch : v1.7.0
           imageio : 2.28.0
           IPython : 8.12.1
        ipywidgets : 8.0.6
             scipy : 1.10.1
              tqdm : 4.65.0
        jupyterlab : 3.6.3
         pythreejs : 2.4.2
      nest_asyncio : 1.5.6
--------------------------------------------------------------------------------
```


### Screenshots

<img width="624" alt="image" src="https://github.com/pyvista/pyvista/assets/28149841/a1b0999f-2d35-4911-a216-eb6503955860">



Discussion:
I can reproduce this problem. We'll add it for the v0.39.1 milestone.
The trick is this bit of code:

https://github.com/pyvista/pyvista/blob/a8921b94b91a7d9809c9b5ac2ef9c981b5f71ea1/pyvista/plotting/plotting.py#L3218-L3224

which isn't used for `MultiBlock` plotting because `add_mesh` forwards to `add_composite()`

https://github.com/pyvista/pyvista/blob/a8921b94b91a7d9809c9b5ac2ef9c981b5f71ea1/pyvista/plotting/plotting.py#L3230

But then I realized this block should handle it

https://github.com/pyvista/pyvista/blob/a8921b94b91a7d9809c9b5ac2ef9c981b5f71ea1/pyvista/plotting/plotting.py#L2544


so maybe there's a bug in that method or the copy isn't propagating? Not sure...



Patch:
diff --git a/pyvista/core/composite.py b/pyvista/core/composite.py
--- a/pyvista/core/composite.py
+++ b/pyvista/core/composite.py
@@ -1110,6 +1110,8 @@ def as_polydata_blocks(self, copy=False):
             if block is not None:
                 if isinstance(block, MultiBlock):
                     dataset.replace(i, block.as_polydata_blocks(copy=copy))
+                elif isinstance(block, pyvista.PointSet):
+                    dataset.replace(i, block.cast_to_polydata(deep=True))
                 elif not isinstance(block, pyvista.PolyData):
                     dataset.replace(i, block.extract_surface())
                 elif copy:


Test patch:
diff --git a/tests/test_composite.py b/tests/test_composite.py
--- a/tests/test_composite.py
+++ b/tests/test_composite.py
@@ -753,9 +753,13 @@ def test_set_active_scalars_mixed(multiblock_poly):
 
 
 def test_to_polydata(multiblock_all):
+    if pyvista.vtk_version_info >= (9, 1, 0):
+        multiblock_all.append(pyvista.PointSet([0.0, 0.0, 1.0]))  # missing pointset
     assert not multiblock_all.is_all_polydata
 
     dataset_a = multiblock_all.as_polydata_blocks()
+    if pyvista.vtk_version_info >= (9, 1, 0):
+        assert dataset_a[-1].n_points == 1
     assert not multiblock_all.is_all_polydata
     assert dataset_a.is_all_polydata