github pyvista/pyvista 0.4.0
Using Subclasses instead of adding Methods

latest releases: v0.43.10, v0.43.9, v0.43.8...
6 years ago

The implementation prior to this release was to instantiate a vtk object and then add methods to the existing objects to extend the functionality of the vtk objects. It worked, but it was messy and lead to the objects not being garbage collected as these methods were viewed by Python as references. There are now three unique subclasses for vtkInterface:

  • vtkInterface.PolyData
  • vtkInterface.UnstructuredGrid
  • vtkInterface.StructuredGrid

Additionally, there are now the private classes Common and Grid that include methods in common with two or all three of the aforementioned subclasses. This eliminates code duplication while preserving functionality.

Each of these objects has help and documentation outlined in readthedocs.

Don't miss a new pyvista release

NewReleases is sending notifications on new releases.