Hi,
I want to create a snapshot with a Python script. We use VRED with a HTC Vive and the Goal is, that the user can create a snaphot while wearing the Vive. When I run the script, I get the message "Please disable Stereo Rendering!". Creating the snapshot using File/Export/Snapshot is possible. Is there any trick/soliution that it is possible by script?
Thanks.
Jochen
Solved! Go to Solution.
Solved by j.kaestle. Go to Solution.
Hi,
we found the solution. We use "createScreenshot" instead of "createSnapshot". There are less Options, but it is OK for us.
Regards
Jochen
One additional Information: "createScreenshot()" is available in VRED 2018, not in VRED 2017.
Regards
Jochen
Hi,
Can you write here your script ? I tried the createScreenshot() function, but there's no image file in the folder indicated by my path...neither an error message...
Don't know where i made a mistake...(I'm on VRED PRO 2018)
Thanks
Hi,
the script is very simple:
createScreenshot(filename)
I define the filename by connecting several strings (e.g. the path to the Folder, the computername and a number) to be sure that every screenshot has a unique filename.
It is important to use "/" or "\\" in the path, not "\" and add the Extension ".png". (e.g. "C:/tmp/screenshot.png")
createScreenshot("C:/tmp/screenshot.png") should work if the Folder is existing.
Do you get any message in the terminal?
Regards
What do I need to do to make sure that the screenshot isn't overwritten each time I come to take an image? I noticed you mentioned creating a string for number to be put on the end... Is there a string that would allow for a unique number each time I created a screenshot?
If you only want to be sure that in the running session the screenshot is not overwritten, a simple Counter is enough.
e.g.:
imgCount = 0
screenshot_path = "C:/Temp/Screenshots/"
screenshotName = "screenshot_" + "_" + str(imgCount) +".png"
createScreenshot(screenshot_path + screenshotName)
imgCount += 1
If you have several sessions running at the same time and saving the screenshots in the same Directory I woul add the computername to the filename:
Import socket:
localName = socket.gethostname()
screenshotName = "screenshot_" + localName + "_" + str(imgCount) +".png"
If you really want a have a unique name I would use a timestamp instead of the Counter:
Import time
Import socket
screenshotName = "screenshot_" + socket.gethostname() + "_" + str(time.time()) +".png"
I hope this helps.
Thanks mate. Just a quick one, where does the 'import time' and 'import socket' go? I can't see where how to define it...
'time' and 'socket' are Python modules which are not loaded by default. If you want to use the time()-method you must import the module 'time' which provides time and date related methods and functions.. Otherwise you will get an error message when running the script. The same with gethostname() and the module 'socket'.
Can't find what you're looking for? Ask the community or share your knowledge.