[Paraview] help with a simple script?

Sebastien Jourdain sebastien.jourdain at kitware.com
Fri Nov 16 06:46:17 EST 2012


Hi Celia,

if you use the vtkWriter directly without using a proxy you will need to do:

writer.SetInput(o.GetClientSideObject())

But the better way to do that is by following

http://www.paraview.org/Wiki/ParaView/Python_Scripting#Writing_Data_Files_.28ParaView_3.9_or_later.29

And maybe, you might be interested in looking at some other examples here:
http://www.paraview.org/Wiki/Python_recipes

Hope that helps,

Seb


On Thu, Nov 15, 2012 at 10:22 PM, Celia Bremer <fuwsle at hotmail.com> wrote:

>
> Tim,
> Thank you. I should've said that I tried that but it didn't work. The
> "regular" trace gave a bunch of errors when I tried to run it. When I did
> smtrace.start_trace(CaptureAllProperties=True) , that recorded more stuff,
> like the parameters that I used in the various filters, and it didn't give
> any errors when I ran it, but it also didn't save the VTI files, which is
> my goal.
> The trace didn't include any output filenames so, apparently, the saving
> part doesn't get recorded. The last line in the trace is just Render().
> Rendering is a part of the process when doing "Save data", at least when
> the object is hidden like in my pipeline, so it makes sense that it's last.
> But the rest of what's involved in "save data" isn't captured by the trace.
> Celia
>
> ----------------------------------------
> > Date: Thu, 15 Nov 2012 19:22:24 -0500
> > From: tim.gallagher at gatech.edu
> > To: fuwsle at hotmail.com
> > CC: paraview at paraview.org
> > Subject: Re: [Paraview] help with a simple script?
> >
> > Use the Paraview trace feature (
> http://paraview.org/Wiki/Python_GUI_Tools#Trace) in the GUI when you do
> it once and save that.
> >
> > Then it's easy to edit the resulting script to loop over the files you
> need.
> >
> > Tim
> >
> > ----- Original Message -----
> > From: "Celia Bremer" <fuwsle at hotmail.com>
> > To: paraview at paraview.org
> > Sent: Thursday, November 15, 2012 7:20:12 PM
> > Subject: [Paraview] help with a simple script?
> >
> >
> >
> > Hello,
> >
> > I want to write a script that would open a saved state, select one of
> the objects, and save data from that object as a VTI file series. I can do
> this with the GUI, but it takes many hours to do this to each file and I
> have about 60 of them, so a script would be nice since I could loop through
> the different states. But I can't figure out how to tell PV what I want to
> render, and I also can't find how to access options like "save time series".
> >
> > ---
> > from paraview.simple import *
> > import paraview.vtk.io as vtk_io
> > servermanager.LoadState("test.pvsm")
> > o=FindSource("Outer Mesh") # this is the name of the Gaussian resampling
> filter
> > SetActiveSource(o) # it shows up if I do Show(o) so I know PV found it
> >
> > writer = vtk_io.vtkXMLImageDataWriter()
> > writer.SetInput(o)
> > # TypeError: argument 1: method requires a VTK object
> > # how do I specify that I want o as input, and that I want to save it as
> a file series?
> >
> > writer.SetFileName("test.vti")
> > writer.Write()
> >
> > # delete everything, load another state, repeat
> > ---
> >
> > I would appreciate any pointers.
> >
> > Celia
> > _______________________________________________
> > 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
> _______________________________________________
> 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/20121116/769c1491/attachment.htm>


More information about the ParaView mailing list