[Paraview] Get selection of input in Python programmable filter

Allan Lyckegaard alyckegaard at xnovotech.com
Wed Mar 18 04:57:18 EDT 2015


Ok, I think I found a way to do it.

First get the proxy of the filter itself (http://public.kitware.com/pipermail/paraview/2011-November/023336.html <http://public.kitware.com/pipermail/paraview/2011-November/023336.html>):

import paraview.servermanager as sm
proxies = sm.ProxyManager().GetProxiesInGroup("sources").values()
selfProxy = [p for p in proxies if p.GetClientSideObject() is self][0]

Then get the selected points of the proxy’s input like this (http://stackoverflow.com/a/27805049):

proxy = paraview.simple.GetActiveSource()
active_selection = proxy.GetSelectionInput(proxy.Port)

/Allan


> On 17 Mar 2015, at 14:03, Allan Lyckegaard <alyckegaard at xnovotech.com> wrote:
> 
> Hi Paraview users,
> 
> I have been searching this list and the documentation but without luck.
> 
> I am working on a python programmable filter with two vtkimagedata as inputs. In the paraview GUI, both input vtkimagedata has an associated selection picked by “Select Points With Polygon”.
> 
> How do I in the python programmable filter find out what points have been selected in the two input vtkimagedata?
> 
> /Allan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20150318/abf27952/attachment.html>


More information about the ParaView mailing list