OnLinkBegin Method


IExport Context On Link Begin Method

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

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

Parameters

node LinkNode

Return Value

RenderNodeAction
Return RenderNodeAction.Skip if you wish to skip processing this link instance, or return RenderNodeAction.Proceed otherwise.
Example
/// <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();
}
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 →