pyvista.Cylinder#
- Cylinder(
 - center: VectorLike[float] = (0.0, 0.0, 0.0),
 - direction: VectorLike[float] = (1.0, 0.0, 0.0),
 - radius: float = 0.5,
 - height: float = 1.0,
 - resolution: int = 100,
 - capping: bool = True,
 Create the surface of a cylinder.
Warning
pyvista.Cylinder()function rotates thepyvista.CylinderSource‘spyvista.PolyDatain its own way. It rotates thepyvista.CylinderSource.output90 degrees in z-axis, translates and orients the mesh to a newcenteranddirection.See also
pyvista.CylinderStructured().- Parameters:
 - centersequence[
float], default: (0.0, 0.0, 0.0) Location of the centroid in
[x, y, z].- directionsequence[
float], default: (1.0, 0.0, 0.0) Direction cylinder points to in
[x, y, z].- radius
float, default: 0.5 Radius of the cylinder.
- height
float, default: 1.0 Height of the cylinder.
- resolution
int, default: 100 Number of points on the circular face of the cylinder.
- cappingbool, default: 
True Cap cylinder ends with polygons.
- centersequence[
 - Returns:
 pyvista.PolyDataCylinder surface.
Examples
>>> import pyvista as pv >>> cylinder = pv.Cylinder( ... center=[1, 2, 3], direction=[1, 1, 1], radius=1, height=2 ... ) >>> cylinder.plot(show_edges=True, line_width=5, cpos='xy')
>>> pl = pv.Plotter() >>> _ = pl.add_mesh( ... pv.Cylinder(center=[1, 2, 3], direction=[1, 1, 1], radius=1, height=2), ... show_edges=True, ... line_width=5, ... ) >>> pl.camera_position = 'xy' >>> pl.show()
The above examples are similar in terms of their behavior.