yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #20134
[Question #682159]: output picture from saved results using saveSnapshot
New question #682159 on Yade:
https://answers.launchpad.net/yade/+question/682159
I have saved a list of results by using O.save during the calculation. Now i want to load each result and output a picture. The function i use is saveSnapshot(). The following codes work,
O.load(file)
qtr = qt.Renderer()
qtr.bgColor = [1,1,1]
v = qt.View()
outpath = path+'/plot/'
v.saveSnapshot(str(O.time)[:4]+'.jpg')
But when i put these codes into a for loop, it fails with 'not support a secondary view'. Then i put a v.close() at the end of each loop, but it does not work. The following is my whole codes,
import os
from yade import qt
path = os.getcwd()
os.mkdir(path+'/plot')
for file in os.listdir(path):
if os.path.isdir(file):
continue
O.load(file)
qtr = qt.Renderer()
qtr.bgColor = [1,1,1]
v = qt.View()
outpath = path+'/plot/'
v.saveSnapshot(str(O.time)[:4]+'.jpg')
v.close()
I open a terminal in the directory consisting of the saved results and copy my codes into it and hit Enter.
--
You received this question notification because your team yade-users is
an answer contact for Yade.