[Paraview] Paraview python - loop to run through multiple files
Cory Quammen
cory.quammen at kitware.com
Fri Jul 7 09:27:00 EDT 2017
Rebekah,
I think you want to write
LoadState("/home/sophy/Desktop/%s.pvsm" % x)
to properly substitute your filename held in x into the path.
Also, you may want to clear out the loaded state after saving the
image, which you can do by calling
Disconnect()
Connect()
HTH,
Cory
On Fri, Jul 7, 2017 at 6:51 AM, Rebekah L <lapham1996 at gmail.com> wrote:
> Hey :)
> I'm trying to script some code so that I can load a file in and then
> WriteImage and then I want this to loop through multiple files so I don't
> have to change the code each time for the new path. My problem is that
> paraview won't recognise a path unless it is the exact path, so I can't get
> it to change automatically. Any help would be greatly appreciated. Here is
> my current code:
>
> sso2_load_python
> from paraview.simple import *
> fname = '/home/sophy/Desktop'
> #I put the files on the desktop so the path was shorter
> filenames = ["c1", "c2"]
> for x in filenames:
> Loadstate("/home/sophy/Desktop/x.pvsm")
> WriteImage("/home/sophy/Desktop/image.png")
>
> #the previous two lines have the four space indent but my phone won't let me
> type it like that
>
>
>
> Thanks - Rebekah
>
> _______________________________________________
> 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
>
--
Cory Quammen
Staff R&D Engineer
Kitware, Inc.
More information about the ParaView
mailing list