Revit 2025 API
IExport |
This method is called at the very start of the export process,
still before the first entity of the model was send out.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
// A context would typically maintain a variable for the document being exported private Document m_document = null; // Some contexts may find it useful to have a flag indicating // whether or not the process should be canceled (see Is private bool m_cancelled = false; // Typically, an export context has to manage a stack of transformation // for all nested objects, such as instances, lights, links, etc. private Stack<Transform> m_TransformationStack = new Stack<Transform>(); /// <summary> /// Assuming that instance variables gets initiated in the context's constructor /// </summary> /// <param name="document"></param> public MyExportContext(Document document) { m_document = document; m_TransformationStack.Push(Transform.Identity); } /// <summary> /// This method is the starting point of the export process. /// </summary> /// <remarks> /// The method is called only once and is typically used to prepare /// the context object, e.g. crate or open the output files, /// or establish a connection to an on-line renderer, etc. /// </remarks> /// <returns> /// Return true if the export process it good to start. /// </returns> public bool Start() { return true; } /// <summary> /// This method establishes the final point of the export process. /// </summary> /// <remarks> /// Resources (such as files, pipes, threads, etc.) used by the context /// should be properly released/closed inside this method. /// </remarks> public void Finish() { } /// <summary> /// This method is invoked many times during the export process. /// </summary> /// <remarks> /// Depending on internal condition of the context, it can be decided /// whether the export is to be immediately canceled or not. /// </remarks> public bool IsCanceled() { return m_cancelled; }
' A context would typically maintain a variable for the document being exported Private m_document As Document = Nothing ' Some contexts may find it useful to have a flag indicating ' whether or not the process should be canceled (see Is Private m_cancelled As Boolean = False ' Typically, an export context has to manage a stack of transformation ' for all nested objects, such as instances, lights, links, etc. Private m_TransformationStack As New Stack(Of Transform)() ' <summary> ' Assuming that instance variables gets initiated in the context's constructor ' </summary> ' <param name="document"></param> Public Sub New(document As Document) m_document = document m_TransformationStack.Push(Transform.Identity) End Sub ' <summary> ' This method is the starting point of the export process. ' </summary> ' <remarks> ' The method is called only once and is typically used to prepare ' the context object, e.g. crate or open the output files, ' or establish a connection to an on-line renderer, etc. ' </remarks> ' <returns> ' Return true if the export process it good to start. ' </returns> Public Function Start() As Boolean Implements IExportContext.Start Return True End Function ' <summary> ' This method establishes the final point of the export process. ' </summary> ' <remarks> ' Resources (such as files, pipes, threads, etc.) used by the context ' should be properly released/closed inside this method. ' </remarks> Public Sub Finish() Implements IExportContext.Finish End Sub ' <summary> ' This method is invoked many times during the export process. ' </summary> ' <remarks> ' Depending on internal condition of the context, it can be decided ' whether the export is to be immediately canceled or not. ' </remarks> Public Function IsCanceled() As Boolean Implements IExportContext.IsCanceled Return m_cancelled End Function
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also