0026406: BRepPrimAPI_MakeRevol crash when rotating Paraboloid face.
authorifv <ifv@opencascade.com>
Mon, 20 Jul 2015 11:59:07 +0000 (14:59 +0300)
committerbugmaster <bugmaster@opencascade.com>
Mon, 20 Jul 2015 12:01:16 +0000 (15:01 +0300)
Test-case for issue #26406

src/BRepSweep/BRepSweep_NumLinearRegularSweep.cxx
src/BRepSweep/BRepSweep_Rotation.cxx
tests/bugs/modalg_6/bug26406 [new file with mode: 0644]

index 8c9779d..21eb408 100644 (file)
 //=======================================================================
 BRepSweep_NumLinearRegularSweep::BRepSweep_NumLinearRegularSweep
   (const BRepSweep_Builder& aBuilder,
-   const TopoDS_Shape& aGenShape,
-   const Sweep_NumShape& aDirShape):
+  const TopoDS_Shape& aGenShape,
+  const Sweep_NumShape& aDirShape):
 
-  myBuilder(aBuilder),
+myBuilder(aBuilder),
   myGenShape(aGenShape),
   myDirWire(aDirShape),
 
@@ -52,9 +52,9 @@ BRepSweep_NumLinearRegularSweep::BRepSweep_NumLinearRegularSweep
   // *****************************************************************
 
   myShapes(1,myGenShapeTool.NbShapes(),
-          1,myDirShapeTool.NbShapes()),
+  1,myDirShapeTool.NbShapes()),
   myBuiltShapes(1,myGenShapeTool.NbShapes(),
-               1,myDirShapeTool.NbShapes())
+  1,myDirShapeTool.NbShapes())
 {
   myBuiltShapes.Init(Standard_False); 
 }
