OnLinkBegin Method


This method marks the beginning of a link instance to be exported.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)
Since: 2014

Syntax

C#
RenderNodeAction OnLinkBegin(
	LinkNode node
)
Visual Basic
Function OnLinkBegin ( _
	node As LinkNode _
) As RenderNodeAction
Visual C++
RenderNodeAction OnLinkBegin(
	LinkNode^ node
)

Parameters

node
Type: Autodesk.Revit.DB LinkNode

Return Value

Return RenderNodeAction.Skip if you wish to skip processing this link instance, or return RenderNodeAction.Proceed otherwise.

Examples

Copy C#
/// <summary>
/// This code demonstrates how to process instances of Revit links.
/// </summary>
public RenderNodeAction OnLinkBegin(LinkNode node)
{
   // We can get more information about the family instance and its type if we need to
   ElementId symbolId = node.GetSymbolId();
   RevitLinkType linkType = m_document.GetElement(symbolId) as RevitLinkType;
   String linkDocumentName = linkType.Name;

   // Typically, an export context has to manage a stack of transformation
   // for all nested objects, such as instances, lights, links, etc.
   // A combined transformation needs to be applied to the incoming geometry
   // (providing all geometry is to be flattened in the resultant format.)
   m_TransformationStack.Push(m_TransformationStack.Peek().Multiply(node.GetTransform()));

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

/// <summary>
/// This method marks the end of processing a Revit link
/// </summary>
public void OnLinkEnd(LinkNode node)
{
   // Note: This method is invoked even for instances that were skipped.

   // If we maintain a transformation stack, we need to remove the latest one from it.
   m_TransformationStack.Pop();
}
Copy VB.NET
' <summary>
' This code demonstrates how to process instances of Revit links.
' </summary>
Public Function OnLinkBegin(node As LinkNode) As RenderNodeAction Implements IExportContext.OnLinkBegin
    ' We can get more information about the family instance and its type if we need to
    Dim symbolId As ElementId = node.GetSymbolId()
    Dim linkType As RevitLinkType = TryCast(m_document.GetElement(symbolId), RevitLinkType)
    Dim linkDocumentName As [String] = linkType.Name

    ' Typically, an export context has to manage a stack of transformation
    ' for all nested objects, such as instances, lights, links, etc.
    ' A combined transformation needs to be applied to the incoming geometry
    ' (providing all geometry is to be flattened in the resultant format.)
    m_TransformationStack.Push(m_TransformationStack.Peek().Multiply(node.GetTransform()))

    ' We can either skip this link instance or proceed with rendering it
    Return RenderNodeAction.Proceed
End Function

' <summary>
' This method marks the end of processing a Revit link
' </summary>
Public Sub OnLinkEnd(node As LinkNode) Implements IExportContext.OnLinkEnd
    ' Note: This method is invoked even for instances that were skipped.


    ' If we maintain a transformation stack, we need to remove the latest one from it.
    m_TransformationStack.Pop()
End Sub

See Also

ArchiLabs Desktop

Put AI to work inside Revit.

Give Desktop your instructions and project files to build Revit families, update model elements, and create views and schedules. Works directly in Revit and AutoCAD.

Explore Desktop →