DrawContext.GetViewRectangle Method

DrawContextGetViewRectangle Method

Gets the rectangle that represents the extent (in 2D) of the Revit view where rendering takes place.

Namespace: Autodesk.Revit.DB.DirectContext3D
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.3.0.0 (25.3.0.0)
Syntax
public static Rectangle GetViewRectangle()
Public Shared Function GetViewRectangle As Rectangle
public:
static Rectangle^ GetViewRectangle()
static member GetViewRectangle : unit -> Rectangle 

Return Value

Rectangle
The view rectangle.
Exceptions
ExceptionCondition
InvalidOperationException This DrawContext is not available because Revit is not currently rendering. In general, this DrawContext must be used in the scope of the RenderScene() callback of IDirectContext3DServer.
See Also