No subject
Fri Mar 19 13:53:46 EDT 2010
I think my question is fairly simple: If I create a new vtkunstructuredgrid
object, how to write it to a file?
Thanks you for being so supportive!
On Sat, Apr 24, 2010 at 9:44 AM, Utkarsh Ayachit <
utkarsh.ayachit at kitware.com> wrote:
> What exactly is the goal with your script? Are you always going to use
> sm.Connect() or do you intend to connect to a remote server as well?
>
> Utkarsh
>
>
>
> On Sat, Apr 24, 2010 at 12:17 AM, <wastrel at gmail.com> wrote:
> > I also tried with Paraview-3.6.2.
> >
> > Below is the code:
> >
> > #! /usr/bin/pvpython
> >
> > 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)
> >
> > ndata=vtk.vtkUnstructuredGrid();
> > ndata.CopyStructure(ndata);
> > ndata.GetPointData().AddArray(data.GetPointData().GetArray(0));
> >
> >
> > 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(ndata)
> >
> >
> >
> writer=sm.writers.XMLUnstructuredGridWriter(DataMode=1,FileName=OUTPUTFILE,Input=obj)
> >
> > writer.UpdatePipeline()
> >
> >
> > The errors:
> >
> > paraview version 3.6.2, Date: 2009-05-18
> > getting appended
> > vtkReductionFilter : [ ...........]
> > Traceback (most recent call last):
> > File "convert.py", line 83, in <module>
> >
> >
> writer=sm.writers.XMLUnstructuredGridWriter(DataMode=1,FileName=OUTPUTFILE,Input=obj)
> > File
> >
> "/home/kitware/ParaView3/Utilities/BuildScripts/ParaView-3.6/ParaView3Bin/Utilities/VTKPythonWrapping/paraview/servermanager.py",
> > line 186, in __init__
> > File
> >
> "/home/kitware/ParaView3/Utilities/BuildScripts/ParaView-3.6/ParaView3Bin/Utilities/VTKPythonWrapping/paraview/servermanager.py",
> > line 204, in __setattr__
> > File
> >
> "/home/kitware/ParaView3/Utilities/BuildScripts/ParaView-3.6/ParaView3Bin/Utilities/VTKPythonWrapping/paraview/servermanager.py",
> > line 2329, in setProperty
> > File
> >
> "/home/kitware/ParaView3/Utilities/BuildScripts/ParaView-3.6/ParaView3Bin/Utilities/VTKPythonWrapping/paraview/servermanager.py",
> > line 253, in SetPropertyWithName
> > File
> >
> "/home/kitware/ParaView3/Utilities/BuildScripts/ParaView-3.6/ParaView3Bin/Utilities/VTKPythonWrapping/paraview/servermanager.py",
> > line 1155, in SetData
> > AttributeError: SMProxy
> >
> >
> > Any help will be appreciated!
> >
>
--0016363b90b455e4f80484ffbb70
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
The goal is to get the first array from the PointData of a vtu file, and th=
en write it to a new vtu file.<br><br>No, there is no remote server involve=
d. All the data files are local.<br><br>From the last email, it seems that =
the writer has issues with the data.<br>
<br>I think my question is fairly simple: If I create a new vtkunstructured=
grid object, how to write it to a file?<br><br>Thanks you for being so supp=
ortive!<br><br><br><br>
<br><br><div class=3D"gmail_quote">On Sat, Apr 24, 2010 at 9:44 AM, Utkarsh=
Ayachit <span dir=3D"ltr"><<a href=3D"mailto:utkarsh.ayachit at kitware.co=
m">utkarsh.ayachit at kitware.com</a>></span> wrote:<br><blockquote class=
=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 204, 204); margin=
: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
What exactly is the goal with your script? Are you always going to use<br>
sm.Connect() or do you intend to connect to a remote server as well?<br>
<font color=3D"#888888"><br>
Utkarsh<br>
</font><div><div></div><div class=3D"h5"><br>
<br>
<br>
On Sat, Apr 24, 2010 at 12:17 AM, =A0<<a href=3D"mailto:wastrel at gmail.co=
m">wastrel at gmail.com</a>> wrote:<br>
> I also tried with Paraview-3.6.2.<br>
><br>
> Below is the code:<br>
><br>
> #! /usr/bin/pvpython<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=3Dsm.Connect()<br>
><br>
><br>
> # Set the pvpython path<br>
> INPUTFILE=3D"test.vtu"<br>
> OUTPUTFILE=3D"tested.vtu"<br>
><br>
> # create a reader<br>
> reader=3Dsm.sources.XMLUnstructuredGridReader(FileName=3DINPUTFILE)<br=
>
><br>
> # get the data i.e moves data from the server to the client<br>
> data =3D sm.Fetch(reader)<br>
><br>
> ndata=3Dvtk.vtkUnstructuredGrid();<br>
> ndata.CopyStructure(ndata);<br>
> ndata.GetPointData().AddArray(data.GetPointData().GetArray(0));<br>
><br>
><br>
> f=3Dopen('trivialproducer.xml','r')<br>
> parser=3Dsm.vtkSMXMLParser()<br>
> parser.Parse(f.read())<br>
> parser.ProcessConfiguration(sm.vtkSMObject.GetProxyManager())<br>
><br>
> # Update the modules<br>
> sm.updateModules()<br>
><br>
> tp=3Dsm.sources.TrivialProducer()<br>
> obj=3Dtp.GetClientSideObject()<br>
> obj.SetOutput(ndata)<br>
><br>
><br>
> writer=3Dsm.writers.XMLUnstructuredGridWriter(DataMode=3D1,FileName=3D=
OUTPUTFILE,Input=3Dobj)<br>
><br>
> writer.UpdatePipeline()<br>
><br>
><br>
> The errors:<br>
><br>
> paraview version 3.6.2, Date: 2009-05-18<br>
> getting appended<br>
> vtkReductionFilter : [ ...........]<br>
> Traceback (most recent call last):<br>
> =A0 File "convert.py", line 83, in <module><br>
><br>
> writer=3Dsm.writers.XMLUnstructuredGridWriter(DataMode=3D1,FileName=3D=
OUTPUTFILE,Input=3Dobj)<br>
> =A0 File<br>
> "/home/kitware/ParaView3/Utilities/BuildScripts/ParaView-3.6/Para=
View3Bin/Utilities/VTKPythonWrapping/paraview/servermanager.py",<br>
> line 186, in __init__<br>
> =A0 File<br>
> "/home/kitware/ParaView3/Utilities/BuildScripts/ParaView-3.6/Para=
View3Bin/Utilities/VTKPythonWrapping/paraview/servermanager.py",<br>
> line 204, in __setattr__<br>
> =A0 File<br>
> "/home/kitware/ParaView3/Utilities/BuildScripts/ParaView-3.6/Para=
View3Bin/Utilities/VTKPythonWrapping/paraview/servermanager.py",<br>
> line 2329, in setProperty<br>
> =A0 File<br>
> "/home/kitware/ParaView3/Utilities/BuildScripts/ParaView-3.6/Para=
View3Bin/Utilities/VTKPythonWrapping/paraview/servermanager.py",<br>
> line 253, in SetPropertyWithName<br>
> =A0 File<br>
> "/home/kitware/ParaView3/Utilities/BuildScripts/ParaView-3.6/Para=
View3Bin/Utilities/VTKPythonWrapping/paraview/servermanager.py",<br>
> line 1155, in SetData<br>
> AttributeError: SMProxy<br>
><br>
><br>
> Any help will be appreciated!<br>
><br>
</div></div></blockquote></div><br>
--0016363b90b455e4f80484ffbb70--
More information about the ParaView
mailing list