<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi<br>
<br>
I tried but still have problems with the script. How can I save
animations to *.avi using scripts? What do I have to apply my script to
save animations? I have a script that imports the timesteps (in
previous mail). Then i wrote something like this:<br>
<br>
animproxy = paraview.CreateProxy("animation", "AnimationScene",
"animation", "PVAnimationScene1")<br>
animproxy.SetStartTime( 0 )<br>
animproxy.SetEndTime( 8 )<br>
animproxy.SetFrameRate( 10 )<br>
animproxy.UpdateVTKObjects()<br>
<br>
anim = paraview.vtkSMAnimationSceneImageWriter()<br>
anim.SetFileName( "/home/miki/Desktop/testAVI.avi" )<br>
anim.SetFrameRate( 10 )<br>
anim.SetAnimationScene( animproxy )<br>
anim.Save()<br>
<br>
But it doesn't seem to work. It doesn't accept animproxy as a parameter
in SetAnimationScene.<br>
<br>
Thankyou for helping!<br>
<br>
*Michael<br>
<br>
-------- Original Message --------
<table class="moz-email-headers-table" border="0" cellpadding="0"
cellspacing="0">
<tbody>
<tr>
<th align="right" nowrap="nowrap" valign="baseline">Subject: </th>
<td>Re: Re: Save animation using python script (Utkarsh Ayachit)</td>
</tr>
<tr>
<th align="right" nowrap="nowrap" valign="baseline">Date: </th>
<td>Fri, 27 Jul 2007 14:00:30 +0200</td>
</tr>
<tr>
<th align="right" nowrap="nowrap" valign="baseline">From: </th>
<td>Michael Martinec <a class="moz-txt-link-rfc2396E" href="mailto:michael.martinec@stud.unibas.ch"><michael.martinec@stud.unibas.ch></a></td>
</tr>
<tr>
<th align="right" nowrap="nowrap" valign="baseline">To: </th>
<td><a class="moz-txt-link-abbreviated" href="mailto:paraview@paraview.org">paraview@paraview.org</a></td>
</tr>
<tr>
<th align="right" nowrap="nowrap" valign="baseline">References: </th>
<td><a class="moz-txt-link-rfc2396E" href="mailto:20070725160021.AF3741D8A6A@public.kitware.com"><20070725160021.AF3741D8A6A@public.kitware.com></a></td>
</tr>
</tbody>
</table>
<br>
<br>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
I need a little more help on this one. Could you give me an example
implementation? What is my animation scene proxy? Below is my xml file
and script (made using dump script from Jordi) for which some of you
have asked.<br>
<br>
<br>
*.pvd:<br>
<br>
<?xml version="1.0"?><br>
<VTKFile type="Collection" version="0.1" byte_order="LittleEndian"
compressor="vtkZLibDataCompressor"><br>
<Collection><br>
<DataSet timestep="0" file="000000-solution.vtu"/><br>
...<br>
<DataSet timestep="130" file="000130-solution.vtu"/><br>
</Collection><br>
</VTKFile><br>
<br>
<br>
*.py:<br>
<br>
#!/usr/local/bin/pvpython<br>
# <script>.py<br>
import paraview<br>
if paraview.ActiveConnection == None : CONSOLE = True<br>
else : CONSOLE = False<br>
if CONSOLE: # init Conn and
RenderM<br>
paraview.ActiveConnection = paraview.Connect()<br>
renderM = paraview.CreateRenderWindow()<br>
else:<br>
renders =
paraview.pyProxyManager().GetProxiesInGroup("multirendermodule",<br>
paraview.ActiveConnection)<br>
renderM = renders.values()[0].GetRenderModules()[0]<br>
<br>
# batchAnimpvd<br>
batchAnimpvd = paraview.CreateProxy("sources", "PVDReader", "sources",
"batchAnim.pvd")<br>
batchAnimpvd.SetFileName(
"/home/miki/uni/bachelor/solutions/batchAnim.pvd" )<br>
batchAnimpvd.SetTimestepValues( 0, 1, 2, 3, 4, 5, 6, 7, 8 )<br>
batchAnimpvd.UpdateVTKObjects()<br>
<br>
<br>
# tissuesvtu<br>
tissuesvtu = paraview.CreateProxy("sources",
"XMLUnstructuredGridReader", "sources", "tissues.vtu")<br>
tissuesvtu.SetCellArrayInfo( "tissues", "1" )<br>
tissuesvtu.SetCellArrayStatus( "tissues", "1" )<br>
tissuesvtu.SetFileName( "/home/miki/uni/bachelor/tissues.vtu" )<br>
# tissuesvtu.SetPointArrayInfo( "" )<br>
# tissuesvtu.SetPointArrayStatus( "" )<br>
tissuesvtu.UpdateVTKObjects()<br>
<br>
# cutFunction<br>
cutFunction = paraview.CreateProxy("implicit_functions", "Plane",
"pq_helper_proxies.348", "CutFunction")<br>
cutFunction.SetInput( batchAnimpvd )<br>
cutFunction.SetNormal( 0, 1, 0 )<br>
cutFunction.SetOffset( 0 )<br>
cutFunction.SetOrigin( -0.006899, 0.005319, -0.0310375 )<br>
cutFunction.UpdateVTKObjects()<br>
<br>
<br>
# v1tissues<br>
v1tissues = paraview.CreateProxy("lookup_tables", "PVLookupTable",
"lookup_tables", "1.tissues")<br>
v1tissues.SetColorSpace( 1 )<br>
v1tissues.SetDiscretize( 1 )<br>
v1tissues.SetHSVWrap( 0 )<br>
v1tissues.SetLockScalarRange( 0 )<br>
v1tissues.SetNumberOfTableValues( 256 )<br>
v1tissues.SetRGBPoints( 1, 0, 0, 1, 7, 1, 0, 0 )<br>
v1tissues.SetScalarRangeInitialized( 1 )<br>
v1tissues.SetUseLogScale( 0 )<br>
v1tissues.SetVectorComponent( 0 )<br>
v1tissues.SetVectorMode( 0 )<br>
v1tissues.UpdateVTKObjects()<br>
<br>
#
scalarOpacityFunction<br>
scalarOpacityFunction = paraview.CreateProxy("piecewise_functions",
"PiecewiseFunction", "pq_helper_proxies.176", "ScalarOpacityFunction")<br>
scalarOpacityFunction.SetPoints( 0, 0, 1, 1 )<br>
scalarOpacityFunction.UpdateVTKObjects()<br>
<br>
# threshold<br>
threshold = paraview.CreateProxy("filters", "Threshold", "sources",
"Threshold1")<br>
threshold.SetAllScalars( 1 )<br>
threshold.SetInput( tissuesvtu )<br>
threshold.SetSelectInputScalars( "tissues", "1" )<br>
threshold.SetThresholdBetween( 3.58, 4.42 )<br>
threshold.UpdateVTKObjects()<br>
<br>
#
scalarOpacityFunction<br>
scalarOpacityFunction = paraview.CreateProxy("piecewise_functions",
"PiecewiseFunction", "pq_helper_proxies.268", "ScalarOpacityFunction")<br>
scalarOpacityFunction.SetPoints( 0, 0, 1, 1 )<br>
scalarOpacityFunction.UpdateVTKObjects()<br>
<br>
#
scalarOpacityFunction<br>
scalarOpacityFunction = paraview.CreateProxy("piecewise_functions",
"PiecewiseFunction", "pq_helper_proxies.76", "ScalarOpacityFunction")<br>
scalarOpacityFunction.SetPoints( 25.4353, 0, 46.7218, 1 )<br>
scalarOpacityFunction.UpdateVTKObjects()<br>
<br>
# v1y<br>
v1y = paraview.CreateProxy("lookup_tables", "PVLookupTable",
"lookup_tables", "1.y")<br>
v1y.SetColorSpace( 1 )<br>
v1y.SetDiscretize( 1 )<br>
v1y.SetHSVWrap( 0 )<br>
v1y.SetLockScalarRange( 0 )<br>
v1y.SetNumberOfTableValues( 256 )<br>
v1y.SetRGBPoints( 25.4353, 0, 0, 1, 46.7218, 1, 0, 0 )<br>
v1y.SetScalarRangeInitialized( 1 )<br>
v1y.SetUseLogScale( 0 )<br>
v1y.SetVectorComponent( 0 )<br>
v1y.SetVectorMode( 0 )<br>
v1y.UpdateVTKObjects()<br>
<br>
#
scalarOpacityFunction<br>
scalarOpacityFunction = paraview.CreateProxy("piecewise_functions",
"PiecewiseFunction", "pq_helper_proxies.366", "ScalarOpacityFunction")<br>
scalarOpacityFunction.SetPoints( 0, 0, 1, 1 )<br>
scalarOpacityFunction.UpdateVTKObjects()<br>
<br>
# cut<br>
cut = paraview.CreateProxy("filters", "Cut", "sources", "Cut1")<br>
cut.SetContourValues( 0 )<br>
cut.SetCutFunction( cutFunction )<br>
cut.SetInput( batchAnimpvd )<br>
# cut.SetInputBounds( "" )<br>
cut.UpdateVTKObjects()<br>
<br>
<br>
# dataDisplay2<br>
dataDisplay2 = paraview.CreateDisplay(tissuesvtu, renderM)<br>
dataDisplay2.SetCacheUpdate( 0, -1 )<br>
dataDisplay2.SetInput( tissuesvtu )<br>
dataDisplay2.SetLODResolution( 50 )<br>
dataDisplay2.SetRepresentation( 2 )<br>
dataDisplay2.SetUpdateTime( 0 )<br>
dataDisplay2.SetVisibility( 0 )<br>
dataDisplay2.SetAmbientColor( 1, 1, 1 )<br>
# dataDisplay2.SetClippingPlanes( "" )<br>
dataDisplay2.SetColor( 1, 1, 1 )<br>
dataDisplay2.SetColorArray( "tissues" )<br>
dataDisplay2.SetColorMode( 1 )<br>
dataDisplay2.SetDiffuseColor( 1, 1, 1 )<br>
dataDisplay2.SetForceStrips( 0 )<br>
dataDisplay2.SetImmediateModeRendering( 0 )<br>
dataDisplay2.SetInterpolateScalarsBeforeMapping( 1 )<br>
dataDisplay2.SetInterpolation( 1 )<br>
dataDisplay2.SetLineWidth( 1 )<br>
dataDisplay2.SetLookupTable( v1tissues )<br>
dataDisplay2.SetMapScalars( 1 )<br>
# dataDisplay2.SetMaterial( "" )<br>
dataDisplay2.SetNumberOfSubPieces( 1 )<br>
dataDisplay2.SetOpacity( 1 )<br>
dataDisplay2.SetOrientation( 0, 0, 0 )<br>
dataDisplay2.SetOrigin( 0, 0, 0 )<br>
dataDisplay2.SetPickable( 1 )<br>
dataDisplay2.SetPointSize( 5 )<br>
dataDisplay2.SetPosition( 0, 0, 0 )<br>
# dataDisplay2.SetRenderModuleHelper( none )<br>
dataDisplay2.SetSaveCacheOnCacheUpdate( 1 )<br>
dataDisplay2.SetScalarMode( 4 )<br>
dataDisplay2.SetScalarOpacityFunction( scalarOpacityFunction )<br>
dataDisplay2.SetScalarOpacityUnitDistance( 1 )<br>
dataDisplay2.SetScalarVisibility( 1 )<br>
dataDisplay2.SetScale( 1, 1, 1 )<br>
dataDisplay2.SetShading( 0 )<br>
dataDisplay2.SetSpecularColor( 1, 1, 1 )<br>
dataDisplay2.SetSpecularPower( 100 )<br>
dataDisplay2.SetUseLookupTableScalarRange( 1 )<br>
dataDisplay2.SetUseStrips( 0 )<br>
dataDisplay2.UpdateVTKObjects()<br>
<br>
# dataDisplay3<br>
dataDisplay3 = paraview.CreateDisplay(threshold, renderM)<br>
dataDisplay3.SetCacheUpdate( 0, -1 )<br>
dataDisplay3.SetInput( threshold )<br>
dataDisplay3.SetLODResolution( 50 )<br>
dataDisplay3.SetRepresentation( 2 )<br>
dataDisplay3.SetUpdateTime( 0 )<br>
dataDisplay3.SetVisibility( 1 )<br>
dataDisplay3.SetAmbientColor( 1, 1, 1 )<br>
# dataDisplay3.SetClippingPlanes( "" )<br>
dataDisplay3.SetColor( 1, 1, 1 )<br>
dataDisplay3.SetColorArray( "tissues" )<br>
dataDisplay3.SetColorMode( 1 )<br>
dataDisplay3.SetDiffuseColor( 1, 1, 1 )<br>
dataDisplay3.SetForceStrips( 0 )<br>
dataDisplay3.SetImmediateModeRendering( 0 )<br>
dataDisplay3.SetInterpolateScalarsBeforeMapping( 1 )<br>
dataDisplay3.SetInterpolation( 1 )<br>
dataDisplay3.SetLineWidth( 1 )<br>
dataDisplay3.SetLookupTable( v1tissues )<br>
dataDisplay3.SetMapScalars( 1 )<br>
# dataDisplay3.SetMaterial( "" )<br>
dataDisplay3.SetNumberOfSubPieces( 1 )<br>
dataDisplay3.SetOpacity( 0.2 )<br>
dataDisplay3.SetOrientation( 0, 0, 0 )<br>
dataDisplay3.SetOrigin( 0, 0, 0 )<br>
dataDisplay3.SetPickable( 1 )<br>
dataDisplay3.SetPointSize( 5 )<br>
dataDisplay3.SetPosition( 0, 0, 0 )<br>
# dataDisplay3.SetRenderModuleHelper( none )<br>
dataDisplay3.SetSaveCacheOnCacheUpdate( 1 )<br>
dataDisplay3.SetScalarMode( 4 )<br>
dataDisplay3.SetScalarOpacityFunction( scalarOpacityFunction )<br>
dataDisplay3.SetScalarOpacityUnitDistance( 1 )<br>
dataDisplay3.SetScalarVisibility( 1 )<br>
dataDisplay3.SetScale( 1, 1, 1 )<br>
dataDisplay3.SetShading( 0 )<br>
dataDisplay3.SetSpecularColor( 1, 1, 1 )<br>
dataDisplay3.SetSpecularPower( 100 )<br>
dataDisplay3.SetUseLookupTableScalarRange( 1 )<br>
dataDisplay3.SetUseStrips( 0 )<br>
dataDisplay3.UpdateVTKObjects()<br>
<br>
# dataDisplay<br>
dataDisplay = paraview.CreateDisplay(batchAnimpvd, renderM)<br>
dataDisplay.SetCacheUpdate( 0, -1 )<br>
dataDisplay.SetInput( batchAnimpvd )<br>
dataDisplay.SetLODResolution( 50 )<br>
dataDisplay.SetRepresentation( 4 )<br>
dataDisplay.SetUpdateTime( 0 )<br>
dataDisplay.SetVisibility( 1 )<br>
dataDisplay.SetAmbientColor( 1, 1, 1 )<br>
# dataDisplay.SetClippingPlanes( "" )<br>
dataDisplay.SetColor( 1, 1, 1 )<br>
dataDisplay.SetColorArray( "y" )<br>
dataDisplay.SetColorMode( 1 )<br>
dataDisplay.SetDiffuseColor( 1, 1, 1 )<br>
dataDisplay.SetForceStrips( 0 )<br>
dataDisplay.SetImmediateModeRendering( 0 )<br>
dataDisplay.SetInterpolateScalarsBeforeMapping( 1 )<br>
dataDisplay.SetInterpolation( 1 )<br>
dataDisplay.SetLineWidth( 1 )<br>
dataDisplay.SetLookupTable( v1y )<br>
dataDisplay.SetMapScalars( 1 )<br>
# dataDisplay.SetMaterial( "" )<br>
dataDisplay.SetNumberOfSubPieces( 1 )<br>
dataDisplay.SetOpacity( 1 )<br>
dataDisplay.SetOrientation( 0, 0, 0 )<br>
dataDisplay.SetOrigin( 0, 0, 0 )<br>
dataDisplay.SetPickable( 1 )<br>
dataDisplay.SetPointSize( 5 )<br>
dataDisplay.SetPosition( 0, 0, 0 )<br>
# dataDisplay.SetRenderModuleHelper( none )<br>
dataDisplay.SetSaveCacheOnCacheUpdate( 1 )<br>
dataDisplay.SetScalarMode( 3 )<br>
dataDisplay.SetScalarOpacityFunction( scalarOpacityFunction )<br>
dataDisplay.SetScalarOpacityUnitDistance( 1 )<br>
dataDisplay.SetScalarVisibility( 1 )<br>
dataDisplay.SetScale( 1, 1, 1 )<br>
dataDisplay.SetShading( 0 )<br>
dataDisplay.SetSpecularColor( 1, 1, 1 )<br>
dataDisplay.SetSpecularPower( 100 )<br>
dataDisplay.SetUseLookupTableScalarRange( 1 )<br>
dataDisplay.SetUseStrips( 0 )<br>
dataDisplay.UpdateVTKObjects()<br>
<br>
# dataDisplay4<br>
dataDisplay4 = paraview.CreateDisplay(cut, renderM)<br>
dataDisplay4.SetCacheUpdate( 0, -1 )<br>
dataDisplay4.SetInput( cut )<br>
dataDisplay4.SetLODResolution( 50 )<br>
dataDisplay4.SetRepresentation( 2 )<br>
dataDisplay4.SetUpdateTime( 0 )<br>
dataDisplay4.SetVisibility( 1 )<br>
dataDisplay4.SetAmbientColor( 1, 1, 1 )<br>
# dataDisplay4.SetClippingPlanes( "" )<br>
dataDisplay4.SetColor( 1, 1, 1 )<br>
dataDisplay4.SetColorArray( "y" )<br>
dataDisplay4.SetColorMode( 1 )<br>
dataDisplay4.SetDiffuseColor( 1, 1, 1 )<br>
dataDisplay4.SetForceStrips( 0 )<br>
dataDisplay4.SetImmediateModeRendering( 0 )<br>
dataDisplay4.SetInterpolateScalarsBeforeMapping( 1 )<br>
dataDisplay4.SetInterpolation( 1 )<br>
dataDisplay4.SetLineWidth( 1 )<br>
dataDisplay4.SetLookupTable( v1y )<br>
dataDisplay4.SetMapScalars( 1 )<br>
# dataDisplay4.SetMaterial( "" )<br>
dataDisplay4.SetNumberOfSubPieces( 1 )<br>
dataDisplay4.SetOpacity( 1 )<br>
dataDisplay4.SetOrientation( 0, 1, 0 )<br>
dataDisplay4.SetOrigin( 0, 0, 0 )<br>
dataDisplay4.SetPickable( 1 )<br>
dataDisplay4.SetPointSize( 5 )<br>
dataDisplay4.SetPosition( 0, 0, 0 )<br>
# dataDisplay4.SetRenderModuleHelper( none )<br>
dataDisplay4.SetSaveCacheOnCacheUpdate( 1 )<br>
dataDisplay4.SetScalarMode( 3 )<br>
dataDisplay4.SetScalarOpacityFunction( scalarOpacityFunction )<br>
dataDisplay4.SetScalarOpacityUnitDistance( 1 )<br>
dataDisplay4.SetScalarVisibility( 1 )<br>
dataDisplay4.SetScale( 1, 1, 1 )<br>
dataDisplay4.SetShading( 0 )<br>
dataDisplay4.SetSpecularColor( 1, 1, 1 )<br>
dataDisplay4.SetSpecularPower( 100 )<br>
dataDisplay4.SetUseLookupTableScalarRange( 1 )<br>
dataDisplay4.SetUseStrips( 0 )<br>
dataDisplay4.UpdateVTKObjects()<br>
<br>
<br>
if CONSOLE:<br>
renderM.ResetCamera()<br>
renderM.StillRender()<br>
raw_input("Enter to finish")<br>
#import time ; time.sleep(2)<br>
<br>
<blockquote cite="mid20070725160021.AF3741D8A6A@public.kitware.com"
type="cite">
<pre wrap="">Utkarsh wrote:
You'll have to create a "vtkSMAnimationSceneImageWriter" object to write
an animation out. This is not a proxy. So simply create the writer
object, set properties such as "FrameRate", "FileName", "Magnification"
on it. Also set the "AnimationScene" to point to the animation scene
proxy, and the call "Save". That should write the animation out.
Utkarsh.
Michael Martinec wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi
I have created a *.pvd xml file which loads timestep and *.vtu file data
into paraview.
From paraview i can then save the animation to a *.avi file nicely. I
could also create a python script which loads the *.pvd file and brings
me to the state before saving it as an animation. But I do not know how
to save the animation from the script. What do I have to apply to the
python script?
Regards and thanx for helping!
*Michael
_______________________________________________
ParaView mailing list
<a class="moz-txt-link-abbreviated" href="mailto:ParaView@paraview.org">ParaView@paraview.org</a>
<a class="moz-txt-link-freetext"
href="http://www.paraview.org/mailman/listinfo/paraview">http://www.paraview.org/mailman/listinfo/paraview</a>
</pre>
</blockquote>
<pre wrap=""><!---->
------------------------------
_______________________________________________
ParaView mailing list
<a class="moz-txt-link-abbreviated" href="mailto:ParaView@paraview.org">ParaView@paraview.org</a>
<a class="moz-txt-link-freetext"
href="http://www.paraview.org/mailman/listinfo/paraview">http://www.paraview.org/mailman/listinfo/paraview</a>
End of ParaView Digest, Vol 39, Issue 44
****************************************
</pre>
</blockquote>
<br>
</body>
</html>