+ Reply to Thread
Results 1 to 5 of 5

Thread: Completing SaveRenderWindowAs command

  1. #1

    Completing SaveRenderWindowAs command

    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.

    Dan

  2. #2
    Hi Dan
    you must modify this line , you must put a space after window("_SaveRenderWindowAs "
    app.Command("_SaveRenderWindowAs " + str(filename))
    Ciao Vittorio

  3. #3
    Thanks vittorio but that did not work either.

    Dan

  4. #4
    Senior Member Steve Baer's Avatar
    Join Date
    Apr 2010
    Location
    Seattle
    Posts
    1,464
    Blog Entries
    19
    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
    Python Code:
      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
    Last edited by Steve Baer; 05-02-2010 at 07:05 PM.

  5. #5
    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

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts