@@ -3,25 +3,25 @@ PyVista
33
44https://docs.pyvista.org
55
6- PyVista is a great library that exposes a high level API for vtk, it has way more features
7- than ipygany. For this reason, ipygany supports PyVista objects:
6+ PyVista is a great library that exposes a high level API for ``vtk ``
7+ and it has way more features than ``ipygany ``. For this reason,
8+ ``ipygany `` supports PyVista objects:
89
910
1011.. jupyter-execute ::
1112
1213 import pyvista as pv
1314 from pyvista import examples
1415
15- pvmesh = examples.download_st_helens()
16- ugrid = pvmesh.cast_to_unstructured_grid()
17-
1816 from ipygany import PolyMesh, Scene, IsoColor, Warp
1917
20- # Turn the PyVista mesh into a PolyMesh
21- mesh = PolyMesh.from_vtk(ugrid)
18+ # Download a pyvista example and convert it to a PolyMesh
19+ pvmesh = examples.download_st_helens()
20+ mesh = PolyMesh.from_pyvista(pvmesh)
21+
22+ # Plot it
2223 warped_mesh = Warp(mesh, input=(0, 0, ('Elevation', 'X1')), warp_factor=1.)
2324 colored_mesh = IsoColor(warped_mesh, input='Elevation', min=682, max=2543)
24-
2525 Scene([colored_mesh])
2626
2727
@@ -30,13 +30,12 @@ than ipygany. For this reason, ipygany supports PyVista objects:
3030 import pyvista as pv
3131 from pyvista import examples
3232
33- nefertiti = examples.download_nefertiti()
34- ugrid = nefertiti.cast_to_unstructured_grid()
35-
3633 from ipygany import PolyMesh, Scene, IsoColor, Warp
3734
38- # Turn the PyVista mesh into a PolyMesh
39- mesh = PolyMesh.from_vtk(ugrid )
40- mesh.default_color = 'gray'
35+ # Download the pyvista nefertiti example and convert it to a PolyMesh
36+ nefertiti = examples.download_nefertiti( )
37+ mesh = PolyMesh.from_pyvista(nefertiti)
4138
39+ # Plot it
40+ mesh.default_color = 'gray'
4241 Scene([mesh])
0 commit comments