|
![]() |
Ends the current sub operation. It may have either fully completed or ended early.
Namespace: Autodesk.Navisworks.Api
Assembly: Autodesk.Navisworks.Api (in Autodesk.Navisworks.Api.dll)
Syntax
Visual Basic |
---|
Public Sub EndSubOperation |
C# |
---|
public void EndSubOperation() |
Visual C++ |
---|
public: void EndSubOperation() |
Remarks
Identifies that a sub operation, which is part of a larger operation, has completed.
Examples

/// <summary> /// This illustrates using Sub processes within a progress bar /// </summary> private static void AdvancedProgressExample() { // Get the progress indicator Progress progress = Autodesk.Navisworks.Api.Application.BeginProgress(); double stage = 0.0; //------------------------------------------------------------------ //Start the first stage //------------------------------------------------------------------ progress.BeginSubOperation(0.33, "Stage 1"); //This takes up 33% of the remaining time for the total operation System.Threading.Thread.Sleep(1000); stage = DoWork(progress, stage, 0.33, 0.01); //End sub operation, pass true to tidy up the progress bar progress.EndSubOperation(true); //------------------------------------------------------------------ //Begin second stage, update main percentage //------------------------------------------------------------------ progress.BeginSubOperation(0.5, "Stage 2"); //This takes up 50% of the remaining time, ( 34% of total time) stage = DoWork(progress, stage, 0.67, 0.01); //End sub operation, pass true to tidy up the progress bar progress.EndSubOperation(true); //------------------------------------------------------------------ //Final stage, update main percentage //------------------------------------------------------------------ progress.BeginSubOperation(1.0, "Stage 3"); //This takes up all the remaining time. (33% of the total time stage = DoWork(progress, stage, 1.0, 0.01); //End sub operation, pass true to tidy up the progress bar progress.EndSubOperation(true); //------------------------------------------------------------------ // End progress bar lifetime Autodesk.Navisworks.Api.Application.EndProgress(); } /// <summary> /// Does some arbitrary work /// </summary> /// <param name="progress">the progress object passed from the API</param> /// <param name="stage">the current overall position</param> /// <param name="maxValue">the max value for this chunk of work</param> /// <param name="increment">what to increment the position by</param> /// <returns></returns> private static double DoWork(Progress progress, double stage, double maxValue, double increment) { for (; stage < maxValue; stage += increment) { //Update progress bar progress.Update(stage); System.Threading.Thread.Sleep(100); } return stage; }
Exceptions
Exception | Condition |
---|---|
System..::..ObjectDisposedException | Object has been Disposed |
System..::..NotSupportedException | Object is Read-Only |