captureToBitmap() Method only working on Windows

I’ve been building a plugin that uses the captureToBitmap() method. I got the plugin working on Windows and then moved it over to Mac. I made sure to make a new .csproj file that uses the RhinoCommon.dll for mac, however, code blocks such as this one no longer seem to work:

b.Save(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop) + "/test_out.jpg");```

The method returns null even though the viewport appears valid (I checked the local variables in my debugger). Any thoughts on way this would happen?
1 Like

Are there any updates on this? Is the Rhino team planning on a fix to this issue for MacOS?

Thanks

Hi Yannis,

Here is the bug item: https://mcneel.myjetbrains.com/youtrack/issue/MR-3031

It is possible to script the ViewCaptureToFile command, using Rhino.RhinoApp.RunScript. Is this sufficient?

– Dale

Dale,

Thank you for replying. I am not familiar with Rhinoscript at all, so I’m wondering if this command will result in a direct output to a file, or if dialogs and/or options are involved. If the latter is the case, it is unusable for me, because I am interested in batch-processing viewport images.

I see that the bug item is newly opened; is there an expected milestone where this bug will be considered?

Thanks

Yannis

See if the attached is helpful.

TestYannis.cs (679 Bytes)

More on running Rhino command from plug-in commands:

Rhino - Run a Rhino command from a Plugin

– Dale

Dale,

Thank you very much for putting together this script. I did not have the chance yet to test it, but will soon do so and report.

Thank you.

Yannis

Dear Dale,

I have tried the script you shared, which works as expected. However, there is one issue, which is that Grasshopper geometry is not visible in the exported image. That being said, the geometry is visible if I manually use the ViewExportToFile command through the Rhino interface.

Is there any way to include GH geometry using the Rhinoscript version of ViewCaptureToFile as well? Am I missing some parameter perhaps?

I am trying to batch export images of multiple design alternatives using Rhino and GH.

Thanks!

This is a bit confusing because the sample code is just running the ViewCaptureToFile. And if I just run the above code in a non-batch way the output contains Grasshopper stuff.

How are you batching all this? Perhaps you script needs a "redraw’ or a “wait” to give Grasshopper a chance to paint…

RhinoCommon’s RhinoView.CaptureToBitmap should now work in the latest RhinoWIP (5E199w) for Mac.