Is it possible to use a custom filter from pvpython?

Hi,
I have created a very long python script from a trace. Unfortunately I used a custom filter, so the trace took it as a function. Now, if I want to re-run the script generated by the trace, I get the error that pvpython does not know anything about the custom filter. Is there a way to load the custom filter into pvpython? In the trace script the custom filter is a function, so I tried to look for a file to import without any success. I tried looking for a file called as the custom filter but did not find it anywhere and the only file with something related is the file ~/.config/ParaView/ParaView5.6.0.ini where the custom filter is mentioned but I don’t see how to use the info there into the trace script. BTW, I am using Mac Os X Mojave with Paraview 5.6.0.
Thnkas in advance

Programmable filter are supported in python script.

Unfortunately I used a custom filter, so the trace took it as a function.

What do you mean by that ?

Could you explain how did you manage to obtain an unusable python script ?

Hello,
Regarding your questions:

  • Custom filter as a function: At least in the trace I get, a custom filter looks like a function call. Example: My filter is called spheres. Here is the code that appears in the trace when I use the custom filter:
    # create a new 'spheres'
    spheres1 = spheres(Input=packing_initialvtp)

  • How I managed to obtain an unusable script : Well, I just used the trace function and a custom filter, and since a custom filter is a function call, when I try to run the trace script with pvpython the interpreter does not know where that function (the custom filter) is defined, so that throws an error. I am attaching the script generated by the trace. It just opens a file and then applies the custom filter. As you can see, there is no declaration of the function spheres (that is, the custom filter) .
    example.py (4.6 KB)

So my original question remains: How do I use a custom filter with pvpython? Should I include some special path? should I export the custom filter as a python script (currently it looks than I can only export it as an xml). My work around was to not use the custom filter and just use the primitive glyphs. But the question still remains.

Thanks in advance

Edit: formatting

Looks like using CustomFilter in pvpython is not supported sadly. This is an usability bug imo.

Am I mistaken @utkarsh.ayachit ?

3 Likes

I have the same issue with Paraview-5.9.1 and need help to make it work…

So the problem is, that i have created a custom filter “exampleFilter.cpd” and want to use it with pvpython/pvbatch. I added this filter via tool - manage custom filters - import and can use it now in my gui.
But it is not known in the batch mode and on other machines.
Is there a way to add this filter permanently? Or maybe just to include it in the python script?

Thanks!

I dont think it changed since three years ago. You may want to open an issue: https://gitlab.kitware.com/paraview/paraview/-/issues