- Cube(center=(0.0, 0.0, 0.0), x_length=1.0, y_length=1.0, z_length=1.0, bounds=None, clean=True)¶
Create a cube.
It’s possible to specify either the center and side lengths or just the bounds of the cube. If
boundsare given, all other arguments are ignored.
Changed in version 0.33.0: The cube is created using
vtk.vtkCubeSource. For compatibility with
pyvista.PlatonicSolid(), face indices are also added as cell data. For full compatibility with
PlatonicSolid(), one has to use
x_length = y_length = z_length = 2 * radius / 3**0.5. The cube points are also cleaned by default now, leaving only the 8 corners and a watertight (manifold) mesh.
[x, y, z].
Length of the cube in the x-direction.
Length of the cube in the y-direction.
Length of the cube in the z-direction.
Specify the bounding box of the cube. If given, all other size arguments are ignored.
(xMin, xMax, yMin, yMax, zMin, zMax).
Whether to clean the raw points of the mesh, making the cube manifold. Note that this will degrade the texture coordinates that come with the mesh, so if you plan to map a texture on the cube, consider setting this to
New in version 0.33.0.
Mesh of the cube.
Create a default cube.
>>> import pyvista >>> mesh = pyvista.Cube() >>> mesh.plot(show_edges=True, line_width=5)