pyvista.DataSet.area#

property DataSet.area: float[source]#

Return the mesh area if 2D.

This will return 0 for meshes with 3D cells.

Returns:
float

Total area of the mesh.

Examples

Get the area of a square of size 2x2. Note 5 points in each direction.

>>> import pyvista as pv
>>> mesh = pv.ImageData(dimensions=(5, 5, 1))
>>> mesh.area
16.0

A mesh with 3D cells does not have an area. To get the outer surface area, first extract the surface using pyvista.DataSetFilters.extract_surface().

>>> mesh = pv.ImageData(dimensions=(5, 5, 5))
>>> mesh.area
0.0

Get the area of a sphere.

>>> mesh = pv.Sphere()
>>> mesh.volume
0.51825