[Paraview] Python Calculator Filter

Adriano Gagliardi agagliardi at ara.co.uk
Tue Jun 23 13:06:07 EDT 2009


I have been trying to write a simple Python script that uses the Calculator
filter to take three scalars and produce a vector using the ParaView3.6
Python wrapping. This is trivial through the GUI Calculator Filter, but I am
having problems adding more than one scalar to the calculator object in my
script. From browsing the posts here and the C++ doxygen I've noticed the
use of AddScalarVariable and AddVectorVariable to accomplish this, but these
appear to be no longer available through the Python interface. Could someone
point out to me what I'm missing?

See below:

#-------------------------------------------------------------------------
from paraview.simple import *

connection = servermanager.Connect('localhost',11111)

er = servermanager.sources.EnSightreader(CaseFileName='/.../data.case')
er.PointArrays =
['x_velocity','1','y_velocity','1','z_velocity','1','cp','1']
er.UpdatePipeline()

calc1 = servermanager.filters.Calculator(Input=er,
ResultArrayName='Velocity')
calc1.ScalarVariable = ['x_velocity','x_velocity','0']
calc1.ScalarVariable = ['y_velocity','y_velocity','0'] #This overwrites
previous declaration
calc1.ScalarVariable = ['z_velocity','z_velocity','0'] #This overwrites
previous declaration
calc1.Function = '(x_velocity)*iHat + (y_velocity)*jHat + (z_velocity)*kHat'
#Produces an error... Variable does not exist
calc1.UpdatePipeline()
#-------------------------------------------------------------------------


===================================

Adriano Gagliardi MEng PhD
Project Scientist
Computational Aerodynamics
Aircraft Research Association Ltd.
Manton Lane
Bedford

Tel: 01234 32 4644
E-mail: agagliardi at ara.co.uk
Url: www.ara.co.uk 


---------------------------
This email contains information that is private and confidential and is intended only for the addressee.  If you are not the intended recipient please delete it and notify us immediately by e-mailing the sender.
Note: All email sent to or from this address may be accessed by someone other than the recipient, for system management and security reasons.
Aircraft Research Association Ltd.  Registered in England, Registration No 503668 Registered Office: Manton Lane, Bedford MK41 7PF England VAT No GB 196351245




More information about the ParaView mailing list