PDA

View Full Version : Completing SaveRenderWindowAs command



Dan_K
05-01-2010, 06:56 PM
Hi,

I am trying to script a render sequence but have not been able to get the SaveRenderWindowAs command to work properly. Here is my script:

import rhinoscript.application as app

filename = "C:\Rendered_Frames\Frame_001.png"
app.Command("_Render")
app.Command("_SaveRenderWindowAs" + str(filename))
app.Command("_CloseRenderWindow")

I have searched Rhino help and tried several variations of line 4 such as:
app.Command("_SaveRenderWindowAs 'C:\Rendered_Frames\Frame_001.png'")
but nothing has worked. :confused:

Dan

vittorio
05-02-2010, 06:00 AM
Hi Dan
you must modify this line , you must put a space after window("_SaveRenderWindowAs "
app.Command("_SaveRenderWindowAs " + str(filename))
Ciao Vittorio

Dan_K
05-02-2010, 04:19 PM
Thanks vittorio but that did not work either.

Dan

Steve Baer
05-02-2010, 07:02 PM
You probably want to use the "dashed" version of SaveRenderWindowAs which asks for a filename without showing a file dialog. The following seems to work for me

import rhinoscriptsyntax as rs

filename = "C:\\Users\\a-steve\\Desktop\\junk.png"
rs.Command("_Render")
#note the '-' in front of the command name
rs.Command("-_SaveRenderWindowAs " + filename)
rs.Command("_CloseRenderWindow")


You also want to use "\\" to define a baskslash in a string. See "escape sequences" on this page
http://docs.python.org/reference/lexical_analysis.html

Thanks,
-Steve

Dan_K
05-04-2010, 03:20 PM
Thanks Steve!

That did the trick.

I also noticed that you used escaped back slashes (\\) in the file path. That's something I wouldn't have figured out right away.

Dan