Helpers#
The pyvista module contains several functions to simplify the
creation and manipulation of meshes or interfacing with VTK datasets.
See Utilities for the full API reference of all utility functions organized by category.
Mesh Creation#
|
Wrap any given VTK data object to its appropriate PyVista data object. |
|
Construct a |
|
Make a connected line set given an array of points. |
|
Generate non-connected line segments from points. |
|
Create a pyvista.PolyData object composed of vectors. |
|
Convert numpy array or array-like to a vtkPoints object. |
Mesh Operations#
|
Merge several datasets. |
|
Translate and orient a mesh to a new center and direction. |
|
Return a vtkPlane. |
|
Fit a plane to points using its |
|
Fit a line to points using its |
Array Utilities#
|
Convert a NumPy array to a vtkDataArray or vice versa. |
|
Sample an implicit function over a structured point set. |
|
Return the implicit function that implements Perlin noise. |
Global Configuration#
- class Config[source]#
PyVista core configuration.
Holds process-wide settings that affect
pyvista.corebehavior. The singleton instance is exposed aspyvista.global_config. This is the sibling ofpyvista.global_themefor plotting (rendering) settings.Examples
Disable the default array-length check performed by
pyvista.wrap():>>> import pyvista as pv >>> pv.global_config.validate_on_wrap = False >>> pv.global_config.validate_on_wrap = True # restore default
- property show_vtk_api: bool[source]#
Return or set whether VTK-inherited attributes appear in
dir().When
False(the default), attributes inherited from VTK base classes are hidden fromdir()and tab-completion on PyVista objects that wrap VTK types (data objects,Renderer,Actor,Property, etc.). This keeps the public surface curated for data-science IDEs such as Positron’s Variables pane and VS Code’s Jupyter extension, and for IPython / Jupyter tab-completion. VTK methods remain fully callable regardless of this setting.When
True, the full VTK API is enumerated alongside the PyVista API, which is useful for VTK developers who want to discover the raw VTK method surface via introspection.Warning
This option requires runtime inspection and does not work with all developer tools, e.g. it has no effect when using PyCharm. This is because it relies on calling the object’s
__dir__method for generating auto-completion suggestions. Tools like PyCharm that only use static analysis for auto-completion are therefore unaffected.Notes
The snake_case VTK aliases (
number_of_points,deep_copy, …) are controlled separately bypyvista.vtk_snake_case(). When snake_case is not'allow'(the default), those names are hidden fromdir()regardless of this setting, because accessing them would already raisePyVistaAttributeError. Enabling snake_case surfaces the snake_case names indir();show_vtk_apionly controls the CamelCase VTK API.Added in version 0.48.
Examples
>>> import pyvista as pv >>> pv.global_config.show_vtk_api False >>> pv.global_config.show_vtk_api = True >>> pv.global_config.show_vtk_api = False # restore default
- property validate_on_wrap: bool[source]#
Return or set whether
pyvista.wrap()validates data arrays.When
True(the default),pyvista.wrap()performs a cheap array-length sanity check on every VTK object it wraps and emits aInvalidMeshWarningif any point or cell data array has a tuple count that does not match the dataset’s point or cell count. Set toFalseto skip this check globally when the cost matters in tight loops and the caller trusts their inputs.Notes
Per-call control is also available via the
validatekeyword onpyvista.wrap(),pyvista.read(), andpyvista.BaseReader.read(). The per-call keyword takes precedence; this global setting is consulted only when the per-call keyword is left at its defaultNone.Added in version 0.48.
Examples
>>> import pyvista as pv >>> pv.global_config.validate_on_wrap True >>> pv.global_config.validate_on_wrap = False >>> pv.global_config.validate_on_wrap = True # restore default