# VTK tubefilter

**URL:** https://discourse.vtk.org/t/vtk-tubefilter/8544
**Category:** Development
**Created:** [May 22, 2022, 12:55pm UTC](https://discourse.vtk.org/t/vtk-tubefilter/8544 "2022-05-22T12:55:06Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Qrtiis](https://discourse.vtk.org/user_avatar/discourse.vtk.org/qrtiis/32/5188_2.png) [@Qrtiis](https://discourse.vtk.org/u/Qrtiis)
#### Post date: [May 22, 2022, 12:55pm UTC](https://discourse.vtk.org/t/vtk-tubefilter/8544/1 "2022-05-22T12:55:06Z")

</div>

Anyone have a clue how to make one of the tubes end wider and another narrower? I have created a line and then added tube filter around it

---

<div class="post-metadata">

### Author: ![mau\_igna\_06](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mau_igna_06/32/8064_2.png) [@mau\_igna\_06](https://discourse.vtk.org/u/mau_igna_06)
#### Post date: [May 22, 2022, 3:49pm UTC](https://discourse.vtk.org/t/vtk-tubefilter/8544/2 "2022-05-22T15:49:08Z")

</div>

I think you need to add a scalar array with the corresponding radius for each point of the line segments

---

<div class="post-metadata">

### Author: ![zhang-qiang-github](https://discourse.vtk.org/user_avatar/discourse.vtk.org/zhang-qiang-github/32/2519_2.png) [@zhang-qiang-github](https://discourse.vtk.org/u/zhang-qiang-github)
#### Post date: [May 23, 2022, 1:34am UTC](https://discourse.vtk.org/t/vtk-tubefilter/8544/3 "2022-05-23T01:34:56Z")

</div>

You may have a try for `vedo` (python):

 ![image](https://discourse.vtk.org/uploads/default/original/2X/2/22bc915ea77064fc26d668a233c88a7bd352fb41.jpeg)

```auto
"""Use array to vary radius and color
of a line represented as a tube"""
from vedo import *
import numpy as np

settings.defaultFont = 'Quikhand'

ln = [[sin(x), cos(x), x / 2] for x in np.arange(0,9, 0.1)]
N = len(ln)

############################### a simple tube( along ln
t1 = Tube(ln, c="blue", r=0.08)

############################### vary radius
rads = [0.3*(cos(6.0*ir/N))**2+0.1 for ir in range(N)]
t2 = Tube(ln, r=rads, c="tomato", res=24)

############################### vary color
cols = [i for i in range(N)]
cols = makeBands(cols, 5) # make color bins
t3 = Tube(ln, r=rads, c=cols, res=24)

############################### visualize
plt = Plotter(N=3, axes=dict(textScale=4))
plt.at(0).show(t1, __doc__ )
plt.at(1).show(t2)
plt.at(2).show(t3, viewup="z")
plt.interactive().close()

```

---

<div class="post-metadata">

### Author: ![Qrtiis](https://discourse.vtk.org/user_avatar/discourse.vtk.org/qrtiis/32/5188_2.png) [@Qrtiis](https://discourse.vtk.org/u/Qrtiis)
#### Post date: [May 24, 2022, 12:35pm UTC](https://discourse.vtk.org/t/vtk-tubefilter/8544/4 "2022-05-24T12:35:23Z")

</div>

Thank you it helped me a lot
