Output Capture viewpoint as bitmap

Hi,

I would like to know that is there a way to capture the viewpoint as image/bitmap on grasshopper and then connect the output from the script directly to the Squid import bitmap component so that we can download export with the capture as pdf export option on Shapediver?

I know that we can export view capture as image to a local file but can we directly get the view capture as image on grasshopper and export them as pdf?

Appreciate your help!

The only way I know to capture the contents of the viewport in Grasshopper is to use the “Capture View” component of FabTools, but this component exports the view to a local file and therefore is not supported on ShapeDiver. Such a component would have to be adapted to output a bitmap parameter instead, that could then be used within Squid. This is not possible at the moment.

The closest related functionality you could explore is to use the Make2D component to capture a view in the form of a set of curves and then use these curves to draw a bitmap with Squid.

Hi Mathieu,

Thank you for your reply. Other than using FabTools or Make2D, I am trying to write a script to directly output bitmap, but the output bitmap is at System.Drawing.Bitmap format.

When I try to connect it to the grasshopper primitive bmp component and then connect to the Squid bitmap, the error from primitive bmp component showing that “data failled to convert from Goo to GrasshopperBitmap”.

I am wondering if this script worth trying to get the viewcapture output, if not, I may just use Make2D component as you suggested.

I attached my script for your reference:

I am attaching an example C# script that takes a Bitmap as input and outputs a modified one. The DirectBitmap class in there is just an optimization that makes it much faster to manipulate individual pixels, but overall it should work to just output a System.Drawing.Bitmap, I am not sure why you are facing an error.

That being said, your script will be denied by our system, and it would not work anyways. On the ShapeDiver servers, the contents of the Rhino document are empty, so there is nothing to capture there. The only way would be to do a capture of the Grasshopper preview, which I am not quite sure is possible.

220222_BitmapScript.gh (466.9 KB)

1 Like

For the sake of completeness, I realized that it is quite straightforward to output a Bitmap object compatible with Squid and our export components from the Grasshopper preview. See the attached definition.

220222_CapturePreview.gh (14.8 KB)

Theoretically, it would not be an issue to accept this script on our system, but at the moment the cloud instances of Rhino are set to hide all previews for better performance, therefore the script would also not work… But we will discuss internally whether supporting this feature would make sense in the future.

1 Like

Thank you very much Matheiu! It will be great if the server can support such feature in the future!