]> OCCT Git - occt.git/commitdiff
0033180: We had a problem calling the OCC library at the customer site, and the progr...
authorakaftasev <akaftasev@opencascade.com>
Thu, 17 Nov 2022 07:25:36 +0000 (10:25 +0300)
committersmoskvin <smoskvin@opencascade.com>
Sun, 4 Dec 2022 10:35:24 +0000 (13:35 +0300)
Added status for thrusection operations and changed throw constructions to set of the status and break the function.

12 files changed:
src/BRepFill/BRepFill_CompatibleWires.cxx
src/BRepFill/BRepFill_CompatibleWires.hxx
src/BRepFill/BRepFill_Generator.cxx
src/BRepFill/BRepFill_Generator.hxx
src/BRepFill/BRepFill_ThruSectionErrorStatus.hxx [new file with mode: 0644]
src/BRepFill/FILES
src/BRepOffsetAPI/BRepOffsetAPI_ThruSections.cxx
src/BRepOffsetAPI/BRepOffsetAPI_ThruSections.hxx
src/BRepTest/BRepTest_SweepCommands.cxx
tests/bugs/modalg_6/bug26636
tests/bugs/modalg_8/bug33180 [new file with mode: 0644]
tests/thrusection/bugs/bug24997

index ebb01adf79752e7c04e8fd0502b99b677da72c09..bc80acbe44e9c014650049c387117cf864db6de2 100644 (file)
@@ -656,7 +656,7 @@ static void BuildConnectedEdges(const TopoDS_Wire& aWire,
 //=======================================================================
 
 BRepFill_CompatibleWires::BRepFill_CompatibleWires() 
-:myIsDone(Standard_False)
+:myStatus(BRepFill_ThruSectionErrorStatus_NotDone)
 {
 }
 
@@ -682,7 +682,7 @@ void BRepFill_CompatibleWires::Init(const TopTools_SequenceOfShape& Sections)
   myInit = Sections;
   myWork = Sections;
   myPercent = 0.01;
-  myIsDone = Standard_False;
+  myStatus = BRepFill_ThruSectionErrorStatus_NotDone;
   myMap.Clear();
 
 }
@@ -707,7 +707,7 @@ void BRepFill_CompatibleWires::SetPercent(const Standard_Real Percent)
 
 Standard_Boolean BRepFill_CompatibleWires::IsDone() const 
 {
-  return myIsDone;
+  return myStatus == BRepFill_ThruSectionErrorStatus_Done;
 }
 
 
@@ -766,6 +766,7 @@ Standard_Boolean BRepFill_CompatibleWires::IsDegeneratedLastSection() const
 
 void BRepFill_CompatibleWires::Perform (const Standard_Boolean WithRotation)
 {
+  myStatus = BRepFill_ThruSectionErrorStatus_Done;
   // compute origin and orientation on wires to avoid twisted results
   // and update wires to have same number of edges
 
@@ -838,7 +839,7 @@ void BRepFill_CompatibleWires::Perform (const Standard_Boolean WithRotation)
     allClosed = (allClosed && wClosed);
     allOpen = (allOpen && !wClosed);
   }
-  
+
   if (allClosed) {
     // All sections are closed 
     if (report) {
@@ -849,24 +850,26 @@ void BRepFill_CompatibleWires::Perform (const Standard_Boolean WithRotation)
       // origin
       ComputeOrigin(Standard_False);
     }
-    myIsDone = Standard_True;
   }
   else if (allOpen) {
     // All sections are open
     // origin
     SearchOrigin();
+    if (myStatus != BRepFill_ThruSectionErrorStatus_Done)
+    {
+      return;
+    }
     // same number of elements
     if (report) {
       SameNumberByACR(report);
     }
-    myIsDone = Standard_True;
   }
   else {
     // There are open and closed sections :
     // not processed
-    throw Standard_DomainError("Sections must be all closed or all open");
+    myStatus = BRepFill_ThruSectionErrorStatus_NotSameTopology;
+    return;
   }
-  
 }
 
 
@@ -906,7 +909,10 @@ void BRepFill_CompatibleWires::
     //allClosed = (allClosed && myWork(i).Closed());
   }
   if (!allClosed)
-    throw Standard_NoSuchObject("BRepFill_CompatibleWires::SameNumberByPolarMethod : the wires must be closed");
+  {
+    myStatus = BRepFill_ThruSectionErrorStatus_NotSameTopology;
+    return;
+  }
   
   // sections ponctuelles, sections bouclantes ?
   if (myDegen1) ideb++;
@@ -986,8 +992,11 @@ void BRepFill_CompatibleWires::
     
     // sequence of vertices of the first wire
     SeqOfVertices(wire1,SeqV);
