[Paraview] Python Proogrammable Filter - Get Proxy

Markus Fuger m_fuger at hotmail.com
Tue Nov 15 14:01:13 EST 2011


Hi Pat,

thank you for the fast help! As mentioned I am still beginner with ParaView and do not know all the insights from ParaView. Furthermore I have to say that at the moment (we are just beginning to use ParaView) both the server and the client do run on the same machine (but in the future we as well like to run it on seperate machines)

First of all I have to say that the provided solution does not work as it was written here. It terminates with the following error:


Traceback (most recent call last):
  File "<string>", line 26, in <module>
  File "<string>", line 4, in RequestData
  File "C:\Program Files (x86)\ParaView 3.12.0\lib\paraview-3.12\site-packages\paraview\servermanager.py", line 1502, in GetProxiesInGroup
    for aProxy in iter:
  File "C:\Program Files (x86)\ParaView 3.12.0\lib\paraview-3.12\site-packages\paraview\servermanager.py", line 1706, in next
    self.AProxy = _getPyProxy(self.SMIterator.GetProxy())
  File "C:\Program Files (x86)\ParaView 3.12.0\lib\paraview-3.12\site-packages\paraview\servermanager.py", line 2227, in _getPyProxy
    classForProxy = _findClassForProxy(_make_name_valid(xmlName), smproxy.GetXMLGroup())
  File "C:\Program Files (x86)\ParaView 3.12.0\lib\paraview-3.12\site-packages\paraview\servermanager.py", line 2289, in _findClassForProxy
    return filters.__dict__[xmlName]
NameError: global name 'filters' is not defined

Dealing a bit more with the python interface I found out, that Proxy is not the correct thing I really need - I believe that I rather would need the filter.
To understand what I want to do:
-) the user loads a file series of vtu or inp files
-) then he can should apply the python programmable filter
   This filter should then open a txt file (which will always be placed in the same directory as the vtu/inp files).
   The filter will then parse the txt file and according to the actual inp/vtu file in the file series it will read a certain value from this text file. This value will be used as x value whereas the y value is calculated by using several vtk filters in the python programmable filter (calculating the y value does already work properly).

In order to automatically open this txt file I would need the directory from the first (input) filter. Furthermore I want to get the recent inp/vtu file name of the file series in order to get the correct information (=row) out of the txt file.

Perhaps somebody has another idea in order resolve this problem.

Markus

From: pat.marion at kitware.com
Date: Mon, 14 Nov 2011 21:10:13 -0800
Subject: Re: [Paraview] Python Proogrammable Filter - Get Proxy
To: m_fuger at hotmail.com
CC: paraview at paraview.org

Hi Markus,

What you're trying to do is discouraged, you shouldn't attempt to access proxies from within the programmable filter.  If you were running paraview in a client-server setup, it would not work because the filter and its proxy would exist on different processes.



Anyway, here's some code that may work for you:



import paraview.servermanager as sm

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

Hope this helps!




Pat


On Mon, Nov 14, 2011 at 2:07 PM, Markus Fuger <m_fuger at hotmail.com> wrote:







Hello,

I do like to program my own plugin based on a Python Programmable filter (PPF).
For some feature (I want to get the file directory of the files from the input of the very first proxy in the pipeline) I need the proxy object of the PPF.



If I once would have this object I could then loop the Input until there is none anymore and then read the FileInfo Field. But as described I would need the proxy object of the PPF first.
I did several tests with the self object as well as with the proxymanager but could not find a working solution. (I have to say that I am new to ParaView as well)



Perhaps somebody of this mailing list could help me!?

With kind regards,
Markus
 		 	   		  

_______________________________________________

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



 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20111115/34e5304e/attachment.htm>


More information about the ParaView mailing list