I am using Paraview 5.13.3 (on Windows 11) to generate a large number of plots with pvbatch. All work fine, except a limited set of plots. In the script, the first plots is empty (except for a color bar), the second is ok, and the third is empty again. I have no idea why this is happening and how to fix it. I tried Render(), .UpdatePipeline() but to no avail.
I made a simplified version of the script that reproduces the problem, but now with two plots. The first one fails, the second one is ok. Only thing in between is that I set a display option (to a value that it already had). Why is this happening, and is this an error on my side, or a bug?
I tried several alternatives, but it seems the only work-around is to save the screenshot twice. In the current script, it works if a Render() is inserted before the SaveScreenshot, but in my original (more complicated script) that did not help.
I provide the script with one of the geometries I try to plot through the link below. The script can be executed from within a Terminal with: pvbatch mwe.py.
Hi Serge, thanks for providing the script and data. I reproduce what you see on my Mac with ParaView 6.0.0-RC3 and 5.13.3.
If I add Render() before the first SaveScreenshot call, I get an image as you are expecting in the first plot on both Mac and Windows versions of ParaView 5.13.3 and 6.0.0-RC3. I know you said that didn’t work, but it seems to work for me.
Code changes
# show color legend
dataCopyDisplay.SetScalarBarVisibility(renderView1, True)
Render()
SaveScreenshot('1-notok.png', ImageResolution=[1920,1080])
# let's do this again
dataCopyDisplay.Orientation = [0.0, 0.0, 180.0]
SaveScreenshot('2-ok.png', ImageResolution=[1920,1080])
Yes, with Render() it works with this script. However, this script is based on reading a datafile that was generated by a more advanced (and quite long) script. If I execute that one together with the screenshot, I get nothing, even when using Render() or UpdatePipeline(). So my only solution is to do the SaveScreenshot twice.
I assume this is not intended behaviour and normally, Render() is not needed before SaveScreenshot. So is this a bug? If so, shall I report this as an issue?
Unfortunately, the script I originally used (3100+ lines) contains proprietary information, lots of if statements and needs more detailed and larger input data, so is rather difficult to share. However, the attached script with simplified data and pipeline does reproduce the problem, at least when Render() is not inserted before the actual SaveScreenshot.