Hi,
I’m trying to write a short script in order to automate configuration and opening med file in paravis
This script works :
import pvsimple
pvsimple.ShowParaviewView()
# trace generated using paraview version 5.9.0
#### import the simple module from the paraview
from pvsimple import *
#### disable automatic camera reset on 'Show'
pvsimple._DisableFirstRenderCameraReset()
b = [None]
d = [None]
i = 0
# create a new 'MED Reader'
b.append("bassin/%s" % i)
d.append("bassin/%s" % i + "Display" )
b = MEDReader(registrationName='bassin' + str(i) + '.med', FileName='/media/vesvard211/Crucial X8/resultat_FSI/0.6S/maillage (1)/bassin' + str(i) + '.med')
# get animation scene
animationScene1 = GetAnimationScene()
# update animation scene based on data timesteps
animationScene1.UpdateAnimationUsingDataTimeSteps()
# Properties modified on bassin0med
b.AllArrays = ['TS0/bassin/ComSup0/Velocity@@][@@P0']
# get active view
renderView1 = GetActiveViewOrCreate('RenderView')
# show data in view
d = Show(b, renderView1, 'UnstructuredGridRepresentation')
# trace defaults for the display properties.
d.Representation = 'Surface'
# reset view to fit data
renderView1.ResetCamera()
# get the material library
materialLibrary1 = GetMaterialLibrary()
# update the view to ensure updated data information
renderView1.Update()
# set scalar coloring
ColorBy(d, ('CELLS', 'Velocity', 'Magnitude'))
# rescale color and/or opacity maps used to include current data range
d.RescaleTransferFunctionToDataRange(True, False)
# show color bar/color legend
d.SetScalarBarVisibility(renderView1, True)
# get color transfer function/color map for 'Velocity'
velocityLUT = GetColorTransferFunction('Velocity')
# get opacity transfer function/opacity map for 'Velocity'
velocityPWF = GetOpacityTransferFunction('Velocity')
#### saving camera placements for all active views
# current camera placement for renderView1
renderView1.CameraPosition = [0.12, 0.0, 1.7787239526758387]
renderView1.CameraFocalPoint = [0.12, 0.0, 0.1500000000000064]
renderView1.CameraParallelScale = 0.4215447781671621
but when i want to create a loop with this simple change
for i in range(0 , 2, 30):
new script :
pvsimple.ShowParaviewView()
# trace generated using paraview version 5.9.0
#### import the simple module from the paraview
from pvsimple import *
#### disable automatic camera reset on 'Show'
pvsimple._DisableFirstRenderCameraReset()
b = [None]
d = [None]
for i in range(0 , 2, 30):
# create a new 'MED Reader'
b.append("bassin/%s" % i)
d.append("bassin/%s" % i + "Display" )
b = MEDReader(registrationName='bassin' + str(i) + '.med', FileName='/media/vesvard211/Crucial X8/resultat_FSI/0.6S/maillage (1)/bassin' + str(i) + '.med')
# get animation scene
animationScene1 = GetAnimationScene()
# update animation scene based on data timesteps
animationScene1.UpdateAnimationUsingDataTimeSteps()
# Properties modified on bassin0med
b.AllArrays = ['TS0/bassin/ComSup0/Velocity@@][@@P0']
# get active view
renderView1 = GetActiveViewOrCreate('RenderView')
# show data in view
d = Show(b, renderView1, 'UnstructuredGridRepresentation')
# trace defaults for the display properties.
d.Representation = 'Surface'
# reset view to fit data
renderView1.ResetCamera()
# get the material library
materialLibrary1 = GetMaterialLibrary()
# update the view to ensure updated data information
renderView1.Update()
# set scalar coloring
ColorBy(d, ('CELLS', 'Velocity', 'Magnitude'))
# rescale color and/or opacity maps used to include current data range
d.RescaleTransferFunctionToDataRange(True, False)
# show color bar/color legend
d.SetScalarBarVisibility(renderView1, True)
# get color transfer function/color map for 'Velocity'
velocityLUT = GetColorTransferFunction('Velocity')
# get opacity transfer function/opacity map for 'Velocity'
velocityPWF = GetOpacityTransferFunction('Velocity')
#### saving camera placements for all active views
# current camera placement for renderView1
renderView1.CameraPosition = [0.12, 0.0, 1.7787239526758387]
renderView1.CameraFocalPoint = [0.12, 0.0, 0.1500000000000064]
renderView1.CameraParallelScale = 0.4215447781671621
it doesn’t work anymore, i have try with while instruction and it doesn’t work too
If someone can help me it will be great