This method marks the beginning of a 3D view to be exported.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 24.0.0.0 (24.0.0.0)
Since: 2014
Syntax
C# |
---|
|
Visual Basic |
---|
|
Visual C++ |
---|
|
Parameters
- node
- Type: Autodesk.Revit.DBViewNode
Geometry node associated with the view.
Return Value
Return RenderNodeAction.Skip if you wish to skip exporting this view, or return RenderNodeAction.Proceed otherwise.Examples

/// <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.
}

' <summary>
' This method marks the start of processing a view (a 3D view)
' </summary>
Public Function OnViewBegin(node As ViewNode) As RenderNodeAction Implements IExportContext.OnViewBegin
' 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.
Dim theView As View3D = TryCast(m_document.GetElement(node.ViewId), View3D)
Dim viewName As String = theView.Name
' Get the view's Orientation information.
Dim theOrientation As ViewOrientation3D = theView.GetOrientation()
' Get the view's camera information, such as whether is a perspective view.
Dim camera As CameraInfo = node.GetCameraInfo()
Dim isPerspective As Boolean = camera.IsPespective
' Get the view's render setting information, such as background style.
Dim renderSettings As RenderingSettings = theView.GetRenderingSettings()
Dim bkStyle As BackgroundStyle = renderSettings.BackgroundStyle
' Get the view's sun related information
Dim sun As SunAndShadowSettings = theView.SunAndShadowSettings
' We can also determine whether we need to process instance of light objects (OnLight)
Dim needToExportLight As Boolean = (renderSettings.LightingSource <> LightingSource.ExteriorSun) AndAlso (renderSettings.LightingSource <> LightingSource.InteriorSun)
' We can either skip this view or proceed with rendering it
Return RenderNodeAction.Proceed
End Function
' <summary>
' This method marks the end of processing a view (a 3D view)
' </summary>
Public Sub OnViewEnd(elementId As ElementId) Implements IExportContext.OnViewEnd
' elementId it indicates which view has just been exported
' Note: This method is invoked even for a view that was skipped.
End Sub