Hello,
I coulnt find any meniton of this possibility in the GUI manual. I would like to save a image of the displayed VTK viewer. I am testing different ways to create meshes and then want to save a screenshot on the script so I can iterate over them. is this possible? I imagine that at least it is possible to send the created mesh in smesh to paravis and from there save the screenshot. if that’s is the case, I would love to know once we get the Mesh object, how one would ‘send’ it to paravis as a source filter. I know how to script in paraview so I imagine that once I have achieved this in python I could continue alone. any inputs would be appreciated.
regards
If I am not mistaken, the dump view cannot be done with python in SMESH
Here, as you described it, you can have a look at one SOLVERLAB test from which you can retrieve some code snippet and fit them to your needs:
- export the mesh as a MED file;
- import this mesh in PARAVIS;
- save the image as a PNG file.
See this example.
You can also have a look at MEDReader which implements some tests for which png images are dumped at the end of the test (using paraview view). See this example.
1 Like
thanks, i will have a look! love how the test goes from writing in English à ecrire en francais ^^ en tout cas merci beaucoup!
Thanks for raising this issue. We will escalate it. Regards.
Hi Franco and best wishes!
to dump the view you can use:
import SalomePyQt
sgPyQt = SalomePyQt.SalomePyQt()
sgPyQt.dumpView("/tmp/mesh.png")
or to save a screenshot with the Salome window:
from qtsalome import QScreen, QApplication
desktop = sgPyQt.getDesktop()
screen = QApplication.primaryScreen()
QScreen.grabWindow(screen, desktop.winId()).save('/tmp/mesh.png', 'png')
Best regards,
Christophe
3 Likes