Thank you for your kind reply, Utkarsh. The C++ example clarifies many of the details that I couldn't find explained anywhere.
I will try to wrap the missing parts in python, because we can't afford to migrate the rest of our application to C++. Just asking, before I waste my time with a bunch of problems that you know in advance that cannot be solved: Is there any reason why the steps you showed cannot be wrapped in python, or has it "just not been done, yet"? Thanks Mario 2016-12-13 18:54 GMT+01:00 Utkarsh Ayachit <utkarsh.ayac...@kitware.com>: > Mario, > > Firstly, there's no way from Python to do what you want to do except > using the property mechanism, since well, the goal with ParaView was > not to provide a general purpose RPC framework. In C++, you can do > that you want as follows: > > vtkSMProxy* proxy = ... > std::string arg = ...; > vtkClientServerStream stream; > stream << vtkClientServerStream::Invoke > << VTKOBJECT(proxy) > << "doSomething" << arg.c_str() > << vtkClientServerStream::End; > > vtkSMSession* session = proxy->GetSession(); > session->ExecuteStream( > /*location*/ proxy->GetLocation(), > /* ignore_errores*/ false); > > vtkClientServerStream result = session->GetLastResult(proxy-> > GetLocation()); > if (result.GetNumberOfMessages() == 1 && result.GetNumberOfArguments(0) == > 1) > { > std:string aresult; > result.GetArgument(0, 0, &aresult); > } > > Utkarsh > > > > On Sun, Dec 11, 2016 at 12:01 PM, Mario Schreiber > <schreibermari...@gmail.com> wrote: > > Why is it so complicated to call a procedure and receive a return value > on > > the client? > > > > I am attaching my attempt (CMakeLists.txt, vtkSquareFun.cxx, > vtkSquareFun.h > > and TestPlugin.xml, each less than 20 lines of code), which basically > > calculates the square of an argument in vtkSquareFun::eval(double x). > > > > When I load this plugin in Paraview and open the Python Shell, I can > > evaluate vtkSquareFun::eval() using a detour by first setting the > argument > > and then getting the result, which is linked to the argument property in > > TestPlugin.xml: > > > > fun=servermanager.CreateProxy("test","SquareFun") > > fun.GetProperty("Arg").SetElement(0,999) > > fun.UpdateVTKObjects() > > fun.UpdatePropertyInformation() > > fun.GetProperty("Result").GetElement(0) > > ... showing the correct result 998001. > > > > Why can't I simply run the following? > > fun=servermanager.CreateProxy("test","SquareFun") > > result=fun.InvokeCommand("eval",[999.0]) > > > > Does Paraview really not provide any means of calling a function with > > arguments and return value within a single client-server communication? > All > > these individual message transfers are a bottleneck in our application. > Does > > the Paraview architecture exclude more universal remote procedure calls, > or > > do you think that one could just augment the available procedures with > > another procedure that can deliver a set of custom return values? > > > > Thanks > > Mario > > > > > > 2016-12-07 7:34 GMT+01:00 Mario Schreiber <schreibermari...@gmail.com>: > >> > >> Hello, > >> I have a use case, where a vtkObject on the server implements a method > >> like > >> > >> std::string doSomething(std::string arg); > >> > >> Now, with a proxy prx on the client for that class, I would like to > call > >> the remote procedure similar to > >> > >> result=prx.InvokeCommand("doSomething",[arg]) > >> > >> Is something like this possible? > >> I found a very complicated workaround by first defining the arguments as > >> properties, defining the result as information_only property linked to > on of > >> the args, then calling "UpdateVTKObjects" to push the arguments and > finally > >> "UpdateInformationProperties" to pull the result. Is there an easier > >> solution, possible with a short example? > >> > >> Thank you > >> Mario > > > > > > > > _______________________________________________ > > 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 > > > > Search the list archives at: http://markmail.org/search/?q=ParaView > > > > Follow this link to subscribe/unsubscribe: > > http://public.kitware.com/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 Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview