class_docstr: An internal class to manage filters/algorithms for polydata datasets.
class_docstr_tok: ["An","internal","class","to","manage","filters\/algorithms","for","polydata","datasets","."]
docstr: Generate a tube around each input line.
  
  The radius of the tube can be set to linearly vary with a
  scalar value.
  
  Parameters
  ----------
  radius : float, optional
      Minimum tube radius (minimum because the tube radius may
      vary).
  
  scalars : str, optional
      Scalars array by which the radius varies.
  
  capping : bool, default: True
      Turn on/off whether to cap the ends with polygons.
  
  n_sides : int, default: 20
      Set the number of sides for the tube. Minimum of 3.
  
  radius_factor : float, default: 10.0
      Maximum tube radius in terms of a multiple of the minimum
      radius.
  
  absolute : bool, default: False
      Vary the radius with values from scalars in absolute units.
  
  preference : str, default: 'point'
      The field preference when searching for the scalars array by
      name.
  
  inplace : bool, default: False
      Whether to update the mesh in-place.
  
  progress_bar : bool, default: False
      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='lightblue')
  
  See :ref:`create_spline_example` for more examples using this filter.
docstr_tok: ["Generate","a","tube","around","each","input","line",".","The","radius","of","the","tube","can","be","set","to","linearly","vary","with","a","scalar","value",".","Parameters","--","--","--","--","--","radius",":","float",",","optional","Minimum","tube","radius","(","minimum","because","the","tube","radius","may","vary",")",".","scalars",":","str",",","optional","Scalars","array","by","which","the","radius","varies",".","capping",":","bool",",","default",":","True","Turn","on\/off","whether","to","cap","the","ends","with","polygons",".","n_sides",":","int",",","default",":","20","Set","the","number","of","sides","for","the","tube",".","Minimum","of","3.","radius_factor",":","float",",","default",":","10.0","Maximum","tube","radius","in","terms","of","a","multiple","of","the","minimum","radius",".","absolute",":","bool",",","default",":","False","Vary","the","radius","with","values","from","scalars","in","absolute","units",".","preference",":","str",",","default",":","'point'","The","field","preference","when","searching","for","the","scalars","array","by","name",".","inplace",":","bool",",","default",":","False","Whether","to","update","the","mesh","in-place",".","progress_bar",":","bool",",","default",":","False","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='lightblue","'",")","See",":","ref",":","`","create_spline_example","`","for","more","examples","using","this","filter","."]
code: def tube(
      self,
      radius=None,
      scalars=None,
      capping=True,
      n_sides=20,
      radius_factor=10.0,
      absolute=False,
      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
      ----------
      radius : float, optional
          Minimum tube radius (minimum because the tube radius may
          vary).
  
      scalars : str, optional
          Scalars array by which the radius varies.
  
      capping : bool, default: True
          Turn on/off whether to cap the ends with polygons.
  
      n_sides : int, default: 20
          Set the number of sides for the tube. Minimum of 3.
  
      radius_factor : float, default: 10.0
          Maximum tube radius in terms of a multiple of the minimum
          radius.
  
      absolute : bool, default: False
          Vary the radius with values from scalars in absolute units.
  
      preference : str, default: 'point'
          The field preference when searching for the scalars array by
          name.
  
      inplace : bool, default: False
          Whether to update the mesh in-place.
  
      progress_bar : bool, default: False
          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='lightblue')
  
      See :ref:`create_spline_example` for more examples using this filter.
  
      """
      poly_data = self
      if not isinstance(poly_data, pyvista.PolyData):
          poly_data = pyvista.PolyData(poly_data)
      if n_sides < 3:
          n_sides = 3
      tube = _vtk.vtkTubeFilter()
      tube.SetInputDataObject(poly_data)
      # User Defined Parameters
      tube.SetCapping(capping)
      if radius is not None:
          tube.SetRadius(radius)
      tube.SetNumberOfSides(n_sides)
      tube.SetRadiusFactor(radius_factor)
      # Check if scalars array given
      if scalars is not None:
          if not isinstance(scalars, str):
              raise TypeError(
                  "scalars array must be given as a string name"
              )
          field = poly_data.get_array_association(
              scalars, preference=preference
          )
          # args: (idx, port, connection, field, name)
          tube.SetInputArrayToProcess(0, 0, 0, field.value, scalars)
          if absolute:
              tube.SetVaryRadiusToVaryRadiusByAbsoluteScalar()
          else:
              tube.SetVaryRadiusToVaryRadiusByScalar()
      # Apply the filter
      _update_alg(tube, progress_bar, "Creating Tube")
  
      mesh = _get_output(tube)
      if inplace:
          poly_data.copy_from(mesh, deep=False)
          return poly_data
      return mesh
  
imports: import collections.abc
  import warnings
  import numpy
  import pyvista
  from pyvista.core import _vtk_core
  from pyvista.core.errors import MissingDataError, NotAllTrianglesError, PyVistaFutureWarning, VTKVersionError
  from pyvista.core.filters import _get_output, _update_alg
  from pyvista.core.filters.data_set import DataSetFilters
  from pyvista.core.utilities.arrays import FieldAssociation, get_array, get_array_association, set_default_active_scalars, vtk_id_list_to_array
  from pyvista.core.utilities.geometric_objects import NORMALS
  from pyvista.core.utilities.helpers import generate_plane, wrap
  from pyvista.core.utilities.misc import abstract_class, assert_empty_kwargs
label_desc: Use image node_id 17 for calling the PolyDataFilters obj's underlying member method code with example usage: obj.tube(radius, scalars, capping, n_sides, radius_factor, absolute, preference, inplace, progress_bar) and returns: mesh, poly_data