0025113: Mesh - Progress indication and user break functionality for BRepMesh component
[occt.git] / src / IMeshTools / IMeshTools_MeshBuilder.cxx
index 3b67a6c..8eb10b9 100644 (file)
@@ -47,7 +47,7 @@ IMeshTools_MeshBuilder::~IMeshTools_MeshBuilder ()
 // Function: Perform
 // Purpose : 
 //=======================================================================
-void IMeshTools_MeshBuilder::Perform ()
+void IMeshTools_MeshBuilder::Perform (const Message_ProgressRange& theRange)
 {
   ClearStatus ();
 
@@ -58,6 +58,8 @@ void IMeshTools_MeshBuilder::Perform ()
     return;
   }
 
+  Message_ProgressScope aPS(theRange, "Mesh Perform", 10);
+
   if (aContext->BuildModel ())
   {
     if (aContext->DiscretizeEdges ())
@@ -66,7 +68,7 @@ void IMeshTools_MeshBuilder::Perform ()
       {
         if (aContext->PreProcessModel())
         {
-          if (aContext->DiscretizeFaces())
+          if (aContext->DiscretizeFaces(aPS.Next(9)))
           {
             if (aContext->PostProcessModel())
             {
@@ -79,6 +81,12 @@ void IMeshTools_MeshBuilder::Perform ()
           }
           else
           {
+            if (!aPS.More())
+            {
+              SetStatus(Message_Fail8);
+              aContext->Clean();
+              return;
+            }
             SetStatus(Message_Fail6);
           }
         }
@@ -113,6 +121,6 @@ void IMeshTools_MeshBuilder::Perform ()
         Message_Warn1 : Message_Fail2);
     }
   }
-
+  aPS.Next(1);
   aContext->Clean ();
 }