<div dir="ltr"><pre>Hello everyone,<br><br>I am wondering if the post had any answer.<br><a href="http://www.itk.org/pipermail/vtkusers/2015-July/091641.html">http://www.itk.org/pipermail/vtkusers/2015-July/091641.html</a><br></pre><pre>I am facing the same problem, where :<br></pre><pre>- I can not set the timestep value in the exported XML file (All TimeStep values are 0)<br>- Paraview does not use the attribute TimeValues when reading XML VTK file<br> <StructuredGrid TimeValues="0.0 0.1 0.2" WholeExtent="0 9 0 9 0 9"><br></pre><pre><br></pre><pre>Below is the mail from Bernard Meehan, who reported this problem.</pre><pre><br><br><br>I’ve looked all over the wiki, and all of the books that I have, and I
just can’t figure this out. Was vtkXMLStructuredGrid just plain not
designed to handle time?
In the vts file, I can see that the time steps are saved: 0.0, 0.1, 0.2,
just like I wrote them, but when I load them into ParaView, they show up
as 0, 1, 2.
In the file it seems to record three separate time steps, but it calls
them all TimeStep=“0”
I get the feeling that I am leaving something simple out, any help would
be appreciated.
On 7/8/15, 8:02 AM, "Meehan, Bernard" <<a href="http://public.kitware.com/mailman/listinfo/vtkusers">MEEHANBT at nv.doe.gov</a>> wrote:
><i>I was hoping to be able to write a scalar field that changed over time to
</i>><i>a vtkXMLStructuredGridFile, following the example on this thread:
</i>><i><a href="http://public.kitware.com/pipermail/vtkusers/2012-November/077262.html">http://public.kitware.com/pipermail/vtkusers/2012-November/077262.html</a>
</i>><i>
</i>><i>But when I examined my ³*vts² file, the scalar function wasn¹t written to
</i>><i>a different time step. I¹d be happy to turn this into an example on the
</i>><i>wiki if I could get it to work Š
</i>><i>
</i>><i>import vtk
</i>><i>
</i>><i>NX = 10
</i>><i>NY = 10
</i>><i>NZ = 10
</i>><i>
</i>><i>#-------------------------------Create your
</i>><i>Grid-------------------------------#
</i>><i>pts = vtk.vtkPoints()
</i>><i>for i in range(NX):
</i>><i> for j in range(NY):
</i>><i> for k in range(NZ):
</i>><i> pts.InsertNextPoint(i, j, k)
</i>><i>
</i>><i>sg = vtk.vtkStructuredGrid()
</i>><i>sg.SetDimensions(NX, NY, NZ)
</i>><i>sg.SetPoints(pts)
</i>><i>
</i>><i>f1 = vtk.vtkDoubleArray()
</i>><i>f1.SetName("Function 1")
</i>><i>for i in range(NX):
</i>><i> for j in range(NY):
</i>><i> for k in range(NZ):
</i>><i> f1.InsertNextValue(i+j+k)
</i>><i>sg.GetPointData().AddArray(f1)
</i>><i>
</i>><i>#----------------------------------Save
</i>><i>File-----------------------------------#
</i>><i>w = vtk.vtkXMLStructuredGridWriter()
</i>><i>w.SetFileName("test.vts")
</i>><i>w.SetInputData(sg)
</i>><i>w.SetDataModeToAscii()
</i>><i>w.SetCompressorTypeToNone()
</i>><i>w.SetNumberOfTimeSteps(3)
</i>><i>
</i>><i>w.Start()
</i>><i>w.WriteNextTime(0.0)
</i>><i>w.WriteNextTime(0.1)
</i>><i>
</i>><i># I wanted to see if I could change "Function 1" at the third time step,
</i>><i>but
</i>><i># when I look at the file that is written, the time step for this never
</i>><i>seems
</i>><i># to change?
</i>><i>
</i>><i>f1 = vtk.vtkDoubleArray()
</i>><i>f1.SetName("Function 1")
</i>><i>for i in range(NX):
</i>><i> for j in range(NY):
</i>><i> for k in range(NZ):
</i>><i> f1.InsertNextValue(-(i+j+k))
</i>><i>sg.GetPointData().AddArray(f1)
</i>><i>sg.Modified()
</i>><i>
</i>><i>w.WriteNextTime(0.2)
</i>><i>w.Stop()
</i>></pre></div>