0025109: Check PolygonOnTriangulation contained in edges
authornbv <nbv@opencascade.com>
Thu, 2 Oct 2014 09:54:14 +0000 (13:54 +0400)
committerbugmaster <bugmaster@opencascade.com>
Thu, 2 Oct 2014 09:54:54 +0000 (13:54 +0400)
1. New status "BRepCheck_InvalidPolygonOnTriangulation" is added.
2. Small correction of output of "checkshape" command result.

Test cases were changed.

Test case for issue CR25109

Some test cases were changed according to their new behavior.

17 files changed:
src/BRepCheck/BRepCheck.cdl
src/BRepCheck/BRepCheck.cxx
src/BRepCheck/BRepCheck_Analyzer.cxx
src/BRepCheck/BRepCheck_Edge.cdl
src/BRepCheck/BRepCheck_Edge.cxx
src/BRepCheck/BRepCheck_Face.cdl
src/BRepCheck/BRepCheck_Face.cxx
src/BRepCheck/BRepCheck_Wire.cdl
src/BRepCheck/BRepCheck_Wire.cxx
src/BRepTest/BRepTest_CheckCommands.cxx
tests/boolean/bfuse_complex/M7
tests/boolean/bopfuse_complex/E5
tests/bugs/modalg_4/bug62
tests/bugs/moddata_3/bug25109 [new file with mode: 0644]
tests/bugs/vis/bug288_5
tests/heal/data/advanced/K4
tests/sewing/tol_100/W6

index 71343e2..56519a3 100644 (file)
@@ -98,6 +98,8 @@ is
       BadOrientation,
       BadOrientationOfSubshape,
       
+      InvalidPolygonOnTriangulation,
+
       InvalidToleranceValue,
 
       -- for exception
index 958f612..5bda987 100644 (file)
@@ -175,6 +175,13 @@ void BRepCheck::Print(const BRepCheck_Status stat,
   case BRepCheck_CheckFail:
     OS << "BRepCheck_CheckFail\n";
     break;
+  case BRepCheck_InvalidPolygonOnTriangulation:
+    OS << "BRepCheck_InvalidPolygonOnTriangulation\n";
+    break;
+  case BRepCheck_InvalidToleranceValue:
+    OS << "BRepCheck_InvalidToleranceValue\n";
+    break;
+
   default:
     break;
   }
