pyvista_js.CellType#

class pyvista_js.CellType#

Bases: object

VTK cell type constants.

Provides named constants for the most common VTK cell types, matching the pyvista.CellType API.

These constants are used to define the type of cells in an UnstructuredGrid. Each cell type corresponds to a specific VTK cell type identifier.

Examples

Basic usage:

>>> import pyvista_js as pv
>>> pv.CellType.TETRA
10
>>> pv.CellType.HEXAHEDRON
12
>>> pv.CellType.TRIANGLE
5
>>> pv.CellType.QUAD
9

Use with UnstructuredGrid:

>>> import numpy as np
>>> points = np.array([[0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1]], dtype=float)
>>> cells = [4, 0, 1, 2, 3]
>>> celltypes = [pv.CellType.TETRA]  # Use the constant
>>> grid = pv.UnstructuredGrid(cells, celltypes, points)

Available cell types:

>>> # 0-D cells
>>> pv.CellType.VERTEX  # Single point
1
>>> # 1-D cells
>>> pv.CellType.LINE  # Line segment
3
>>> # 2-D cells
>>> pv.CellType.TRIANGLE  # 3-point triangle
5
>>> pv.CellType.QUAD  # 4-point quadrilateral
9
>>> # 3-D cells
>>> pv.CellType.TETRA  # 4-point tetrahedron
10
>>> pv.CellType.HEXAHEDRON  # 8-point hexahedron (cube)
12
>>> pv.CellType.WEDGE  # 6-point triangular prism
13
>>> pv.CellType.PYRAMID  # 5-point pyramid
14
__init__()#

Methods

Attributes

HEXAHEDRON: int = 12#
LINE: int = 3#
PYRAMID: int = 14#
QUAD: int = 9#
TETRA: int = 10#
TRIANGLE: int = 5#
VERTEX: int = 1#
WEDGE: int = 13#