0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / BRepLib / BRepLib_MakeShell.cxx
index 446f887..c866cb7 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include <BRepLib_MakeShell.ixx>
 
+#include <BRep_Builder.hxx>
 #include <BRepLib.hxx>
-#include <Precision.hxx>
-#include <TColStd_Array1OfReal.hxx>
-
-#include <Geom_RectangularTrimmedSurface.hxx>
-#include <Geom_BSplineSurface.hxx>
+#include <BRepLib_MakeFace.hxx>
+#include <BRepLib_MakeShell.hxx>
 #include <Geom2d_Line.hxx>
+#include <Geom_BSplineSurface.hxx>
+#include <Geom_RectangularTrimmedSurface.hxx>
+#include <Geom_Surface.hxx>
 #include <GeomAdaptor_Surface.hxx>
-#include <TColGeom2d_Array1OfCurve.hxx>
 #include <gp_Pnt.hxx>
-
+#include <Precision.hxx>
+#include <StdFail_NotDone.hxx>
+#include <TColGeom2d_Array1OfCurve.hxx>
+#include <TColStd_Array1OfReal.hxx>
+#include <TopExp_Explorer.hxx>
 #include <TopoDS.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Wire.hxx>
 #include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Shell.hxx>
 #include <TopoDS_Vertex.hxx>
+#include <TopoDS_Wire.hxx>
 #include <TopTools_Array1OfShape.hxx>
-#include <BRep_Builder.hxx>
-
 
 //=======================================================================
 //function : BRepLib_MakeShell
 //purpose  : 
 //=======================================================================
-
 BRepLib_MakeShell::BRepLib_MakeShell() :
        myError(BRepLib_EmptyShell)
 {
@@ -354,6 +355,20 @@ void BRepLib_MakeShell::Init(const Handle(Geom_Surface)& S,
   BRepLib::BuildCurves3d(myShape,tol);
   BRepLib::EncodeRegularity(myShape);
   myShape.Closed (BRep_Tool::IsClosed (myShape));
+
+  // Additional checking for degenerated edges
+  Standard_Boolean isDegenerated;
+  Standard_Real aFirst, aLast;
+  Standard_Real aTol = Precision::Confusion();
+  Standard_Real anActTol;
+  TopExp_Explorer anExp(myShape, TopAbs_EDGE);
+  for ( ; anExp.More(); anExp.Next())
+  {
+    const TopoDS_Edge& anEdge = TopoDS::Edge(anExp.Current());
+    Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
+    isDegenerated = BRepLib_MakeFace::IsDegenerated(aCurve, aTol, anActTol);
+    B.Degenerated(anEdge, isDegenerated);
+  }
   
   myError = BRepLib_ShellDone;
   Done();