[Paraview] Python Programmable Filter Timesteps

Bane Sullivan banesulli at gmail.com
Sun Feb 18 21:29:10 EST 2018


I fixed this issue by adding a time step attribute to the XML of this as a
plugin following this blog post
https://blog.kitware.com/easy-customization-of-the-paraview-python-programmable-filter-property-panel/

ExtraXml = '''\
    <DoubleVectorProperty
      name="TimestepValues"
      repeatable="1"
      information_only="1">
      <TimeStepsInformationHelper/>
          <Documentation>
          Available timestep values.
          </Documentation>
    </DoubleVectorProperty>
'''


On February 18, 2018 at 6:35:27 PM, Bane Sullivan (banesulli at gmail.com)
wrote:

Is it possible to add time steps in a Programmable Filter? For example, I
have read a single static csv file with the normal delimited text reader
and I want to iterate over each row of that file at different time steps.

My RequestInformation script:
    executive = self.GetExecutive()
    outInfo = executive.GetOutputInformation(0)
    #- Get number of rows in table and use that for num time steps
    pdi = self.GetInput()
    nrows = int(pdi.GetColumn(0).GetNumberOfTuples())
# Calculate list of time steps
xtime = range(0,nrows)
    outInfo.Remove(executive.TIME_STEPS())
    for i in range(len(xtime)):
        outInfo.Append(executive.TIME_STEPS(), xtime[i])
    # Remove and set time range info
    outInfo.Remove(executive.TIME_RANGE())
    outInfo.Append(executive.TIME_RANGE(), xtime[0])
    outInfo.Append(executive.TIME_RANGE(), xtime[-1])

Then my Request Data script:
pdi = self.GetInput()
pdo = self.GetOutput()
# grab coordinates for each part of boring machine at time idx as row
executive = self.GetExecutive()
outInfo = executive.GetOutputInformation(0)
idx = outInfo.Get(executive.UPDATE_TIME_STEP())
print("Current time step: “, idx)
# NOW I SHOULD BE ABLE TO USE IDX TO ITERATE OVER EACH ROW OF THE INPUT
VTKTABLE



The time steps printed in Request Data do not reflect the time steps set in
Request Information. However if I add this little snippet to the Request
Data call it prints out the expected time steps:
print(self.GetExecutive().GetOutputInformation(0).Get(vtk.vtkStreamingDemandDrivenPipeline.TIME_STEPS()))

Is there something I am missing, or can timesteps only be set this way in a
Programmable Source?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/paraview/attachments/20180218/5471d0d1/attachment.html>


More information about the ParaView mailing list