Generating line plots for each time step separately

Dear community,

I am currently working on some sort of specialized export.

Basically, I need PlotOverLine at different locations based on the time step. I am planing to provide an array and change the location of PlotOverLine on each time step individually via a loop.

Currently I took a step back and tried to mimic the “WriteAllTimeSteps=1” manually, which is normally a buildin function in SaveData (I am still using Paraview 4.4.0). However, the change of time step from “AnimationScene1” does not apply to “plotOverLine1”. I get the csv files (even the right number), but they all give the same result. So how do I get the change of time step applied to “plotOverLine1”?

Below the code snipped which I use. “vtu_List” is a list of all VTU files in the particular folder, “Coords” is a collection of coordinates for the line plots and “passArrays1” is a filtered subset from the original input.

set active source

SetActiveSource(passArrays1)
AnimationScene1 = GetAnimationScene()

for i in range(len(Coords)):
AnimationScene1.GoToFirst()
for j in range(len(vtu_List)):
plotOverLine1 = PlotOverLine(Input=passArrays1, Source=‘High Resolution Line Source’)

# Properties modified on plotOverLine1
plotOverLine1.Tolerance = 5.0e-16
# Properties modified on plotOverLine1.Source
plotOverLine1.Source.Point1 = Coords[i][0]
plotOverLine1.Source.Point2 = Coords[i][1]
# save data
SaveData(path+'/Export'+str(i+2)+'_'+str(j)+'.csv', proxy=plotOverLine1, Precision=8, UseScientificNotation=1)#, WriteAllTimeSteps=1)

AnimationScene1.GoToNext()

Kind regards,

Lukas

1 Like

I figured it out by myself. Here the code snipped, which did the trick:

i=0

SetActiveSource(rTT_)

tsteps = rTT_.TimestepValues

PlotOverLine1 = PlotOverLine(Input=passArrays1, Source='High Resolution Line Source')

Data = Show()

view = GetActiveView()

j=0
i=i+1
for TimeStepNum in range(len(tsteps)):
    view.ViewTime = tsteps[TimeStepNum]
    PlotOverLine1.Source.Point1 = [l1[j],0.0,T]
    PlotOverLine1.Source.Point2 = [l1[j],B,T]
    Render()
    writer = CreateWriter("Export"+str(i)+".%d.csv" %(TimeStepNum), PlotOverLine1)
    #writer.FieldAssociation = "Point Data"
    writer.UpdatePipeline()
    Render()
    del writer
    j=j+1

For clarification:
rTT_ is the name of my unstructured grid reader and passArrays1 is a filter for the desired quantities I want to write (speeds up the whole process). In variable l1, the coordinate (in x-direction) of the line plot was pre defined for every time step.

I hope this might help someone in the future.

Kind regards,

Lukas

2 Likes