tube

PolyDataFilters.tube(radius=None, scalars=None, capping=True, n_sides=20, radius_factor=10, preference='point', inplace=False, progress_bar=False)

Generate a tube around each input line.

The radius of the tube can be set to linearly vary with a scalar value.

Parameters
radiusfloat

Minimum tube radius (minimum because the tube radius may vary).

scalarsstr, optional

Scalars array by which the radius varies.

cappingbool, optional

Turn on/off whether to cap the ends with polygons. Default True.

n_sidesint, optional

Set the number of sides for the tube. Minimum of 3.

radius_factorfloat, optional

Maximum tube radius in terms of a multiple of the minimum radius.

preferencestr, optional

The field preference when searching for the scalars array by name.

inplacebool, optional

Whether to update the mesh in-place.

progress_barbool, optional

Display a progress bar to indicate progress.

Returns
pyvista.PolyData

Tube-filtered mesh.

Examples

Convert a single line to a tube.

>>> import pyvista as pv
>>> line = pv.Line()
>>> tube = line.tube(radius=0.02)
>>> f'Line Cells: {line.n_cells}'
'Line Cells: 1'
>>> f'Tube Cells: {tube.n_cells}'
'Tube Cells: 22'
>>> tube.plot(color='tan')
../../../_images/pyvista-PolyDataFilters-tube-1_00_00.png

See Creating a Spline for more examples using this filter.