From: mpv Date: Tue, 12 Sep 2017 06:44:11 +0000 (+0300) Subject: Make sketch not fail on start when the sphere is in the viewer. X-Git-Tag: V_2.9.0~23^2~13 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2383897e4bffa14abd33abfb8426c5be4ee03159;p=modules%2Fshaper.git Make sketch not fail on start when the sphere is in the viewer. --- diff --git a/src/GeomAPI/GeomAPI_Edge.cpp b/src/GeomAPI/GeomAPI_Edge.cpp index 9927c2ae9..37862ec30 100644 --- a/src/GeomAPI/GeomAPI_Edge.cpp +++ b/src/GeomAPI/GeomAPI_Edge.cpp @@ -67,6 +67,8 @@ bool GeomAPI_Edge::isLine() const const TopoDS_Shape& aShape = const_cast(this)->impl(); double aFirst, aLast; Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge&)aShape, aFirst, aLast); + if (aCurve.IsNull()) // degenerative edge + return false; if (aCurve->IsKind(STANDARD_TYPE(Geom_Line))) return true; return false; @@ -77,6 +79,8 @@ bool GeomAPI_Edge::isCircle() const const TopoDS_Shape& aShape = const_cast(this)->impl(); double aFirst, aLast; Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge&)aShape, aFirst, aLast); + if (aCurve.IsNull()) // degenerative edge + return false; if (aCurve->IsKind(STANDARD_TYPE(Geom_Circle))) { // Check the difference of first and last parameters to be equal to the curve period @@ -91,6 +95,8 @@ bool GeomAPI_Edge::isArc() const const TopoDS_Shape& aShape = const_cast(this)->impl(); double aFirst, aLast; Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge&)aShape, aFirst, aLast); + if (aCurve.IsNull()) // degenerative edge + return false; if (aCurve->IsKind(STANDARD_TYPE(Geom_Circle))) { // Check the difference of first and last parameters is not equal the curve period @@ -105,6 +111,8 @@ bool GeomAPI_Edge::isEllipse() const const TopoDS_Shape& aShape = const_cast(this)->impl(); double aFirst, aLast; Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge&)aShape, aFirst, aLast); + if (aCurve.IsNull()) // degenerative edge + return false; if (aCurve->IsKind(STANDARD_TYPE(Geom_Ellipse))) return true; return false;