From c34dfacd49401237cbee7d652d2bcc7e63337e3c Mon Sep 17 00:00:00 2001 From: MatthewFlamm <39341281+MatthewFlamm@users.noreply.github.com> Date: Sat, 23 Mar 2024 03:24:49 -0400 Subject: [PATCH] Link api docs in examples for Mesh Creation (#5811) * link api docs in examples for load * Apply suggestions from code review * Update examples/00-load/create-polyhedron.py * Update examples/00-load/create-uniform-grid.py Co-authored-by: MatthewFlamm <39341281+MatthewFlamm@users.noreply.github.com> * Add KochanekSpline --------- Co-authored-by: Tetsuo Koyama --- doc/source/api/utilities/geometric.rst | 3 +++ doc/source/api/utilities/parametric.rst | 2 ++ examples/00-load/create-explicit-structured-grid.py | 3 ++- examples/00-load/create-geometric-objects.py | 3 ++- examples/00-load/create-kochanek-spline.py | 1 + examples/00-load/create-parametric-geometric-objects.py | 2 +- examples/00-load/create-polyhedron.py | 2 +- examples/00-load/create-structured-surface.py | 1 + examples/00-load/create-surface-draped.py | 2 +- examples/00-load/create-tri-surface.py | 1 + examples/00-load/create-truss.py | 2 ++ examples/00-load/create-uniform-grid.py | 1 + examples/00-load/create-unstructured-surface.py | 1 + examples/00-load/load-gltf.py | 2 +- examples/00-load/load-vrml.py | 1 + examples/00-load/read-dolfin.py | 1 + examples/00-load/read-parallel.py | 2 +- 17 files changed, 23 insertions(+), 7 deletions(-) diff --git a/doc/source/api/utilities/geometric.rst b/doc/source/api/utilities/geometric.rst index 96c1112107..1ffd7929dc 100644 --- a/doc/source/api/utilities/geometric.rst +++ b/doc/source/api/utilities/geometric.rst @@ -1,3 +1,5 @@ +.. _geometry_api: + Geometry -------- PyVista includes several functions to generate simple geometric @@ -48,6 +50,7 @@ Geometric Objects Dodecahedron Icosahedron Icosphere + KochanekSpline Line MultipleLines Octahedron diff --git a/doc/source/api/utilities/parametric.rst b/doc/source/api/utilities/parametric.rst index b5ecb15fce..fb9ca9e58c 100644 --- a/doc/source/api/utilities/parametric.rst +++ b/doc/source/api/utilities/parametric.rst @@ -1,3 +1,5 @@ +.. _parametric_api: + Parametric Objects ------------------ diff --git a/examples/00-load/create-explicit-structured-grid.py b/examples/00-load/create-explicit-structured-grid.py index b15c05299d..c18c6dbf09 100644 --- a/examples/00-load/create-explicit-structured-grid.py +++ b/examples/00-load/create-explicit-structured-grid.py @@ -4,7 +4,8 @@ Creating an Explicit Structured Grid ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Create an explicit structured grid from NumPy arrays. +Create an explicit structured grid from NumPy arrays using +:class:`pyvista.ExplicitStructuredGrid`. """ diff --git a/examples/00-load/create-geometric-objects.py b/examples/00-load/create-geometric-objects.py index d41cb51ab6..cd54a336d1 100644 --- a/examples/00-load/create-geometric-objects.py +++ b/examples/00-load/create-geometric-objects.py @@ -4,7 +4,8 @@ Geometric Objects ~~~~~~~~~~~~~~~~~ -The "Hello, world!" of VTK +The "Hello, world!" of VTK. +Uses objects from :ref:`geometry_api`. """ import pyvista as pv diff --git a/examples/00-load/create-kochanek-spline.py b/examples/00-load/create-kochanek-spline.py index 4650eda121..c7c0578daf 100644 --- a/examples/00-load/create-kochanek-spline.py +++ b/examples/00-load/create-kochanek-spline.py @@ -5,6 +5,7 @@ ~~~~~~~~~~~~~~~~~~~~~~~~ Create a Kochanek spline/polyline from a numpy array of XYZ vertices. +Uses :func:`pyvista.KochanekSpline`. """ # sphinx_gallery_start_ignore diff --git a/examples/00-load/create-parametric-geometric-objects.py b/examples/00-load/create-parametric-geometric-objects.py index 40e4322e79..1d23164ebd 100644 --- a/examples/00-load/create-parametric-geometric-objects.py +++ b/examples/00-load/create-parametric-geometric-objects.py @@ -4,7 +4,7 @@ Parametric Geometric Objects ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Creating parametric objects +Creating parametric objects from :ref:`parametric_api`. """ from math import pi diff --git a/examples/00-load/create-polyhedron.py b/examples/00-load/create-polyhedron.py index 2fd8c71c1c..3486781842 100644 --- a/examples/00-load/create-polyhedron.py +++ b/examples/00-load/create-polyhedron.py @@ -6,7 +6,7 @@ This example shows how to build a simple :class:`pyvista.UnstructuredGrid` using polyhedra. We will be using VTK types to determine which type of cells we -are building. +are building. A list of cell types is given in :class:`pyvista.CellType`. First, we import the required libraries. """ diff --git a/examples/00-load/create-structured-surface.py b/examples/00-load/create-structured-surface.py index 209b9d5469..b1e7f56fc3 100644 --- a/examples/00-load/create-structured-surface.py +++ b/examples/00-load/create-structured-surface.py @@ -5,6 +5,7 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Create a StructuredGrid surface from NumPy arrays +using :class:`pyvista.StructuredGrid`. """ import numpy as np diff --git a/examples/00-load/create-surface-draped.py b/examples/00-load/create-surface-draped.py index 260abf0138..7aad4da370 100644 --- a/examples/00-load/create-surface-draped.py +++ b/examples/00-load/create-surface-draped.py @@ -22,7 +22,7 @@ some example data for this: 1) XYZ coordinates of a GPR path and 2) a 2D array of data values produced from the GPR. -the data here are wacky (it's difficult to get shareable data of decent +The data here are wacky (it's difficult to get shareable data of decent quality), so ignore them but pay attention to the structure. The coordinates we have are technically shifted up and we have some NaN filler above the surface - its weird and just ignore it. You'll typically have a more uniform looking diff --git a/examples/00-load/create-tri-surface.py b/examples/00-load/create-tri-surface.py index 3a70ed277c..909f7c759d 100644 --- a/examples/00-load/create-tri-surface.py +++ b/examples/00-load/create-tri-surface.py @@ -5,6 +5,7 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Create a surface from a set of points through a Delaunay triangulation. +This example uses :func:`pyvista.PolyDataFilters.delaunay_2d`. """ import numpy as np diff --git a/examples/00-load/create-truss.py b/examples/00-load/create-truss.py index 02832c8a35..fb9ce427ee 100644 --- a/examples/00-load/create-truss.py +++ b/examples/00-load/create-truss.py @@ -5,6 +5,8 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Plot connections between points in 3D as cylinders, colored by scalars. +Lines are created in a :class:`pyvista.PolyData` and then rendered as +cylinders. """ diff --git a/examples/00-load/create-uniform-grid.py b/examples/00-load/create-uniform-grid.py index 2f1cb37d66..654d14de4e 100644 --- a/examples/00-load/create-uniform-grid.py +++ b/examples/00-load/create-uniform-grid.py @@ -3,6 +3,7 @@ ~~~~~~~~~~~~~~~~~~~~~~~ Create a simple uniform grid from a 3D NumPy array of values. +This example uses :class:`pyvista.ImageData`. """ diff --git a/examples/00-load/create-unstructured-surface.py b/examples/00-load/create-unstructured-surface.py index 825001b843..c8e2a42502 100644 --- a/examples/00-load/create-unstructured-surface.py +++ b/examples/00-load/create-unstructured-surface.py @@ -5,6 +5,7 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Create an irregular, unstructured grid from NumPy arrays. +This example uses :class:`pyvista.UnstructuredGrid`. """ import numpy as np diff --git a/examples/00-load/load-gltf.py b/examples/00-load/load-gltf.py index 94f09b1f69..038052dc6a 100644 --- a/examples/00-load/load-gltf.py +++ b/examples/00-load/load-gltf.py @@ -23,7 +23,7 @@ ############################################################################### # Set up the plotter and enable environment textures. This works well # for physically based rendering enabled meshes like the damaged -# helmet example. +# helmet example. Use :func:`pyvista.Plotter.import_gltf` to import file. # sphinx_gallery_start_ignore PYVISTA_GALLERY_FORCE_STATIC = True diff --git a/examples/00-load/load-vrml.py b/examples/00-load/load-vrml.py index 0da3b36ff3..78b336aed5 100644 --- a/examples/00-load/load-vrml.py +++ b/examples/00-load/load-vrml.py @@ -17,6 +17,7 @@ ############################################################################### # Set up the plotter and import VRML file. +# Use :func:`pyvista.Plotter.import_vrml` to import file. pl = pyvista.Plotter() pl.import_vrml(sextant_file) diff --git a/examples/00-load/read-dolfin.py b/examples/00-load/read-dolfin.py index 8b964be96c..784e3325be 100644 --- a/examples/00-load/read-dolfin.py +++ b/examples/00-load/read-dolfin.py @@ -4,6 +4,7 @@ PyVista leverages `meshio`_ to read many mesh formats not natively supported by VTK including the `FEniCS/Dolfin`_ XML format. +This example uses :func:`pyvista.read`. .. _meshio: https://github.com/nschloe/meshio .. _FEniCS/Dolfin: https://fenicsproject.org diff --git a/examples/00-load/read-parallel.py b/examples/00-load/read-parallel.py index 509c85b028..8065691d50 100644 --- a/examples/00-load/read-parallel.py +++ b/examples/00-load/read-parallel.py @@ -33,7 +33,7 @@ # Note that a ``.pvtu`` file is available alongside a directory. This # directory contains all the parallel files or pieces that make the whole mesh. # We can simply read the ``.pvtu`` file and VTK will handle putting the mesh -# together. +# together. In PyVista, this is accomplished through :func:`pyvista.read`. mesh = pv.read(filename) mesh