Community
VRED Forum
Welcome to Autodesk’s VRED Forums. Share your knowledge, ask questions, and explore popular VRED topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to create a snapshot using HMD

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
j.kaestle
1783 Views, 10 Replies

How to create a snapshot using HMD

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

10 REPLIES 10
Message 2 of 11
j.kaestle
in reply to: j.kaestle

Hi,

 

we found the solution. We use "createScreenshot" instead of "createSnapshot". There are less Options, but it is OK for us.

 

Regards

Jochen

Message 3 of 11
j.kaestle
in reply to: j.kaestle

One additional Information: "createScreenshot()" is available in VRED 2018, not in VRED 2017.

 

Regards

Jochen

Message 4 of 11
Anonymous
in reply to: j.kaestle

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

Message 5 of 11
j.kaestle
in reply to: Anonymous

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

Message 6 of 11
Anonymous
in reply to: j.kaestle

Thanks man, i used "\" instead of "/"...problem solved ! 🙂

Message 7 of 11
Anonymous
in reply to: j.kaestle

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?

Message 8 of 11
j.kaestle
in reply to: Anonymous

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.

Message 9 of 11
Anonymous
in reply to: j.kaestle

Thanks mate. Just a quick one, where does the 'import time' and 'import socket' go?  I can't see where how to define it...

Message 10 of 11
j.kaestle
in reply to: Anonymous

'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'.

Message 11 of 11
Anonymous
in reply to: j.kaestle

Thanks for the help mate. Sorted it. 🙂

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report