0025748: Parallel version of progress indicator
[occt.git] / src / STEPControl / STEPControl_ActorRead.cxx
index 57c8c8b..8beb469 100644 (file)
@@ -29,7 +29,7 @@
 #include <Interface_Macros.hxx>
 #include <Interface_Static.hxx>
 #include <Message_Messenger.hxx>
-#include <Message_ProgressSentry.hxx>
+#include <Message_ProgressScope.hxx>
 #include <OSD_Timer.hxx>
 #include <Precision.hxx>
 #include <Standard_ErrorHandler.hxx>
@@ -278,7 +278,8 @@ Standard_Boolean  STEPControl_ActorRead::Recognize
 
 Handle(Transfer_Binder)  STEPControl_ActorRead::Transfer
 (const Handle(Standard_Transient)& start,
- const Handle(Transfer_TransientProcess)& TP)
+ const Handle(Transfer_TransientProcess)& TP,
+ const Message_ProgressRange& theProgress)
 {  
   // [BEGIN] Get version of preprocessor (to detect I-Deas case) (ssv; 23.11.2010)
   Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast ( TP->Model() );
@@ -302,7 +303,7 @@ Handle(Transfer_Binder)  STEPControl_ActorRead::Transfer
     }
   }
   // [END] Get version of preprocessor (to detect I-Deas case) (ssv; 23.11.2010)
-  return TransferShape (start, TP, Standard_True, Standard_True);
+  return TransferShape (start, TP, Standard_True, Standard_True, theProgress);
 }
 
 
@@ -468,10 +469,12 @@ static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
 //function : TransferEntity
 //purpose  : 
 //=======================================================================
- Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
-     const Handle(StepBasic_ProductDefinition)& PD,
-     const Handle(Transfer_TransientProcess)& TP,
-     const Standard_Boolean theUseTrsf)
+ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
+                   (const Handle(StepBasic_ProductDefinition)& PD,
+                    const Handle(Transfer_TransientProcess)& TP,
+                    const Standard_Boolean theUseTrsf,
+                    const Message_ProgressRange& theProgress)
+
 {
   Message_Messenger::StreamBuffer sout = TP->Messenger()->SendInfo();
   Handle(TransferBRep_ShapeBinder) shbinder;
@@ -540,11 +543,11 @@ static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
     return shbinder;
 
   // common progress indicator for translation of own shapes and sub-assemblies
-  Message_ProgressSentry PS ( TP->GetProgress(), "Part", 0, nbEnt, 1 );
+  Message_ProgressScope PS(theProgress, "Part", nbEnt);
   Standard_Integer nbComponents=0, nbShapes=0;
 
   // translate sub-assemblies
-  for ( Standard_Integer nbNauo =1; nbNauo <= listNAUO->Length() && PS.More(); nbNauo++, PS.Next()) {
+  for ( Standard_Integer nbNauo =1; nbNauo <= listNAUO->Length() && PS.More(); nbNauo++) {
     Handle(StepRepr_NextAssemblyUsageOccurrence) NAUO = 
       Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(listNAUO->Value(nbNauo));
       
@@ -553,7 +556,8 @@ static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
       sout<<" -- Actor : Ent.n0 "<<TP->Model()->Number(PD)<<" -> Shared Ent.no"<<TP->Model()->Number(NAUO)<<std::endl;
 #endif
     Handle(Transfer_Binder) binder;
-    if (!TP->IsBound(NAUO)) binder = TransferEntity(NAUO,TP);
+    Message_ProgressRange aRange = PS.Next();
+    if (!TP->IsBound(NAUO)) binder = TransferEntity(NAUO,TP, aRange);
     else                       binder = TP->Find(NAUO);
 
     TopoDS_Shape theResult = TransferBRep::ShapeResult (binder);
@@ -577,13 +581,15 @@ static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
   }
 
   // translate shapes assigned directly
-  for(Standard_Integer i=1; i <= listSDR->Length() && PS.More(); i++, PS.Next()) {
+  for(Standard_Integer i=1; i <= listSDR->Length() && PS.More(); i++) {
     Handle(StepShape_ShapeDefinitionRepresentation) sdr = 
       Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(listSDR->Value(i));
     Handle(StepShape_ShapeRepresentation) rep =  Handle(StepShape_ShapeRepresentation)::DownCast(sdr->UsedRepresentation());
     if ( rep.IsNull() )
       continue;
 
+    Message_ProgressScope aPS1(PS.Next(), NULL, 2);
+
     // translate SDR representation
     Standard_Boolean isBound = Standard_True;
     // SKL for bug 29068: transformation need to applied only for "main" ShapeDefinitionRepresentation.
@@ -592,7 +598,7 @@ static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
     Standard_Boolean useTrsf = theUseTrsf && (i <= nbNotAspect);
     Handle(Transfer_Binder) binder = TP->Find(rep);
     if (binder.IsNull())
-      binder = TransferEntity(rep, TP, isBound, useTrsf);
+      binder = TransferEntity(rep, TP, isBound, useTrsf, aPS1.Next());
 
     // if SDR is obtained from ShapeAspect and representation items have already been tramnslated,
     // this means that that ShapeAspect is used to refer to sub-shape of the main shape
@@ -642,7 +648,7 @@ static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
           // SKL for bug 29068: parameter useTrsf is used because if root entity has connection with other
           // by ShapeRepresentationRelationship then result after such transferring need to transform also.
           // This case is from test "bugs modalg_7 bug30196"
-          binder = TransferEntity(SRR, TP, nbrep, useTrsf);
+          binder = TransferEntity(SRR, TP, nbrep, useTrsf, aPS1.Next());
           if (! binder.IsNull()) {
             theResult = TransferBRep::ShapeResult (binder);
             Result1 = theResult;
@@ -686,10 +692,12 @@ static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
 //purpose  : 
 //=======================================================================
 
-Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Handle(StepRepr_NextAssemblyUsageOccurrence)& NAUO ,
-                                                                       const Handle(Transfer_TransientProcess)& TP)
+Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
+                   (const Handle(StepRepr_NextAssemblyUsageOccurrence)& NAUO,
+                    const Handle(Transfer_TransientProcess)& TP,
+                    const Message_ProgressRange& theProgress)
 {
-  Handle(TransferBRep_ShapeBinder) shbinder;
+ Handle(TransferBRep_ShapeBinder) shbinder;
   Handle(StepBasic_ProductDefinition) PD;
   const Interface_Graph& graph = TP->Graph();
   gp_Trsf Trsf;
@@ -744,10 +752,11 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
   shbinder.Nullify();
   
   if(IsDepend) {
-    
+    Message_ProgressScope aPS(theProgress, NULL, 2);
+
     if(!PD.IsNull()) {
       binder = TP->Find(PD);
-      if ( binder.IsNull() ) binder = TransferEntity(PD,TP);
+      if (binder.IsNull()) binder = TransferEntity(PD, TP, Standard_False, aPS.Next());
       theResult = TransferBRep::ShapeResult(binder);
       if (!theResult.IsNull()) {
         if (iatrsf) {
@@ -761,7 +770,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
     if ( theResult.IsNull() && !SRR.IsNull() ) {
       binder = TP->Find(SRR);
       if ( binder.IsNull() ) {
-        binder = TransferEntity(SRR,TP);
+        binder = TransferEntity(SRR, TP, 0, Standard_False, aPS.Next());
         theResult = TransferBRep::ShapeResult (binder);
         if (!theResult.IsNull())
           shbinder = new TransferBRep_ShapeBinder (theResult);
@@ -782,7 +791,8 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
     const Handle(StepShape_ShapeRepresentation)& sr,
     const Handle(Transfer_TransientProcess)& TP,
     Standard_Boolean& isBound,
-    const Standard_Boolean theUseTrsf)
+    const Standard_Boolean theUseTrsf,
+    const Message_ProgressRange& theProgress)
 {
   NM_DETECTED = Standard_False;
   Handle(TransferBRep_ShapeBinder) shbinder;
@@ -807,7 +817,6 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
   B.MakeCompound (comp);
   TopoDS_Shape OneResult;
   Standard_Integer nsh = 0;
-  Message_ProgressSentry PS ( TP->GetProgress(), "Sub-assembly", 0, nb, 1 );
 
   // [BEGIN] Proceed with non-manifold topology (ssv; 12.11.2010)
   Standard_Boolean isNMMode = Interface_Static::IVal("read.step.nonmanifold") != 0;
@@ -841,8 +850,11 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
   // [END] Proceed with non-manifold topology (ssv; 12.11.2010)
 
   gp_Trsf aTrsf;
-  for (Standard_Integer i = 1; i <= nb && PS.More(); i ++,PS.Next()) {
-  //for (i = 1; i <= nb ; i ++) {
+  Message_ProgressScope aPSRoot(theProgress, "Sub-assembly", isManifold ? 1 : 2);
+  Message_ProgressScope aPS (aPSRoot.Next(), "Transfer", nb);
+  for (Standard_Integer i = 1; i <= nb && aPS.More(); i ++)
+  {
+    Message_ProgressRange aRange = aPS.Next();
     #ifdef TRANSLOG
     if (TP->TraceLevel() > 2) 
       sout<<" -- Actor, shape_representation.item n0. "<<i<<std::endl;
@@ -887,7 +899,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
     }
     Handle(Transfer_Binder) binder;
     if (!TP->IsBound(anitem)) {
-      binder = TransferShape(anitem, TP, isManifold);
+      binder = TransferShape(anitem, TP, isManifold, Standard_False, aRange);
     }
     else {
       isBound = Standard_True;
@@ -903,6 +915,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
 
   // [BEGIN] Proceed with non-manifold topology (ssv; 12.11.2010)
   if (!isManifold) {
+    Message_ProgressScope aPS1 (aPSRoot.Next(), "Process", 1);
 
     Handle(Standard_Transient) info;
     // IMPORTANT: any fixing on non-manifold topology must be done after the shape is transferred from STEP
@@ -910,7 +923,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
       XSAlgo::AlgoContainer()->ProcessShape( comp, myPrecision, myMaxTol,
                                              "read.step.resource.name", 
                                              "read.step.sequence", info,
-                                             TP->GetProgress(), Standard_True);
+                                             aPS1.Next(), Standard_True);
     XSAlgo::AlgoContainer()->MergeTransferInfo(TP, info, nbTPitems);
 
     if (fixedResult.ShapeType() == TopAbs_COMPOUND)
@@ -1020,8 +1033,10 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
 //purpose  : 
 //=======================================================================
 
-Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Handle(StepShape_ContextDependentShapeRepresentation)& CDSR,
-                                                                       const Handle(Transfer_TransientProcess)& TP)
+Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
+                   (const Handle(StepShape_ContextDependentShapeRepresentation)& CDSR,
+                    const Handle(Transfer_TransientProcess)& TP,
+                    const Message_ProgressRange& theProgress)
 {
   Handle(TransferBRep_ShapeBinder) shbinder;
   //:j2: treat SRRs here in order to compare them with NAUO
@@ -1042,9 +1057,9 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
 
   Handle(Transfer_Binder) binder;
   Standard_Boolean isBound = Standard_False;
-    if (!TP->IsBound(rep)) binder = TransferEntity(rep,TP,isBound);
-    else binder = TP->Find(rep);
-    theResult = TransferBRep::ShapeResult (binder);
+  if (!TP->IsBound(rep)) binder = TransferEntity(rep, TP, isBound, Standard_False, theProgress);
+  else binder = TP->Find(rep);
+  theResult = TransferBRep::ShapeResult(binder);
       
   if ( ! theResult.IsNull() ) {
     if ( iatrsf ) {
@@ -1067,7 +1082,8 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
     const Handle(StepRepr_ShapeRepresentationRelationship)& und,
     const Handle(Transfer_TransientProcess)& TP,
     const Standard_Integer nbrep,
-    const Standard_Boolean theUseTrsf)
+    const Standard_Boolean theUseTrsf,
+    const Message_ProgressRange& theProgress)
 {
   //  REPRESENTATION_RELATIONSHIP et la famille
   Handle(TransferBRep_ShapeBinder) shbinder;
@@ -1087,8 +1103,10 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
   Standard_Boolean iatrsf = ComputeSRRWT ( und, TP, Trsf );
   
   //    Transfert : que faut-il prendre au juste ?
-  
-  for (Standard_Integer i = 1; i <= 2; i ++) {
+  Message_ProgressScope aPS(theProgress, NULL, 2);
+  for (Standard_Integer i = 1; i <= 2 && aPS.More(); i++)
+  {
+    Message_ProgressRange aRange = aPS.Next();
     if(nbrep && nbrep != i)
       continue;
     Handle(StepRepr_Representation) anitemt;
@@ -1097,8 +1115,8 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
     Handle(StepShape_ShapeRepresentation) anitem = Handle(StepShape_ShapeRepresentation)::DownCast(anitemt);
     Handle(Transfer_Binder) binder;
     Standard_Boolean isBound = Standard_False;
-    if (!TP->IsBound(anitem)) binder = TransferEntity(anitem, TP, isBound, theUseTrsf);
-    else                       binder = TP->Find(anitem);
+    if (!TP->IsBound(anitem)) binder = TransferEntity(anitem, TP, isBound, theUseTrsf, aRange);
+    else                     binder = TP->Find(anitem);
     TopoDS_Shape theResult = TransferBRep::ShapeResult (binder);
     if (!theResult.IsNull()) {
       OneResult = theResult;
@@ -1232,8 +1250,10 @@ static Standard_Boolean IsNeedRepresentation(const Handle(StepRepr_ShapeAspect)&
 //purpose  : 
 //=======================================================================
 
-Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::OldWay(const Handle(Standard_Transient)& start,
-                                                               const Handle(Transfer_TransientProcess)& TP)
+Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::OldWay
+                   (const Handle(Standard_Transient)& start,
+                    const Handle(Transfer_TransientProcess)& TP,
+                    const Message_ProgressRange& theProgress)
 {
   Message_Messenger::StreamBuffer sout = TP->Messenger()->SendInfo();
   const Interface_Graph& graph = TP->Graph();
@@ -1253,12 +1273,22 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::OldWay(const Handle(Stan
     }
   }
     
+  Message_ProgressScope aPSRoot(theProgress, NULL, 2);
+
 #ifdef TRANSLOG
   if (TP->TraceLevel() > 2) 
     sout<<" -- Actor : case  shape_definition_representation."<<std::endl;
 #endif
   Handle(Transfer_Binder) binder = TP->Find(rep);
-  if (binder.IsNull()) binder = TP->Transferring(rep);
+  {
+    Message_ProgressRange aRange = aPSRoot.Next();
+    if (binder.IsNull())
+    {
+      binder = TP->Transferring(rep, aRange);
+    }
+  }
+  if (aPSRoot.UserBreak())
+    return shbinder;
 //:j2    if (!binder.IsNull()) return binder;
 
 //    SDR designant des CDSR (lien implicite, via la UsedRepr)
@@ -1288,8 +1318,10 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::OldWay(const Handle(Stan
   Handle(Standard_Type) tSRR = STANDARD_TYPE(StepRepr_ShapeRepresentationRelationship);
   Standard_Integer nbitem=0;
   for (subs.Start();subs.More();subs.Next()) nbitem++;
-  Message_ProgressSentry PS ( TP->GetProgress(), "Sub", 0, nbitem, 1 );
-  for (subs.Start(); subs.More() && PS.More(); subs.Next() ,PS.Next()) {
+  Message_ProgressScope PS (aPSRoot.Next(), "Sub", nbitem);
+  for (subs.Start(); subs.More() && PS.More(); subs.Next())
+  {
+    Message_ProgressRange aRange = PS.Next();
     Handle(Standard_Transient) anitem = subs.Value();
     if ( anitem->DynamicType() != tCDSR && anitem->DynamicType() != tSRR ) continue;
 //      DeclareAndCast(StepShape_ContextDependentShapeRepresentation,anitem,subs.Value());
@@ -1299,7 +1331,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::OldWay(const Handle(Stan
       sout<<" -- Actor : Ent.n0 "<<TP->Model()->Number(start)<<" -> Shared Ent.no"<<TP->Model()->Number(anitem)<<std::endl;
 #endif
 
-    if (!TP->IsBound(anitem)) binder = TP->Transferring(anitem);
+    if (!TP->IsBound(anitem)) binder = TP->Transferring(anitem, aRange);
     else                       binder = TP->Find(anitem);
     TopoDS_Shape theResult = TransferBRep::ShapeResult (binder);
     if (!theResult.IsNull()) {
@@ -1321,9 +1353,11 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::OldWay(const Handle(Stan
 //purpose  : 
 //=======================================================================
 
-Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Handle(StepGeom_GeometricRepresentationItem)& start,
-                                                                       const Handle(Transfer_TransientProcess)& TP,
-                                                                       const Standard_Boolean isManifold)
+Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
+                   (const Handle(StepGeom_GeometricRepresentationItem)& start,
+                    const Handle(Transfer_TransientProcess)& TP,
+                    const Standard_Boolean isManifold,
+                    const Message_ProgressRange& theProgress)
 {
   Message_Messenger::StreamBuffer sout = TP->Messenger()->SendInfo();
   Handle(TransferBRep_ShapeBinder) shbinder;
@@ -1353,50 +1387,52 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
   myShapeBuilder.SetMaxTol(myMaxTol);
 
   // Start progress scope (no need to check if progress exists -- it is safe)
-  Message_ProgressSentry aPSentry(TP->GetProgress(), "Transfer stage", 0, 2, 1);
+  Message_ProgressScope aPS(theProgress, "Transfer stage", isManifold ? 2 : 1);
 
   try {
     OCC_CATCH_SIGNALS
-  if (start->IsKind(STANDARD_TYPE(StepShape_FacetedBrep))) {
-    myShapeBuilder.Init(GetCasted(StepShape_FacetedBrep, start), TP);
-    found = Standard_True;
-  } 
-  else if (start->IsKind(STANDARD_TYPE(StepShape_BrepWithVoids))) {
-    myShapeBuilder.Init(GetCasted(StepShape_BrepWithVoids, start), TP);
-    found = Standard_True;
-  } 
-  else if (start->IsKind(STANDARD_TYPE(StepShape_ManifoldSolidBrep))) {
-    myShapeBuilder.Init(GetCasted(StepShape_ManifoldSolidBrep, start), TP);
-    found = Standard_True;
-  } 
-  else if (start->IsKind(STANDARD_TYPE(StepShape_ShellBasedSurfaceModel))) {
-    myShapeBuilder.Init(GetCasted(StepShape_ShellBasedSurfaceModel, start), TP, myNMTool);
-    found = Standard_True;
-  } 
-  else if (start->IsKind(STANDARD_TYPE(StepShape_FacetedBrepAndBrepWithVoids))) {
-    myShapeBuilder.Init(GetCasted(StepShape_FacetedBrepAndBrepWithVoids, start), TP);
-    found = Standard_True;
-  } 
-  else if (start->IsKind(STANDARD_TYPE(StepShape_GeometricSet))) {
-    myShapeBuilder.Init(GetCasted(StepShape_GeometricSet, start), TP, this, isManifold);
-    found = Standard_True;
-  }
-  else if (start->IsKind(STANDARD_TYPE(StepShape_EdgeBasedWireframeModel))) {
-    myShapeBuilder.Init(GetCasted(StepShape_EdgeBasedWireframeModel, start), TP);
-    found = Standard_True;
-  }
-  else if (start->IsKind(STANDARD_TYPE(StepShape_FaceBasedSurfaceModel))) {
-    myShapeBuilder.Init(GetCasted(StepShape_FaceBasedSurfaceModel, start), TP);
-    found = Standard_True;
+    Message_ProgressRange aRange = aPS.Next();
+    if (start->IsKind(STANDARD_TYPE(StepShape_FacetedBrep))) {
+      myShapeBuilder.Init(GetCasted(StepShape_FacetedBrep, start), TP, aRange);
+      found = Standard_True;
+    } 
+    else if (start->IsKind(STANDARD_TYPE(StepShape_BrepWithVoids))) {
+      myShapeBuilder.Init(GetCasted(StepShape_BrepWithVoids, start), TP, aRange);
+      found = Standard_True;
+    } 
+    else if (start->IsKind(STANDARD_TYPE(StepShape_ManifoldSolidBrep))) {
+      myShapeBuilder.Init(GetCasted(StepShape_ManifoldSolidBrep, start), TP, aRange);
+      found = Standard_True;
+    } 
+    else if (start->IsKind(STANDARD_TYPE(StepShape_ShellBasedSurfaceModel))) {
+      myShapeBuilder.Init(GetCasted(StepShape_ShellBasedSurfaceModel, start), TP, myNMTool, aRange);
+      found = Standard_True;
+    } 
+    else if (start->IsKind(STANDARD_TYPE(StepShape_FacetedBrepAndBrepWithVoids))) {
+      myShapeBuilder.Init(GetCasted(StepShape_FacetedBrepAndBrepWithVoids, start), TP, aRange);
+      found = Standard_True;
+    } 
+    else if (start->IsKind(STANDARD_TYPE(StepShape_GeometricSet))) {
+      myShapeBuilder.Init(GetCasted(StepShape_GeometricSet, start), TP, this, isManifold, aRange);
+      found = Standard_True;
+    }
+    else if (start->IsKind(STANDARD_TYPE(StepShape_EdgeBasedWireframeModel))) {
+      myShapeBuilder.Init(GetCasted(StepShape_EdgeBasedWireframeModel, start), TP);
+      found = Standard_True;
+    }
+    else if (start->IsKind(STANDARD_TYPE(StepShape_FaceBasedSurfaceModel))) {
+      myShapeBuilder.Init(GetCasted(StepShape_FaceBasedSurfaceModel, start), TP);
+      found = Standard_True;
+    }
   }
-}
   catch(Standard_Failure const&) {
     TP->AddFail(start,"Exeption is raised. Entity was not translated.");
     TP->Bind(start, shbinder);
     return shbinder;
   }
 
-  aPSentry.Next();
+  if (aPS.UserBreak())
+    return shbinder;
   
   if (found && myShapeBuilder.IsDone()) {
     mappedShape = myShapeBuilder.Value();
@@ -1407,7 +1443,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
         XSAlgo::AlgoContainer()->ProcessShape( mappedShape, myPrecision, myMaxTol,
                                                "read.step.resource.name", 
                                                "read.step.sequence", info,
-                                               TP->GetProgress() );
+                                               aPS.Next());
       XSAlgo::AlgoContainer()->MergeTransferInfo(TP, info, nbTPitems);
     }
   }
@@ -1432,8 +1468,10 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
 //purpose  : 
 //=======================================================================
 
-Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Handle(StepRepr_MappedItem)&  mapit,
-                                                              const Handle(Transfer_TransientProcess)& TP)
+Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
+                   (const Handle(StepRepr_MappedItem)&  mapit,
+                    const Handle(Transfer_TransientProcess)& TP,
+                    const Message_ProgressRange& theProgress)
 {
   Handle(TransferBRep_ShapeBinder) shbinder;
   
@@ -1450,7 +1488,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
     DownCast(mapit->MappingSource()->MappedRepresentation());
   Standard_Boolean isBound = Standard_False; 
   Handle(Transfer_Binder) binder = TP->Find(maprep);
-  if (binder.IsNull())    binder = TransferEntity(maprep,TP,isBound);
+  if (binder.IsNull())    binder = TransferEntity(maprep,TP,isBound, Standard_False, theProgress);
   shbinder = Handle(TransferBRep_ShapeBinder)::DownCast(binder);
   if (shbinder.IsNull()) TP->AddWarning(mapit,"No Shape Produced");
   else {
@@ -1496,8 +1534,10 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
 //purpose  : 
 //=======================================================================
 
-Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Handle(StepShape_FaceSurface)& fs,
-                                                                       const Handle(Transfer_TransientProcess)& TP)
+Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
+                   (const Handle(StepShape_FaceSurface)& fs,
+                    const Handle(Transfer_TransientProcess)& TP,
+                    const Message_ProgressRange& theProgress)
 {
 
   //    Cas bien utile meme si non reconnu explicitement
@@ -1537,7 +1577,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
       TopoDS_Shape shape = XSAlgo::AlgoContainer()->ProcessShape(S, myPrecision, myMaxTol,
         "read.step.resource.name",
         "read.step.sequence", info,
-        TP->GetProgress());
+        theProgress);
       //      TopoDS_Shape shape = XSAlgo::AlgoContainer()->PerformFixShape( S, TP, myPrecision, myMaxTol );
       if (shape != S)
         sb->SetResult(shape);
@@ -1568,7 +1608,8 @@ Handle(Transfer_Binder) STEPControl_ActorRead::TransferShape(
     const Handle(Standard_Transient)& start,
     const Handle(Transfer_TransientProcess)& TP,
     const Standard_Boolean isManifold,
-    const Standard_Boolean theUseTrsf)
+    const Standard_Boolean theUseTrsf,
+    const Message_ProgressRange& theProgress)
 {
   if (start.IsNull()) return NullResult();
   XSAlgo::AlgoContainer()->PrepareForTransfer();
@@ -1589,20 +1630,20 @@ Handle(Transfer_Binder) STEPControl_ActorRead::TransferShape(
   TCollection_AsciiString aProdMode = Interface_Static::CVal("read.step.product.mode");
   if(!aProdMode.IsEqual("ON") && 
      start->IsKind(STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation))) 
-    shbinder = OldWay(start,TP);
+    shbinder = OldWay(start,TP, theProgress);
   //skl
   
   else if (start->IsKind(STANDARD_TYPE(StepBasic_ProductDefinition))) {
     Handle(StepBasic_ProductDefinition) PD =
       Handle(StepBasic_ProductDefinition)::DownCast(start);
-    shbinder = TransferEntity(PD, TP, theUseTrsf);
+    shbinder = TransferEntity(PD, TP, theUseTrsf, theProgress);
   }
   
   // NextAssemblyUsageOccurrence
   else if (start->IsKind(STANDARD_TYPE(StepRepr_NextAssemblyUsageOccurrence))) {
     Handle(StepRepr_NextAssemblyUsageOccurrence) NAUO =
       Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(start);
-    shbinder = TransferEntity(NAUO, TP);
+    shbinder = TransferEntity(NAUO, TP, theProgress);
   }
   //end skl
     
@@ -1610,7 +1651,7 @@ Handle(Transfer_Binder) STEPControl_ActorRead::TransferShape(
   else if (start->IsKind(STANDARD_TYPE(StepShape_ShapeRepresentation))) {
     DeclareAndCast(StepShape_ShapeRepresentation,sr,start);
     Standard_Boolean isBound = Standard_False;
-    shbinder = TransferEntity(sr,TP,isBound);
+    shbinder = TransferEntity(sr,TP,isBound, Standard_False, theProgress);
   }
   
     // --------------------------------------------------------------
@@ -1620,29 +1661,29 @@ Handle(Transfer_Binder) STEPControl_ActorRead::TransferShape(
 
   else if (start->IsKind(STANDARD_TYPE(StepShape_ContextDependentShapeRepresentation))) {
     DeclareAndCast(StepShape_ContextDependentShapeRepresentation,CDSR,start);
-    shbinder =  TransferEntity(CDSR,TP);
+    shbinder =  TransferEntity(CDSR,TP, theProgress);
   }
 
   else if (start->IsKind (STANDARD_TYPE(StepRepr_ShapeRepresentationRelationship)) ) {
     //  REPRESENTATION_RELATIONSHIP et la famille
 
     DeclareAndCast(StepRepr_ShapeRepresentationRelationship,und,start);
-    shbinder =  TransferEntity(und,TP);
+    shbinder =  TransferEntity(und,TP, 0, Standard_False, theProgress);
   }
 
   else if (start->IsKind (STANDARD_TYPE(StepGeom_GeometricRepresentationItem)) ) {
     // Here starts the entity to be treated : Shape Representation Subtype
   // It can be also other Root entities
     DeclareAndCast(StepGeom_GeometricRepresentationItem,git,start);
-    shbinder = TransferEntity(git, TP, isManifold);
+    shbinder = TransferEntity(git, TP, isManifold, theProgress);
   }
   else if (start->IsKind(STANDARD_TYPE(StepRepr_MappedItem))) {
     DeclareAndCast(StepRepr_MappedItem,mapit,start);
-    shbinder=  TransferEntity(mapit,TP);
+    shbinder=  TransferEntity(mapit,TP, theProgress);
   }
   else if (start->IsKind(STANDARD_TYPE(StepShape_FaceSurface))) {
     DeclareAndCast(StepShape_FaceSurface,fs,start);
-    shbinder =  TransferEntity(fs,TP);
+    shbinder =  TransferEntity(fs,TP, theProgress);
   }
 
 //  if (!shbinder.IsNull()) TP->Bind(start,binder);