-    if (SeqV.Length()>NbMaxV) 
-      throw Standard_NoSuchObject("BRepFill::SameNumberByPolarMethod failed");
+    if (SeqV.Length() > NbMaxV)
+    {
+      myStatus = BRepFill_ThruSectionErrorStatus_Failed;
+      return;
+    }
     
     // loop on vertices of wire1
     for (ii=1;ii<=SeqV.Length();ii++) {
@@ -1062,7 +1071,10 @@ void BRepFill_CompatibleWires::
     // sequence of vertices of the first wire
     SeqOfVertices(wire1,SeqV);
     if ( SeqV.Length()>NbMaxV || SeqV.Length()>SizeMap ) 
-      throw Standard_NoSuchObject("BRepFill::SameNumberByPolarMethod failed");
+    {
+      myStatus = BRepFill_ThruSectionErrorStatus_Failed;
+      return;
+    }
     
 
     // next wire 
@@ -1184,14 +1196,17 @@ void BRepFill_CompatibleWires::
        }
       } //end of for(; itW.More(); itW.Next())
     if (Esol.IsNull())
-      throw Standard_ConstructionError("BRepFill :: profiles are inconsistent");
+    {
+      myStatus = BRepFill_ThruSectionErrorStatus_ProfilesInconsistent;
+      return;
+    }
     MW.Add(Esol);
 
     TopTools_ListOfShape ConnectedEdges;
     BuildConnectedEdges( TopoDS::Wire(myWork(i)), Esol, V2, ConnectedEdges );
 
     TopTools_ListIteratorOfListOfShape itCE(ConnectedEdges);
-    for(; anExp.More(), itCE.More(); anExp.Next(), itCE.Next())
+    for(; anExp.More() && itCE.More(); anExp.Next(), itCE.Next())
       {
        ECur = anExp.Current();
        TopExp::Vertices(ECur,VF,VL,Standard_True);
@@ -1264,8 +1279,10 @@ void BRepFill_CompatibleWires::
     if (nbmax<nbEdges) nbmax = nbEdges;
     if (nbmin>nbEdges) nbmin = nbEdges;
   }
-  if (nbmin!=nbmax) {
-    throw Standard_NoSuchObject("BRepFill_CompatibleWires::SameNumberByPolarMethod failed");
+  if (nbmin!=nbmax) 
+  {
+    myStatus = BRepFill_ThruSectionErrorStatus_Failed;
+    return;
   }
 
   //Fill <myMap>
@@ -1487,7 +1504,10 @@ void BRepFill_CompatibleWires::SameNumberByACR(const  Standard_Boolean  report)
     if (nbmin>nbEdges(i)) nbmin = nbEdges(i);
   }
   if (nbmax!=nbmin) 
-    throw Standard_NoSuchObject("BRepFill_CompatibleWires::SameNumberByACR failed");
+  {
+    myStatus = BRepFill_ThruSectionErrorStatus_Failed;
+    return;
+  }
 }
 
 //=======================================================================
@@ -1532,7 +1552,10 @@ void BRepFill_CompatibleWires::ComputeOrigin(const  Standard_Boolean /*polar*/ )
   }
 */
   if (!allClosed) 
-    throw Standard_NoSuchObject("BRepFill_CompatibleWires::ComputeOrigin : the wires must be closed");
+  {
+    myStatus = BRepFill_ThruSectionErrorStatus_NotSameTopology;
+    return;
+  }
 
 /*  
   // Max number of possible cuts
@@ -1869,7 +1892,10 @@ void BRepFill_CompatibleWires::ComputeOrigin(const  Standard_Boolean /*polar*/ )
       gp_Pnt Pmini,P1,P2;
       SeqOfVertices(wire,SeqV);
       if (SeqV.Length()>NbMaxV) 
-       throw Standard_NoSuchObject("BRepFill::ComputeOrigin failed");
+      {
+        myStatus = BRepFill::ThruSectionsError_Failed;
+        return;
+      }
       if (!polar) {
        // choix du vertex le plus proche comme origine
        distmini = Precision::Infinite();
@@ -2094,7 +2120,10 @@ void BRepFill_CompatibleWires::SearchOrigin()
     allOpen = (allOpen && !myWork(i).Closed());
   }
   if (!allOpen)
-    throw Standard_NoSuchObject("BRepFill_CompatibleWires::SearchOrigin : the wires must be open");
+  {
+    myStatus = BRepFill_ThruSectionErrorStatus_NotSameTopology;
+    return;
+  }
 
   // init
 
index ffcac2acc8352e0579708780daadefe4bae9a219..fa7bc0ca2401022c0a651558eb6f190c4cad2330 100644 (file)
@@ -20,6 +20,7 @@
 #include <Standard.hxx>
 #include <Standard_DefineAlloc.hxx>
 
