From 2383897e4bffa14abd33abfb8426c5be4ee03159 Mon Sep 17 00:00:00 2001 From: mpv Date: Tue, 12 Sep 2017 09:44:11 +0300 Subject: [PATCH] Make sketch not fail on start when the sphere is in the viewer. --- src/GeomAPI/GeomAPI_Edge.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) 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; -- 2.39.2