IExportContext.Start
Method
Description:
This method is called at the very start of the export process, still before the first entity of the model was send out.
This method is called at the very start of the export process, still before the first entity of the model was send out.
Examples
// 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;
}