Hi,
in a programmable Filter do something like this:
import math
input = self.GetInputDataObject(0, 0)
output = self.GetOutputDataObject(0)
COUNT=input.GetNumberOfPoints()
pd=input.GetPointData()
m=0
v=0
for i in xrange(COUNT):
r=pd.GetArray('radius').GetValue(i)
v=v+((4.0/3.0)*math.pi*r*r*r)
m=m+pd.GetArray('Mass').GetValue(i)
outputarray = vtk.vtkStringArray()
outputarray.SetName("Text")
outputarray.SetNumberOfTuples(1)
outputarray.SetValue(0,"N=%d\nV=%1.6f m³\nm=%1.6f kg" % (COUNT,v,m))
output.GetRowData().AddArray(outputarray)
Attention: if you save this to a state-file change the ³ to 3 because it
will not be escaped and you can not load the state anymore.
best wishes,
Christian
Am 02.11.2012 21:49, schrieb Scott Ripplinger:
I need to sum all the values in a vector of a scalar property. I've
struggled understanding the documentation for the python calculator
and programmable filter, mainly in how to access the point data that I
want to use. Any tips will be appreciated.
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the ParaView Wiki at:
http://paraview.org/Wiki/ParaView
Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the ParaView Wiki at:
http://paraview.org/Wiki/ParaView
Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview