[Paraview] programmable filter in a python script

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Wed Nov 27 08:56:29 EST 2013


Joe,

YOu can put your script in a function with arguments in the foo.py
file and then call that function with the inputs argument passed in
from the small script in the Programmable filter.

Utkarsh

On Tue, Nov 26, 2013 at 5:47 PM, joseph insley <insley at anl.gov> wrote:
> Thanks for the pointers.
>
> Another naive follow up question..
>
> The script of my programmable filter starts with:
> input = inputs[0]
>
> This works fine when the script is defined inline, but when I import it from an external file, inputs is not defined.  How do I get around this?
>
> Thanks,
> joe
>
> On Nov 26, 2013, at 2:55 PM, Felipe Bordeu Weldt wrote:
>
>> or you can use the execfile('myfiltersource.py') instruction of python, and you put all you filter's code in the file.
>>
>>
>>
>> Le 26 nov. 13 à 21:03, Utkarsh Ayachit a écrit :
>>
>>>> my question is, can I create the script of the Programmable filter as a separate python script, and then just give the Programmable filter the path to this external python script?
>>>
>>> Yup, you indeed can. In fact, the programmable filter/source also has
>>> a property named "PythonPath" that you can set to the location where
>>> you'll have the python script you want to import in the filter code
>>> (you may have to put the path in quotes). State file attached. It will
>>> import foo in the Python programmable source when foo.py is put in
>>> /tmp.
>>>
>>> Utkarsh
>>> <foo.py><sample.pvsm>_______________________________________________
>>> 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
>
> _______________________________________________
> 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


More information about the ParaView mailing list