This method marks the beginning of a link instance to be exported.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 23.0.0.0 (23.1.0.0)
Since: 2014
Syntax
C# |
---|
|
Visual Basic |
---|
|
Visual C++ |
---|
|
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

/// <summary>
/// This code demonstrates how to process instances of Revit links.
/// </summary>
public RenderNodeAction OnLinkBegin(LinkNode node)
{
// We can get more information about the Revit Link and its type if we need to
ElementId symbolId = node.SymbolId;
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();
}

' <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 Revit Link and its type if we need to
Dim symbolId As ElementId = node.SymbolId
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