[Paraview] Using time in Python script

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Wed Aug 27 22:55:13 EDT 2014


You need to call either RenderView1.StillRender() or
RenderView1.Update() to ensure that the view updates all pipelines
shown in it after changing the AnimationTime.

Utkarsh

On Mon, Aug 11, 2014 at 1:55 AM, Elaine Tang <lingdeer at gmail.com> wrote:
> Hi,
>
> I have data in time that has time points like
> {0.02124,0.04248,0.06372,0.08496, etc.}
>
> I wrote a python script to loop through these time points with time
> increment of 0.02124 and export as .csv.
>
> ----------------------------------------------
>
> for x in range(1, 4):
>
> currentT = x*deltaT
> AnimationScene1 = GetAnimationScene()
> RenderView1 = GetRenderView()
> AnimationScene1.AnimationTime = currentT
> RenderView1.ViewTime = currentT
> RenderView1.CacheKey = currentT
> RenderView1.UseCache = 1
> RenderView1.UseCache = 0
>
> SetActiveSource(data)
> writer = CreateWriter("output.csv")
> writer.FieldAssociation = "Points"
> writer.UpdatePipeline()
> del writer
>
> Render()
>
> ------------------------------------------
>
> When I played the macro, some time points were not correctly read. (e.g.
> the 4th time point spreadsheet saved data that belong to the 3rd time
> point.)
>
> I used "start trace" to see how paraview handles time, and here is what I
> caught:
>
> --------------------------------------------------------
> try: paraview.simple
> except: from paraview.simple import *
> paraview.simple._DisableFirstRenderCameraReset()
>
> AnimationScene1 = GetAnimationScene()
> RenderView1 = GetRenderView()
> AnimationScene1.AnimationTime = 0.021239999681711197
>
> RenderView1.ViewTime = 0.021239999681711197
> RenderView1.CacheKey = 0.021239999681711197
> RenderView1.UseCache = 1
>
> AnimationScene1.AnimationTime = 0.042479999363422394
>
> RenderView1.ViewTime = 0.042479999363422394
> RenderView1.CacheKey = 0.042479999363422394
> RenderView1.UseCache = 1
>
> AnimationScene1.AnimationTime = 0.06372000277042389
>
> RenderView1.ViewTime = 0.06372000277042389
> RenderView1.CacheKey = 0.06372000277042389
> RenderView1.UseCache = 1
>
> AnimationScene1.AnimationTime = 0.08495999872684479
>
> RenderView1.ViewTime = 0.08495999872684479
> RenderView1.CacheKey = 0.08495999872684479
> RenderView1.UseCache = 1
>
> RenderView1.UseCache = 0
>
> Render()
> --------------------------------------------------------
> Then I realized, if I tried to read data at 0.08496, it will read data from
> the previous time point instead. If I explicitly specify in my script to
> read data at time 0.08495999872684479, then it will read the correct data.
>
> Anyone has any insights?
> Thanks in advance!!!
>
> --
> Elaine
>
> _______________________________________________
> 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://public.kitware.com/mailman/listinfo/paraview
>


More information about the ParaView mailing list