[Paraview-developers] How to use the "Parameters" property of "Programmable Filter" in pvpython?

Di Cheng chengdi at imech.ac.cn
Mon Apr 27 11:49:57 EDT 2015


Hi, everyone

I am using Programmable Filter in paraview. I noticed that there is a Parameters property in Programmable Filter. But I cannot use it in GUI, either in pvpython.

I referred the C++ document about this filter in [http://www.paraview.org/ParaView3/Doc/Nightly/www/cxx-doc/classvtkPythonProgrammableFilter.html], It is used to pass arguments to python script. BUT, I CANNOT USE IT in pvpython. I think it is because it accept two or more parameters and cannot be wrapped by XML file.

I know there is a undocumented GetClientSideObject() method which could work in "builtin:" mode. But it could only work locally

Currently, I am using a script generator to pass arguments
-----code-----
def pass_arg_script(d):
"""
generate script to pass parameters in dictionary d={'name':value}
value can be numpy arrays
"""
    s=""
    for k in d:
        s+='self.'+k+'='+repr(d[k])+'\n'
        s+="print '"+k+"=', self."+k+'\n'
    return s

pf.Script = s+ pf.Script
------end of code------

My question is: Is there any decent way to pass Parameters to Programmable Filter in pvpython? 

Di CHENG (Ph.D. candidate)
Supersonic Combustion Group
State Key Laboratory of High Temperature Gas Dynamics
Institute of Mechanics, Chinese Academy of Sciences
ADDRESS: No.15 Beisihuanxi Road, Beijing (100190)
P. R. China
E-mail: chengdi at imech.ac.cn
Phone: +86-10-82544053
Fax: +86-10-82544034




More information about the Paraview-developers mailing list