IExportContextOnViewBegin Method

This method marks the beginning of a 3D view to be exported.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
RenderNodeAction OnViewBegin(
	ViewNode node
)

Parameters

node  ViewNode
Geometry node associated with the view.

Return Value

RenderNodeAction
Return RenderNodeAction.Skip if you wish to skip exporting this view, or return RenderNodeAction.Proceed otherwise.
Example
/// <summary>
/// This method marks the start of processing a view (a 3D view)
/// </summary>
public RenderNodeAction OnViewBegin(ViewNode node)
{
   // If we did not do so before we invoked the custom export
   // we can get information about the view from the supplied view node,
   // That includes : rendering settings, sun settings, camera data, etc.

   // Get the view information from the node.
   View3D theView = m_document.GetElement(node.ViewId) as View3D;
   string viewName = theView.Name;

   // Get the view's Orientation information.
   ViewOrientation3D theOrientation = theView.GetOrientation();

   // Get the view's camera information, such as whether is a perspective view.
   CameraInfo camera = node.GetCameraInfo();
   bool isPerspective = camera.IsPespective;

   // Get the view's render setting information, such as background style.
   RenderingSettings renderSettings = theView.GetRenderingSettings();
   BackgroundStyle bkStyle = renderSettings.BackgroundStyle;

   // Get the view's sun related information
   SunAndShadowSettings sun = theView.SunAndShadowSettings;

   // We can also determine whether we need to process instance of light objects (OnLight)
   bool needToExportLight =
      (renderSettings.LightingSource != LightingSource.ExteriorSun) &&
      (renderSettings.LightingSource != LightingSource.InteriorSun);

   // We can either skip this view or proceed with rendering it
   return RenderNodeAction.Proceed;
}

/// <summary>
/// This method marks the end of processing a view (a 3D view)
/// </summary>
public void OnViewEnd(ElementId elementId)
{
   // elementId it indicates which view has just been exported

   // Note: This method is invoked even for a view that was skipped.
}
See Also