[Paraview] RE : RE : using with python - VTK multifiles animate

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Tue Jul 7 11:54:49 EDT 2009


Jona,

Please keep the discussion to the mailing list so that others can
participate as well.

TimestepValues is a read-only property. With the legacy reader it's
not possible to change the time values for legacy vtk files read as a
file series. You can create a pvd file which is an xml file describing
the time values for each file, however pvd doesn't support legacy VTK
files, you need to write the new xml-based vtk files.

Utkarsh

On Tue, Jul 7, 2009 at 10:49 AM, BOUSSOIR Jonathan
167706<Jonathan.BOUSSOIR at cea.fr> wrote:
> Hi Utkarsh,
>
> Thank you very much.
>
> With AnimateReader(reader, "coupe.avi"), I can save a movie.
> Now, I would like to change the time sequence by real time.
>
> I had tried to change PlayMode = 1 (I suppose that 0 is for 'Sequence', 1 is for 'Real Time' and 2 is for 'Snap to TimeSteps')
> scene.PlayMode = 1
> and
>
> reader.TimestepValues.SetData((0,7,9,10))
> or
> reader.TimestepValues = (0,7,9,10)
>
> When I execute TimestepValues(), I have well [0.0, 7.0, 9.0, 10.0]
> But when I excute my script and I see the movie, the VTK file sequence aren't be equivalent with the sequence I had fixed.
> I don't understand why? Perhaps I have a bug in my script?
>
> I had seen that when I execute UpdatePipelineInformation() I have once again [0.0, 1.0, 2.0, 3.0]
>
> reader.TimestepValues = (0,7,9,10)
> reader.UpdatePipelineInformation()
> reader.TimestepValues
>>>> [0.0, 1.0, 2.0, 3.0]
>
>
> Can you help me how do I change the time value in the sources.LegacyVTKReader()
>
> Thanks in advance for your kind help.
>
> Regards,
> Jona
>
> My script:
>
> from paraview.simple import *
> Connect('localhost')
>
> files = ["/home/myrrha/test4/coupe01.vtk",
> "/home/myrrha/test4/coupe02.vtk",
> "/home/myrrha/test4/coupe03.vtk",
> "/home/myrrha/test4/coupe04.vtk"]
>
> reader = servermanager.sources.LegacyVTKReader(FileNames=files)
>
> reader.TimestepValues.SetData((0,5,9,10))
>
> scene = servermanager.animation.AnimationScene()
> scene.ViewModules = [GetRenderView()]
> #reader.UpdatePipelineInformation()
>
> scene.StartTime = reader.TimestepValues.GetData()[0]
> scene.EndTime = reader.TimestepValues.GetData()[-1]
> #scene.NumberOfFrames = 10
>
> scene.PlayMode = 1
>
> cue = servermanager.animation.TimeAnimationCue()
> cue.AnimatedProxy = GetRenderView()
> cue.AnimatedPropertyName = "ViewTime"
> scene.Cues = [cue]
>
> writer = servermanager.vtkSMAnimationSceneImageWriter()
> writer.SetFileName('az3.avi')
> writer.SetFrameRate(1)
> writer.SetAnimationScene(scene.SMProxy)
> writer.Save()
>
>
>
>
> -------- Message d'origine--------
> De: Utkarsh Ayachit [mailto:utkarsh.ayachit at kitware.com]
> Date: lun. 06/07/2009 14:39
> À: BOUSSOIR Jonathan 167706
> Cc: ParaView
> Objet : Re: RE : [Paraview] using with python - VTK multifiles animate
>
> Oops, I should have looked at your original script more closely.
> LegacyVTKReader can read multiple files on it's own, you don't have to
> create separate readers for each file.
> Try the following:
>
> from paraview.simple import *
> Connect('localhost')
>
> files = ["/home/myrrha/test4/coupe01.vtk",
> "/home/myrrha/test4/coupe02.vtk",
> "/home/myrrha/test4/coupe03.vtk",
> "/home/myrrha/test4/coupe04.vtk"]
>
> reader = servermanager.sources.LegacyVTKReader(FileNames=files)
>
> Show(reader)
> Render()
>
> AnimateReader(reader)
>
> Utkarsh
>
> On Mon, Jul 6, 2009 at 4:35 AM, BOUSSOIR Jonathan
> 167706<Jonathan.BOUSSOIR at cea.fr> wrote:
>> Hi Utkarsh,
>>
>> Thank you for your answer.
>> I had tried with AnimateReader but it didn't animate multifile.
>> I don't seen how to do.
>> Thanks in advance for your kind help.
>>
>> Regards,
>> Jona
>>
>> my script:
>>
>> from paraview.simple import *
>> Connect('localhost')
>>
>> files = ["/home/myrrha/test4/coupe01.vtk",
>> "/home/myrrha/test4/coupe02.vtk",
>> "/home/myrrha/test4/coupe03.vtk",
>> "/home/myrrha/test4/coupe04.vtk"]
>>
>> readers = []
>> for f in files:
>>    reader = servermanager.sources.LegacyVTKReader(FileNames=f)
>>    readers.append(reader)
>>
>> Show(readers[0])
>> Render()
>>
>> AnimateReader(readers)
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> -------- Message d'origine--------
>> De: Utkarsh Ayachit [mailto:utkarsh.ayachit at kitware.com]
>> Date: ven. 03/07/2009 15:02
>> À: BOUSSOIR Jonathan 167706
>> Cc: paraview at paraview.org
>> Objet : Re: [Paraview] using with python - VTK multifiles animate
>>
>> Doesn't the following work?
>>
>>> simple.AnimateReader(yourreader)
>>
>> If it does take a look at the implementation in
>> ParaView3Source/Utilities/VTKPythonWrapping/paraview/simple.py
>>
>> Utkarsh
>>
>>
>> On Thu, Jul 2, 2009 at 6:01 AM, BOUSSOIR Jonathan
>> 167706<Jonathan.BOUSSOIR at cea.fr> wrote:
>>>
>>> Hi all,
>>>
>>> I am work with Paraview (3.7) and with linux.
>>> I had done on Paraview to load VTK multifigure and clic a play button to see animation.
>>> I would like to do a same on Pythyn with paraview and I don't know how to do the animation.
>>>
>>>
>>> from paraview.simple import *
>>> Connect('localhost')
>>>
>>> f = ["coupe01.vtk", "coupe02.vtk", "coupe03.vtk", "coupe04.vtk"]
>>> readers = []
>>> for f in files:
>>>    reader = servermanager.sources.LegacyVTKReader(FileNames=f)
>>>    readers.append(reader)
>>>
>>> Show(readers[0])
>>> Render()
>>>
>>> # Create an animation scene
>>> scene = servermanager.animation.AnimationScene()
>>> # Add one view
>>> scene.ViewModules = [GetActiveView()]
>>>
>>> # Create a cue to animate the StartTheta property
>>> cue = servermanager.animation.KeyFrameAnimationCue()
>>> cue.AnimatedProxy = GetActiveSource()
>>>
>>> # Add it to the scene's cues
>>> scene.Cues = [cue]
>>> ....
>>>
>>> After, I don't know how I would done ?
>>> Do you have a small pyphon script to explain or if somebody can explained me how I can do.
>>>
>>> Thanks in advance for your kind help.
>>>
>>> Regards,
>>> Jona
>>>
>>>
>>> _______________________________________________
>>> 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
>>>
>>
>>
>
>
>


More information about the ParaView mailing list