diff --git a/src/BRepLib/BRepLib.cdl b/src/BRepLib/BRepLib.cdl index 808ff54570..f2a5f8fa95 100755 --- a/src/BRepLib/BRepLib.cdl +++ b/src/BRepLib/BRepLib.cdl @@ -191,7 +191,7 @@ is ---Purpose: Computes the 3d curve for the edge if it does -- not exist. Returns True if the curve was computed -- or existed. Returns False if there is no planar - -- pcurve. + -- pcurve or the computation failed. -- >= 30 in approximation BuildCurves3d(S : Shape from TopoDS ; diff --git a/src/BRepLib/BRepLib.cxx b/src/BRepLib/BRepLib.cxx index 314f9037c7..13f03e4795 100755 --- a/src/BRepLib/BRepLib.cxx +++ b/src/BRepLib/BRepLib.cxx @@ -347,7 +347,8 @@ Standard_Boolean BRepLib::BuildCurve3d(const TopoDS_Edge& AnEdge, // compute the 3d curve gp_Ax2 axes = P->Position().Ax2(); Handle(Geom_Curve) C3d = GeomLib::To3d(axes,PC); - + if (C3d.IsNull()) + return Standard_False; // update the edge Standard_Real First, Last; @@ -419,7 +420,8 @@ Standard_Boolean BRepLib::BuildCurve3d(const TopoDS_Edge& AnEdge, //Patch //max_deviation = Max(tolerance, max_deviation) ; max_deviation = Max( tolerance, Tolerance ); - + if (NewCurvePtr.IsNull()) + return Standard_False; Standard_Boolean is_closed ; is_closed = AnEdge.Closed() ; B.UpdateEdge(TopoDS::Edge(AnEdge), diff --git a/src/ShapeBuild/ShapeBuild_Edge.cxx b/src/ShapeBuild/ShapeBuild_Edge.cxx index e2eb2ae1a5..0c2f8e2f50 100755 --- a/src/ShapeBuild/ShapeBuild_Edge.cxx +++ b/src/ShapeBuild/ShapeBuild_Edge.cxx @@ -589,6 +589,8 @@ Standard_Boolean ShapeBuild_Edge::BuildCurve3d (const TopoDS_Edge& edge) const Handle(Geom_Curve) c3d; Standard_Real f,l; c3d = BRep_Tool::Curve(edge,f,l); + if (c3d.IsNull()) + return Standard_False; // 15.11.2002 PTV OCC966 if(!IsPeriodic(c3d)) { Standard_Boolean isLess = Standard_False; diff --git a/src/ShapeFix/ShapeFix_Wire.cxx b/src/ShapeFix/ShapeFix_Wire.cxx index 428ef6ffdd..5ed835789f 100755 --- a/src/ShapeFix/ShapeFix_Wire.cxx +++ b/src/ShapeFix/ShapeFix_Wire.cxx @@ -668,14 +668,15 @@ Standard_Boolean ShapeFix_Wire::FixEdgeCurves() Handle(Geom2d_Curve) C; Handle(Geom_Surface) S; TopLoc_Location L; - Standard_Real first, last; + Standard_Real first = 0., last = 0.; BRep_Tool::CurveOnSurface ( sbwd->Edge(i), C, S, L, first, last ); - if ( C.IsNull() ) + if ( C.IsNull() || Abs (last - first) < Precision::PConfusion()) { SendWarning ( sbwd->Edge ( i ), Message_Msg ( "FixWire.FixCurve3d.Removed" ) );// Incomplete edge (with no pcurves or 3d curve) removed sbwd->Remove ( i-- ); nb--; myStatusEdgeCurves |= ShapeExtend::EncodeStatus ( ShapeExtend_DONE5 ); + FixConnected (i + 1, Precision()); } myStatusEdgeCurves |= ShapeExtend::EncodeStatus ( ShapeExtend_FAIL5 ); }