My purpose is to do some batch processing, and take screen shots.
Here is the script.
#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()
# create a new 'Legacy VTK Reader'
filename = '/root/Documents/huiyi/odb/100-100-30-s-p/frame32-300.0.vtk'
vtk1 = LegacyVTKReader(FileNames=[filename])
renderView1 = GetActiveViewOrCreate('RenderView')
threshold = []
thresholdDisplay = []
n = 0
SetActiveSource(vtk1)
threshold.append(Threshold(Input=vtk1))
threshold[n].Scalars = ['CELLS', 'modePE']
threshold[n].ThresholdRange = [2.0, 2.0]
thresholdDisplay.append(Show(threshold[n], renderView1))
thresholdDisplay[n].Representation = 'Surface'
ColorBy(thresholdDisplay[n], ('CELLS', 'modePE'))
thresholdDisplay[n].RescaleTransferFunctionToDataRange(True, False)
thresholdDisplay[n].SetScalarBarVisibility(renderView1, True)
renderView1.Update()
modePELUT = GetColorTransferFunction('modePE')
modePELUT.RescaleTransferFunction(0.0, 26.0)
modePEPWF = GetOpacityTransferFunction('modePE')
modePEPWF.RescaleTransferFunction(0.0, 26.0)
renderView1.CameraPosition = [50.0, 50.0, 294.28455359756214]
renderView1.CameraFocalPoint = [50.0, 50.0, 15.0]
renderView1.CameraParallelScale = 72.2841614740048
SaveScreenshot('/root/Documents/huiyi/odb/100-100-30-s-p/demo.png', renderView1, ImageResolution=[716, 452],
OverrideColorPalette='PrintBackground',
TransparentBackground=1,
# PNG options
CompressionLevel='0')
With above codes, I can get what I want in the window but nothing in the .png file.
It’s also weird that after code finishing, the Apply button is highlighted and the file --> save screenshot is deactivated.
Below is the disappointing .png
I wonder how to fix it.
P.S.
By the way, I also wanna to know the PYTHONPATH setting of my version.
It seems that I can’t find any existing path like those in former answers.
My OS is Centos 7.
My Paraview is ParaView-5.6.0-RC2-Qt5-MPI-Linux-64bit.