Salome HOME
Copyright update 2021
[modules/geom.git] / src / GEOMImpl / GEOMImpl_PipeDriver.cxx
index 5bb530e396aa9b8d828f64b007789295132d32e8..9fa0d3beb2046694720d83a1e59c31c15aa535cf 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -52,6 +52,7 @@
 #include <GeomFill_CorrectedFrenet.hxx>
 #include <BRepOffsetAPI_MakePipe.hxx>
 #include <BRepOffsetAPI_MakePipeShell.hxx>
+#include <BRepOffsetAPI_ThruSections.hxx>
 
 #include <TopAbs.hxx>
 #include <TopExp.hxx>
@@ -209,17 +210,13 @@ static bool FillForOtherEdges(const TopoDS_Shape& F1,
                               const TopoDS_Shape& V1,
                               TopTools_IndexedDataMapOfShapeShape& FF)
 {
-  //cout<<"FillForOtherEdges"<<endl;
   // find other pairs for vertexes and edges
   // creating map of vertex edges for both faces
   TopTools_IndexedDataMapOfShapeListOfShape aMapVertEdge1;
   TopExp::MapShapesAndAncestors(F1, TopAbs_VERTEX, TopAbs_EDGE, aMapVertEdge1);
-  if (!FF.Contains(F1))
-    MESSAGE("    FillForOtherEdges: map FF not contains key F1");
-  if (!FF.Contains(E1))
-    MESSAGE("    FillForOtherEdges: map FF not contains key E1");
-  if (!FF.Contains(V1))
-    MESSAGE("    FillForOtherEdges: map FF not contains key V1");
+  if (!FF.Contains(F1)) MESSAGE("    FillForOtherEdges: map FF not contains key F1");
+  if (!FF.Contains(E1)) MESSAGE("    FillForOtherEdges: map FF not contains key E1");
+  if (!FF.Contains(V1)) MESSAGE("    FillForOtherEdges: map FF not contains key V1");
   const TopoDS_Shape& F2 = FF.FindFromKey(F1);
   const TopoDS_Shape& E2 = FF.FindFromKey(E1);
   const TopoDS_Shape& V2 = FF.FindFromKey(V1);
@@ -233,26 +230,18 @@ static bool FillForOtherEdges(const TopoDS_Shape& F1,
 
   ShapeAnalysis_Edge sae;
   while(1) {
-    if (!aMapVertEdge1.Contains(VS1))
-      MESSAGE ("    FillForOtherEdges: map aMapVertEdge1 not contains key VS1");
+    if (!aMapVertEdge1.Contains(VS1)) MESSAGE ("    FillForOtherEdges: map aMapVertEdge1 not contains key VS1");
     const TopTools_ListOfShape& aList1 = aMapVertEdge1.FindFromKey(VS1);
-    //TopoDS_Shape E1next;
     TopTools_ListIteratorOfListOfShape anIter1(aList1);
     if (anIter1.Value().IsSame(ES1)) {
       anIter1.Next();
     }
-    //E1next = anIter1.Value();
-    if (!aMapVertEdge2.Contains(VS2))
-      MESSAGE ("    FillForOtherEdges: map aMapVertEdge2 not contains key VS2");
+    if (!aMapVertEdge2.Contains(VS2)) MESSAGE ("    FillForOtherEdges: map aMapVertEdge2 not contains key VS2");
     const TopTools_ListOfShape& aList2 = aMapVertEdge2.FindFromKey(VS2);
-    //TopoDS_Shape E2next;
     TopTools_ListIteratorOfListOfShape anIter2(aList2);
     if (anIter2.Value().IsSame(ES2)) {
       anIter2.Next();
     }
-    //E2next = anIter2.Value();
-    //ES1 = TopoDS::Edge(E1next);
-    //ES2 = TopoDS::Edge(E2next);
     ES1 = TopoDS::Edge(anIter1.Value());
     ES2 = TopoDS::Edge(anIter2.Value());
     if (!FF.Contains(ES1)) {
@@ -287,7 +276,6 @@ static bool FillCorrespondingEdges(const TopoDS_Shape& FS1,
                                    const TopoDS_Wire& aWirePath,
                                    TopTools_IndexedDataMapOfShapeShape& FF)
 {
-  //cout<<"FillCorrespondingEdges"<<endl;
   // find corresponding edges
   TopExp_Explorer expw1(FS1,TopAbs_WIRE);
   TopoDS_Wire aWire1 = TopoDS::Wire(expw1.Current());
@@ -318,8 +306,6 @@ static bool FillCorrespondingEdges(const TopoDS_Shape& FS1,
   TopoDS_Vertex V21 = sae.LastVertex(E1);
   gp_Pnt P11 = BRep_Tool::Pnt(V11);
   gp_Pnt P21 = BRep_Tool::Pnt(V21);
-  //cout<<"P11("<<P11.X()<<","<<P11.Y()<<","<<P11.Z()<<")"<<endl;
-  //cout<<"P21("<<P21.X()<<","<<P21.Y()<<","<<P21.Z()<<")"<<endl;
   // find corresponding vertexes from created shape
   TopoDS_Vertex VN11,VN21;
   for (exp.Init(aShape, TopAbs_VERTEX); exp.More(); exp.Next()) {
@@ -370,8 +356,6 @@ static bool FillCorrespondingEdges(const TopoDS_Shape& FS1,
   TopoDS_Vertex V12,V22;
   gp_Pnt PN12 = BRep_Tool::Pnt(VN12);
   gp_Pnt PN22 = BRep_Tool::Pnt(VN22);
-  //cout<<"PN12("<<PN12.X()<<","<<PN12.Y()<<","<<PN12.Z()<<")"<<endl;
-  //cout<<"PN22("<<PN22.X()<<","<<PN22.Y()<<","<<PN22.Z()<<")"<<endl;
   TopoDS_Edge E2;
   TopExp_Explorer expe;
   for (expe.Init(FS2, TopAbs_EDGE); expe.More(); expe.Next()) {
@@ -414,8 +398,6 @@ static bool FillCorrespondingEdges(const TopoDS_Shape& FS1,
                                    const TopoDS_Vertex& aLoc2,
                                    TopTools_IndexedDataMapOfShapeShape& FF)
 {
-  //cout<<"FillCorrespondingEdges"<<endl;
-
   gp_Pnt P1 = BRep_Tool::Pnt(aLoc1);
   gp_Pnt P2 = BRep_Tool::Pnt(aLoc2);
   gp_Vec aDir(P1,P2);
@@ -435,8 +417,6 @@ static bool FillCorrespondingEdges(const TopoDS_Shape& FS1,
     TopoDS_Vertex V2 = sae.LastVertex(E1);
     gp_Pnt Ptmp1 = BRep_Tool::Pnt(V1);
     gp_Pnt Ptmp2 = BRep_Tool::Pnt(V2);
-    //cout<<"P11("<<P11.X()<<","<<P11.Y()<<","<<P11.Z()<<")"<<endl;
-    //cout<<"P21("<<P21.X()<<","<<P21.Y()<<","<<P21.Z()<<")"<<endl;
     if (P1.Distance(Ptmp1)<tol) {
       V21 = V2;
       break;
@@ -516,7 +496,6 @@ static void FindNextPairOfFaces(const TopoDS_Shape& aCurFace,
                                 TopTools_IndexedDataMapOfShapeShape& FF,
                                 GEOMImpl_IPipe* aCI)
 {
-  //cout<<"FindNextPairOfFaces"<<endl;
   TopExp_Explorer anExp;
   for (anExp.Init(aCurFace, TopAbs_EDGE); anExp.More(); anExp.Next()) {
     TopoDS_Shape E1 = anExp.Current();
@@ -524,8 +503,7 @@ static void FindNextPairOfFaces(const TopoDS_Shape& aCurFace,
       if (aCI) delete aCI;
       Standard_ConstructionError::Raise("FindNextPairOfFaces: Can not find edge in map");
     }
-    if (!FF.Contains(E1))
-      MESSAGE ("    FindNextPairOfFaces: map FF not contains key E1");
+    if (!FF.Contains(E1)) MESSAGE ("    FindNextPairOfFaces: map FF not contains key E1");
     const TopoDS_Shape& E2 = FF.FindFromKey(E1);
     TopExp_Explorer anExpV;
     anExpV.Init(E1, TopAbs_VERTEX);
@@ -535,8 +513,7 @@ static void FindNextPairOfFaces(const TopoDS_Shape& aCurFace,
       Standard_ConstructionError::Raise("FindNextPairOfFaces: Can not find vertex in map");
     }
 
-    if (!aMapEdgeFaces1.Contains(E1))
-      MESSAGE ("    FindNextPairOfFaces: map aMapEdgeFaces1 not contains key E1");
+    if (!aMapEdgeFaces1.Contains(E1)) MESSAGE ("    FindNextPairOfFaces: map aMapEdgeFaces1 not contains key E1");
     const TopTools_ListOfShape& aList1 = aMapEdgeFaces1.FindFromKey(E1);
     if (aList1.Extent()<2)
       continue;
@@ -548,11 +525,9 @@ static void FindNextPairOfFaces(const TopoDS_Shape& aCurFace,
     if (FF.Contains(F1other))
       continue;
 
-    if (!FF.Contains(aCurFace))
-      MESSAGE ("    FindNextPairOfFaces: map FF not contains key aCurFace");
+    if (!FF.Contains(aCurFace)) MESSAGE ("    FindNextPairOfFaces: map FF not contains key aCurFace");
     const TopoDS_Shape& F2 = FF.FindFromKey(aCurFace);
-    if (!aMapEdgeFaces2.Contains(E2))
-      MESSAGE ("    FindNextPairOfFaces: map aMapEdgeFaces2 not contains key E2");
+    if (!aMapEdgeFaces2.Contains(E2)) MESSAGE ("    FindNextPairOfFaces: map aMapEdgeFaces2 not contains key E2");
     const TopTools_ListOfShape& aList2 = aMapEdgeFaces2.FindFromKey(E2);
     if (aList2.Extent()<2) {
       if (aCI) delete aCI;
@@ -569,7 +544,7 @@ static void FindNextPairOfFaces(const TopoDS_Shape& aCurFace,
     bool stat =  FillForOtherEdges(F1other,E1,V1,FF);
     if (!stat) {
       if (aCI) delete aCI;
-      Standard_ConstructionError::Raise("FindNextPairOfFaces: Can not mapping other egdes");
+      Standard_ConstructionError::Raise("FindNextPairOfFaces: Can not map other edges");
     }
 
     FindNextPairOfFaces(F1other, aMapEdgeFaces1, aMapEdgeFaces2, FF, aCI);
@@ -584,8 +559,6 @@ static void FindFirstPairFaces(const TopoDS_Shape& S1, const TopoDS_Shape& S2,
                                TopoDS_Vertex& V1, TopoDS_Vertex& V2,
                                TopoDS_Shape& FS1, TopoDS_Shape& FS2)
 {
-  //cout<<"FindFirstPairFaces"<<endl;
-
   // check if vertexes are sub-shapes of sections
   gp_Pnt P1 = BRep_Tool::Pnt(V1);
   gp_Pnt P2 = BRep_Tool::Pnt(V2);
@@ -612,13 +585,6 @@ static void FindFirstPairFaces(const TopoDS_Shape& S1, const TopoDS_Shape& S2,
     }
   }
 
-  //gp_Pnt P1new = BRep_Tool::Pnt(V1new);
-  //gp_Pnt P2new = BRep_Tool::Pnt(V2new);
-  //cout<<"  P1("<<P1.X()<<","<<P1.Y()<<","<<P1.Z()<<")"<<endl;
-  //cout<<"  P2("<<P2.X()<<","<<P2.Y()<<","<<P2.Z()<<")"<<endl;
-  //cout<<"  P1new("<<P1new.X()<<","<<P1new.Y()<<","<<P1new.Z()<<")"<<endl;
-  //cout<<"  P2new("<<P2new.X()<<","<<P2new.Y()<<","<<P2new.Z()<<")"<<endl;
-
   // replace vertexes if it is needed
   if (!V1.IsSame(V1new)) {
     V1 = V1new;
@@ -732,6 +698,93 @@ static TopoDS_Shape RemoveFaces(const TopoDS_Shape &theShapeFrom,
   return aResult;
 }
 
+//=======================================================================
+//function : makeSolid
+//purpose  : auxiliary for CreatePipeWithDifferentSections
+//=======================================================================
+Standard_Boolean makeSolid(
+  BRepOffsetAPI_MakePipeShell aBuilder,
+  const TopoDS_Shape& aSh1,
+  const TopoDS_Shape& aSh2,
+  TopoDS_Shape& aShape)
+{
+  Standard_Boolean isDone = Standard_True;
+  Standard_Integer nbPlanar = 0;
+  if (aSh1.ShapeType() == TopAbs_FACE && aSh2.ShapeType() == TopAbs_FACE)
+  {
+    Handle(Geom_Surface) aS = BRep_Tool::Surface(TopoDS::Face(aSh1));
+    if (aS->IsKind(STANDARD_TYPE(Geom_Plane))) {
+      nbPlanar++;
+    }
+    else if (aS->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
+      Handle(Geom_RectangularTrimmedSurface) aTS = Handle(Geom_RectangularTrimmedSurface)::DownCast(aS);
+      if (aTS->BasisSurface()->IsKind(STANDARD_TYPE(Geom_Plane))) {
+        nbPlanar++;
+      }
+    }
+    aS = BRep_Tool::Surface(TopoDS::Face(aSh2));
+    if (aS->IsKind(STANDARD_TYPE(Geom_Plane))) {
+      nbPlanar++;
+    }
+    else if (aS->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
+      Handle(Geom_RectangularTrimmedSurface) aTS = Handle(Geom_RectangularTrimmedSurface)::DownCast(aS);
+      if (aTS->BasisSurface()->IsKind(STANDARD_TYPE(Geom_Plane))) {
+        nbPlanar++;
+      }
+    }
+  }
+  if (nbPlanar < 2) {
+    TopoDS_Shape aPipe = aBuilder.Shape();
+    // make sewing for result
+    Handle(BRepBuilderAPI_Sewing) aSewing = new BRepBuilderAPI_Sewing;
+    Standard_Real aTol = Precision::Confusion();
+    aSewing->SetTolerance(aTol);
+    aSewing->SetFaceMode(Standard_True);
+    aSewing->SetFloatingEdgesMode(Standard_False);
+    aSewing->SetNonManifoldMode(Standard_False);
+    TopExp_Explorer anExp;
+    for (anExp.Init(aPipe, TopAbs_FACE); anExp.More(); anExp.Next()) {
+      aSewing->Add(anExp.Current());
+    }
+    aSewing->Add(aSh1);
+    aSewing->Add(aSh2);
+    aSewing->Perform();
+    aShape = aSewing->SewedShape();
+    if (aShape.ShapeType() == TopAbs_SHELL) {
+      // Build a solid.
+      BRepBuilderAPI_MakeSolid aMkSolid;
+      aMkSolid.Add(TopoDS::Shell(aShape));
+      if (!aMkSolid.IsDone()) {
+        isDone = Standard_False;
+      }
+      else {
+        TopoDS_Solid aSolid = aMkSolid.Solid();
+        BRepClass3d_SolidClassifier aSC(aSolid);
+        aSC.PerformInfinitePoint(Precision::Confusion());
+        if (aSC.State() == TopAbs_IN) {
+          aShape = aSolid.Reversed();
+        }
+        else {
+          aShape = aSolid;
+        }
+      }
+    }
+    else {
+      isDone = Standard_False;
+    }
+  }
+  else {
+    isDone = Standard_False;
+  }
+  if (!isDone) {
+    isDone = aBuilder.MakeSolid();
+    if (isDone) {
+      aShape = aBuilder.Shape();
+    }
+  }
+  return isDone;
+}
+
 //=======================================================================
 //function : CreatePipeWithDifferentSections
 //purpose  :
@@ -845,7 +898,6 @@ TopoDS_Shape GEOMImpl_PipeDriver::CreatePipeWithDifferentSections
     double tol = BRep_Tool::Tolerance(edge);
     TopoDS_Vertex VF = sae.FirstVertex(edge);
     gp_Pnt PF = BRep_Tool::Pnt(VF);
-    //cout<<"PF("<<PF.X()<<","<<PF.Y()<<","<<PF.Z()<<")"<<endl;
     if (PF.Distance(PLocs.First()) > tol) {
       Standard_ConstructionError::Raise
         ("First location shapes is not coincided with first vertex of aWirePath");
@@ -919,7 +971,7 @@ TopoDS_Shape GEOMImpl_PipeDriver::CreatePipeWithDifferentSections
       }
     }
     if (nbEdges<Edges.Length()) {
-        // one of edges was splitted => we have to update WirePath
+        // one of edges was split => we have to update WirePath
         BRep_Builder B;
         TopoDS_Wire W;
         B.MakeWire(W);
@@ -981,7 +1033,6 @@ TopoDS_Shape GEOMImpl_PipeDriver::CreatePipeWithDifferentSections
       P1 = P2;
     }
     int LastLoc = 1;
-    //cout<<"Edges.Length()="<<Edges.Length()<<endl;
     for (i=2; i<=Edges.Length(); i++) {
         TopoDS_Edge edge = TopoDS::Edge(Edges.Value(i));
         double tol = BRep_Tool::Tolerance(edge);
@@ -1230,6 +1281,44 @@ TopoDS_Shape GEOMImpl_PipeDriver::CreatePipeWithDifferentSections
       }
   }
   else {
+    // old implementation without splitting
+
+    // Generally, we should better use BRepOffsetAPI_ThruSections algorithm if
+    //   1) the path is a polyline, and
+    //   2) all break points of the path have correspondent sections
+    bool doThruSections = false;
+    if (!theWithContact && !theWithCorrect && theGroups == NULL &&
+        nbBases == Edges.Length() + 1) {
+      doThruSections = true;
+      // check if all edges are lines
+      Standard_Real aFP, aLP;
+      for (int ie = 1; ie <= Edges.Length() && doThruSections; ie++) {
+        TopoDS_Edge anE = TopoDS::Edge(Edges.Value(ie));
+        Handle(Geom_Curve) aC = BRep_Tool::Curve(anE, aFP, aLP);
+        if (!aC.IsNull()) {
+          while(aC->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
+            Handle(Geom_TrimmedCurve) aTc = Handle(Geom_TrimmedCurve)::DownCast(aC);
+            aC = aTc->BasisCurve();
+          }
+          if (!aC->IsKind(STANDARD_TYPE(Geom_Line)))
+            doThruSections = false;
+        }
+      }
+    }
+    
+    if (doThruSections) {
+      BRepOffsetAPI_ThruSections aBuilder (NeedCreateSolid, Standard_True, Precision::Confusion()*10.0);
+      aBuilder.CheckCompatibility(Standard_False);
+
+      for (int ibase = 1; ibase <= nbBases; ibase++) {
+        TopoDS_Shape aBase = aSeqBases.Value(ibase);
+        aBuilder.AddWire(TopoDS::Wire(aBase));
+      }
+
+      aBuilder.Build();
+      aShape = aBuilder.Shape();
+    }
+    else {
       // old implementation without splitting
       BRepOffsetAPI_MakePipeShell aBuilder(aWirePath);
       GeomFill_Trihedron theBestMode = EvaluateBestSweepMode(aWirePath);
@@ -1269,14 +1358,20 @@ TopoDS_Shape GEOMImpl_PipeDriver::CreatePipeWithDifferentSections
 
         Standard_Boolean isDone = BuildPipeShell(aBuilder);
 
-        if (isDone && NeedCreateSolid) {
-          isDone = aBuilder.MakeSolid();
+        if (isDone) {
+          if (NeedCreateSolid) {
+            TopoDS_Shape aSh1 = aSeqFaces.Value(1);
+            TopoDS_Shape aSh2 = aSeqFaces.Value(aSeqFaces.Length());
+            isDone = makeSolid(aBuilder, aSh1, aSh2, aShape);
+          }
+          else {
+            aShape = aBuilder.Shape();
+          }
         }
 
         if (!isDone) {
           Standard_ConstructionError::Raise("Pipe construction failure");
         }
-        aShape = aBuilder.Shape();
 
         if (isCreateGroups) {
           // Make groups.
@@ -1302,6 +1397,7 @@ TopoDS_Shape GEOMImpl_PipeDriver::CreatePipeWithDifferentSections
         for (j = 1; j <=usedBases.Length(); j++)
           aBuilder.Delete(usedBases.Value(j));
       }
+    }
   }
 
   return aShape;
@@ -1407,7 +1503,6 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath,
     double tol = BRep_Tool::Tolerance(edge);
     TopoDS_Vertex VF = sae.FirstVertex(edge);
     gp_Pnt PF = BRep_Tool::Pnt(VF);
-    //cout<<"PF("<<PF.X()<<","<<PF.Y()<<","<<PF.Z()<<")"<<endl;
     if (PF.Distance(PLocs.First()) > tol) {
       if (aCI) delete aCI;
       Standard_ConstructionError::Raise
@@ -1739,7 +1834,7 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath,
       TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces2;
       TopExp::MapShapesAndAncestors(aShBase2, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces2);
 
-      // constuct map face->face
+      // construct map face->face
       TopTools_IndexedDataMapOfShapeShape FF;
       TopoDS_Shape FS1,FS2;
       if (nbSubBases==0) {
@@ -1824,7 +1919,7 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath,
         bool stat =  FillForOtherEdges(FS1,E1,V11,FF);
         if (!stat) {
           if (aCI) delete aCI;
-          Standard_ConstructionError::Raise("FindForOtherEdges: Can not mapping other egdes");
+          Standard_ConstructionError::Raise("FindForOtherEdges: Can not map other edges");
         }
 
       }
@@ -1966,8 +2061,7 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath,
             aShell = TopoDS::Shell(aSewShape);
             GProp_GProps aSystem;
             BRepGProp::VolumeProperties(aShell, aSystem);
-            if (aSystem.Mass()<0) {
-              //cout<<"aSewShape is reversed"<<endl;
+            if (aSystem.Mass() < 0) {
               aShell.Reverse();
             }
             if (BRep_Tool::IsClosed(aShell)) {
@@ -2038,7 +2132,6 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath,
 //=======================================================================
 static TopoDS_Shape CreatePipeShellsWithoutPath(GEOMImpl_IPipe* aCI)
 {
-  //cout<<"CreatePipeShellsWithoutPath"<<endl;
   int i,j;
   BRep_Builder B;
 
@@ -2102,7 +2195,6 @@ static TopoDS_Shape CreatePipeShellsWithoutPath(GEOMImpl_IPipe* aCI)
     for (anExp.Init(aShBase2, TopAbs_FACE); anExp.More(); anExp.Next()) {
       nbf2++;
     }
-    //cout<<"nbf1="<<nbf1<<" nbf2="<<nbf2<<endl;
     if (nbf1!=nbf2) {
       if (aCI) delete aCI;
       Standard_ConstructionError::Raise("Different number of faces in the sections");
@@ -2137,7 +2229,7 @@ static TopoDS_Shape CreatePipeShellsWithoutPath(GEOMImpl_IPipe* aCI)
     TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces2;
     TopExp::MapShapesAndAncestors(aShBase2, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces2);
 
-    // constuct map face->face (and sub-shapes)
+    // construct map face->face (and sub-shapes)
     TopTools_IndexedDataMapOfShapeShape FF;
     //TopoDS_Shape FS1 = SecFs.Value(i), FS2 = SecFs.Value(i+1);
     TopoDS_Shape FS1, FS2;
@@ -2163,7 +2255,6 @@ static TopoDS_Shape CreatePipeShellsWithoutPath(GEOMImpl_IPipe* aCI)
     // auxiliary map vertex->edge for created pipe edges
     TopTools_IndexedDataMapOfShapeShape VPE;
     ShapeAnalysis_Edge sae;
-    //cout<<"FF.Extent()="<<FF.Extent()<<endl;
     int nbff = 0;
     for (j=1; j<=FF.Extent(); j++) {
       TopoDS_Shape F1 = FF.FindKey(j);
@@ -2300,26 +2391,13 @@ static TopoDS_Shape CreatePipeShellsWithoutPath(GEOMImpl_IPipe* aCI)
 
         double fp,lp;
         Handle(Geom_Curve) C1 = BRep_Tool::Curve(E1,fp,lp);
-        //bool IsConicC1 = false;
-        //if (C1->IsKind(STANDARD_TYPE(Geom_Conic))) {
-        //  IsConicC1 = true;
-        //  cout<<"C1 - Geom_Conic"<<endl;
-        //}
         if (C1->IsKind(STANDARD_TYPE(Geom_Line)) || C1->IsKind(STANDARD_TYPE(Geom_Conic))) {
           C1 = new Geom_TrimmedCurve(C1,fp,lp);
         }
-        //if (IsConicC1) {
-        //  double tol = BRep_Tool::Tolerance(E1);
-        //  GeomConvert_ApproxCurve ApxC1(C1,tol,GeomAbs_C1,10,5);
-        //  C1 = ApxC1.Curve();
-        //}
         Handle(Geom_Curve) C3 = BRep_Tool::Curve(E3,fp,lp);
         if (C3->IsKind(STANDARD_TYPE(Geom_Line)) || C3->IsKind(STANDARD_TYPE(Geom_Conic))) {
           C3 = new Geom_TrimmedCurve(C3,fp,lp);
         }
-        //filebuf fic;
-        //ostream os(&fic);
-        //os.precision(15);
         Handle(Geom_BSplineCurve) CE1 =
           GeomConvert::CurveToBSplineCurve(C1,Convert_RationalC1);
         if (CE1->Degree()<3)
@@ -2475,8 +2553,7 @@ static TopoDS_Shape CreatePipeShellsWithoutPath(GEOMImpl_IPipe* aCI)
         aShell = TopoDS::Shell(aSewShape);
         GProp_GProps aSystem;
         BRepGProp::VolumeProperties(aShell, aSystem);
-        if (aSystem.Mass()<0) {
-          //cout<<"aSewShape is reversed"<<endl;
+        if (aSystem.Mass() < 0) {
           aShell.Reverse();
         }
         if (BRep_Tool::IsClosed(aShell)) {
@@ -3454,4 +3531,4 @@ GetCreationInformation(std::string&             theOperationName,
   return true;
 }
 
-IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_PipeDriver,GEOM_BaseDriver);
+IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_PipeDriver,GEOM_BaseDriver)