@@ -91,7 +91,7 @@ TopoDS_Shape BRepSweep_NumLinearRegularSweep::Shape ()
 TopoDS_Shape BRepSweep_NumLinearRegularSweep::Shape (const TopoDS_Shape& aGenS) 
 {
   if (myGenShapeTool.Index(aGenS) != 0 &&
-      HasShape(aGenS,myDirWire)) return Shape(aGenS,myDirWire);
+    HasShape(aGenS,myDirWire)) return Shape(aGenS,myDirWire);
   else {
     TopoDS_Shape bidon;
     return bidon;
@@ -105,7 +105,7 @@ TopoDS_Shape BRepSweep_NumLinearRegularSweep::Shape (const TopoDS_Shape& aGenS)
 //=======================================================================
 
 TopoDS_Shape BRepSweep_NumLinearRegularSweep::Shape (const TopoDS_Shape& aGenS, 
-                                         const Sweep_NumShape& aDirS)
+  const Sweep_NumShape& aDirS)
 {
   Standard_Integer iGenS = myGenShapeTool.Index(aGenS);
   Standard_Integer iDirS = myDirShapeTool.Index(aDirS);
@@ -122,80 +122,80 @@ TopoDS_Shape BRepSweep_NumLinearRegularSweep::Shape (const TopoDS_Shape& aGenS,
       TopAbs_ShapeEnum aGenSType = myGenShapeTool.Type(aGenS);
       switch (aGenSType){
       case TopAbs_VERTEX : 
-       myShapes(iGenS,iDirS)=MakeEmptyVertex(aGenS,aDirS);
-       break;
+        myShapes(iGenS,iDirS)=MakeEmptyVertex(aGenS,aDirS);
+        break;
       case TopAbs_EDGE :
-       myShapes(iGenS,iDirS)=MakeEmptyGeneratingEdge(aGenS,aDirS);
-       break;
+        myShapes(iGenS,iDirS)=MakeEmptyGeneratingEdge(aGenS,aDirS);
+        break;
       case TopAbs_WIRE :
-       myBuilder.MakeWire(myShapes(iGenS,iDirS));
-       break;
+        myBuilder.MakeWire(myShapes(iGenS,iDirS));
+        break;
       case TopAbs_FACE :
-       myShapes(iGenS,iDirS)=MakeEmptyFace(aGenS,aDirS);
-       break;
+        myShapes(iGenS,iDirS)=MakeEmptyFace(aGenS,aDirS);
+        break;
       case TopAbs_SHELL :
-       myBuilder.MakeShell(myShapes(iGenS,iDirS));
-       break;
+        myBuilder.MakeShell(myShapes(iGenS,iDirS));
+        break;
       case TopAbs_SOLID :
-       Standard_NoSuchObject::Raise("Solids are not Processed");
-       break;
+        Standard_NoSuchObject::Raise("Solids are not Processed");
+        break;
       case TopAbs_COMPSOLID :
-       Standard_NoSuchObject::Raise("Solids are not Processed");
-       break;
+        Standard_NoSuchObject::Raise("Solids are not Processed");
+        break;
       case TopAbs_COMPOUND :
-       myBuilder.MakeCompound(myShapes(iGenS,iDirS));
-       break;
+        myBuilder.MakeCompound(myShapes(iGenS,iDirS));
+        break;
       default:
-       Standard_NoSuchObject::Raise("Unknown Shape");  
-       break;
+        Standard_NoSuchObject::Raise("Unknown Shape"); 
+        break;
       }
       bGenS = aGenS;
       myGenShapeTool.SetOrientation(bGenS,TopAbs_FORWARD);
       for (It.Init(bGenS);It.More();It.Next()){
-       subGenS = It.Value();
-       Or = It.Orientation();
-       if(HasShape(subGenS,aDirS)){
-         newShape = Shape(subGenS,aDirS);
-         if (GGDShapeIsToAdd(myShapes(iGenS,iDirS),newShape,
-                             aGenS,subGenS,aDirS)){
-           //Les "planchers" doivent etre construits par les 
-           //fonctions de construcion geometrique identiquement 
-           //au shape generateur.
-           //On leur recolle juste une orientation pour etre bien 
-            //sur.
-
-           myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
-           TopAbs_ShapeEnum subGenSType = myGenShapeTool.Type(subGenS);
-           if (aGenSType==TopAbs_FACE){   
-             if(subGenSType==TopAbs_VERTEX){
-               SetParameters(myShapes(iGenS,iDirS),
-                             newShape,aGenS,subGenS,aDirS);
-             }
-             else if(subGenSType==TopAbs_EDGE){
-               SetPCurve(myShapes(iGenS,iDirS),newShape,
-                         aGenS,subGenS,aDirS,Or);
-             }     
-             else if(subGenSType==TopAbs_WIRE){
-               BRepSweep_Iterator Jt;
-               cGenS = subGenS;
-               myGenShapeTool.SetOrientation(cGenS,TopAbs_FORWARD);
-               for (Jt.Init(cGenS);Jt.More();Jt.Next()){
-                 subsubGenS = Jt.Value();
-                 Pr = Jt.Orientation();
-                 if(HasShape(subsubGenS,aDirS)){
-                   TopoDS_Shape newsubEdge = Shape(subsubGenS,aDirS);
-                   SetPCurve(myShapes(iGenS,iDirS),newsubEdge,
-                             aGenS,subsubGenS,aDirS,Pr);
-                 }
-               }
-             }
-           }
-           else if(aGenSType==TopAbs_EDGE){
-             SetGeneratingParameter(myShapes(iGenS,iDirS),
-                                    newShape,bGenS,subGenS,aDirS);
-           }
-         }
-       }
+        subGenS = It.Value();
+        Or = It.Orientation();
+        if(HasShape(subGenS,aDirS)){
+          newShape = Shape(subGenS,aDirS);
+          if (GGDShapeIsToAdd(myShapes(iGenS,iDirS),newShape,
+            aGenS,subGenS,aDirS)){
+              //Les "planchers" doivent etre construits par les 
+              //fonctions de construcion geometrique identiquement 
+              //au shape generateur.
+              //On leur recolle juste une orientation pour etre bien 
+              //sur.
+
+              myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
+              TopAbs_ShapeEnum subGenSType = myGenShapeTool.Type(subGenS);
+              if (aGenSType==TopAbs_FACE){   
+                if(subGenSType==TopAbs_VERTEX){
+                  SetParameters(myShapes(iGenS,iDirS),
+                    newShape,aGenS,subGenS,aDirS);
+                }
+                else if(subGenSType==TopAbs_EDGE){
+                  SetPCurve(myShapes(iGenS,iDirS),newShape,
+                    aGenS,subGenS,aDirS,Or);
+                }          
+                else if(subGenSType==TopAbs_WIRE){
+                  BRepSweep_Iterator Jt;
+                  cGenS = subGenS;
+                  myGenShapeTool.SetOrientation(cGenS,TopAbs_FORWARD);
+                  for (Jt.Init(cGenS);Jt.More();Jt.Next()){
+                    subsubGenS = Jt.Value();
+                    Pr = Jt.Orientation();
+                    if(HasShape(subsubGenS,aDirS)){
+                      TopoDS_Shape newsubEdge = Shape(subsubGenS,aDirS);
+                      SetPCurve(myShapes(iGenS,iDirS),newsubEdge,
+                        aGenS,subsubGenS,aDirS,Pr);
+                    }
+                  }
+                }
+              }
+              else if(aGenSType==TopAbs_EDGE){
+                SetGeneratingParameter(myShapes(iGenS,iDirS),
+                  newShape,bGenS,subGenS,aDirS);
+              }
+          }
+        }
       }
     }
     else if (myDirShapeTool.Type(aDirS)==TopAbs_EDGE){
@@ -206,201 +206,201 @@ TopoDS_Shape BRepSweep_NumLinearRegularSweep::Shape (const TopoDS_Shape& aGenS,
       Standard_Boolean sepwires = Standard_False;
       switch (aGenSType){
       case TopAbs_VERTEX : 
-       myShapes(iGenS,iDirS)=MakeEmptyDirectingEdge(aGenS,aDirS);
-       break;
+        myShapes(iGenS,iDirS)=MakeEmptyDirectingEdge(aGenS,aDirS);
+        break;
       case TopAbs_EDGE :
-       //On cree un wire intermediaire qui contient tous les edges
-       //du montant (face) du Shape pour le cas standard, et une 
-       //sequence de wires pour les cas merdiques necessitant des
-       //wires independants.
-       myBuilder.MakeWire(newWire);
-       myShapes(iGenS,iDirS)=MakeEmptyFace(aGenS,aDirS);
-       break;
+        //On cree un wire intermediaire qui contient tous les edges
+        //du montant (face) du Shape pour le cas standard, et une 
+        //sequence de wires pour les cas merdiques necessitant des
+        //wires independants.
+        myBuilder.MakeWire(newWire);
+        myShapes(iGenS,iDirS)=MakeEmptyFace(aGenS,aDirS);
+        break;
       case TopAbs_WIRE :
-       myBuilder.MakeShell(myShapes(iGenS,iDirS));
-       break;
+        myBuilder.MakeShell(myShapes(iGenS,iDirS));
+        break;
       case TopAbs_FACE :
-       //On cree un shell intermediaire dans lequel on jette toutes 
-       //les faces en direct, pour eviter les empilages compliques 
-       //de shells et sous shells dans la structure du solide.
-       myBuilder.MakeShell(newShell);
-       myBuilder.MakeSolid(myShapes(iGenS,iDirS));
-       break;
+        //On cree un shell intermediaire dans lequel on jette toutes 
+        //les faces en direct, pour eviter les empilages compliques 
+        //de shells et sous shells dans la structure du solide.
+        myBuilder.MakeShell(newShell);
+        myBuilder.MakeSolid(myShapes(iGenS,iDirS));
+        break;
       case TopAbs_SHELL :
-       myBuilder.MakeCompSolid(myShapes(iGenS,iDirS));
-       break;
+        myBuilder.MakeCompSolid(myShapes(iGenS,iDirS));
+        break;
       case TopAbs_SOLID :
-       Standard_NoSuchObject::Raise("Solids are not Processed");
-       break;
+        Standard_NoSuchObject::Raise("Solids are not Processed");
+        break;
       case TopAbs_COMPSOLID :
-       Standard_NoSuchObject::Raise("Solids are not Processed");
-       break;
+        Standard_NoSuchObject::Raise("Solids are not Processed");
+        break;
       case TopAbs_COMPOUND :
-       myBuilder.MakeCompound(myShapes(iGenS,iDirS));
-       break;
+        myBuilder.MakeCompound(myShapes(iGenS,iDirS));
+        break;
       default:
-       Standard_NoSuchObject::Raise("Unknown Shape");  
-       break;
+        Standard_NoSuchObject::Raise("Unknown Shape"); 
+        break;
       }
       bGenS = aGenS;
       myGenShapeTool.SetOrientation(bGenS,TopAbs_FORWARD);
       for (It.Init(bGenS);It.More();It.Next()){
-       subGenS = It.Value();
-       if(HasShape(subGenS,aDirS)){
-         newShape = Shape(subGenS,aDirS);
-         if (GGDShapeIsToAdd(myShapes(iGenS,iDirS),newShape,
-                             aGenS,subGenS,aDirS)){
-           TopAbs_ShapeEnum subGenSType = myGenShapeTool.Type(subGenS);
-           if (aGenSType==TopAbs_EDGE){   
-             Or = It.Orientation();
-             if (SeparatedWires(myShapes(iGenS,iDirS),newShape,
-                                aGenS,subGenS,aDirS)){
-               sepwires = Standard_True;
-               TopoDS_Shape wi;
-               myBuilder.MakeWire(wi);
-               myBuilder.Add(wi,newShape,Or);
-               wi.Closed(BRep_Tool::IsClosed(wi));
-               WireSeq.Append(wi);
-             }
-             else{
-               myBuilder.Add(newWire,newShape,Or);
-             }
-             SetDirectingPCurve (myShapes(iGenS,iDirS),
-                                 newShape,bGenS,subGenS,aDirS,Or);
-           }
-           else if (aGenSType==TopAbs_WIRE){
-             Or = It.Orientation();
-             myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
-           }
-           else if (aGenSType==TopAbs_FACE){
-             Or = It.Orientation();
-             if(subGenSType == TopAbs_WIRE) {
-               for (Lt.Init(newShape);Lt.More();Lt.Next()){
-                 myBuilder.Add(newShell,Lt.Value(),
-                               TopAbs::Compose(Lt.Orientation(),Or));
-               }
-             }
-             else if(subGenSType == TopAbs_EDGE) {
-               myBuilder.Add(newShell,newShape,Or);
-             }
-           }
-           else if(aGenSType == TopAbs_SHELL){
-             Or = TopAbs_FORWARD;
-             myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
-           }
-           else if(aGenSType == TopAbs_COMPOUND){
-             Or = TopAbs_FORWARD;
-             myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
-           }
-           else{
-             Or = It.Orientation();
-             myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
-           }
-         }
-       }
+        subGenS = It.Value();
+        if(HasShape(subGenS,aDirS)){
+          newShape = Shape(subGenS,aDirS);
+          if (GGDShapeIsToAdd(myShapes(iGenS,iDirS),newShape,
+            aGenS,subGenS,aDirS)){
+              TopAbs_ShapeEnum subGenSType = myGenShapeTool.Type(subGenS);
+              if (aGenSType==TopAbs_EDGE){   
+                Or = It.Orientation();
+                if (SeparatedWires(myShapes(iGenS,iDirS),newShape,
+                  aGenS,subGenS,aDirS)){
+                    sepwires = Standard_True;
+                    TopoDS_Shape wi;
+                    myBuilder.MakeWire(wi);
+                    myBuilder.Add(wi,newShape,Or);
+                    wi.Closed(BRep_Tool::IsClosed(wi));
+                    WireSeq.Append(wi);
+                }
+                else{
+                  myBuilder.Add(newWire,newShape,Or);
+                }
+                SetDirectingPCurve (myShapes(iGenS,iDirS),
+                  newShape,bGenS,subGenS,aDirS,Or);
+              }
+              else if (aGenSType==TopAbs_WIRE){
+                Or = It.Orientation();
+                myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
+              }
+              else if (aGenSType==TopAbs_FACE){
+                Or = It.Orientation();
+                if(subGenSType == TopAbs_WIRE) {
+                  for (Lt.Init(newShape);Lt.More();Lt.Next()){
+                    myBuilder.Add(newShell,Lt.Value(),
+                      TopAbs::Compose(Lt.Orientation(),Or));
+                  }
+                }
+                else if(subGenSType == TopAbs_EDGE) {
+                  myBuilder.Add(newShell,newShape,Or);
+                }
+              }
+              else if(aGenSType == TopAbs_SHELL){
+                Or = TopAbs_FORWARD;
+                myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
+              }
+              else if(aGenSType == TopAbs_COMPOUND){
+                Or = TopAbs_FORWARD;
+                myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
+              }
+              else{
+                Or = It.Orientation();
+                myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
+              }
+          }
+        }
       }
       bDirS = aDirS;
       for (Kt.Init(bDirS);Kt.More();Kt.Next()){
-       subDirS = Kt.Value();
-       if(HasShape(aGenS,subDirS)){
-         newShape = Shape(aGenS,subDirS);
-         if (GDDShapeIsToAdd(myShapes(iGenS,iDirS),newShape,
-                             aGenS,aDirS,subDirS)){
-           if (aGenSType==TopAbs_EDGE){   
-             Or = TopAbs::Reverse(Kt.Orientation());
-             myBuilder.Add(newWire,newShape,Or);
-             SetGeneratingPCurve
-               (myShapes(iGenS,iDirS),newShape,aGenS,aDirS,subDirS,Or);
-           }
-           else if(aGenSType==TopAbs_VERTEX){
-             Or = Kt.Orientation();
-             myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
-             SetDirectingParameter
-               (myShapes(iGenS,iDirS),newShape,aGenS,aDirS,subDirS);
-           }
-           else if(aGenSType==TopAbs_FACE){
-             Or = Kt.Orientation();
-             myBuilder.Add(newShell,newShape,Or);
-           }
-         }
-       }
+        subDirS = Kt.Value();
+        if(HasShape(aGenS,subDirS)){
+          newShape = Shape(aGenS,subDirS);
+          if (GDDShapeIsToAdd(myShapes(iGenS,iDirS),newShape,
+            aGenS,aDirS,subDirS)){
+              if (aGenSType==TopAbs_EDGE){   
+                Or = TopAbs::Reverse(Kt.Orientation());
+                myBuilder.Add(newWire,newShape,Or);
+                SetGeneratingPCurve
+                  (myShapes(iGenS,iDirS),newShape,aGenS,aDirS,subDirS,Or);
+              }
+              else if(aGenSType==TopAbs_VERTEX){
+                Or = Kt.Orientation();
+                myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
+                SetDirectingParameter
+                  (myShapes(iGenS,iDirS),newShape,aGenS,aDirS,subDirS);
+              }
+              else if(aGenSType==TopAbs_FACE){
+                Or = Kt.Orientation();
+                myBuilder.Add(newShell,newShape,Or);
+              }
+          }
+        }
       }
       if (aGenSType==TopAbs_EDGE){
-       if (sepwires){
-         for(Standard_Integer ij = 1;ij <= WireSeq.Length();ij++){
-           myBuilder.Add(myShapes(iGenS,iDirS),WireSeq.Value(ij));
-         }
-       }
-       else{
-         newWire.Closed(BRep_Tool::IsClosed(newWire));
-         myBuilder.Add(myShapes(iGenS,iDirS),newWire);
-       }
-       myBuiltShapes(iGenS,iDirS) = Standard_True;
-       SetContinuity(aGenS,aDirS);
+        if (sepwires){
+          for(Standard_Integer ij = 1;ij <= WireSeq.Length();ij++){
+            myBuilder.Add(myShapes(iGenS,iDirS),WireSeq.Value(ij));
+          }
+        }
+        else{
+          newWire.Closed(BRep_Tool::IsClosed(newWire));
+          myBuilder.Add(myShapes(iGenS,iDirS),newWire);
+        }
+        myBuiltShapes(iGenS,iDirS) = Standard_True;
+        SetContinuity(aGenS,aDirS);
       }
       if (aGenSType==TopAbs_WIRE){
-       SetContinuity(aGenS,aDirS);
+        SetContinuity(aGenS,aDirS);
       }        
       if (aGenSType==TopAbs_FACE){
         newShell.Closed (BRep_Tool::IsClosed (newShell));
-       TopoDS_Shape temp = SplitShell(newShell);
-       TopAbs_Orientation Or = DirectSolid(aGenS,aDirS);
-       Lt.Init(temp);
-       if(Lt.More()) Lt.Next();
-       if(Lt.More()){
-         for (Lt.Init(temp);Lt.More();Lt.Next()){
-           myBuilder.Add(myShapes(iGenS,iDirS),Lt.Value(),Or);
-         }
-       }
-       else myBuilder.Add(myShapes(iGenS,iDirS),newShell,Or);
+        TopoDS_Shape temp = SplitShell(newShell);
+        TopAbs_Orientation Or = DirectSolid(aGenS,aDirS);
+        Lt.Init(temp);
+        if(Lt.More()) Lt.Next();
+        if(Lt.More()){
+          for (Lt.Init(temp);Lt.More();Lt.Next()){
+            myBuilder.Add(myShapes(iGenS,iDirS),Lt.Value(),Or);
+          }
+        }
+        else myBuilder.Add(myShapes(iGenS,iDirS),newShell,Or);
       }
     }
     else if (myDirShapeTool.Type(aDirS)==TopAbs_WIRE){
       TopAbs_ShapeEnum aGenSType = myGenShapeTool.Type(aGenS);
       switch (aGenSType){
       case TopAbs_VERTEX : 
-       myBuilder.MakeWire(myShapes(iGenS,iDirS));
-       break;
+        myBuilder.MakeWire(myShapes(iGenS,iDirS));
+        break;
       case TopAbs_EDGE :
-       myBuilder.MakeShell(myShapes(iGenS,iDirS));
-       break;
+        myBuilder.MakeShell(myShapes(iGenS,iDirS));
+        break;
       case TopAbs_WIRE :
-       myBuilder.MakeShell(myShapes(iGenS,iDirS));
-       break;
+        myBuilder.MakeShell(myShapes(iGenS,iDirS));
+        break;
       case TopAbs_FACE :
-       myBuilder.MakeCompSolid(myShapes(iGenS,iDirS));
-       break;
+        myBuilder.MakeCompSolid(myShapes(iGenS,iDirS));
+        break;
       case TopAbs_SHELL :
-       myBuilder.MakeCompSolid(myShapes(iGenS,iDirS));
-       break;
+        myBuilder.MakeCompSolid(myShapes(iGenS,iDirS));
+        break;
       case TopAbs_SOLID :
-       Standard_NoSuchObject::Raise("Solids are not Processed");
-       break;
+        Standard_NoSuchObject::Raise("Solids are not Processed");
+        break;
       case TopAbs_COMPSOLID :
-       Standard_NoSuchObject::Raise("Solids are not Processed");
-       break;
+        Standard_NoSuchObject::Raise("Solids are not Processed");
+        break;
       case TopAbs_COMPOUND :
-       myBuilder.MakeCompound(myShapes(iGenS,iDirS));
-       break;
+        myBuilder.MakeCompound(myShapes(iGenS,iDirS));
+        break;
       default:
-       Standard_NoSuchObject::Raise("Unknown Shape");  
-       break;
+        Standard_NoSuchObject::Raise("Unknown Shape"); 
+        break;
       }
       bDirS = aDirS;
       for (Kt.Init(aDirS);Kt.More();Kt.Next()){
-       subDirS = Kt.Value();
-       if(HasShape(aGenS,subDirS)){
-         Or = Kt.Orientation();
-         newShape = Shape(aGenS,subDirS);
-         myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
-       }
+        subDirS = Kt.Value();
+        if(HasShape(aGenS,subDirS)){
+          Or = Kt.Orientation();
+          newShape = Shape(aGenS,subDirS);
+          myBuilder.Add(myShapes(iGenS,iDirS),newShape,Or);
+        }
       }
     }
     myBuiltShapes(iGenS,iDirS) = Standard_True;
   }
   // Change the "Closed" flag only for Wires and Shells
   if (myShapes(iGenS, iDirS).ShapeType() == TopAbs_WIRE ||
-      myShapes(iGenS, iDirS).ShapeType() == TopAbs_SHELL)
+    myShapes(iGenS, iDirS).ShapeType() == TopAbs_SHELL)
     myShapes(iGenS,iDirS).Closed (BRep_Tool::IsClosed (myShapes(iGenS,iDirS)));
   return myShapes(iGenS,iDirS);
 }
