AnsweredAssumed Answered

Exporting snapshots via Python scripts

Question asked by jbf_gentofte on Oct 17, 2017
Latest reply on Oct 18, 2017 by jbf_gentofte

Hello all,

 

I often need to take snapshots of my scenes and have tried to write a small python script, which would automatically export all my bookmarks. But when running the script nothing happens (or at least the directory is still empty).

 

 

Any help would be greatly appreciated.

/Jonas

 

The full script goes as follows:


'''
Created on 14/09/2017

@author: JBF
'''
from scripting import *
import View3D

# get a CityEngine instance
ce = CE()

def exportImages(directory, Tag=""):
   views = ce.get3DViews()
      for v in views:
         for b in v.getBookmarks():
            path = directory + "\_" + str(b) + str(v) + str(viewports.index(v)) + "_" + Tag + "_raw.png"
            v.restoreBookmark(b, False)
            v.snapshot(path)

if __name__ == '__main__':
   exportImages("N:\CityEngine_workspace110517\Sportsparken\images\Testmappe")

Outcomes