index 44e1e57..80578e8 100644 (file)
@@ -103,15 +103,17 @@ void BRepCheck_Analyzer::Put(const TopoDS_Shape& S,
 
 void BRepCheck_Analyzer::Perform(const TopoDS_Shape& S)
 {
-  for(TopoDS_Iterator theIterator(S);theIterator.More();theIterator.Next()) {
+  for(TopoDS_Iterator theIterator(S);theIterator.More();theIterator.Next()) 
     Perform(theIterator.Value());
-  }
+  
   //
   TopAbs_ShapeEnum styp;
   TopExp_Explorer exp;
   //
   styp = S.ShapeType();
-  switch (styp) {
+  
+  switch (styp) 
+  {
   case TopAbs_VERTEX: 
     // modified by NIZHNY-MKK  Wed May 19 16:56:16 2004.BEGIN
     // There is no need to check anything.
@@ -121,306 +123,313 @@ void BRepCheck_Analyzer::Perform(const TopoDS_Shape& S)
     // modified by NIZHNY-MKK  Wed May 19 16:56:23 2004.END
   
     break;
-  case TopAbs_EDGE:    {
-    //  Modified by skv - Tue Apr 27 11:38:08 2004 Begin
-    // There is no need to check anything except vertices on single edge.
-    //       if (myShape.IsSame(S)) {
-    //         myMap(S)->Blind();
-    //       }
-    //  Modified by skv - Tue Apr 27 11:38:09 2004 End
-    TopTools_MapOfShape MapS;
-    
-    for (exp.Init(S,TopAbs_VERTEX);exp.More(); exp.Next()) {
-      const TopoDS_Shape& aVertex = exp.Current();
-      try {
-       OCC_CATCH_SIGNALS
-       if (MapS.Add(aVertex)) {
-         myMap(aVertex)->InContext(S);
-       }
+  case TopAbs_EDGE:
+    {
+      Handle(BRepCheck_Result)& aRes = myMap(S);
+
+      try
+      {
+        BRepCheck_Status ste = Handle(BRepCheck_Edge)::
+          DownCast(aRes)->CheckPolygonOnTriangulation(TopoDS::Edge(S));
+
+        if(ste != BRepCheck_NoError)
+        {
+          Handle(BRepCheck_Edge)::DownCast(aRes)->SetStatus(ste);
+        }
       }
-      catch(Standard_Failure) {
+      catch(Standard_Failure)
+      {
 #ifdef DEB
-       cout<<"BRepCheck_Analyzer : ";
-       Standard_Failure::Caught()->Print(cout);  
-       cout<<endl;
+        cout<<"BRepCheck_Analyzer : ";
+        Standard_Failure::Caught()->Print(cout);  
+        cout<<endl;
 #endif
-       if ( ! myMap(S).IsNull() ) {
-         myMap(S)->SetFailStatus(S);
-       }
-       Handle(BRepCheck_Result) aRes = myMap(aVertex);
-       if ( ! aRes.IsNull() ) {
-         aRes->SetFailStatus(aVertex);
-         aRes->SetFailStatus(S);
-       }
+        if ( ! myMap(S).IsNull() )
+        {
+          myMap(S)->SetFailStatus(S);
+        }
+
+        if ( ! aRes.IsNull() )
+        {
+          aRes->SetFailStatus(exp.Current());
+          aRes->SetFailStatus(S);
+        }
       }
-    }
+
+      TopTools_MapOfShape MapS;
+      
+      for (exp.Init(S,TopAbs_VERTEX);exp.More(); exp.Next())
+      {
+        const TopoDS_Shape& aVertex = exp.Current();
+        try
+        {
+          OCC_CATCH_SIGNALS
+          if (MapS.Add(aVertex))
+            myMap(aVertex)->InContext(S);
+        }
+        catch(Standard_Failure)
+        {
+#ifdef DEB
+          cout<<"BRepCheck_Analyzer : ";
+          Standard_Failure::Caught()->Print(cout);  
+          cout<<endl;
+#endif
+          if ( ! myMap(S).IsNull() )
+            myMap(S)->SetFailStatus(S);
+
+          Handle(BRepCheck_Result) aRes = myMap(aVertex);
+
+          if ( ! aRes.IsNull() ) 
+          {
+            aRes->SetFailStatus(aVertex);
+            aRes->SetFailStatus(S);
+          }
+        }//catch(Standard_Failure)
+      }//for (exp.Init(S,TopAbs_VERTEX);exp.More(); exp.Next())
     }
     break;
   case TopAbs_WIRE:
-    //  Modified by Sergey KHROMOV - Mon May  6 15:53:39 2002 Begin
-    // There is no need to check the orientation of a single wire 
-    // (not in context of face).
-    //     {
-    //       if (myShape.IsSame(S)) {
-    //         Handle(BRepCheck_Wire)::DownCast(myMap(S))->Orientation(TopoDS_Face(),
-    //                                                                 Standard_True);
-    //       }
-    //     }
-    //  Modified by Sergey KHROMOV - Mon May  6 15:53:40 2002 End
+    {
+    }
     break;
   case TopAbs_FACE:
     {
       TopTools_MapOfShape MapS;
-      for (exp.Init(S,TopAbs_VERTEX);exp.More(); exp.Next()) {
-       try {
-         OCC_CATCH_SIGNALS
-         if (MapS.Add(exp.Current())) {
-           myMap(exp.Current())->InContext(S);
-         }
-       }
-       catch(Standard_Failure) {
+      for (exp.Init(S,TopAbs_VERTEX);exp.More(); exp.Next())
+      {
+        try
+        {
+          OCC_CATCH_SIGNALS
+          if (MapS.Add(exp.Current()))
+          {
+            myMap(exp.Current())->InContext(S);
+          }
+        }
+        catch(Standard_Failure)
+        {
 #ifdef DEB
-         cout<<"BRepCheck_Analyzer : ";
-         Standard_Failure::Caught()->Print(cout);  
-         cout<<endl;
+          cout<<"BRepCheck_Analyzer : ";
+          Standard_Failure::Caught()->Print(cout);  
+          cout<<endl;
 #endif
-         if ( ! myMap(S).IsNull() ) {
-           myMap(S)->SetFailStatus(S);
-         }
-         Handle(BRepCheck_Result) aRes = myMap(exp.Current());
-
-         if ( ! aRes.IsNull() ) {
-           aRes->SetFailStatus(exp.Current());
-           aRes->SetFailStatus(S);
-         }
-       }
+          if ( ! myMap(S).IsNull() )
+          {
+            myMap(S)->SetFailStatus(S);
+          }
+          
+          Handle(BRepCheck_Result) aRes = myMap(exp.Current());
+
+          if ( ! aRes.IsNull() )
+          {
+            aRes->SetFailStatus(exp.Current());
+            aRes->SetFailStatus(S);
+          }
+        }
       }
+
       Standard_Boolean performwire = Standard_True;
+      Standard_Boolean isInvalidTolerance = Standard_False;
       MapS.Clear();
-      for (exp.Init(S,TopAbs_EDGE);exp.More(); exp.Next()) {
-       try {
-         OCC_CATCH_SIGNALS
-         if (MapS.Add(exp.Current())) {
-           Handle(BRepCheck_Result)& res = myMap(exp.Current());
-           res->InContext(S);
-           if (performwire) {
-             for (res->InitContextIterator();
-                  res->MoreShapeInContext();
-                  res->NextShapeInContext()) {
-               if(res->ContextualShape().IsSame(S)) {
-                 break;
-               }
-             }
-             BRepCheck_ListIteratorOfListOfStatus itl(res->StatusOnShape());
-             for (; itl.More(); itl.Next()) {
-               BRepCheck_Status ste = itl.Value();
-               if (ste == BRepCheck_NoCurveOnSurface  ||
-                   ste == BRepCheck_InvalidCurveOnSurface ||
-                   ste == BRepCheck_InvalidRange ||
-                   ste == BRepCheck_InvalidCurveOnClosedSurface) {
-                 performwire = Standard_False;
-                 break;
-               }
-             }
-           }
-         }
-       }
-       catch(Standard_Failure) {
+      for (exp.Init(S,TopAbs_EDGE);exp.More(); exp.Next())
+      {
+        try
+        {
+          OCC_CATCH_SIGNALS
+          if (MapS.Add(exp.Current()))
+          {
+            Handle(BRepCheck_Result)& res = myMap(exp.Current());
+            res->InContext(S);
+            if (performwire)
+            {
+              for ( res->InitContextIterator();
+                    res->MoreShapeInContext();
+                    res->NextShapeInContext())
+              {
+                if(res->ContextualShape().IsSame(S))
+                  break;
+              }
+
+              BRepCheck_ListIteratorOfListOfStatus itl(res->StatusOnShape());
+              for (; itl.More(); itl.Next())
+              {
+                BRepCheck_Status ste = itl.Value();
+                if (ste == BRepCheck_NoCurveOnSurface  ||
+                    ste == BRepCheck_InvalidCurveOnSurface ||
+                    ste == BRepCheck_InvalidRange ||
+                    ste == BRepCheck_InvalidCurveOnClosedSurface)
+                {
+                  performwire = Standard_False;
+                  break;
+                }
+              }
+            }
+          }
+        }
+        catch(Standard_Failure)
+        {
 #ifdef DEB
-         cout<<"BRepCheck_Analyzer : ";
-         Standard_Failure::Caught()->Print(cout);  
-         cout<<endl;
+          cout<<"BRepCheck_Analyzer : ";
+          Standard_Failure::Caught()->Print(cout);  
+          cout<<endl;
 #endif
+          if ( ! myMap(S).IsNull() )
+          {
+            myMap(S)->SetFailStatus(S);
+          }
 
-         if ( ! myMap(S).IsNull() ) {
-           myMap(S)->SetFailStatus(S);
-         }
-         Handle(BRepCheck_Result) aRes = myMap(exp.Current());
+          Handle(BRepCheck_Result) aRes = myMap(exp.Current());
 
-         if ( ! aRes.IsNull() ) {
-           aRes->SetFailStatus(exp.Current());
-           aRes->SetFailStatus(S);
-         }
-       }
+          if ( ! aRes.IsNull() )
+          {
+            aRes->SetFailStatus(exp.Current());
+            aRes->SetFailStatus(S);
+          }
+        }
       }
+
       Standard_Boolean orientofwires = performwire;
-      for (exp.Init(S,TopAbs_WIRE);exp.More(); exp.Next()) {
-       try {
-         OCC_CATCH_SIGNALS
-         Handle(BRepCheck_Result)& res = myMap(exp.Current());
-         res->InContext(S);
-         if (orientofwires) {
-           for (res->InitContextIterator();
-                res->MoreShapeInContext();
-                res->NextShapeInContext()) {
-             if(res->ContextualShape().IsSame(S)) {
-               break;
-             }
-           }
-           BRepCheck_ListIteratorOfListOfStatus itl(res->StatusOnShape());
-           for (; itl.More(); itl.Next()) {
-             BRepCheck_Status ste = itl.Value();
-             if (ste != BRepCheck_NoError) {
-               orientofwires = Standard_False;
-               break;
-             }
-           }
-         }       
-       }
-       catch(Standard_Failure) {
+      for (exp.Init(S,TopAbs_WIRE);exp.More(); exp.Next())
+      {
+        try
+        {
+          OCC_CATCH_SIGNALS
+          Handle(BRepCheck_Result)& res = myMap(exp.Current());
+          res->InContext(S);
+          if (orientofwires)
+          {
+            for ( res->InitContextIterator();
+                  res->MoreShapeInContext();
+                  res->NextShapeInContext())
+            {
+              if(res->ContextualShape().IsSame(S))
+              {
+                break;
+              }
+            }
+            BRepCheck_ListIteratorOfListOfStatus itl(res->StatusOnShape());
+            for (; itl.More(); itl.Next())
+            {
+              BRepCheck_Status ste = itl.Value();
+              if (ste != BRepCheck_NoError)
+              {
+                orientofwires = Standard_False;
+                break;
+              }
+            }
+          }
+        }
+        catch(Standard_Failure)
+        {
 #ifdef DEB
-         cout<<"BRepCheck_Analyzer : ";
-         Standard_Failure::Caught()->Print(cout);  
-         cout<<endl;
+          cout<<"BRepCheck_Analyzer : ";
+          Standard_Failure::Caught()->Print(cout);  
+          cout<<endl;
 #endif
-         if ( ! myMap(S).IsNull() ) {
-           myMap(S)->SetFailStatus(S);
-         }
-         Handle(BRepCheck_Result) aRes = myMap(exp.Current());
-
-         if ( ! aRes.IsNull() ) {
-           aRes->SetFailStatus(exp.Current());
-           aRes->SetFailStatus(S);
-         }
-       }
+          if ( ! myMap(S).IsNull() )
+          {
+            myMap(S)->SetFailStatus(S);
+          }
+
+          Handle(BRepCheck_Result) aRes = myMap(exp.Current());
+
+          if ( ! aRes.IsNull() )
+          {
+            aRes->SetFailStatus(exp.Current());
+            aRes->SetFailStatus(S);
+          }
+        }
       }
-      
-      try {
+
+      try
+      {
         OCC_CATCH_SIGNALS
-       if (performwire) {
-         if (orientofwires) {
-           Handle(BRepCheck_Face)::DownCast(myMap(S))->
-             OrientationOfWires(Standard_True);// on enregistre
-         }
-         //    else {
-         //       Handle(BRepCheck_Face)::DownCast(myMap(S))->
-         //          IntersectWires(Standard_True); // on enregistre
-         //      }
-         else {
-           Handle(BRepCheck_Face)::DownCast(myMap(S))->SetUnorientable();
-         }
-       }
-       else {
-         Handle(BRepCheck_Face)::DownCast(myMap(S))->SetUnorientable();
-       }
+        if(isInvalidTolerance)
+        {
+          Handle(BRepCheck_Face)::
+              DownCast(myMap(S))->SetStatus(BRepCheck_InvalidToleranceValue);
+        }
+        else if (performwire)
+        {
+          if (orientofwires)
+          {
+            Handle(BRepCheck_Face)::DownCast(myMap(S))->
+                        OrientationOfWires(Standard_True);// on enregistre
+          }
+          else
+          {
+            Handle(BRepCheck_Face)::DownCast(myMap(S))->SetUnorientable();
+          }
+        }
+        else
+        {
+          Handle(BRepCheck_Face)::DownCast(myMap(S))->SetUnorientable();
+        }
       }
-      catch(Standard_Failure) {
+      catch(Standard_Failure)
+      {
 #ifdef DEB
-         cout<<"BRepCheck_Analyzer : ";
-         Standard_Failure::Caught()->Print(cout);  
-         cout<<endl;
+        cout<<"BRepCheck_Analyzer : ";
+        Standard_Failure::Caught()->Print(cout);  
+        cout<<endl;
 #endif
+        if ( ! myMap(S).IsNull() )
+        {
+          myMap(S)->SetFailStatus(S);
+        }
 
-       if ( ! myMap(S).IsNull() ) {
-         myMap(S)->SetFailStatus(S);
-       }
-       
-       for (exp.Init(S,TopAbs_WIRE);exp.More(); exp.Next()) {
-         Handle(BRepCheck_Result) aRes = myMap(exp.Current());
-
-         if ( ! aRes.IsNull() ) {
-           aRes->SetFailStatus(exp.Current());
-           aRes->SetFailStatus(S);
-           myMap(S)->SetFailStatus(exp.Current());
-         }
-       }
+        for (exp.Init(S,TopAbs_WIRE);exp.More(); exp.Next())
+        {
+          Handle(BRepCheck_Result) aRes = myMap(exp.Current());
+          
+          if ( ! aRes.IsNull() )
+          {
+            aRes->SetFailStatus(exp.Current());
+            aRes->SetFailStatus(S);
+            myMap(S)->SetFailStatus(exp.Current());
+          }
+        }
       }
     }
     break;
     
   case TopAbs_SHELL:   
     //modified by NIZNHY-PKV Mon Oct 13 14:23:53 2008f
-    /* {
-    Standard_Boolean VerifyOrientation, bFlag;
-    //
-    VerifyOrientation = Standard_True;
-    //
-    exp.Init(S,TopAbs_FACE);
-    for (; exp.More(); exp.Next()) {
-      const TopoDS_Shape& aF=exp.Current();
-      try {
-       OCC_CATCH_SIGNALS
-       bFlag=  !(Handle(BRepCheck_Face)::DownCast(myMap(aF))->IsUnorientable());
-       VerifyOrientation = (VerifyOrientation && bFlag);
-      }
-      catch(Standard_Failure) {
-#ifdef DEB
-       cout<<"BRepCheck_Analyzer : ";
-       Standard_Failure::Caught()->Print(cout);  
-       cout<<endl;
-#endif
-       
-       if ( ! myMap(S).IsNull() ) {
-         myMap(S)->SetFailStatus(S);
-       }
-       Handle(BRepCheck_Result) aRes = myMap(exp.Current());
-       
-       if ( ! aRes.IsNull() ) {
-         aRes->SetFailStatus(exp.Current());
-         aRes->SetFailStatus(S);
-       }
-      }
-    } // 
-    try {
-      OCC_CATCH_SIGNALS
-      if (VerifyOrientation) {
-       Handle(BRepCheck_Shell)::DownCast(myMap(S))->Orientation(Standard_True);
-      }
-      else {
-       Handle(BRepCheck_Shell)::DownCast(myMap(S))->SetUnorientable();
-      }
-    }
-    catch(Standard_Failure) {
-#ifdef DEB
-      cout<<"BRepCheck_Analyzer : ";
-      Standard_Failure::Caught()->Print(cout);  
-      cout<<endl;
-#endif
-      
-      if ( ! myMap(S).IsNull() ) {
-       myMap(S)->SetFailStatus(S);
-      }
-      exp.Init(S,TopAbs_FACE);
-      for (; exp.More(); exp.Next()) {
-       Handle(BRepCheck_Result) aRes = myMap(exp.Current());
-       if ( ! aRes.IsNull() ) {
-         aRes->SetFailStatus(exp.Current());
-         aRes->SetFailStatus(S);
-         myMap(S)->SetFailStatus(exp.Current());
-       }
-      }
-    }
-  }
-  */
     //modified by NIZNHY-PKV Mon Oct 13 14:24:04 2008t
     break;
-    //
-  case TopAbs_SOLID:    {
+
+  case TopAbs_SOLID:
+    {
     exp.Init(S,TopAbs_SHELL);
-    for (; exp.More(); exp.Next()) {
+      for (; exp.More(); exp.Next())
+      {
       const TopoDS_Shape& aShell=exp.Current();
-      try {
+        try 
+        {
        OCC_CATCH_SIGNALS
        myMap(aShell)->InContext(S);
       }
-      catch(Standard_Failure) {
+        catch(Standard_Failure)
+        {
 #ifdef DEB
        cout<<"BRepCheck_Analyzer : ";
        Standard_Failure::Caught()->Print(cout);  
        cout<<endl;
 #endif
-       if ( ! myMap(S).IsNull() ) {
+          if ( ! myMap(S).IsNull() )
+          {
          myMap(S)->SetFailStatus(S);
        }
+
        //
        Handle(BRepCheck_Result) aRes = myMap(aShell);
-       if (!aRes.IsNull() ) {
+          if (!aRes.IsNull() )
+          {
          aRes->SetFailStatus(exp.Current());
          aRes->SetFailStatus(S);
        }
+        }//catch(Standard_Failure)
+      }//for (; exp.More(); exp.Next())
       }
-    }
-  }
   break;//case TopAbs_SOLID
   default:
     break;
index 96d83cf..93b0907 100644 (file)
@@ -21,7 +21,8 @@ class Edge from BRepCheck inherits Result from BRepCheck
 uses Shape               from TopoDS,
      Edge                from TopoDS,
      CurveRepresentation from BRep,
-     HCurve              from Adaptor3d
+     HCurve              from Adaptor3d,
+     Status              from BRepCheck
 
 is
 
@@ -55,6 +56,18 @@ is
 
        is static;
 
+    SetStatus(me: mutable;
+              theStatus:Status from BRepCheck)
+
+          --- Purpose: Sets status of Edge;
+       is static;
+
+    CheckPolygonOnTriangulation(me: mutable; theEdge: Edge from TopoDS)
+         --- Purpose: Checks, if polygon on triangulation of heEdge
+     -- is out of 3D-curve of this edge.
+        returns Status from BRepCheck
+       is static;
+
 fields
 
     myCref   : CurveRepresentation from BRep;
index 1d42883..e308103 100644 (file)
 
 #include <BRepCheck_Edge.ixx>
 #include <TColStd_Array1OfTransient.hxx>
+#include <TColStd_HArray1OfReal.hxx>
+
+#include <BRepAdaptor_Curve.hxx>
+#include <Bnd_Box.hxx>
 
 #include <BRepCheck_ListOfStatus.hxx>
 #include <BRepCheck_ListIteratorOfListOfStatus.hxx>
@@ -29,6 +33,8 @@
 #include <BRep_GCurve.hxx>
 #include <BRep_CurveOnSurface.hxx>
 
+#include <BRep_PolygonOnTriangulation.hxx>
+
 #include <BRep_Tool.hxx>
 
 #include <TopExp_Explorer.hxx>
@@ -57,6 +63,8 @@
 #include <TopoDS_Face.hxx>
 #include <Precision.hxx>
 
+#include <Poly_PolygonOnTriangulation.hxx>
+#include <Poly_Triangulation.hxx>
 
 //modified by NIZNHY-PKV Thu May 05 09:01:57 2011f
 static 
@@ -83,7 +91,7 @@ static
 //                              const Standard_Boolean);
 //modified by NIZNHY-PKV Thu May 05 09:02:01 2011t
 
-#define NCONTROL 23
+static const Standard_Integer NCONTROL=23;
 
 //=======================================================================
 //function : BRepCheck_Edge
@@ -236,7 +244,13 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
     return;
   }
   
-  switch (styp) {
+  switch (styp) 
+  {
+  case TopAbs_WIRE:
+    {
+    }
+    break;
+
   case TopAbs_FACE:
     if (!myCref.IsNull()) {
       
@@ -273,8 +287,8 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
           // gka OCC
 //  Modified by skv - Tue Apr 27 11:50:35 2004 Begin
 //       if (SameRange && (fabs(f-First) > Precision::PConfusion() || fabs(l-Last)> Precision::PConfusion())) { //f != First || l != Last)) { gka OCC
-         if (fabs(f-First) > Precision::PConfusion() ||
-             fabs(l-Last)  > Precision::PConfusion()) {
+         if (Abs(f-First) > Precision::PConfusion() ||
+             Abs(l-Last)  > Precision::PConfusion()) {
            BRepCheck::Add(lst,BRepCheck_InvalidSameRangeFlag);
            BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
 //         if (SameParameter) {
@@ -449,7 +463,14 @@ Standard_Boolean BRepCheck_Edge::GeometricControls() const
   return myGctrl;
 }
 
-
+//=======================================================================
+//function :   SetStatus
+//purpose  : 
+//=======================================================================
+void BRepCheck_Edge::SetStatus(const BRepCheck_Status theStatus)
+{
+    BRepCheck::Add(myMap(myShape),theStatus);
+}
 
 
 //=======================================================================
@@ -547,6 +568,114 @@ Standard_Real BRepCheck_Edge::Tolerance()
   return sqrt(tolCal)*1.05;
 }
 
+
+//=======================================================================
+//function : CheckPolygonOnTriangulation
+//purpose  : 
+//=======================================================================
+BRepCheck_Status BRepCheck_Edge::
+              CheckPolygonOnTriangulation(const TopoDS_Edge& theEdge)
+{
+  BRep_ListOfCurveRepresentation& aListOfCR = 
+          (*((Handle(BRep_TEdge)*) &theEdge.TShape()))->ChangeCurves();
+  BRep_ListIteratorOfListOfCurveRepresentation anITCR(aListOfCR);
+
+  BRepAdaptor_Curve aBC;
+  aBC.Initialize(theEdge);
+
+  if(!aBC.Is3DCurve())
+    return BRepCheck_NoError;
+
+  while (anITCR.More())
+  {
+    if(!anITCR.Value()->IsPolygonOnTriangulation())
+    {
+      anITCR.Next();
+      continue;
+    }
+
+    const Handle(BRep_CurveRepresentation) aCR = anITCR.Value();
+    const Handle(BRep_PolygonOnTriangulation)& aPT = 
+              Handle(BRep_PolygonOnTriangulation)::DownCast(aCR);
+
+    const TopLoc_Location aLL = theEdge.Location() * aPT->Location();
+
+    const Handle(Poly_Triangulation) aTriang =  aCR->Triangulation();
+    const Handle(Poly_PolygonOnTriangulation) aPOnTriag = 
+                                    aCR->IsPolygonOnClosedTriangulation() ? 
+                                    aCR->PolygonOnTriangulation2() : 
+                                    aCR->PolygonOnTriangulation();
+    const TColStd_Array1OfInteger& anIndices = aPOnTriag->Nodes();
+    const TColgp_Array1OfPnt& Nodes = aTriang->Nodes();
+    const Standard_Integer aNbNodes = anIndices.Length();
+
+    const Standard_Real aTol = aPOnTriag->Deflection() +
+                                  BRep_Tool::Tolerance(theEdge);
+
+    if(aPOnTriag->HasParameters())
+    {
+      for(Standard_Integer i = aPOnTriag->Parameters()->Lower();
+                            i <= aPOnTriag->Parameters()->Upper(); i++)
+      {
+        const Standard_Real aParam = aPOnTriag->Parameters()->Value(i);
+        const gp_Pnt  aPE(aBC.Value(aParam)), 
+                      aPT(Nodes(anIndices(i)).Transformed(aLL));
+
+        const Standard_Real aSQDist = aPE.SquareDistance(aPT);
+        if(aSQDist > aTol*aTol)
+        {
+          return BRepCheck_InvalidPolygonOnTriangulation;
+        }
+      }
+    }
+    else
+    {
+      //If aPOnTriag does not have any parameters we will check if it
+      //inscribes into Bounding box, which is built on the edge triangulation.
+
+      Bnd_Box aB;
+
+      for (Standard_Integer i = 1; i <= aNbNodes; i++)
+      {
+        if (aLL.IsIdentity())
+          aB.Add(Nodes(anIndices(i)));
+        else
+          aB.Add(Nodes(anIndices(i)).Transformed(aLL));
+      }
+
+      aB.Enlarge(aTol);
+
+      Standard_Real aFP = aBC.FirstParameter();
+      Standard_Real aLP = aBC.LastParameter();
+
+      const Standard_Real aStep = (aLP - aFP)/IntToReal(NCONTROL);
+      gp_Pnt aP;
+      Standard_Real aPar = aFP;
+
+      for(Standard_Integer i = 1; i < NCONTROL; i ++)
+      {
+        aBC.D0(aPar, aP);
+        if(aB.IsOut(aP))
+        {
+          return BRepCheck_InvalidPolygonOnTriangulation;
+        }
+
+        aPar += aStep;
+      }
+
+      aBC.D0(aLP, aP);
+      if(aB.IsOut(aP))
+      {
+        return BRepCheck_InvalidPolygonOnTriangulation;
+      }
+    }
+
+    anITCR.Next();
+  }
+
+  return BRepCheck_NoError;
+}
+
 //=======================================================================
 //function : Validate
 //purpose  : 
@@ -564,12 +693,13 @@ Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
   Error = 0.;
   First = CRef.FirstParameter();
   Last  = CRef.LastParameter();
-  //
+  
   aPC=Precision::PConfusion();
   proj = (!SameParameter || 
-         fabs(Other.FirstParameter()-First) > aPC || 
-         fabs( Other.LastParameter()-Last) > aPC);
-  if (!proj) {
+         Abs(Other.FirstParameter()-First) > aPC || 
+         Abs( Other.LastParameter()-Last) > aPC);
+  if (!proj)
+  {
     Standard_Integer i;
     Standard_Real Tol2, prm, dD;
     gp_Pnt pref, pother;
@@ -581,7 +711,7 @@ Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
     //Tol2=Tol*Tol;
     //modified by NIZNHY-PKV Thu May 05 09:06:47 2011t
     
-    for (i = 0; i< NCONTROL; ++i) {
+    for (i = 0; i < NCONTROL; ++i) {
       prm = ((NCONTROL-1-i)*First + i*Last)/(NCONTROL-1);
       pref = CRef.Value(prm);
       pother = Other.Value(prm);
@@ -659,18 +789,6 @@ Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
       }
     }
   }
-  //FINISH :
-/*
-#ifdef DEB
-    if (! Status) {
-      cout << " **** probleme de SameParameter au point :" << endl;
-      cout << "         " << problematic_point.Coord(1) << " " 
-          << problematic_point.Coord(2) << " " 
-          << problematic_point.Coord(3) << endl ;
-      cout << "   Erreur detectee :" << Error << " Tolerance :" << Tol << endl;
-    }
-#endif
-*/
 
   return Status ;
   
index e5f50ac..338a433 100644 (file)
@@ -66,6 +66,13 @@ is
     
        is static;
 
+    SetStatus(me: mutable;
+              theStatus:Status from BRepCheck)
+
+          --- Purpose: Sets status of Face;
+       is static;
+
+
 
     IsUnorientable(me)
     
index c971583..62e4552 100644 (file)
@@ -494,6 +494,15 @@ void BRepCheck_Face::SetUnorientable()
   BRepCheck::Add(myMap(myShape),BRepCheck_UnorientableShape);
 }
 
+//=======================================================================
+//function :   SetStatus
+//purpose  : 
+//=======================================================================
+
+void BRepCheck_Face::SetStatus(const BRepCheck_Status theStatus)
+{
+    BRepCheck::Add(myMap(myShape),theStatus);
+}
 
 //=======================================================================
 //function : IsUnorientable
index 4a1d3cb..48c0f33 100644 (file)
@@ -122,7 +122,11 @@ is
         ---Purpose: set SelfIntersect() to be checked
        is static;
 
+    SetStatus(me: mutable;
+              theStatus:Status from BRepCheck)
 
+          --- Purpose: Sets status of Wire;
+       is static;
 
 fields
 
index c4c8d20..872fab4 100644 (file)
@@ -1500,6 +1500,17 @@ BRepCheck_Status BRepCheck_Wire::SelfIntersect(const TopoDS_Face& F,
   //
   return (BRepCheck_NoError);
 }
+
+//=======================================================================
+//function :   SetStatus
+//purpose  : 
+//=======================================================================
+
+void BRepCheck_Wire::SetStatus(const BRepCheck_Status theStatus)
+{
+    BRepCheck::Add(myMap(myShape),theStatus);
+}
+
 //=======================================================================
 //function : GeometricControls
 //purpose  : 
index f13c5ee..92672f8 100644 (file)
 
 #include <stdio.h>
 
+//Number of BRepCheck_Statuses in BRepCheck_Status.hxx file
+//(BRepCheck_NoError is not considered, i.e. general status 
+//is smaller by one specified in file)
+static const Standard_Integer NumberOfStatus = 34;
+
 static char* checkfaultyname = NULL;
 Standard_EXPORT void BRepTest_CheckCommands_SetFaultyName(const char* name)
 {
@@ -205,6 +210,7 @@ static void Print(Standard_OStream& OS,
       OS << "On Shape " << Name << " :\n";
        
       for (;itl.More(); itl.Next()) {
+        if (itl.Value() != BRepCheck_NoError)
        BRepCheck::Print(itl.Value(),OS);
       }
     }
@@ -218,6 +224,10 @@ static void Print(Standard_OStream& OS,
   case TopAbs_EDGE:
     PrintSub(OS,Ana,S,TopAbs_VERTEX);
     break;
+  case TopAbs_WIRE:
+    PrintSub(OS,Ana,S,TopAbs_EDGE);
+    PrintSub(OS,Ana,S,TopAbs_VERTEX);
+    break;
   case TopAbs_FACE:
     PrintSub(OS,Ana,S,TopAbs_WIRE);
     PrintSub(OS,Ana,S,TopAbs_EDGE);
@@ -473,74 +483,14 @@ void ContextualDump(Draw_Interpretor& theCommands,
 static void FillProblems(const BRepCheck_Status stat,
                          Handle(TColStd_HArray1OfInteger)& NbProblems)
 {
-  switch (stat) {
-  case BRepCheck_InvalidPointOnCurve:
-    NbProblems->SetValue(1,NbProblems->Value(1)+1); break;
-  case BRepCheck_InvalidPointOnCurveOnSurface:
-    NbProblems->SetValue(2,NbProblems->Value(2)+1); break;
-  case BRepCheck_InvalidPointOnSurface:
-    NbProblems->SetValue(3,NbProblems->Value(3)+1); break;
-  case BRepCheck_No3DCurve:
-    NbProblems->SetValue(4,NbProblems->Value(4)+1); break;
-  case BRepCheck_Multiple3DCurve:
-    NbProblems->SetValue(5,NbProblems->Value(5)+1); break;
-  case BRepCheck_Invalid3DCurve:
-    NbProblems->SetValue(6,NbProblems->Value(6)+1); break;
-  case BRepCheck_NoCurveOnSurface:
-    NbProblems->SetValue(7,NbProblems->Value(7)+1); break;
-  case BRepCheck_InvalidCurveOnSurface:
-    NbProblems->SetValue(8,NbProblems->Value(8)+1); break;
-  case BRepCheck_InvalidCurveOnClosedSurface:
-    NbProblems->SetValue(9,NbProblems->Value(9)+1); break;
-  case BRepCheck_InvalidSameRangeFlag:
-    NbProblems->SetValue(10,NbProblems->Value(10)+1); break;
-  case BRepCheck_InvalidSameParameterFlag:
-    NbProblems->SetValue(11,NbProblems->Value(11)+1); break;
-  case BRepCheck_InvalidDegeneratedFlag:
-    NbProblems->SetValue(12,NbProblems->Value(12)+1); break;
-  case BRepCheck_FreeEdge:
-    NbProblems->SetValue(13,NbProblems->Value(13)+1); break;
-  case BRepCheck_InvalidMultiConnexity:
-    NbProblems->SetValue(14,NbProblems->Value(14)+1); break;
-  case BRepCheck_InvalidRange:
-    NbProblems->SetValue(15,NbProblems->Value(15)+1); break;
-  case BRepCheck_EmptyWire:
-    NbProblems->SetValue(16,NbProblems->Value(16)+1); break;
-  case BRepCheck_RedundantEdge:
-    NbProblems->SetValue(17,NbProblems->Value(17)+1); break;
-  case BRepCheck_SelfIntersectingWire:
-    NbProblems->SetValue(18,NbProblems->Value(18)+1); break;
-  case BRepCheck_NoSurface:
-    NbProblems->SetValue(19,NbProblems->Value(19)+1); break;
-  case BRepCheck_InvalidWire:
-    NbProblems->SetValue(20,NbProblems->Value(20)+1); break;
-  case BRepCheck_RedundantWire:
-    NbProblems->SetValue(21,NbProblems->Value(21)+1); break;
-  case BRepCheck_IntersectingWires:
-    NbProblems->SetValue(22,NbProblems->Value(22)+1); break;
-  case BRepCheck_InvalidImbricationOfWires:
-    NbProblems->SetValue(23,NbProblems->Value(23)+1); break;
-  case BRepCheck_EmptyShell:
-    NbProblems->SetValue(24,NbProblems->Value(24)+1); break;
-  case BRepCheck_RedundantFace:
-    NbProblems->SetValue(25,NbProblems->Value(25)+1); break;
-  case BRepCheck_UnorientableShape:
-    NbProblems->SetValue(26,NbProblems->Value(26)+1); break;
-  case BRepCheck_NotClosed:
-    NbProblems->SetValue(27,NbProblems->Value(27)+1); break;
-  case BRepCheck_NotConnected:
-    NbProblems->SetValue(28,NbProblems->Value(28)+1); break;
-  case BRepCheck_SubshapeNotInShape:
-    NbProblems->SetValue(29,NbProblems->Value(29)+1); break;
-  case BRepCheck_BadOrientation:
-    NbProblems->SetValue(30,NbProblems->Value(30)+1); break;
-  case BRepCheck_BadOrientationOfSubshape:
-    NbProblems->SetValue(31,NbProblems->Value(31)+1); break;
-  case BRepCheck_CheckFail:
-    NbProblems->SetValue(32,NbProblems->Value(32)+1); break;
-  default:
-    break;
-  }
+
+  const Standard_Integer anID = static_cast<Standard_Integer> (stat);
+
+  if((NbProblems->Upper() < anID) || (NbProblems->Lower() > anID))
+    return;
+
+  NbProblems->SetValue(anID, NbProblems->Value(anID)+1);
+
 }
 
 
@@ -663,114 +613,151 @@ void StructuralDump(Draw_Interpretor& theCommands,
   theCommands<<"  Check                                    Count"<<"\n";
   theCommands<<" ------------------------------------------------"<<"\n";
 
-  Handle(TColStd_HArray1OfInteger) NbProblems = new TColStd_HArray1OfInteger(1,32);
-  for(i=1; i<=32; i++) NbProblems->SetValue(i,0);
+  Handle(TColStd_HArray1OfInteger) NbProblems = new 
+                              TColStd_HArray1OfInteger(1,NumberOfStatus);
+  for(i=1; i<=NumberOfStatus; i++) NbProblems->SetValue(i,0);
   Handle(TopTools_HSequenceOfShape) sl,slv,sle,slw,slf,sls,slo;
   sl = new TopTools_HSequenceOfShape();
   theMap.Clear();
   GetProblemShapes(theAna, theShape, sl, NbProblems);
   theMap.Clear();
   
-  if(NbProblems->Value(1)>0)
-    theCommands<<"  Invalid Point on Curve ................... "<<NbProblems->Value(1)<<"\n";
-    //cout<<"  Invalid Point on Curve ................... "<<NbProblems->Value(1)<<endl;
-  if(NbProblems->Value(2)>0)
-    theCommands<<"  Invalid Point on CurveOnSurface .......... "<<NbProblems->Value(2)<<"\n";
-    //cout<<"  Invalid Point on CurveOnSurface .......... "<<NbProblems->Value(2)<<endl;
-  if(NbProblems->Value(3)>0)
-    theCommands<<"  Invalid Point on Surface ................. "<<NbProblems->Value(3)<<"\n";
-    //cout<<"  Invalid Point on Surface ................. "<<NbProblems->Value(3)<<endl;
-  if(NbProblems->Value(4)>0)
-    theCommands<<"  No 3D Curve .............................. "<<NbProblems->Value(4)<<"\n";
-    //cout<<"  No 3D Curve .............................. "<<NbProblems->Value(4)<<endl;
-  if(NbProblems->Value(5)>0)
-    theCommands<<"  Multiple 3D Curve ........................ "<<NbProblems->Value(5)<<"\n";
-    //cout<<"  Multiple 3D Curve ........................ "<<NbProblems->Value(5)<<endl;
-  if(NbProblems->Value(6)>0)
-    theCommands<<"  Invalid 3D Curve ......................... "<<NbProblems->Value(6)<<"\n";
-    //cout<<"  Invalid 3D Curve ......................... "<<NbProblems->Value(6)<<endl;
-  if(NbProblems->Value(7)>0)
-    theCommands<<"  No Curve on Surface ...................... "<<NbProblems->Value(7)<<"\n";
-    //cout<<"  No Curve on Surface ...................... "<<NbProblems->Value(7)<<endl;
-  if(NbProblems->Value(8)>0)
-    theCommands<<"  Invalid Curve on Surface ................. "<<NbProblems->Value(8)<<"\n";
-    //cout<<"  Invalid Curve on Surface ................. "<<NbProblems->Value(8)<<endl;
-  if(NbProblems->Value(9)>0)
-    theCommands<<"  Invalid Curve on closed Surface .......... "<<NbProblems->Value(9)<<"\n";
-    //cout<<"  Invalid Curve on closed Surface .......... "<<NbProblems->Value(9)<<endl;
-  if(NbProblems->Value(10)>0)
-    theCommands<<"  Invalid SameRange Flag ................... "<<NbProblems->Value(10)<<"\n";
-    //cout<<"  Invalid SameRange Flag ................... "<<NbProblems->Value(10)<<endl;
-  if(NbProblems->Value(11)>0)
-    theCommands<<"  Invalid SameParameter Flag ............... "<<NbProblems->Value(11)<<"\n";
-    //cout<<"  Invalid SameParameter Flag ............... "<<NbProblems->Value(11)<<endl;
-  if(NbProblems->Value(12)>0)
-    theCommands<<"  Invalid Degenerated Flag ................. "<<NbProblems->Value(12)<<"\n";
-    //cout<<"  Invalid Degenerated Flag ................. "<<NbProblems->Value(12)<<endl;
-  if(NbProblems->Value(13)>0)
-    theCommands<<"  Free Edge ................................ "<<NbProblems->Value(13)<<"\n";
-    //cout<<"  Free Edge ................................ "<<NbProblems->Value(13)<<endl;
-  if(NbProblems->Value(14)>0)
-    theCommands<<"  Invalid MultiConnexity ................... "<<NbProblems->Value(14)<<"\n";
-    //cout<<"  Invalid MultiConnexity ................... "<<NbProblems->Value(14)<<endl;
-  if(NbProblems->Value(15)>0)
-    theCommands<<"  Invalid Range ............................ "<<NbProblems->Value(15)<<"\n";
-    //cout<<"  Invalid Range ............................ "<<NbProblems->Value(15)<<endl;
-  if(NbProblems->Value(16)>0)
-    theCommands<<"  Empty Wire ............................... "<<NbProblems->Value(16)<<"\n";
-    //cout<<"  Empty Wire ............................... "<<NbProblems->Value(16)<<endl;
-  if(NbProblems->Value(17)>0)
-    theCommands<<"  Redundant Edge ........................... "<<NbProblems->Value(17)<<"\n";
-    //cout<<"  Redundant Edge ........................... "<<NbProblems->Value(17)<<endl;
-  if(NbProblems->Value(18)>0)
-    theCommands<<"  Self Intersecting Wire ................... "<<NbProblems->Value(18)<<"\n";
-    //cout<<"  Self Intersecting Wire ................... "<<NbProblems->Value(18)<<endl;
-  if(NbProblems->Value(19)>0)
-    theCommands<<"  No Surface ............................... "<<NbProblems->Value(19)<<"\n";
-    //cout<<"  No Surface ............................... "<<NbProblems->Value(19)<<endl;
-  if(NbProblems->Value(20)>0)
-    theCommands<<"  Invalid Wire ............................. "<<NbProblems->Value(20)<<"\n";
-    //cout<<"  Invalid Wire ............................. "<<NbProblems->Value(20)<<endl;
-  if(NbProblems->Value(21)>0)
-    theCommands<<"  Redundant Wire ........................... "<<NbProblems->Value(21)<<"\n";
-    //cout<<"  Redundant Wire ........................... "<<NbProblems->Value(21)<<endl;
-  if(NbProblems->Value(22)>0)
-    theCommands<<"  Intersecting Wires ....................... "<<NbProblems->Value(22)<<"\n";
-    //cout<<"  Intersecting Wires ....................... "<<NbProblems->Value(22)<<endl;
-  if(NbProblems->Value(23)>0)
-    theCommands<<"  Invalid Imbrication of Wires ............. "<<NbProblems->Value(23)<<"\n";
-    //cout<<"  Invalid Imbrication of Wires ............. "<<NbProblems->Value(23)<<endl;
-  if(NbProblems->Value(24)>0)
-    theCommands<<"  Empty Shell .............................. "<<NbProblems->Value(24)<<"\n";
-    //cout<<"  Empty Shell .............................. "<<NbProblems->Value(24)<<endl;
-  if(NbProblems->Value(25)>0)
-    theCommands<<"  Redundant Face ........................... "<<NbProblems->Value(25)<<"\n";
-    //cout<<"  Redundant Face ........................... "<<NbProblems->Value(25)<<endl;
-  if(NbProblems->Value(26)>0)
-    theCommands<<"  Unorientable Shape ....................... "<<NbProblems->Value(26)<<"\n";
-    //cout<<"  Unorientable Shape ....................... "<<NbProblems->Value(26)<<endl;
-  if(NbProblems->Value(27)>0)
-    theCommands<<"  Not Closed ............................... "<<NbProblems->Value(27)<<"\n";
-    //cout<<"  Not Closed ............................... "<<NbProblems->Value(27)<<endl;
-  if(NbProblems->Value(28)>0)
-    theCommands<<"  Not Connected ............................ "<<NbProblems->Value(28)<<"\n";
-    //cout<<"  Not Connected ............................ "<<NbProblems->Value(28)<<endl;
-  if(NbProblems->Value(29)>0)
-    theCommands<<"  Subshape not in Shape .................... "<<NbProblems->Value(29)<<"\n";
-    //cout<<"  Subshape not in Shape .................... "<<NbProblems->Value(29)<<endl;
-  if(NbProblems->Value(30)>0)
-    theCommands<<"  Bad Orientation .......................... "<<NbProblems->Value(30)<<"\n";
-    //cout<<"  Bad Orientation .......................... "<<NbProblems->Value(30)<<endl;
-  if(NbProblems->Value(31)>0)
-    theCommands<<"  Bad Orientation of Subshape .............. "<<NbProblems->Value(31)<<"\n";
-    //cout<<"  Bad Orientation of Subshape .............. "<<NbProblems->Value(31)<<endl;
-  if(NbProblems->Value(32)>0)
-    theCommands<<"  checkshape failure......... .............. "<<NbProblems->Value(32)<<"\n";
-    //cout<<"  checkshape failure......... .............. "<<NbProblems->Value(32)<<endl;
+  Standard_Integer aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidPointOnCurve);
+  if(NbProblems->Value(aProblemID) > 0)
+    theCommands<<"  Invalid Point on Curve ................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidPointOnCurveOnSurface);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Invalid Point on CurveOnSurface .......... "<<NbProblems->Value(aProblemID)<<"\n";
+
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidPointOnSurface);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Invalid Point on Surface ................. "<<NbProblems->Value(aProblemID)<<"\n";
+
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_No3DCurve);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  No 3D Curve .............................. "<<NbProblems->Value(aProblemID)<<"\n";
+
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_Multiple3DCurve);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Multiple 3D Curve ........................ "<<NbProblems->Value(aProblemID)<<"\n";
+
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_Invalid3DCurve);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Invalid 3D Curve ......................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_NoCurveOnSurface);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  No Curve on Surface ...................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidCurveOnSurface);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Invalid Curve on Surface ................. "<<NbProblems->Value(aProblemID)<<"\n";
+
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidCurveOnClosedSurface);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Invalid Curve on closed Surface .......... "<<NbProblems->Value(aProblemID)<<"\n";
+  
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidSameRangeFlag);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Invalid SameRange Flag ................... "<<NbProblems->Value(aProblemID)<<"\n";
+  
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidSameParameterFlag);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Invalid SameParameter Flag ............... "<<NbProblems->Value(aProblemID)<<"\n";
+  
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidDegeneratedFlag);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Invalid Degenerated Flag ................. "<<NbProblems->Value(aProblemID)<<"\n";
+  
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_FreeEdge);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Free Edge ................................ "<<NbProblems->Value(aProblemID)<<"\n";
+  
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidMultiConnexity);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Invalid MultiConnexity ................... "<<NbProblems->Value(aProblemID)<<"\n";
+  
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidRange);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Invalid Range ............................ "<<NbProblems->Value(aProblemID)<<"\n";
+  
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_EmptyWire);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Empty Wire ............................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_RedundantEdge);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Redundant Edge ........................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_SelfIntersectingWire);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Self Intersecting Wire ................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_NoSurface);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  No Surface ............................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidWire);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Invalid Wire ............................. "<<NbProblems->Value(aProblemID)<<"\n";
+
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_RedundantWire);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Redundant Wire ........................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_IntersectingWires);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Intersecting Wires ....................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidImbricationOfWires);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Invalid Imbrication of Wires ............. "<<NbProblems->Value(aProblemID)<<"\n";
+
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_EmptyShell);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Empty Shell .............................. "<<NbProblems->Value(aProblemID)<<"\n";
+
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_RedundantFace);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Redundant Face ........................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_UnorientableShape);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Unorientable Shape ....................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_NotClosed);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Not Closed ............................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_NotConnected);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Not Connected ............................ "<<NbProblems->Value(aProblemID)<<"\n";
+
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_SubshapeNotInShape);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Subshape not in Shape .................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_BadOrientation);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Bad Orientation .......................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_BadOrientationOfSubshape);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Bad Orientation of Subshape .............. "<<NbProblems->Value(aProblemID)<<"\n";
+
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidToleranceValue);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Invalid tolerance value................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidPolygonOnTriangulation);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  Invalid polygon on triangulation.......... "<<NbProblems->Value(aProblemID)<<"\n";
+
+  aProblemID = static_cast<Standard_Integer>(BRepCheck_CheckFail);
+  if(NbProblems->Value(aProblemID)>0)
+    theCommands<<"  checkshape failure........................ "<<NbProblems->Value(aProblemID)<<"\n";
 
