Hello, I wanted to analyze my simulation result by extracting data from multiple cutlines, so I wrote a very simple Python script for this. Here we go.
Steps:
- Click Tools
- Select Python Script Editor
- In the Python Script Editor, select File >> Run
from paraview.simple import *
import numpy as np
registration_name = 'AutomaticCutline'
file_name = '/home/.../your_structure_file.pvd'
directory = '/home/.../Cutlines'
DataArray = ['Data1', 'Data2', 'Data3']
PVDFile = PVDReader(registrationName=registration_name, FileName=file_name)
plotOverLine = PlotOverLine(registrationName='PlotOverLine', Input=PVDFile)
y = np.linspace(0, -6e-8, 100)
for i, yi in enumerate(y):
path = directory + '/Cutline_%s.csv' % (i + 1)
plotOverLine.Point1 = [0.0, yi, -6e-08]
plotOverLine.Point2 = [0.0, yi, 1e-07]
SaveData(path, proxy=plotOverLine, PointDataArrays=DataArray)