Exporting PNG from rhino

Hi All,

I am trying to export png images with my code. It seems like all steps went well without any error msg.
I also checked rhino command line to find any possible error, but it looks fine to me. But there is no images under the file folder location I have set up. What could cause this issue? Please advise.

Thank you.

Hi Hye Joo Son,

you seem to have a space in your file_path, but I can’t quite work out where the script picks up ‘Son\Desktop\render’

For starters, you define render_step() (line 24) within the for loop starting on line 10. This is not good. You never even call this function. Either move it outside of the for loop, or get rid of it. You don’t actually need it in your case.

In line 27, you join render_folder + file_path. Since your render_folder ends with a backslash, that should work. However, I would encourage you to explore the os.path module, specifically os.path.join() for more robust code.

Finally, why don’t you print() the output folder and/or output name first, just to double-check that they are what you expect? Check that the output path actually exists with os.path.isdir()

1 Like

I’d suggest going the RhinoCommon route directly (i.e. don’t script the command):



The problem is that you’re missing enclosing double-quotes around the command: file_path = " \"" + render_folder + file_name + ".png\""

If you want to use the ViewCapture class here is one sample: Issue Programmatically Saving "Raytraced" (Cycles) Renderings - #5 by nathanletwory . This particular script swaps out materials on selected objects and captures the view. If you have a Raytraced view (or other realtime render engine integration view) it’ll render for 10 passes.


Hi Axa,

Thanks for reminding me to try print() the directory and os.path.isdir().
I tried it out, and directory exists correctly as I expected…

Hi Nathan,

I appreciate your advice as a first time learner. I tried to add enclosing double-quotes around the command, and got syntaxError. What went wrong here?

You’ll note that in my example I have the extra double quotes escaped: \". The backward slashes I have are important.

I have added back slashes and still getting an error.
I also tried your first note. There was no error, but images were not exported under the output folder.

The second slash is at the wrong place. Move it one character to the left.