I would to like automate the plot over line filter with three cases (having different grid size).I started “start trace” in paraview and all the actions are recorded in a python script. When I run "pvbatch" command, I could get plot1.csv only in last folder (i.e. case_3) but not in all three folders.
Could anyone please let me know why this script is not saving csv file in all folders. ?
Thank you very much
#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()
l=["case_1","case_2","case_3"]
for i in l:
# create a new 'Legacy VTK Reader'
case_1_0vtk = LegacyVTKReader(FileNames ['/media/skumar/Official/OF/SK/grids/testing/'+i+'/VTK/'+i+'_0.vtk'])
# get active view
renderView1 = GetActiveViewOrCreate('RenderView')
# uncomment following to set a specific view size
# renderView1.ViewSize = [1004, 490]
# show data in view
case_1_0vtkDisplay = Show(case_1_0vtk, renderView1)
# trace defaults for the display properties.
case_1_0vtkDisplay.Representation = 'Surface'
case_1_0vtkDisplay.ColorArrayName = [None, '']
case_1_0vtkDisplay.OSPRayScaleArray = 'AR'
case_1_0vtkDisplay.OSPRayScaleFunction = 'PiecewiseFunction'
case_1_0vtkDisplay.SelectOrientationVectors = 'AR'
case_1_0vtkDisplay.ScaleFactor = 0.020000000298023225
case_1_0vtkDisplay.SelectScaleArray = 'AR'
case_1_0vtkDisplay.GlyphType = 'Arrow'
case_1_0vtkDisplay.GlyphTableIndexArray = 'AR'
case_1_0vtkDisplay.DataAxesGrid = 'GridAxesRepresentation'
case_1_0vtkDisplay.PolarAxes = 'PolarAxesRepresentation'
case_1_0vtkDisplay.ScalarOpacityUnitDistance = 0.004056509360095651
# reset view to fit data
renderView1.ResetCamera()
# update the view to ensure updated data information
renderView1.Update()
# set scalar coloring
ColorBy(case_1_0vtkDisplay, ('POINTS', 'Ma'))
# rescale color and/or opacity maps used to include current data range
case_1_0vtkDisplay.RescaleTransferFunctionToDataRange(True, False)
# show color bar/color legend
case_1_0vtkDisplay.SetScalarBarVisibility(renderView1, True)
# get color transfer function/color map for 'Ma'
maLUT = GetColorTransferFunction('Ma')
# create a new 'Slice'
slice1 = Slice(Input=case_1_0vtk)
slice1.SliceType = 'Plane'
slice1.SliceOffsetValues = [0.0]
# init the 'Plane' selected for 'SliceType'
slice1.SliceType.Origin = [0.10000000149011612, 0.022600000258535147, 0.0005000000237487257]
# toggle 3D widget visibility (only when running from the GUI)
Hide3DWidgets(proxy=slice1.SliceType)
# Properties modified on slice1.SliceType
slice1.SliceType.Origin = [0.100000001490116, 0.0226000002585351, 0.000500000023748726]
slice1.SliceType.Normal = [0.0, 0.0, 1.0]
# Properties modified on slice1.SliceType
slice1.SliceType.Origin = [0.100000001490116, 0.0226000002585351, 0.000500000023748726]
slice1.SliceType.Normal = [0.0, 0.0, 1.0]
# show data in view
slice1Display = Show(slice1, renderView1)
# trace defaults for the display properties.
slice1Display.Representation = 'Surface'
slice1Display.ColorArrayName = ['POINTS', 'Ma']
slice1Display.LookupTable = maLUT
slice1Display.OSPRayScaleArray = 'AR'
slice1Display.OSPRayScaleFunction = 'PiecewiseFunction'
slice1Display.SelectOrientationVectors = 'AR'
slice1Display.ScaleFactor = 0.020000000298023225
slice1Display.SelectScaleArray = 'AR'
slice1Display.GlyphType = 'Arrow'
slice1Display.GlyphTableIndexArray = 'AR'
slice1Display.DataAxesGrid = 'GridAxesRepresentation'
slice1Display.PolarAxes = 'PolarAxesRepresentation'
# hide data in view
Hide(case_1_0vtk, renderView1)
# show color bar/color legend
slice1Display.SetScalarBarVisibility(renderView1, True)
# update the view to ensure updated data information
renderView1.Update()
# create a new 'Plot Over Line'
plotOverLine1 = PlotOverLine(Input=slice1,
Source='High Resolution Line Source')
# init the 'High Resolution Line Source' selected for 'Source'
plotOverLine1.Source.Point1 = [0.0, -0.004800000227987766, 0.0005000000237487257]
plotOverLine1.Source.Point2 = [0.20000000298023224, 0.05000000074505806, 0.0005000000237487257]
# Properties modified on plotOverLine1.Source
plotOverLine1.Source.Point1 = [0.100000001490116, -0.0, 0.000500000023748726]
plotOverLine1.Source.Point2 = [0.100000001490116, 0.0500000007450581, 0.000500000023748726]
# Properties modified on plotOverLine1
plotOverLine1.Tolerance = 2.22044604925031e-16
# Properties modified on plotOverLine1.Source
plotOverLine1.Source.Point1 = [0.100000001490116, -0.0, 0.000500000023748726]
plotOverLine1.Source.Point2 = [0.100000001490116, 0.0500000007450581, 0.000500000023748726]
# show data in view
plotOverLine1Display = Show(plotOverLine1, renderView1)
# trace defaults for the display properties.
plotOverLine1Display.Representation = 'Surface'
plotOverLine1Display.ColorArrayName = ['POINTS', 'Ma']
plotOverLine1Display.LookupTable = maLUT
plotOverLine1Display.OSPRayScaleArray = 'AR'
plotOverLine1Display.OSPRayScaleFunction = 'PiecewiseFunction'
plotOverLine1Display.SelectOrientationVectors = 'AR'
plotOverLine1Display.ScaleFactor = 0.005000000074505806
plotOverLine1Display.SelectScaleArray = 'AR'
plotOverLine1Display.GlyphType = 'Arrow'
plotOverLine1Display.GlyphTableIndexArray = 'AR'
plotOverLine1Display.DataAxesGrid = 'GridAxesRepresentation'
plotOverLine1Display.PolarAxes = 'PolarAxesRepresentation'
# Create a new 'Line Chart View'
lineChartView1 = CreateView('XYChartView')
lineChartView1.ViewSize = [497, 490]
# get layout
layout1 = GetLayout()
# place view in the layout
#layout1.AssignView(2, lineChartView1)
# show data in view
plotOverLine1Display_1 = Show(plotOverLine1, lineChartView1)
# trace defaults for the display properties.
plotOverLine1Display_1.CompositeDataSetIndex = [0]
plotOverLine1Display_1.UseIndexForXAxis = 0
plotOverLine1Display_1.XArrayName = 'arc_length'
plotOverLine1Display_1.SeriesVisibility = ['alphat', 'AR', 'cellID', 'H', 'H2', 'H2O', 'H2O2', 'HO2', 'k', 'Ma', 'N2', 'nut', 'O', 'O2', 'OH', 'omega', 'p', 'Qdot', 'rho', 'T', 'U_Magnitude']
plotOverLine1Display_1.SeriesLabel = ['alphat', 'alphat', 'AR', 'AR', 'arc_length', 'arc_length', 'cellID', 'cellID', 'H', 'H', 'H2', 'H2', 'H2O', 'H2O', 'H2O2', 'H2O2', 'HO2', 'HO2', 'k', 'k', 'Ma', 'Ma', 'N2', 'N2', 'nut', 'nut', 'O', 'O', 'O2', 'O2', 'OH', 'OH', 'omega', 'omega', 'p', 'p', 'Qdot', 'Qdot', 'rho', 'rho', 'T', 'T', 'U_X', 'U_X', 'U_Y', 'U_Y', 'U_Z', 'U_Z', 'U_Magnitude', 'U_Magnitude', 'vtkValidPointMask', 'vtkValidPointMask', 'Points_X', 'Points_X', 'Points_Y', 'Points_Y', 'Points_Z', 'Points_Z', 'Points_Magnitude', 'Points_Magnitude']
plotOverLine1Display_1.SeriesColor = ['alphat', '0', '0', '0', 'AR', '0.89', '0.1', '0.11', 'arc_length', '0.22', '0.49', '0.72', 'cellID', '0.3', '0.69', '0.29', 'H', '0.6', '0.31', '0.64', 'H2', '1', '0.5', '0', 'H2O', '0.65', '0.34', '0.16', 'H2O2', '0', '0', '0', 'HO2', '0.89', '0.1', '0.11', 'k', '0.22', '0.49', '0.72', 'Ma', '0.3', '0.69', '0.29', 'N2', '0.6', '0.31', '0.64', 'nut', '1', '0.5', '0', 'O', '0.65', '0.34', '0.16', 'O2', '0', '0', '0', 'OH', '0.89', '0.1', '0.11', 'omega', '0.22', '0.49', '0.72', 'p', '0.3', '0.69', '0.29', 'Qdot', '0.6', '0.31', '0.64', 'rho', '1', '0.5', '0', 'T', '0.65', '0.34', '0.16', 'U_X', '0', '0', '0', 'U_Y', '0.89', '0.1', '0.11', 'U_Z', '0.22', '0.49', '0.72', 'U_Magnitude', '0.3', '0.69', '0.29', 'vtkValidPointMask', '0.6', '0.31', '0.64', 'Points_X', '1', '0.5', '0', 'Points_Y', '0.65', '0.34', '0.16', 'Points_Z', '0', '0', '0', 'Points_Magnitude', '0.89', '0.1', '0.11']
plotOverLine1Display_1.SeriesPlotCorner = ['alphat', '0', 'AR', '0', 'arc_length', '0', 'cellID', '0', 'H', '0', 'H2', '0', 'H2O', '0', 'H2O2', '0', 'HO2', '0', 'k', '0', 'Ma', '0', 'N2', '0', 'nut', '0', 'O', '0', 'O2', '0', 'OH', '0', 'omega', '0', 'p', '0', 'Qdot', '0', 'rho', '0', 'T', '0', 'U_X', '0', 'U_Y', '0', 'U_Z', '0', 'U_Magnitude', '0', 'vtkValidPointMask', '0', 'Points_X', '0', 'Points_Y', '0', 'Points_Z', '0', 'Points_Magnitude', '0']
plotOverLine1Display_1.SeriesLabelPrefix = ''
plotOverLine1Display_1.SeriesLineStyle = ['alphat', '1', 'AR', '1', 'arc_length', '1', 'cellID', '1', 'H', '1', 'H2', '1', 'H2O', '1', 'H2O2', '1', 'HO2', '1', 'k', '1', 'Ma', '1', 'N2', '1', 'nut', '1', 'O', '1', 'O2', '1', 'OH', '1', 'omega', '1', 'p', '1', 'Qdot', '1', 'rho', '1', 'T', '1', 'U_X', '1', 'U_Y', '1', 'U_Z', '1', 'U_Magnitude', '1', 'vtkValidPointMask', '1', 'Points_X', '1', 'Points_Y', '1', 'Points_Z', '1', 'Points_Magnitude', '1']
plotOverLine1Display_1.SeriesLineThickness = ['alphat', '2', 'AR', '2', 'arc_length', '2', 'cellID', '2', 'H', '2', 'H2', '2', 'H2O', '2', 'H2O2', '2', 'HO2', '2', 'k', '2', 'Ma', '2', 'N2', '2', 'nut', '2', 'O', '2', 'O2', '2', 'OH', '2', 'omega', '2', 'p', '2', 'Qdot', '2', 'rho', '2', 'T', '2', 'U_X', '2', 'U_Y', '2', 'U_Z', '2', 'U_Magnitude', '2', 'vtkValidPointMask', '2', 'Points_X', '2', 'Points_Y', '2', 'Points_Z', '2', 'Points_Magnitude', '2']
plotOverLine1Display_1.SeriesMarkerStyle = ['alphat', '0', 'AR', '0', 'arc_length', '0', 'cellID', '0', 'H', '0', 'H2', '0', 'H2O', '0', 'H2O2', '0', 'HO2', '0', 'k', '0', 'Ma', '0', 'N2', '0', 'nut', '0', 'O', '0', 'O2', '0', 'OH', '0', 'omega', '0', 'p', '0', 'Qdot', '0', 'rho', '0', 'T', '0', 'U_X', '0', 'U_Y', '0', 'U_Z', '0', 'U_Magnitude', '0', 'vtkValidPointMask', '0', 'Points_X', '0', 'Points_Y', '0', 'Points_Z', '0', 'Points_Magnitude', '0']
# update the view to ensure updated data information
renderView1.Update()
# update the view to ensure updated data information
lineChartView1.Update()
# Properties modified on plotOverLine1Display_1
plotOverLine1Display_1.SeriesVisibility = []
plotOverLine1Display_1.SeriesColor = ['alphat', '0', '0', '0', 'AR', '0.889998', '0.100008', '0.110002', 'arc_length', '0.220005', '0.489998', '0.719997', 'cellID', '0.300008', '0.689998', '0.289998', 'H', '0.6', '0.310002', '0.639994', 'H2', '1', '0.500008', '0', 'H2O', '0.650004', '0.340002', '0.160006', 'H2O2', '0', '0', '0', 'HO2', '0.889998', '0.100008', '0.110002', 'k', '0.220005', '0.489998', '0.719997', 'Ma', '0.300008', '0.689998', '0.289998', 'N2', '0.6', '0.310002', '0.639994', 'nut', '1', '0.500008', '0', 'O', '0.650004', '0.340002', '0.160006', 'O2', '0', '0', '0', 'OH', '0.889998', '0.100008', '0.110002', 'omega', '0.220005', '0.489998', '0.719997', 'p', '0.300008', '0.689998', '0.289998', 'Qdot', '0.6', '0.310002', '0.639994', 'rho', '1', '0.500008', '0', 'T', '0.650004', '0.340002', '0.160006', 'U_X', '0', '0', '0', 'U_Y', '0.889998', '0.100008', '0.110002', 'U_Z', '0.220005', '0.489998', '0.719997', 'U_Magnitude', '0.300008', '0.689998', '0.289998', 'vtkValidPointMask', '0.6', '0.310002', '0.639994', 'Points_X', '1', '0.500008', '0', 'Points_Y', '0.650004', '0.340002', '0.160006', 'Points_Z', '0', '0', '0', 'Points_Magnitude', '0.889998', '0.100008', '0.110002']
plotOverLine1Display_1.SeriesPlotCorner = ['AR', '0', 'H', '0', 'H2', '0', 'H2O', '0', 'H2O2', '0', 'HO2', '0', 'Ma', '0', 'N2', '0', 'O', '0', 'O2', '0', 'OH', '0', 'Points_Magnitude', '0', 'Points_X', '0', 'Points_Y', '0', 'Points_Z', '0', 'Qdot', '0', 'T', '0', 'U_Magnitude', '0', 'U_X', '0', 'U_Y', '0', 'U_Z', '0', 'alphat', '0', 'arc_length', '0', 'cellID', '0', 'k', '0', 'nut', '0', 'omega', '0', 'p', '0', 'rho', '0', 'vtkValidPointMask', '0']
plotOverLine1Display_1.SeriesLineStyle = ['AR', '1', 'H', '1', 'H2', '1', 'H2O', '1', 'H2O2', '1', 'HO2', '1', 'Ma', '1', 'N2', '1', 'O', '1', 'O2', '1', 'OH', '1', 'Points_Magnitude', '1', 'Points_X', '1', 'Points_Y', '1', 'Points_Z', '1', 'Qdot', '1', 'T', '1', 'U_Magnitude', '1', 'U_X', '1', 'U_Y', '1', 'U_Z', '1', 'alphat', '1', 'arc_length', '1', 'cellID', '1', 'k', '1', 'nut', '1', 'omega', '1', 'p', '1', 'rho', '1', 'vtkValidPointMask', '1']
plotOverLine1Display_1.SeriesLineThickness = ['AR', '2', 'H', '2', 'H2', '2', 'H2O', '2', 'H2O2', '2', 'HO2', '2', 'Ma', '2', 'N2', '2', 'O', '2', 'O2', '2', 'OH', '2', 'Points_Magnitude', '2', 'Points_X', '2', 'Points_Y', '2', 'Points_Z', '2', 'Qdot', '2', 'T', '2', 'U_Magnitude', '2', 'U_X', '2', 'U_Y', '2', 'U_Z', '2', 'alphat', '2', 'arc_length', '2', 'cellID', '2', 'k', '2', 'nut', '2', 'omega', '2', 'p', '2', 'rho', '2', 'vtkValidPointMask', '2']
plotOverLine1Display_1.SeriesMarkerStyle = ['AR', '0', 'H', '0', 'H2', '0', 'H2O', '0', 'H2O2', '0', 'HO2', '0', 'Ma', '0', 'N2', '0', 'O', '0', 'O2', '0', 'OH', '0', 'Points_Magnitude', '0', 'Points_X', '0', 'Points_Y', '0', 'Points_Z', '0', 'Qdot', '0', 'T', '0', 'U_Magnitude', '0', 'U_X', '0', 'U_Y', '0', 'U_Z', '0', 'alphat', '0', 'arc_length', '0', 'cellID', '0', 'k', '0', 'nut', '0', 'omega', '0', 'p', '0', 'rho', '0', 'vtkValidPointMask', '0']
# Properties modified on plotOverLine1Display_1
plotOverLine1Display_1.SeriesVisibility = ['rho']
# save data
SaveData('/media/skumar/Official/OF/SK/grids/testing/'+i+'/plot1.csv', proxy=plotOverLine1)
#### saving camera placements for all active views
# current camera placement for renderView1
renderView1.CameraPosition = [0.10000000149011612, 0.022600000258535147, 0.40111610935790637]
renderView1.CameraFocalPoint = [0.10000000149011612, 0.022600000258535147, 0.0005000000237487257]
renderView1.CameraParallelScale = 0.10368707887055373
#### uncomment the following to render all views
# RenderAllViews()
# alternatively, if you want to write images, you can use SaveScreenshot(...).
You for
loop is badly formed, you are creating three readers in the same variable and then use it.
Put your whole pipeline in the loop