Generating custom thumbnails

Hi,
I would like to understand if there is an easy way to generate custom thumbnail out of a set of objects (in RhinoCommon).

Let me phrase that better, I want to generate the thumbnail of layer-like objects that I am using in my plugin. I know that RhinoView has a CaptureToBitmap method. But my understanding is that I need to hide all the objects that I do not want to be visible within the thumbnail and then get the bitmap.

Is there another way to do this? Or I need to write a simple renderer myself? :slight_smile:

Thanks a lot
Alberto

Hi Alberto,

Are these images something you need to generate on the fly? Or can the images be pre-generated and used at a later time?

– Dale

Hi Dale,
I am creating previews for layers so it would need to generate the image on the fly. Thanks a lot!

Alberto

Hi Alberto,

Got it, thanks for the details.

RhinoCommon does not have a function that will generate preview images (like this for you). But you can probably code something up that works for you.

Basically, you need to provide a custom display conduit that draws only your preview geometry, and then capture it using DisplayPipeline.DrawToBitmap. Sorry I don’t have a sample of this.

Here are some other threads on the same topic that may help you.

How to create a control like CRhinoUiBlockPreview?

DrawtoBitmap with my own created RhinoViewport - c# RhinoCommon

– Dale

Hi Dale,
thanks a lot! That will work just fine, looks like a great start. I will share an example as soon as I got to implement it!

Alberto