index c814ef1..d384f96 100644 (file)
@@ -66,6 +66,8 @@
 #include <TopoDS_Shape.hxx>
 #include <TopoDS_Vertex.hxx>
 
+
+#include <TopExp_Explorer.hxx>
 static Standard_Real ComputeTolerance(TopoDS_Edge& E,
                                      const TopoDS_Face& F,
                                      const Handle(Geom2d_Curve)& C)
@@ -221,14 +223,26 @@ TopoDS_Shape  BRepSweep_Rotation::MakeEmptyGeneratingEdge
    const Sweep_NumShape& aDirV)
 {
   //call in case of construction with copy, or only when meridian touches myaxe.
-  Standard_Real First,Last;
-  TopLoc_Location Loc;
-  Handle(Geom_Curve) C = Handle(Geom_Curve)::DownCast
-    (BRep_Tool::Curve(TopoDS::Edge(aGenE),Loc,First,Last)->Copy());
-  C->Transform(Loc.Transformation());
-  TopoDS_Edge E;
-  if(aDirV.Index() == 2) C->Transform(myLocation.Transformation()); 
-  myBuilder.Builder().MakeEdge(E,C,BRep_Tool::Tolerance(TopoDS::Edge(aGenE)));
+  TopoDS_Edge E; 
+  if(BRep_Tool::Degenerated(TopoDS::Edge(aGenE)))
+  {
+    myBuilder.Builder().MakeEdge(E);
+    myBuilder.Builder().UpdateEdge(E, BRep_Tool::Tolerance(TopoDS::Edge(aGenE)));
+    myBuilder.Builder().Degenerated(E, Standard_True);
+  }
+  else
+  {
+    Standard_Real First,Last;
+    TopLoc_Location Loc;
+    Handle(Geom_Curve) C = Handle(Geom_Curve)::DownCast
+      (BRep_Tool::Curve(TopoDS::Edge(aGenE),Loc,First,Last)->Copy());
+    if(!C.IsNull())
+    {
+      C->Transform(Loc.Transformation());
+      if(aDirV.Index() == 2) C->Transform(myLocation.Transformation()); 
+    }
+    myBuilder.Builder().MakeEdge(E,C,BRep_Tool::Tolerance(TopoDS::Edge(aGenE)));
+  }
   if (aDirV.Index() == 1 && 
       IsInvariant(aGenE) && 
       myDirShapeTool.NbShapes() == 3) {
@@ -723,6 +737,7 @@ Standard_Boolean BRepSweep_Rotation::GGDShapeIsToAdd
    const TopoDS_Shape& aSubGenS,
    const Sweep_NumShape& aDirS )const
 {
+  Standard_Boolean aRes = Standard_True;
   if (aNewShape.ShapeType()==TopAbs_FACE &&
       aNewSubShape.ShapeType()==TopAbs_EDGE &&
       aGenS.ShapeType()==TopAbs_EDGE &&
@@ -734,11 +749,11 @@ Standard_Boolean BRepSweep_Rotation::GGDShapeIsToAdd
       return (!IsInvariant(aSubGenS));
     }
     else{
-      return Standard_True;
+      return aRes;
     }
   }
   else{
-    return Standard_True;
+    return aRes;
   }
 }
 
