Thanks. I just tired it and it seems to work. But how does the writer figure out the input object?<br><br>Is there any detailed documentation on pvpython?<br><br>Thanks,<br><br>Ken<br><br>
<br><br><div class="gmail_quote">On Sun, Apr 25, 2010 at 6:37 AM, Utkarsh Ayachit <span dir="ltr"><<a href="mailto:utkarsh.ayachit@kitware.com">utkarsh.ayachit@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Here's a modified version of the script, using the updated python<br>
scripting style (since ParaView 3.6)<br>
<div class="im"><br>
<br>
from paraview.simple import *<br>
from paraview.simple import servermanager as sm<br>
from paraview import vtk<br>
<br>
</div><div class="im"># Set the pvpython path<br>
INPUTFILE="test.vtu"<br>
OUTPUTFILE="tested.vtu"<br>
<br>
# create a reader<br>
</div>reader=XMLUnstructuredGridReader(FileName=INPUTFILE)<br>
<div class="im"><br>
# get the data i.e moves data from the server to the client<br>
data=sm.Fetch(reader)<br>
<br>
</div>tp=TrivialProducer()<br>
<div class="im">obj=tp.GetClientSideObject()<br>
obj.SetOutput(data)<br>
<br>
</div>writer=XMLUnstructuredGridWriter(DataMode=2,FileName=OUTPUTFILE)<br>
writer.UpdatePipeline()<br>
<font color="#888888"><br>
<br>
Utkarsh<br>
</font><div><div></div><div class="h5"><br>
On Sat, Apr 24, 2010 at 3:24 PM, <<a href="mailto:wastrel@gmail.com">wastrel@gmail.com</a>> wrote:<br>
> I simplified the code and tried it on Paraview3.8.0. It reads in a vtu file,<br>
> fetch the data and then write it back to a new file. But still got errors as<br>
> follow.<br>
><br>
> Script:<br>
><br>
> from paraview.simple import *<br>
> from paraview.simple import servermanager as sm<br>
> from paraview import vtk<br>
><br>
> # connect internally<br>
> connection=sm.Connect()<br>
><br>
> # Set the pvpython path<br>
> INPUTFILE="test.vtu"<br>
> OUTPUTFILE="tested.vtu"<br>
><br>
> # create a reader<br>
> reader=sm.sources.XMLUnstructuredGridReader(FileName=INPUTFILE)<br>
><br>
> # get the data i.e moves data from the server to the client<br>
> data=sm.Fetch(reader)<br>
><br>
> tp=sm.sources.TrivialProducer()<br>
> obj=tp.GetClientSideObject()<br>
> obj.SetOutput(data)<br>
><br>
> writer=sm.writers.XMLUnstructuredGridWriter(DataMode=2,FileName=OUTPUTFILE,Input=obj)<br>
><br>
> writer.UpdatePipeline()<br>
><br>
><br>
> Errors:<br>
><br>
> getting appended<br>
> vtkReductionFilter : [ ...........]<br>
> Traceback (most recent call last):<br>
> File "convert.py", line 88, in <module><br>
><br>
> writer=sm.writers.XMLUnstructuredGridWriter(DataMode=2,FileName=OUTPUTFILE,Input=obj)<br>
> File<br>
> "/home/kitware/ParaView-3-8/ParaView-3.8/ParaView3Bin/Utilities/VTKPythonWrapping/paraview/servermanager.py",<br>
> line 186, in __init__<br>
> File<br>
> "/home/kitware/ParaView-3-8/ParaView-3.8/ParaView3Bin/Utilities/VTKPythonWrapping/paraview/servermanager.py",<br>
> line 204, in __setattr__<br>
> File<br>
> "/home/kitware/ParaView-3-8/ParaView-3.8/ParaView3Bin/Utilities/VTKPythonWrapping/paraview/servermanager.py",<br>
> line 2361, in setProperty<br>
> File<br>
> "/home/kitware/ParaView-3-8/ParaView-3.8/ParaView3Bin/Utilities/VTKPythonWrapping/paraview/servermanager.py",<br>
> line 253, in SetPropertyWithName<br>
> File<br>
> "/home/kitware/ParaView-3-8/ParaView-3.8/ParaView3Bin/Utilities/VTKPythonWrapping/paraview/servermanager.py",<br>
> line 1162, in SetData<br>
> AttributeError: SMProxy<br>
><br>
><br>
><br>
> Any clues?<br>
><br>
><br>
> On Sat, Apr 24, 2010 at 9:41 AM, Utkarsh Ayachit<br>
> <<a href="mailto:utkarsh.ayachit@kitware.com">utkarsh.ayachit@kitware.com</a>> wrote:<br>
>><br>
>> Here are my results from 3.7 (consequently 3.8 or git master should<br>
>> work as well).<br>
>><br>
>> >>> from paraview.simple import *<br>
>> paraview version 3.7.0, Date: 2010-03-27<br>
>> >>> TrivialProducer()<br>
>> <paraview.servermanager.TrivialProducer object at 0x121587e90><br>
>> >>> servermanager.sources.TrivialProducer()<br>
>> <paraview.servermanager.TrivialProducer object at 0x121587d50><br>
>><br>
>> Utkarsh<br>
>><br>
>> On Fri, Apr 23, 2010 at 5:44 PM, Utkarsh Ayachit<br>
>> <<a href="mailto:utkarsh.ayachit@kitware.com">utkarsh.ayachit@kitware.com</a>> wrote:<br>
>> > You no longer need the initial part for loading the XML. You can<br>
>> > directly use:<br>
>> ><br>
>> > tp = sm.sources.TrivialProducer()<br>
>> ><br>
>> > and that should work.<br>
>> ><br>
>> > Utkarsh<br>
>> ><br>
>> > On Fri, Apr 23, 2010 at 5:09 PM, <<a href="mailto:wastrel@gmail.com">wastrel@gmail.com</a>> wrote:<br>
>> >> I used the the following snippet to generate data on the client side<br>
>> >> but<br>
>> >> ended up with errors:<br>
>> >><br>
>> >> Code:<br>
>> >> sm = servermanager<br>
>> >> f = open('trivialproducer.xml', 'r')<br>
>> >> parser = sm.vtkSMXMLParser()<br>
>> >> parser.Parse(f.read())<br>
>> >> parser.ProcessConfiguration(sm.vtkSMObject.GetProxyManager())<br>
>> >> # Update the modules<br>
>> >> sm._updateModules()<br>
>> >><br>
>> >> tp = sm.sources.TrivialProducer()<br>
>> >> obj = tp.GetClientSideObject()<br>
>> >> obj.SetOutput(pd)<br>
>> >><br>
>> >> # use tp as any other source proxy<br>
>> >><br>
>> >><br>
>> >> trivialproducer.xml:<br>
>> >><br>
>> >> <ServerManagerConfiguration><br>
>> >> <ProxyGroup name="sources"><br>
>> >><br>
>> >> <SourceProxy name="TrivialProducer"<br>
>> >> class="vtkPVTrivialProducer"><br>
>> >> </SourceProxy><br>
>> >> </ProxyGroup><br>
>> >><br>
>> >><br>
>> >> Errors:<br>
>> >> ERROR: In<br>
>> >><br>
>> >> /home/berk/Work/ReleaseBuilds/ParaView3/Servers/Common/vtkProcessModule.cxx,<br>
>> >> line 1001<br>
>> >> vtkProcessModule (0x807b790): Cannot create object of type<br>
>> >> "vtkPVTrivialProducer".<br>
>> >> while processing<br>
>> >> Message 0 = New<br>
>> >> Argument 0 = string_value {vtkPVTrivialProducer}<br>
>> >> Argument 1 = id_value {40}<br>
>> >><br>
>> >><br>
>> >> ERROR: In<br>
>> >><br>
>> >> /home/berk/Work/ReleaseBuilds/ParaView3/Servers/Common/vtkProcessModule.cxx,<br>
>> >> line 1002<br>
>> >> vtkProcessModule (0x807b790): Aborting execution for debugging<br>
>> >> purposes.<br>
>> >><br>
>> >> Abort<br>
>> >><br>
>> >><br>
>> >> _______________________________________________<br>
>> >> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>> >><br>
>> >> Visit other Kitware open-source projects at<br>
>> >> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>> >><br>
>> >> Please keep messages on-topic and check the ParaView Wiki at:<br>
>> >> <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
>> >><br>
>> >> Follow this link to subscribe/unsubscribe:<br>
>> >> <a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
>> >><br>
>> >><br>
>> ><br>
><br>
><br>
</div></div></blockquote></div><br>