CreatePreviewImage rhinoscript command not working in Rhino 7

Hi,

I’m trying to create a preview image using Rhinoscript using this line:
Rhino.CreatePreviewImage("C:\Users\jordi\test.jpg")

It is working in Rhino 5 and 6 but it is not in Rhino 7 (tested on 7.2.21012.11001, 12/01/2021). I get a black image.

Hi @Jordi_Llonch,

I am able to repeat this.

https://mcneel.myjetbrains.com/youtrack/issue/RH-62382

Thanks for reporting.

– Dale

Hi @dale ,

I’m testing this on Rhino 7.3.21039.11201 and I see it is not fixed. Is it not fixed yet? I see in your tracking systems that the fix is merged.

Thanks.

Hey @Jordi_Llonch,

The release target for the fix is 7.4.

image

If you want to try the current Rhino 7.4 Release Candidate, then you can download it from here:

https://www.rhino3d.com/download/rhino-for-windows/7/latest/rc

– Dale

Thanks Dale!

Hi Dale,
I had the same issue as Jordi (the image was completely black with V7.2).
I installed 7.4 from your link, and now, the jpg created seems to be a copy of active viewport, not the render created.
Here is the file created:
ImageCreated
And here is a screen shot (I would expect the same image as the one in Legacy Rhino Render window, not the one from Perspective viewport.

It may be a bug unless there is a new parameter in the function CreatePreviewImage.

-Olivier

Yep, that’s what RhinoScript’s CreatePreviewImage method does.

If you want to script saving the render window results, then just script the SaveRenderWindowAs command.

– Dale

Hi @dale
Thank you for your reply
In V6, the Rhino.CreatePreviewImage had different behavior, it saved the RenderWindow and not the ViewPort.
I changed my script and it is OK now.
Thanks
-Ollivier

Hi @dale,
I updated the rhino version to 7.6.21127.19001 and then tried the rhinoscriptsyntax.CreatePreviewImage in rhinopython. However, the whole saved picture was still black. It seems that there is still a bug.

Hi @ruishuyan,

Try this:

SampleViewCaptureToFile.py

– Dale