[Paraview] Table of points to colored tube.

Moreland, Kenneth kmorel at sandia.gov
Mon May 9 13:36:07 EDT 2016


Jan,

I think you want to copy the field data as point data, not cell data. Since the points of your input are the same as your output, you can just call “PassData” to copy them over. Try this version of the script for the programmable filter:

pdi = self.GetPolyDataInput()
pdo = self.GetPolyDataOutput()
numPoints = pdi.GetNumberOfPoints()
pdo.Allocate()
for i in range(0, numPoints-1):
 points = [i, i+1]
 pdo.InsertNextCell(3, 2, points)

pdo.GetPointData().PassData(pdi.GetPointData())

-Ken


From: ParaView <paraview-bounces at paraview.org> on behalf of Jan Deca <jandeca at gmail.com>
Date: Saturday, May 7, 2016 at 6:17 PM
To: "paraview at paraview.org" <ParaView at paraview.org>
Subject: [EXTERNAL] Re: [Paraview] Table of points to colored tube.

So, I'm almost there with this script:

"
pdi = self.GetPolyDataInput()
pdo =  self.GetPolyDataOutput()
numPoints = pdi.GetNumberOfPoints()
pdo.Allocate()
for i in range(0, numPoints-1):
 points = [i, i+1]
 pdo.InsertNextCell(3, 2, points)

ivals = pdi.GetPointData().GetScalars("u")
ca = vtk.vtkFloatArray()
ca.SetName(ivals.GetName())
ca.SetNumberOfComponents(1)
ca.SetNumberOfTuples(numPoints-1)
pdo.GetCellData().AddArray(ca)
for i in range(0, numPoints-1):
  ca.SetValue(i, ivals.GetValue(i))
"

The only issue now is that the Tube filter is unhappy as it is unable to compute the normals making its output segmented looking like a collection of separate disks. I've attached a test-file and screenshot of the output.

"


Generic Warning: In /Users/kitware/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release-Python27/paraview/src/paraview/VTK/Common/DataModel/vtkPolyLine.cxx, line 106

Coincident points in polyline...can't compute normals

Warning: In /Users/kitware/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release-Python27/paraview/src/paraview/VTK/Filters/Core/vtkTubeFilter.cxx, line 243

vtkTubeFilter (0x7f840214ca40): Could not generate normals for line. Skipping to next.
"

Anybody any suggestions?

Thank you!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20160509/6626eb72/attachment.html>


More information about the ParaView mailing list