pyvista_wasm.PolyData.tube#
- PolyData.tube(*, radius: float = 0.5, n_sides: int = 20, capping: bool = True) PolyData#
Generate a tube around a line polydata.
This filter creates a tube representation around lines in the mesh by sweeping a polygonal cross-section along each line. It mirrors the PyVista
tubefilter API and is backed by VTK.wasm’svtkTubeFilter.Note
This filter is intended for use with line-based polydata (such as the output of
Line). It uses VTK.wasm’svtkTubeFilter, which generates a tube by sweeping a circle withn_sidessides along the line segments.- Parameters:
radius (float, optional) – The radius of the tube. Default is 0.5.
n_sides (int, optional) – The number of sides for the tube cross-section. Higher values produce smoother tubes. Default is 20.
capping (bool, optional) – Whether to cap the ends of the tube. Default is True.
- Returns:
A new mesh representing the tube.
- Return type:
Examples
>>> import pyvista_wasm as pv >>> line = pv.Line() >>> tube = line.tube(radius=0.05, n_sides=20) >>> isinstance(tube, pv.PolyData) True
Render the tube:
>>> tube.plot()