def Box(bounds=(-1., 1., -1., 1., -1., 1.), level=0, quads=True): """Create a box with solid faces for the given bounds. Parameters ---------- bounds : np.ndarray or list Specify the bounding box of the cube. ``(xMin, xMax, yMin, yMax, zMin, zMax)`` level : int Level of subdivision of the faces. quads : bool, optional Flag to tell the source to generate either a quad or two triangle for a set of four points. Default ``True``. """ if np.array(bounds).size != 6: raise TypeError('Bounds must be given as length 6 tuple: (xMin, xMax, yMin, yMax, zMin, zMax)') src = _vtk.vtkTessellatedBoxSource() src.SetLevel(level) if quads: src.QuadsOn() else: src.QuadsOff() src.SetBounds(bounds) src.Update() return pyvista.wrap(src.GetOutput())
def Box(bounds=(-1., 1., -1., 1., -1., 1.), level=0, quads=True): """Create a box with solid faces for the given bounds. Parameters ---------- bounds : iterable, optional Specify the bounding box of the cube. ``(xMin, xMax, yMin, yMax, zMin, zMax)``. level : int, optional Level of subdivision of the faces. quads : bool, optional Flag to tell the source to generate either a quad or two triangle for a set of four points. Default ``True``. Returns ------- pyvista.PolyData Mesh of the box. Examples -------- Create a box with subdivision ``level=2``. >>> import pyvista >>> mesh = pyvista.Box(level=2) >>> mesh.plot(show_edges=True) """ if np.array(bounds).size != 6: raise TypeError( 'Bounds must be given as length 6 tuple: (xMin, xMax, yMin, yMax, zMin, zMax)' ) src = _vtk.vtkTessellatedBoxSource() src.SetLevel(level) if quads: src.QuadsOn() else: src.QuadsOff() src.SetBounds(bounds) src.Update() return pyvista.wrap(src.GetOutput())