pyvista.CylinderSource#

class CylinderSource(
center=(0.0, 0.0, 0.0),
direction=(1.0, 0.0, 0.0),
radius=0.5,
height=1.0,
capping=True,
resolution=100,
)[source]#

Cylinder source algorithm class.

Warning

pyvista.Cylinder() function rotates the pyvista.CylinderSource ‘s pyvista.PolyData in its own way. It rotates the pyvista.CylinderSource.output 90 degrees in z-axis, translates and orients the mesh to a new center and direction.

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].

radiusfloat, default: 0.5

Radius of the cylinder.

heightfloat, default: 1.0

Height of the cylinder.

cappingbool, default: True

Cap cylinder ends with polygons.

resolutionint, default: 100

Number of points on the circular face of the cylinder.

Examples

Create a default CylinderSource.

>>> import pyvista as pv
>>> source = pv.CylinderSource()
>>> source.output.plot(show_edges=True, line_width=5)
../../../_images/pyvista-CylinderSource-1_00_00.png

Display a 3D plot of a default CylinderSource.

>>> import pyvista as pv
>>> pl = pv.Plotter()
>>> _ = pl.add_mesh(pv.CylinderSource(), show_edges=True, line_width=5)
>>> pl.show()
../../../_images/pyvista-CylinderSource-1_01_00.png

Visualize the output of CylinderSource in a 3D plot.

>>> pl = pv.Plotter()
>>> _ = pl.add_mesh(
...     pv.CylinderSource().output, show_edges=True, line_width=5
... )
>>> pl.show()
../../../_images/pyvista-CylinderSource-1_02_00.png

The above examples are similar in terms of their behavior.

Methods

Attributes

CylinderSource.capping

Get cap cylinder ends with polygons.

CylinderSource.capsule_cap

Get whether the capping should make the cylinder a capsule.

CylinderSource.center

Get location of the centroid in [x, y, z].

CylinderSource.direction

Get the direction vector in [x, y, z].

CylinderSource.height

Get the height of the cylinder.

CylinderSource.output

Get the output data object for a port on this algorithm.

CylinderSource.radius

Get radius of the cylinder.

CylinderSource.resolution

Get number of points on the circular face of the cylinder.