+#include <BRepFill_ThruSectionErrorStatus.hxx>
 #include <TopTools_SequenceOfShape.hxx>
 #include <TopTools_DataMapOfShapeListOfShape.hxx>
 #include <TopTools_ListOfShape.hxx>
@@ -49,6 +50,11 @@ public:
   Standard_EXPORT void Perform (const Standard_Boolean WithRotation = Standard_True);
   
   Standard_EXPORT Standard_Boolean IsDone() const;
+
+  BRepFill_ThruSectionErrorStatus GetStatus() const
+  {
+    return myStatus;
+  }
   
   //! returns the generated sequence.
   Standard_EXPORT const TopTools_SequenceOfShape& Shape() const;
@@ -101,7 +107,7 @@ private:
   Standard_Real myPercent;
   Standard_Boolean myDegen1;
   Standard_Boolean myDegen2;
-  Standard_Boolean myIsDone;
+  BRepFill_ThruSectionErrorStatus myStatus;
   TopTools_DataMapOfShapeListOfShape myMap;
 
 
index 756a31bf03eb74069202eb0c4e17f77bc79375d8..553a0365a0dcac2837cacbe51bee2351019cca48 100644 (file)
@@ -65,6 +65,7 @@ Standard_Integer DetectKPart(const TopoDS_Edge& Edge1,
                             const TopoDS_Edge& Edge2)
 {
   // initializations
+  // !Note if IType set as -1 it means that occurs error with null 3d curve for the edge
   Standard_Integer IType = 0;
 
   // characteristics of the first edge
@@ -89,7 +90,9 @@ Standard_Integer DetectKPart(const TopoDS_Edge& Edge1,
   else {
     curv1 = BRep_Tool::Curve(Edge1, loc, first1, last1);
     if (curv1.IsNull())
-      throw Standard_NullObject("Null 3D curve in edge");
+    {
+      return -1;
+    }
     curv1 = 
       Handle(Geom_Curve)::DownCast(curv1->Transformed(loc.Transformation()));
     ff = first1;
@@ -156,7 +159,9 @@ Standard_Integer DetectKPart(const TopoDS_Edge& Edge1,
     else {
       curv = BRep_Tool::Curve(Edge2, loc, first2, last2);
       if (curv.IsNull())
-        throw Standard_NullObject("Null 3D curve in edge");
+      {
+        return -1;
+      }
       curv = 
        Handle(Geom_Curve)::DownCast(curv->Transformed(loc.Transformation()));
       ff = first2;
@@ -312,12 +317,12 @@ Standard_Integer DetectKPart(const TopoDS_Edge& Edge1,
 
 //=======================================================================
 //function : CreateKPart
-//purpose  : 
+//purpose  : Returns true if there is no errors occur
 //=======================================================================
 
-void CreateKPart(const TopoDS_Edge& Edge1,const TopoDS_Edge& Edge2,
-                const Standard_Integer IType, 
-                Handle(Geom_Surface)& Surf)
+Standard_Boolean CreateKPart (const TopoDS_Edge& Edge1,const TopoDS_Edge& Edge2,
+                              const Standard_Integer IType, 
+                              Handle(Geom_Surface)& Surf)
 {
   // find the dimension
   TopoDS_Vertex V1, V2;
@@ -326,6 +331,8 @@ void CreateKPart(const TopoDS_Edge& Edge1,const TopoDS_Edge& Edge2,
   Standard_Real a1, b1, aa =0., bb =0.;
   TopoDS_Vertex v1f,v1l,v2f,v2l;
 
+  Standard_Boolean isDone = Standard_True;
+
   // find characteristics of the first edge
   Handle(Geom_Curve) C1;
   Standard_Boolean degen1 = BRep_Tool::Degenerated(Edge1);
@@ -336,7 +343,9 @@ void CreateKPart(const TopoDS_Edge& Edge1,const TopoDS_Edge& Edge2,
   else {
     C1 = BRep_Tool::Curve(Edge1, loc, a1, b1);
     if (C1.IsNull())
-      throw Standard_NullObject("Null 3D curve in edge");
+    {
+      return Standard_False;
+    }
     C1 = Handle(Geom_Curve)::DownCast(C1->Transformed(loc.Transformation()));
     aa = a1;
     bb = b1;
@@ -361,7 +370,9 @@ void CreateKPart(const TopoDS_Edge& Edge1,const TopoDS_Edge& Edge2,
   else {
     C2 = BRep_Tool::Curve(Edge2, loc, a1, b1);
     if (C2.IsNull())
-      throw Standard_NullObject("Null 3D curve in edge");
+    {
+      return Standard_False;
+    }
     C2 = Handle(Geom_Curve)::DownCast(C2->Transformed(loc.Transformation()));
     if (Edge2.Orientation() == TopAbs_REVERSED) {
       C2->Reverse();
@@ -496,6 +507,7 @@ void CreateKPart(const TopoDS_Edge& Edge1,const TopoDS_Edge& Edge2,
     // IType incorrect
   }
   Surf = surface;
+  return isDone;
 }
 
 //=======================================================================
@@ -528,7 +540,8 @@ static TopoDS_Edge CreateNewEdge(const TopoDS_Edge& theEdge, TopTools_DataMapOfS
 //=======================================================================
 
 BRepFill_Generator::BRepFill_Generator(): 
-  myMutableInput (Standard_True)
+  myMutableInput (Standard_True),
+  myStatus (BRepFill_ThruSectionErrorStatus_NotDone)
 {
 }
 
@@ -551,6 +564,8 @@ void BRepFill_Generator::AddWire(const TopoDS_Wire& Wire)
 
 void BRepFill_Generator::Perform()
 {
+  myStatus = BRepFill_ThruSectionErrorStatus_Done;
+
   TopoDS_Shell Shell;
   TopoDS_Face  Face;
   TopoDS_Shape S1, S2;
@@ -679,6 +694,12 @@ void BRepFill_Generator::Perform()
 
       // processing of KPart
       Standard_Integer IType = DetectKPart(Edge1,Edge2);
+      if (IType == -1)
+      {
+        myStatus = BRepFill_ThruSectionErrorStatus_Null3DCurve;
+        return;
+      }
+
       if (IType==0) {
        // no part cases
        TopLoc_Location L,L1,L2;
@@ -694,7 +715,10 @@ void BRepFill_Generator::Perform()
        else {
          C1 = BRep_Tool::Curve(Edge1,L1,f1,l1);
           if (C1.IsNull())
-            throw Standard_NullObject("Null 3D curve in edge");
+          {
+            myStatus = BRepFill_ThruSectionErrorStatus_Null3DCurve;
+            return;
+          }
        }
        if (degen2) {
          Extremities(1) = BRep_Tool::Pnt(V2l);
@@ -704,7 +728,10 @@ void BRepFill_Generator::Perform()
        else {
          C2 = BRep_Tool::Curve(Edge2,L2,f2,l2);
           if (C2.IsNull())
-            throw Standard_NullObject("Null 3D curve in edge");
+          {
+            myStatus = BRepFill_ThruSectionErrorStatus_Null3DCurve;
+            return;
+          }
        }
        
        // compute the location
@@ -746,7 +773,11 @@ void BRepFill_Generator::Perform()
       }
       else {
        // particular case
-       CreateKPart(Edge1,Edge2,IType,Surf);
+        if (!CreateKPart(Edge1, Edge2, IType, Surf))
+        {
+          myStatus = BRepFill_ThruSectionErrorStatus_Null3DCurve;
+          return;
+        }
        B.MakeFace(Face,Surf,Precision::Confusion());
       }
       
index 421040bd5a8b6358ec2480d4cd5efc0e4b7e9805..65b31657a555d5679f0f90a05ddaa038ec99f8c9 100644 (file)
@@ -20,6 +20,7 @@
 #include <Standard.hxx>
 #include <Standard_DefineAlloc.hxx>
 
+#include <BRepFill_ThruSectionErrorStatus.hxx>
 #include <TopTools_SequenceOfShape.hxx>
 #include <TopoDS_Shell.hxx>
 #include <TopTools_DataMapOfShapeListOfShape.hxx>
@@ -68,6 +69,12 @@ public:
   //! Returns the current mutable input state
   Standard_EXPORT Standard_Boolean IsMutableInput() const;
 
+  //! Returns status of the operation
+  BRepFill_ThruSectionErrorStatus GetStatus() const
+  {
+    return myStatus;
+  }
+
 protected:
 
 private:
@@ -78,6 +85,7 @@ private:
   TopTools_DataMapOfShapeShape myOldNewShapes;
   BRepTools_ReShape myReshaper;
   Standard_Boolean myMutableInput;
+  BRepFill_ThruSectionErrorStatus myStatus;
 
 };
 
diff --git a/src/BRepFill/BRepFill_ThruSectionErrorStatus.hxx b/src/BRepFill/BRepFill_ThruSectionErrorStatus.hxx
new file mode 100644 (file)
index 0000000..4700b2a
--- /dev/null
@@ -0,0 +1,29 @@
+// Copyright (c) 2022 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _BRepFill_ThruSectionErrorStatus_HeaderFile
+#define _BRepFill_ThruSectionErrorStatus_HeaderFile
+
+//! Errors that can occur at thrusection algorithm.
+enum BRepFill_ThruSectionErrorStatus
+{
+  BRepFill_ThruSectionErrorStatus_Done,                     //!< Thrusection algorithm is done
+  BRepFill_ThruSectionErrorStatus_NotDone,                  //!< Thrusection algorithm is not done
+  BRepFill_ThruSectionErrorStatus_NotSameTopology,          //!< All profiles have not same topology (they should be all closed or all opened)
+  BRepFill_ThruSectionErrorStatus_ProfilesInconsistent,     //!< Profiles are inconsistent 
+  BRepFill_ThruSectionErrorStatus_WrongUsage,               //!< Wrong usage of punctual sections
+  BRepFill_ThruSectionErrorStatus_Null3DCurve,              //!< Null 3D curve in edge
+  BRepFill_ThruSectionErrorStatus_Failed                    //!< Thrusection algorithm has failed
+};
+
+#endif // _BRepFill_ThruSectionErrorStatus_HeaderFile
index 9289a69da42fa2b1f302b618de8b3ce798c9e5a9..655a1ff3c82106c106d5bc0a48d762e8adcab996 100644 (file)
@@ -77,6 +77,7 @@ BRepFill_ShapeLaw.hxx
 BRepFill_ShapeLaw.lxx
 BRepFill_Sweep.cxx
 BRepFill_Sweep.hxx
+BRepFill_ThruSectionErrorStatus.hxx
 BRepFill_TransitionStyle.hxx
 BRepFill_TrimEdgeTool.cxx
 BRepFill_TrimEdgeTool.hxx
index c9312271369787ca883c2c7633f972adac2d98f4..96c12766ac224733025feab4a1d2b1b80e88e5dc 100644 (file)
@@ -262,6 +262,7 @@ BRepOffsetAPI_ThruSections::BRepOffsetAPI_ThruSections(const Standard_Boolean is
   myCritWeights[1] = .2; 
   myCritWeights[2] = .4; 
   myUseSmoothing = Standard_False;
+  myStatus = BRepFill_ThruSectionErrorStatus_NotDone;
 }
 
 
@@ -286,7 +287,7 @@ void BRepOffsetAPI_ThruSections::Init(const Standard_Boolean isSolid, const Stan
   myCritWeights[1] = .2; 
   myCritWeights[2] = .4; 
   myUseSmoothing = Standard_False;
-
+  myStatus = BRepFill_ThruSectionErrorStatus_NotDone;
 }
 
 
@@ -343,6 +344,7 @@ void BRepOffsetAPI_ThruSections::CheckCompatibility(const Standard_Boolean check
 
 void BRepOffsetAPI_ThruSections::Build(const Message_ProgressRange& /*theRange*/)
 {
+  myStatus = BRepFill_ThruSectionErrorStatus_Done;
   myBFGenerator.Nullify();
   //Check set of section for right configuration of punctual sections
   Standard_Integer i;
@@ -356,7 +358,10 @@ void BRepOffsetAPI_ThruSections::Build(const Message_ProgressRange& /*theRange*/
       wdeg = wdeg && (BRep_Tool::Degenerated(anEdge));
     }
     if (wdeg)
-      throw Standard_Failure("Wrong usage of punctual sections");
+    {
+      myStatus = BRepFill_ThruSectionErrorStatus_WrongUsage;
+      return;
+    }
   }
   if (myWires.Length() <= 2)
   {
@@ -371,7 +376,8 @@ void BRepOffsetAPI_ThruSections::Build(const Message_ProgressRange& /*theRange*/
     }
     if (wdeg)
     {
-      throw Standard_Failure("Wrong usage of punctual sections");
+      myStatus = BRepFill_ThruSectionErrorStatus_WrongUsage;
+      return;
     }
   }
 
@@ -447,6 +453,13 @@ void BRepOffsetAPI_ThruSections::Build(const Message_ProgressRange& /*theRange*/
         }
       }
     }
+    else
+    {
+      myStatus = Georges.GetStatus();
+      NotDone();
+      return;
+    }
+
     myWires = WorkingSections;
   } //if (myWCheck)
   else //no check
@@ -498,6 +511,12 @@ void BRepOffsetAPI_ThruSections::Build(const Message_ProgressRange& /*theRange*/
     NotDone();
     return;
   }
+
+  if (myStatus != BRepFill_ThruSectionErrorStatus_Done)
+  {
+    NotDone();
+    return;
+  }
   // Encode the Regularities
   BRepLib::EncodeRegularity(myShape);
 }
@@ -520,6 +539,12 @@ void BRepOffsetAPI_ThruSections::CreateRuled()
     myBFGenerator->AddWire(TopoDS::Wire(myWires(i)));
   }
   myBFGenerator->Perform();
+  BRepFill_ThruSectionErrorStatus aStatus = myBFGenerator->GetStatus();
+  if (aStatus != BRepFill_ThruSectionErrorStatus_Done)
+  {
+    myStatus = aStatus;
+    return;
+  }
   TopoDS_Shell shell = myBFGenerator->Shell();
 
   if (myIsSolid) {
@@ -739,6 +764,7 @@ void BRepOffsetAPI_ThruSections::CreateSmoothed()
   TS = TotalSurf(shapes,nbSects,nbEdges,w1Point,w2Point,vClosed);
 
   if(TS.IsNull()) {
+    myStatus = BRepFill_ThruSectionErrorStatus_Failed;
     return;
   }
 
@@ -934,14 +960,12 @@ void BRepOffsetAPI_ThruSections::CreateSmoothed()
     else {
       myShape = MakeSolid(shell, newW1, newW2, myPres3d, myFirst, myLast);
     }
-
-    Done();
   }
 
   else {
     myShape = shell;
-    Done();
   }
+  Done();
 
   TopTools_DataMapOfShapeReal aVertexToleranceMap;
   TopExp_Explorer aTopExplorer(myShape,TopAbs_EDGE);
@@ -1040,7 +1064,9 @@ static Handle(Geom_BSplineCurve) EdgeToBSpline (const TopoDS_Edge& theEdge)
     Standard_Real aFirst, aLast;
     Handle(Geom_Curve) aCurve = BRep_Tool::Curve (theEdge, aLoc, aFirst, aLast);
     if (aCurve.IsNull())
-      throw Standard_NullObject("Null 3D curve in edge");
+    {
+      return nullptr;
+    }
 
     // convert its part used by edge to bspline; note that if edge curve is bspline,
     // conversion made via trimmed curve is still needed -- it will copy it, segment 
@@ -1132,6 +1158,10 @@ Handle(Geom_BSplineSurface) BRepOffsetAPI_ThruSections::
       // read the first edge to initialise CompBS;
       TopoDS_Edge aPrevEdge = TopoDS::Edge (shapes((j-1)*NbEdges+1));
       Handle(Geom_BSplineCurve) curvBS = EdgeToBSpline (aPrevEdge);
+      if (curvBS.IsNull())
+      {
+        return nullptr;
+      }
 
       // initialization
       GeomConvert_CompCurveToBSplineCurve CompBS(curvBS);
@@ -1145,6 +1175,10 @@ Handle(Geom_BSplineSurface) BRepOffsetAPI_ThruSections::
         aTolV = Max(aTolV, BRep_Tool::Tolerance(vl));
         aTolV = Min(aTolV, 1.e-3);
         curvBS = EdgeToBSpline (aNextEdge);
+        if (curvBS.IsNull())
+        {
+          return nullptr;
+        }
 
         // concatenation
         CompBS.Add(curvBS, aTolV, Standard_True, Standard_False, 1);
@@ -1503,7 +1537,11 @@ void BRepOffsetAPI_ThruSections::CriteriumWeight(Standard_Real& W1, Standard_Rea
 
 void BRepOffsetAPI_ThruSections::SetCriteriumWeight(const Standard_Real W1, const Standard_Real W2, const Standard_Real W3)
 {
-  if (W1 < 0 || W2 < 0 || W3 < 0 ) throw Standard_DomainError();
+  if (W1 < 0 || W2 < 0 || W3 < 0)
+  {
+    myStatus = BRepFill_ThruSectionErrorStatus_Failed;
+    return;
+  }
   myCritWeights[0] = W1;
   myCritWeights[1] = W2;
   myCritWeights[2] = W3;
index a69dc022b4984ff26a7728163418adeb4d34adcb..066058eb4ccb463c2a01c76084e2caf056dd977f 100644 (file)
@@ -21,6 +21,7 @@
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
 
+#include <BRepFill_ThruSectionErrorStatus.hxx>
 #include <TopTools_SequenceOfShape.hxx>
 #include <TopoDS_Face.hxx>
 #include <TopTools_DataMapOfShapeShape.hxx>
@@ -163,6 +164,11 @@ public:
   //! Returns the current mutable input state
   Standard_EXPORT Standard_Boolean IsMutableInput() const;
   
+  //! Returns the status of thrusection operation
+  BRepFill_ThruSectionErrorStatus GetStatus() const
+  {
+    return myStatus;
+  }
 
 protected:
 
@@ -206,6 +212,7 @@ private:
   Standard_Boolean myUseSmoothing;
   Standard_Boolean myMutableInput;
   NCollection_Handle<BRepFill_Generator> myBFGenerator;
+  BRepFill_ThruSectionErrorStatus myStatus;
 
 };
 
index 100feb264450bb6b241f72f96e374968f6574b22..e4cb347e72fe2668471c089727c3c4a17f6e8201 100644 (file)
@@ -443,7 +443,7 @@ Standard_Integer gener(Draw_Interpretor&, Standard_Integer n, const char** a)
 //purpose  : 
 //=======================================================================
 
-Standard_Integer thrusections(Draw_Interpretor&, Standard_Integer n, const char** a)
+Standard_Integer thrusections(Draw_Interpretor& di, Standard_Integer n, const char** a)
 {
   if (n < 6) return 1;
 
@@ -525,7 +525,30 @@ Standard_Integer thrusections(Draw_Interpretor&, Standard_Integer n, const char*
       BRepTest_Objects::SetHistory(Generator->Wires(), *Generator);
   }
   else {
-    std::cout << "Algorithm is not done" << std::endl;
+    BRepFill_ThruSectionErrorStatus aStatus = Generator->GetStatus();
+    switch (aStatus)
+    {
+    case BRepFill_ThruSectionErrorStatus_NotDone:
+      di << "Algorithm is not done\n";
+      break;
+    case BRepFill_ThruSectionErrorStatus_NotSameTopology:
+      di << "The input profiles should be all closed or all opened\n";
+      break;
+    case BRepFill_ThruSectionErrorStatus_ProfilesInconsistent:
+      di << "Profiles inconsistent\n";
+      break;
+    case BRepFill_ThruSectionErrorStatus_WrongUsage:
+      di << "Wrong usage of punctual sections\n";
+      break;
+    case BRepFill_ThruSectionErrorStatus_Null3DCurve:
+      di << "Some edges have null 3d curve";
+      break;
+    case BRepFill_ThruSectionErrorStatus_Failed:
+      di << "Algorithm has failed\n";
+      break;
+    default:
+      break;
+    }
   }
 
   return 0;
index df079c47b13d6b29ff50f624bbcfd26e1afcaa78..75969471087c747d760458f0f935681b4776af51 100644 (file)
@@ -1,4 +1,6 @@
-puts "REQUIRED All: Standard_ConstructionError\\: BRepFill \\:\\: profiles are inconsistent"
+puts "REQUIRED All: Profiles inconsistent"
+puts "REQUIRED All: Error: Algorithm has failed"
+
 puts "=========="
 puts "OCC26636"
 puts "=========="
@@ -10,4 +12,9 @@ puts ""
 restore [locate_data_file bug26636_w1.brep] w1
 restore [locate_data_file bug26636_w2.brep] w2
 
-catch {thrusections result 0 1 w1 w2}
+thrusections result 0 1 w1 w2
+
+
+if {![isdraw result]} {
+  puts "Error: Algorithm has failed"
+}
diff --git a/tests/bugs/modalg_8/bug33180 b/tests/bugs/modalg_8/bug33180
new file mode 100644 (file)
index 0000000..87b85dc
--- /dev/null
@@ -0,0 +1,83 @@
+puts "REQUIRED ALL: Algorithm has failed"
+
+puts "========================"
+puts "0033180: We had a problem calling the OCC library at the customer site"
+puts "========================"
+puts ""
+
+ellipse e 1982.57313150102 4275.76510950417 9.86296194928099  0 1 0  0 0 1  0.114299999871658 0.114299999871477
+mkedge e e
+wire w1 e 
+
+polyline w2 1982.5731315010235 4275.7682845041272 9.9771213071771765 \
+1982.5787999289748 4275.7682845041272 9.9771213071771765 \
+1982.5900810211417 4275.7682845041272 9.9759982412286909 \
+1982.6011953705065 4275.7682845041272 9.9737631624170451 \
+1982.6120336335414 4275.7682845041272 9.9704380624719775 \
+1982.6224891918419 4275.7682845041272 9.9660556333490522 \
+1982.6324591844793 4275.7682845041272 9.9606590097376024 \
+1982.6418455284352 4275.7682845041272 9.9543012731500777 \
+1982.6505558889621 4275.7682845041272 9.9470449655481499 \
+1982.6585045688862 4275.7682845041272 9.9389614837595133 \
+1982.6656133812182 4275.7682845041272 9.9301303356119313 \
+1982.6718123787159 4275.7682845041272 9.9206384056039951 \
+1982.6770405929797 4275.7682845041272 9.9105790775247744 \
+1982.6770405929797 4275.7778095039830 9.9105790775247744 \
+1982.6811072223895 4275.7778095039830 9.9004550688692241 \
+1982.6841900604484 4275.7778095039830 9.8899894516893543 \
+1982.6862610309836 4275.7778095039830 9.8792775850721526 \
+1982.6873012512442 4275.7778095039830 9.8684170620866922 \
+1982.6873012512442 4275.7778095039830 9.8575068365760963 \
+1982.6862610309836 4275.7778095039830 9.8466463141866836 \
+1982.6841900604484 4275.7778095039830 9.8359344451852966 \
+1982.6811072223895 4275.7778095039830 9.8254688303896121 \
+1982.6770405929797 4275.7778095039830 9.8153448217340618 \
+1982.6770405929797 4275.7682845041272 9.8153448217340618 \
+1982.6718123787159 4275.7682845041272 9.8052854936548393 \
+1982.6656133812182 4275.7682845041272 9.7957935636469031 \
+1982.6585045688862 4275.7682845041272 9.7869624154993211 \
+1982.6505558889621 4275.7682845041272 9.7788789289423139 \
+1982.6418455284352 4275.7682845041272 9.7716226213403843 \
+1982.6324591844793 4275.7682845041272 9.7652648847528614 \
+1982.6224891918419 4275.7682845041272 9.7598682611414116 \
+1982.6120336335414 4275.7682845041272 9.7554858415552310 \
+1982.6011953705065 4275.7682845041272 9.7521607320734187 \
+1982.5900810211417 4275.7682845041272 9.7499256532617729 \
+1982.5787999289748 4275.7682845041272 9.7488025873132873 \
+1982.5674630730864 4275.7682845041272 9.7488025873132873 \
+1982.5561819809195 4275.7682845041272 9.7499256532617729 \
+1982.5450676315540 4275.7682845041272 9.7521607320734187 \
+1982.5342293685192 4275.7682845041272 9.7554858415552310 \
+1982.5237738102194 4275.7682845041272 9.7598682611414116 \
+1982.5138038175819 4275.7682845041272 9.7652648847528614 \
+1982.5044174736254 4275.7682845041272 9.7716226213403843 \
+1982.4957071130984 4275.7682845041272 9.7788789289423139 \
+1982.4877584331743 4275.7682845041272 9.7869624154993211 \
+1982.4806496208423 4275.7682845041272 9.7957935636469031 \
+1982.4744506233446 4275.7682845041272 9.8052854936548393 \
+1982.4692224090809 4275.7682845041272 9.8153448217340618 \
+1982.4692224090809 4275.7778095039830 9.8153448217340618 \
+1982.4651557796710 4275.7778095039830 9.8254688303896121 \
+1982.4620729416129 4275.7778095039830 9.8359344451852966 \
+1982.4600019710776 4275.7778095039830 9.8466463141866836 \
+1982.4589617508170 4275.7778095039830 9.8575068365760963 \
+1982.4589617508170 4275.7778095039830 9.8684170620866922 \
+1982.4600019710776 4275.7778095039830 9.8792775850721526 \
+1982.4620729416129 4275.7778095039830 9.8899894516893543 \
+1982.4651557796710 4275.7778095039830 9.9004550688692241 \
+1982.4692224090809 4275.7778095039830 9.9105790775247744 \
+1982.4692224090809 4275.7682845041272 9.9105790775247744 \
+1982.4744506233446 4275.7682845041272 9.9206384056039951 \
+1982.4806496208423 4275.7682845041272 9.9301303356119313 \
+1982.4877584331743 4275.7682845041272 9.9389614837595133 \
+1982.4957071130984 4275.7682845041272 9.9470449655481499 \
+1982.5044174736254 4275.7682845041272 9.9543012731500777 \
+1982.5138038175819 4275.7682845041272 9.9606590097376024 \
+1982.5237738102194 4275.7682845041272 9.9660556333490522 \
+1982.5342293685192 4275.7682845041272 9.9704380624719775 \
+1982.5450676315540 4275.7682845041272 9.9737631624170451 \
+1982.5561819809195 4275.7682845041272 9.9759982412286909 \
+1982.5674630730864 4275.7682845041272 9.9771213071771765 \
+1982.5731315010235 4275.7682845041272 9.9771213071771765
+
+thrusections res 0 0 w1 w2 
index e859880cc7958edff1a556c7f48b093c04b72375..57d21acac76a75d607d7cb1a550b914747439540 100755 (executable)
@@ -1,5 +1,4 @@
-puts "TODO OCC24997 ALL: An exception was caught"
-puts "TODO OCC24997 ALL: TEST INCOMPLETE"
+puts "REQUIRED ALL: Error : The command cannot be built."
 
 puts "========"
 puts "0024997: S I G S E G V in BRepOffsetAPI_ThruSections"