0

I'm interested whether I can add a custom property to a source I generate. What I'm now doing is the following:

renderView1 = GetActiveViewOrCreate('RenderView')

for pset in sphereParams:
    sphere = Sphere()
    sphere.Center = pset[0:3]
    sphere.Radius = pset[3]
    Show(sphere, renderView1)

    spheres.append(sphere)

Now I would want to visualize the spheres such that the colour corresponds to another parameter which is stored also in the sphereParams vector. How does one add such a property to a Paraview source?

Thanks!

ZappaZ
  • 95
  • 1
  • 6

2 Answers2

1

You could manually set the color based on the property

renderView1 = GetActiveViewOrCreate('RenderView')

for pset in sphereParams:
    sphere = Sphere()
    sphere.Center = pset[0:3]
    sphere.Radius = pset[3]
    sphereDisplay = Show(sphere, renderView1)
    sphereDisplay.DiffuseColor = ... # 3-element list specifying color from sphere params

    spheres.append(sphere)
Cory Quammen
  • 1,243
  • 7
  • 9
0

You can't, what you need to do is to change the color map of the visualization or to add a pointarray/cellarray (for example, with Calculator or ProgrammableFilter) to the output of the sphere source

lib
  • 2,918
  • 3
  • 27
  • 53
  • All right - that's too bad. Let me check on the programmable filter, and will post any solutions, if I find any... – ZappaZ Aug 13 '15 at 14:39