[Paraview] How to re-render or update the window through python script

Junyi Han demonmerlin at gmail.com
Fri Nov 8 13:34:22 EST 2013


Hi,

Thanks for your reply. Below is my script:


'''
Created on 29 Oct 2013

@author: Junyi Han
'''
from paraview.simple import *

PVServer = 'localhost'
OutPutLocation = '/home/johnny/Application/DPD/myDPD-PVersion/'
exist = 0
count = 0
true = 1

Connect(PVServer)

while true == 1:
    OutPutFile = OutPutLocation+'local_'+str(count).zfill(4)+'.vtk'

    while exist == 0:
        try:
            with open(OutPutFile):
                exist = 1
        except IOError:
            exist = 0
    exist = 0

    reader = OpenDataFile(OutPutFile)

    reader.PointData
    view = GetRenderView()

    dp = GetDisplayProperties()
    dp.Representation = 'Surface'

    readerRep = GetRepresentation()
    readerRep.ColorArrayName = 'density_01'

# Force read
    reader.UpdatePipeline()

    Show(reader)
    Render()

# Get a nice view angle
    if count == 0:
        cam = GetActiveCamera()
        cam.Elevation(30)
        cam.Azimuth(30)
        Render()

    count = count + 1
# Stop the script killing itself
    nOutPutFile = OutPutLocation+'local_'+str(count).zfill(4)+'.vtk'
    while exist == 0:
        try:
            with open(nOutPutFile):
                exist = 1
        except IOError:
            exist = 0



2013/11/8 Burlen Loring <bloring at lbl.gov>

>  it sounds like what happens when one leaks datasets, filters, or other
> vtk objects that hold large amounts of data. Could you share your script?
>
>
> On 11/08/2013 09:55 AM, Junyi Han wrote:
>
> Hi,
>
>  I'm using python script to read data files. Render() function is called
> as many times as the number of files. I found that after I call render()
> for 40 or 50 times, the speed of rendering is very slow. Is there a way to
> solve it? Instead of calling Render() function several times, is there a
> way to update or re-render?
>
>  Best wishes,
> Junyi Han
>
>
> _______________________________________________
> 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/20131108/0ef01690/attachment.htm>


More information about the ParaView mailing list