From: nds Date: Thu, 7 Apr 2016 08:43:31 +0000 (+0300) Subject: Correction for case: Start Arc, select "2 points type", move mouse in viewer, result... X-Git-Tag: V_2.3.0~276 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e1caac9fe68fe9ee0aa1bcf13b3d514f7fcc7a66;p=modules%2Fshaper.git Correction for case: Start Arc, select "2 points type", move mouse in viewer, result: crash(in background mode) --- diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp index 26e90ab95..9089c195a 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp @@ -130,9 +130,16 @@ std::shared_ptr GeomAlgoAPI_EdgeBuilder::lineCircleArc( std::shared_ptr theCenter, std::shared_ptr theStartPoint, std::shared_ptr theEndPoint, std::shared_ptr theNormal) { + std::shared_ptr aRes; + const gp_Pnt& aCenter = theCenter->impl(); const gp_Dir& aDir = theNormal->impl(); + /// OCCT creates an edge on a circle with empty radius, but visualization + /// is not able to process it + if (theCenter->isEqual(theStartPoint)) + return aRes; + double aRadius = theCenter->distance(theStartPoint); gp_Circ aCircle(gp_Ax2(aCenter, aDir), aRadius); @@ -145,12 +152,11 @@ std::shared_ptr GeomAlgoAPI_EdgeBuilder::lineCircleArc( else anEdgeBuilder = BRepBuilderAPI_MakeEdge(aCircle, aStart, anEnd); - std::shared_ptr aRes(new GeomAPI_Edge); anEdgeBuilder.Build(); - if (anEdgeBuilder.IsDone()) + if (anEdgeBuilder.IsDone()) { + aRes = std::shared_ptr(new GeomAPI_Edge); aRes->setImpl(new TopoDS_Shape(anEdgeBuilder.Edge())); - else - aRes = std::shared_ptr(); + } return aRes; }