-  //cout<<" ------------------------------------------------"<<endl;
-  //cout<<"*** Shapes with problems : "<<sl->Length()<<endl;
-  //cout<<endl;
   theCommands<<" ------------------------------------------------"<<"\n";
   theCommands<<"*** Shapes with problems : "<<sl->Length()<<"\n";
 
index 07a1cb3..8724598 100644 (file)
@@ -4,6 +4,9 @@
 restore [locate_data_file CTO904_cts20176a.rle] a 
 restore [locate_data_file cts20176b.rle] b
 
+#Delete invalid (in terms of bug#25109) triangulation
+tclean a
+
 bfuse result a b
 
 set square 70265.2
index 5d5bae1..0dfbbc5 100644 (file)
@@ -2,6 +2,10 @@ puts "TODO DEBUG_OCC24121 Debian60-64: Process killed by CPU limit"
 puts "TODO DEBUG_OCC24121 Debian60-64: TEST INCOMPLETE"
 
 restore [locate_data_file OCC62.brep] sh
+
+#Delete invalid (in terms of bug#25109) triangulation
+tclean sh
+
 explode sh
 
 bop sh_1 sh_3
index 69f71b5..5fae0b3 100755 (executable)
@@ -4,12 +4,8 @@ if {[array get env os_type] != ""} {
   set os $env(os_type)
 }
 
