From e1caac9fe68fe9ee0aa1bcf13b3d514f7fcc7a66 Mon Sep 17 00:00:00 2001 From: nds Date: Thu, 7 Apr 2016 11:43:31 +0300 Subject: [PATCH] Correction for case: Start Arc, select "2 points type", move mouse in viewer, result: crash(in background mode) --- src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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; } -- 2.39.2