ViewCaptureToFile saves the wrong mode

I’m trying to create a bulk renderer using Python on Rhino for Mac.

  1. I set the view to rendered using -SetDisplayMode Viewport=Active Mode=Rendered _Enter which works.
  2. I render the view to file using -ViewCaptureToFile "output.png" _Enter which also works…

But the rendered view isn’t in Rendered mode, it’s in whatever was previously chosen!

Here’s the full code, in case I’ve missed something obvious:

rs.Command('_SetDisplayMode _Viewport=_Active _Mode=_Rendered _Enter')

rs.Command('-ViewCaptureToFile "thumbnails/' + filename[0:-4] + '.png" Width=' + str(width) + ' Height=' + str(height) + ' TransparentBackground=Yes _Enter')

It’s possible that the viewport isn’t updated yet when you take the Capture so it will take the old DisplayMode.

Try a rs.Redraw() between the commands.

Cheers.

Hmm, didn’t seem to do it! I also tried a Python time.sleep(1) as a last-ditch attempt to give Rhino time to catch up, but no luck.

If I could save the render window, I’d just do that, but it doesn’t seem to be implemented for Mac yet.

Sorry to hear.
Maybe @stevebaer knows whats happening?

No need to apologize - just hoping there’s a way that saves me manual rendering and saving :smile:

This doesn’t sound like a scripting issue and possibly a bug with ViewCaptureToFile. Am I confused?

If I recall correctly this was also once an issue with the PC V5 WIP.

FWIW, SaveRenderWindowAs comes up as “not implemented” on Mac.

Hi All - I am consistently having very similar issues with -ViewCaptureToFile.

Here is what is happening:

If I change views it will capture the previous view, not the new view.

If I select an object in the scene it will capture the new view - however, it will show the object highlighted even if it is no longer selected during the screen capture.

If I turn geometry on in a scene - it will omit that newly visible geometry.

Does anyone have a clue what is happening?