@@ -835,20 +850,33 @@ Standard_Boolean  BRepSweep_Rotation::HasShape
    const Sweep_NumShape& aDirS)const 
 {
   if(aDirS.Type()==TopAbs_EDGE&&
-     aGenS.ShapeType()==TopAbs_EDGE){
+     aGenS.ShapeType()==TopAbs_EDGE)
+  {
     // Verify that the edge has entrails
     const TopoDS_Edge& anEdge = TopoDS::Edge(aGenS);
-    Standard_Boolean hasGeom = !BRep_Tool::Degenerated(anEdge);
-    if (hasGeom)
-    { // The edge is not degenerated. Check if it has no curve
-      Standard_Real aPFirst, aPLast;
-      TopLoc_Location aLoc;
-      Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aLoc, aPFirst, aPLast);
-      hasGeom = !aCurve.IsNull();
+    //
+    if(BRep_Tool::Degenerated(anEdge)) return Standard_False;
+
+    Standard_Real aPFirst, aPLast;
+    TopLoc_Location aLoc;
+    Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aLoc, aPFirst, aPLast);
+    if(aCurve.IsNull()) return Standard_False;
+
+    if(IsInvariant(aGenS)) return Standard_False;
+
+    //Check seem edge
+    TopExp_Explorer FaceExp(myGenShape, TopAbs_FACE);
+    for (;FaceExp.More(); FaceExp.Next()) {
+      TopoDS_Face F = TopoDS::Face(FaceExp.Current());
+      if (BRepTools::IsReallyClosed(anEdge, F))
+          return Standard_False;
     }
-    return hasGeom && !IsInvariant(aGenS);
+
+    return Standard_True;
+      
   }
-  else{
+  else
+  {
     return Standard_True;
   }
 }
diff --git a/tests/bugs/modalg_6/bug26406 b/tests/bugs/modalg_6/bug26406
new file mode 100644 (file)
index 0000000..a3a4473
--- /dev/null
@@ -0,0 +1,15 @@
+puts "========"
+puts "OCC26406"
+puts "========"
+puts ""
+#############################################################
+# BRepPrimAPI_MakeRevol crash when rotating Paraboloid face
+#############################################################
+
+smallview
+
+restore [locate_data_file OCC26406-Paraboloid.brep] p
+revol r p 0 0 0 0 0 1 180 c
+checkshape r
+
+set only_screen_axo 1