I’ve got an issue with the function .capturetobitmap : the elements drawn on my custom display conduit are not captured. How could I fix this?

I tried

Dim myview As Display.RhinoView = doc.Views.ActiveView
Dim Bmp As Drawing.Bitmap = myview.CaptureToBitmap(New Size(myview.Size.Width, myview.Size.Height), False, False, False)


Dim myview As Display.RhinoView = doc.Views.ActiveView
            Dim view_capture = New Display.ViewCapture With {
                .Width = myview.ActiveViewport.Size.Width,
                .Height = myview.ActiveViewport.Size.Height,
                .ScaleScreenItems = False,
                .DrawAxes = False,
                .DrawGrid = False,
                .DrawGridAxes = False,
                .TransparentBackground = True
            Dim Bmp As Drawing.Bitmap = view_capture.CaptureToBitmap(myview)

but in both cases the display conduit elements are not captured.

@stevebaer, can you help with this?

– Dale

With a breakpoint set, does the Visual Studio debugger even stop on your conduit when you try to capture to bitmap?

Hi, I’m back on the subject, sorry for not answering last year, I had to put on hold this project to work on another one.

However, I still don’t know how to capture the things drawn in my custom display conduit.
@stevebaer, I checked with a breackpoint as suggested, it does run through the displayconduit but it’s not included in the resulting bitmap…

Any idea?

What does your conduit code look like? I know this works because it is used for things like capturing Grasshopper previews so we need to figure out what is different.

Do you have a sample I could try to repeat the problem with?

I’ve created this simplified version of my conduit in a new project, and it works when it is loaded alone in rhino. (122.5 KB)
However, if my real plugin is also loaded with its conduit enabled, both are displayed as expected, but both commands using capturetoBitmap() fail to capture the displayConduits. There seems to be something in my code that prevent CaptureToBitmap to work properly even on other plugins!

I’m going to do more tests, please let me know if you have any idea.

Two additional questions:

  • Am I supposed to call the base displayConduit functions from mine?

      Protected Overrides Sub DrawOverlay(e As DrawEventArgs)
         'some code
      End Sub
  • Am I supposed to give my custom display conduit a GUID? Could it be what causes interferences?

I tested in both V6 SR26 and V7 and your capture command succeeded. Are you working with an older build of Rhino?

One possibility is that an exception is being thrown which cancels other conduits. Did you run this in a debugger to see if exceptions were thrown from your conduit?

Thanks for your help @stevebaer
I am running Rhino6 SR26 like you, and I don’t have any exception raised in debug mode.
Anyway, the display in rhinoviews works just fine, wouldn’t it also fail in case of a runtime exception?

It would. I’m just trying to think of what could possibly be causing your system to fail

Ok, thanks @stevebaer I’ll keep digging