-if {[string compare $os "MacOS"] == 0} {
-  #puts "TODO #23828 MacOS: Tcl Exception: sh is not a topological shape!!!"
-  #puts "TODO #23828 MacOS: TEST INCOMPLETE"
-} else {
-  #puts "TODO OCC12345 ALL: Faulty shapes in variables faulty_1 to faulty_"
-  puts "TODO ?OCC12345 ALL: Error : The square of result shape is"
+if {[string compare $os "MacOS"] != 0} {
+  puts "TODO OCC25286 ALL: Error : The square of result shape is"
 }
 
 puts "================"
@@ -20,6 +16,9 @@ puts "================"
 cpulimit 1400
 restore [locate_data_file OCC62.brep] sh 
 
+#Delete invalid (in terms of bug#25109) triangulation
+tclean sh
+
 explode sh 
 checkshape sh
 
diff --git a/tests/bugs/moddata_3/bug25109 b/tests/bugs/moddata_3/bug25109
new file mode 100644 (file)
index 0000000..ac7932c
--- /dev/null
@@ -0,0 +1,19 @@
+puts "============"
+puts "CR25109"
+puts "============"
+puts ""
+##########################################################################################################
+# Check PolygonOnTriangulation contained in edges
+##########################################################################################################
+
+restore [locate_data_file bug25109_e1.brep] b
+
+decho off
+set info [checkshape b]
+decho on
+
+if { [regexp "This shape seems to be valid" ${info}] == 1 } {
+    puts "Error: checkshape is incorrect"
+} else {
+    puts "OK: checkshape is correct"
+}
index 46c7f96..26894eb 100755 (executable)
@@ -1,9 +1,11 @@
 puts "============ OCC288 (case 5) ==============="
 
 restore [locate_data_file OCC288e.brep] result 
-checkshape result
 
+#Delete invalid (in terms of bug#25109) triangulation
 tclean result
+checkshape result
+
 vinit
 vdisplay result
 vsetdispmode result 1
index 1c07bb1..f9c3f5d 100644 (file)
@@ -1,2 +1,4 @@
 restore [locate_data_file CTO904_cts20176a.rle] a
 
+#Delete invalid (in terms of bug#25109) triangulation
+tclean a
index ba77e44..eb635b3 100644 (file)
@@ -1 +1,4 @@
 restore [locate_data_file CTO904_cts20176a.rle] a
+
+#Delete invalid (in terms of bug#25109) triangulation
+tclean a
\ No newline at end of file