[Paraview] simple Programmable Source

Heiland, Randy heiland at iu.edu
Wed Oct 11 21:48:31 EDT 2017


I create the following in the Pgmable Source in PV, but cannot figure out how to color the resulting points or 3D glyphs using the scalar values. What am I missing?
-Randy

# Get a vtk.PolyData object for the output
pdo = self.GetPolyDataOutput()

# Create points
num_pts = 3
newPts = vtk.vtkPoints()
scalars = vtk.vtkFloatArray()

xval = -1.0
for idx in range(0, num_pts):
  # rf. PhysiCell User Guide for these array indices to a cell's position.
  x = xval
  y = 0.0
  z = 0.0
  newPts.InsertPoint(idx, x,y,z)
  sval = xval*2
  scalars.InsertNextValue(sval)
  xval += 1.0

# Add the points to the vtkPolyData object.
pdo.SetPoints(newPts)
pdo.GetPointData().SetScalars(scalars)

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

pdo.SetVerts(verts)


-------------- 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/20171012/9b5c2596/attachment.bin>


More information about the ParaView mailing list