Viewport Capture to Bitmap - how to set extents

Hi everyone,

I’m trying to capture the document from a certain viewport and am using the following VB code to do so:

    Dim View As Rhino.Display.RhinoView = document.Views.ActiveView
    If View.Equals(Nothing) Then
        Return Rhino.Commands.Result.Failure
    Else
        Dim capture As Bitmap = View.CaptureToBitmap()
        capture.Save(FilePath)
    End If

In the Rhino print dialog there are the options Viewport, Extents, Window.

How can I mirror the effect of ‘Extents’ - i.e. capture everything in the document, and use the ActiveView only to decide which direction to capture from? Should I be changing the variable “View” above, or are there arguments of CaptureToBitmap() to do this?

CaptureToBitmap() works like the ViewCaptureToClipboard and ViewCaptureToFile commands - it does not work like printing. If you want to capture some else, (e.g. the extents), then you will have to manipulate the view before capturing.

– Dale

You would need to do something like call

document.Views.ActiveView.MainViewport.ZoomExtents()

before capturing is you want to capture extents

1 Like

Perfect, thanks!