Hi @cory.quammen ,
Thanks for your reply.
I’ve seen examples doing this working directly with vtkPolyData() and adding a scalar as a vtkDoubleArray().
I was just wondering if it was possible to do the same using only paraview.simple.
Here’s my code so far which I run from Spyder
import paraview.simple as pvs
import pandas as pd
#Define some data
coords_lst = [[0,0,0,10,50],[10,15,50,20,40],[20,20,60,30,30],
[20,30,40,40,20],[40,40,60,50,10]]
coords_df = pd.DataFrame(coords_lst, columns=[‘x’,‘y’,‘z’,‘prop1’,‘prop2’])
#Create a PolyLineSource
pl = pvs.PolyLineSource(Points=coords_df.values.flatten(),
registrationName=‘a_polyline’)
#Create a scalar using the calculator filter
calculator = pvs.Calculator(registrationName=‘calc’, Input=pl)
calculator.ResultArrayName = ‘radius’
calculator.Function = ‘coordsX’
#create a Tube filter with radius and color? by scalar
tube = pvs.Tube(registrationName=‘tube’, Input=calculator)
tube.Scalars = [‘POINTS’, ‘radius’]
tube.Radius = 0.5
tube.VaryRadius = ‘By Scalar’
pvs.Show()
pvs.Render()
This works pretty well and I get a tube changing its radius and color.
Now, as you can see I have other properties in my Pandas DataFrame. I would like to use those properties to vary the radius but I cannot seem to find a solution from paraview.simple
Thanks in advance