[Paraview] multiple scalar fields

Heiland, Randy heiland at iu.edu
Wed Oct 25 12:32:57 EDT 2017


How does one use 2 (or more) scalar fields in a dataset, e.g. one for a colormap, one to scale glyphs?  E.g., Pgmable Source:

pdo = self.GetPolyDataOutput()

num_pts = 2
newPts = vtk.vtkPoints()
cell_color_ID = vtk.vtkFloatArray()
cell_radius = vtk.vtkFloatArray()

cell_color_ID.SetName('cell_color_ID')
cell_radius.SetName('cell_radius')

newPts.InsertPoint(0, -1,0,0)
cell_color_ID.InsertNextValue(1)
cell_radius.InsertNextValue(0.2)

newPts.InsertPoint(1, 1,0,0)
cell_color_ID.InsertNextValue(2)
cell_radius.InsertNextValue(0.3)

pdo.SetPoints(newPts)
pdo.GetPointData().SetScalars(cell_color_ID)
pdo.GetPointData().SetScalars(cell_radius)   # overrides the 1st

verts = vtk.vtkCellArray()
for idx in range(0, num_pts):
  verts.InsertNextCell(1)
  verts.InsertCellPoint(idx)
pdo.SetVerts(verts)


thanks, Randy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4035 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/paraview/attachments/20171025/c0999105/attachment.bin>


More information about the ParaView mailing list