.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/bunny.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_bunny.py: Bunny ----- Repair the holes in the bunny mesh. .. GENERATED FROM PYTHON SOURCE LINES 7-14 .. code-block:: Python # sphinx_gallery_thumbnail_number = 2 import pyvista as pv from pyvista import examples from pymeshfix import MeshFix .. GENERATED FROM PYTHON SOURCE LINES 15-23 .. code-block:: Python bunny = examples.download_bunny() # Define a camera position that shows the holes in the mesh cpos = [(-0.2, -0.13, 0.12), (-0.015, 0.10, -0.0), (0.28, 0.26, 0.9)] # Show mesh bunny.plot(cpos=cpos, eye_dome_lighting=True, anti_aliasing=True, smooth_shading=True) .. image-sg:: /examples/images/sphx_glr_bunny_001.png :alt: bunny :srcset: /examples/images/sphx_glr_bunny_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 24-25 Create an instance of :class:`pymeshfix.MeshFix` from :class:`pyvista.PolyData`. .. GENERATED FROM PYTHON SOURCE LINES 25-28 .. code-block:: Python mfix = MeshFix(bunny, verbose=True) holes = mfix.extract_holes() .. GENERATED FROM PYTHON SOURCE LINES 29-30 Render the mesh and outline the holes .. GENERATED FROM PYTHON SOURCE LINES 30-38 .. code-block:: Python pl = pv.Plotter() pl.add_mesh(bunny, color=True, smooth_shading=True) pl.add_mesh(holes, color="r", line_width=12, render_lines_as_tubes=True, lighting=False) pl.camera_position = cpos pl.enable_eye_dome_lighting() # helps depth perception pl.enable_anti_aliasing("ssaa") pl.show() .. image-sg:: /examples/images/sphx_glr_bunny_002.png :alt: bunny :srcset: /examples/images/sphx_glr_bunny_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 39-40 Repair the mesh .. GENERATED FROM PYTHON SOURCE LINES 40-42 .. code-block:: Python mfix.repair() .. GENERATED FROM PYTHON SOURCE LINES 43-44 Show the repaired mesh .. GENERATED FROM PYTHON SOURCE LINES 44-45 .. code-block:: Python mfix.mesh.plot(cpos=cpos, eye_dome_lighting=True, anti_aliasing=True, smooth_shading=True) .. image-sg:: /examples/images/sphx_glr_bunny_003.png :alt: bunny :srcset: /examples/images/sphx_glr_bunny_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 4.378 seconds) .. _sphx_glr_download_examples_bunny.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: bunny.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: bunny.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: bunny.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_