[Paraview] vtkPVTrivialProducer issues
Utkarsh Ayachit
utkarsh.ayachit at kitware.com
Sun Apr 25 07:37:31 EDT 2010
Here's a modified version of the script, using the updated python
scripting style (since ParaView 3.6)
from paraview.simple import *
from paraview.simple import servermanager as sm
from paraview import vtk
# Set the pvpython path
INPUTFILE="test.vtu"
OUTPUTFILE="tested.vtu"
# create a reader
reader=XMLUnstructuredGridReader(FileName=INPUTFILE)
# get the data i.e moves data from the server to the client
data=sm.Fetch(reader)
tp=TrivialProducer()
obj=tp.GetClientSideObject()
obj.SetOutput(data)
writer=XMLUnstructuredGridWriter(DataMode=2,FileName=OUTPUTFILE)
writer.UpdatePipeline()
Utkarsh
On Sat, Apr 24, 2010 at 3:24 PM, <wastrel at gmail.com> wrote:
> I simplified the code and tried it on Paraview3.8.0. It reads in a vtu file,
> fetch the data and then write it back to a new file. But still got errors as
> follow.
>
> Script:
>
> from paraview.simple import *
> from paraview.simple import servermanager as sm
> from paraview import vtk
>
> # connect internally
> connection=sm.Connect()
>
> # Set the pvpython path
> INPUTFILE="test.vtu"
> OUTPUTFILE="tested.vtu"
>
> # create a reader
> reader=sm.sources.XMLUnstructuredGridReader(FileName=INPUTFILE)
>
> # get the data i.e moves data from the server to the client
> data=sm.Fetch(reader)
>
> tp=sm.sources.TrivialProducer()
> obj=tp.GetClientSideObject()
> obj.SetOutput(data)
>
> writer=sm.writers.XMLUnstructuredGridWriter(DataMode=2,FileName=OUTPUTFILE,Input=obj)
>
> writer.UpdatePipeline()
>
>
> Errors:
>
> getting appended
> vtkReductionFilter : [ ...........]
> Traceback (most recent call last):
> File "convert.py", line 88, in <module>
>
> writer=sm.writers.XMLUnstructuredGridWriter(DataMode=2,FileName=OUTPUTFILE,Input=obj)
> File
> "/home/kitware/ParaView-3-8/ParaView-3.8/ParaView3Bin/Utilities/VTKPythonWrapping/paraview/servermanager.py",
> line 186, in __init__
> File
> "/home/kitware/ParaView-3-8/ParaView-3.8/ParaView3Bin/Utilities/VTKPythonWrapping/paraview/servermanager.py",
> line 204, in __setattr__
> File
> "/home/kitware/ParaView-3-8/ParaView-3.8/ParaView3Bin/Utilities/VTKPythonWrapping/paraview/servermanager.py",
> line 2361, in setProperty
> File
> "/home/kitware/ParaView-3-8/ParaView-3.8/ParaView3Bin/Utilities/VTKPythonWrapping/paraview/servermanager.py",
> line 253, in SetPropertyWithName
> File
> "/home/kitware/ParaView-3-8/ParaView-3.8/ParaView3Bin/Utilities/VTKPythonWrapping/paraview/servermanager.py",
> line 1162, in SetData
> AttributeError: SMProxy
>
>
>
> Any clues?
>
>
> On Sat, Apr 24, 2010 at 9:41 AM, Utkarsh Ayachit
> <utkarsh.ayachit at kitware.com> wrote:
>>
>> Here are my results from 3.7 (consequently 3.8 or git master should
>> work as well).
>>
>> >>> from paraview.simple import *
>> paraview version 3.7.0, Date: 2010-03-27
>> >>> TrivialProducer()
>> <paraview.servermanager.TrivialProducer object at 0x121587e90>
>> >>> servermanager.sources.TrivialProducer()
>> <paraview.servermanager.TrivialProducer object at 0x121587d50>
>>
>> Utkarsh
>>
>> On Fri, Apr 23, 2010 at 5:44 PM, Utkarsh Ayachit
>> <utkarsh.ayachit at kitware.com> wrote:
>> > You no longer need the initial part for loading the XML. You can
>> > directly use:
>> >
>> > tp = sm.sources.TrivialProducer()
>> >
>> > and that should work.
>> >
>> > Utkarsh
>> >
>> > On Fri, Apr 23, 2010 at 5:09 PM, <wastrel at gmail.com> wrote:
>> >> I used the the following snippet to generate data on the client side
>> >> but
>> >> ended up with errors:
>> >>
>> >> Code:
>> >> sm = servermanager
>> >> f = open('trivialproducer.xml', 'r')
>> >> parser = sm.vtkSMXMLParser()
>> >> parser.Parse(f.read())
>> >> parser.ProcessConfiguration(sm.vtkSMObject.GetProxyManager())
>> >> # Update the modules
>> >> sm._updateModules()
>> >>
>> >> tp = sm.sources.TrivialProducer()
>> >> obj = tp.GetClientSideObject()
>> >> obj.SetOutput(pd)
>> >>
>> >> # use tp as any other source proxy
>> >>
>> >>
>> >> trivialproducer.xml:
>> >>
>> >> <ServerManagerConfiguration>
>> >> <ProxyGroup name="sources">
>> >>
>> >> <SourceProxy name="TrivialProducer"
>> >> class="vtkPVTrivialProducer">
>> >> </SourceProxy>
>> >> </ProxyGroup>
>> >>
>> >>
>> >> Errors:
>> >> ERROR: In
>> >>
>> >> /home/berk/Work/ReleaseBuilds/ParaView3/Servers/Common/vtkProcessModule.cxx,
>> >> line 1001
>> >> vtkProcessModule (0x807b790): Cannot create object of type
>> >> "vtkPVTrivialProducer".
>> >> while processing
>> >> Message 0 = New
>> >> Argument 0 = string_value {vtkPVTrivialProducer}
>> >> Argument 1 = id_value {40}
>> >>
>> >>
>> >> ERROR: In
>> >>
>> >> /home/berk/Work/ReleaseBuilds/ParaView3/Servers/Common/vtkProcessModule.cxx,
>> >> line 1002
>> >> vtkProcessModule (0x807b790): Aborting execution for debugging
>> >> purposes.
>> >>
>> >> Abort
>> >>
>> >>
>> >> _______________________________________________
>> >> 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
>> >>
>> >>
>> >
>
>
More information about the ParaView
mailing list