From: azv Date: Wed, 15 Nov 2017 13:00:07 +0000 (+0300) Subject: Issue #2298: Fatal error when adding a coincident constraint X-Git-Tag: V_2.10.0RC~162 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=56e43a603ae77f9dd54cf4e7838e2f3f63a7d0d5;p=modules%2Fshaper.git Issue #2298: Fatal error when adding a coincident constraint The crash in the positioning of the Perpendicular constraint has been eliminated. --- diff --git a/src/SketcherPrs/SketcherPrs_PositionMgr.cpp b/src/SketcherPrs/SketcherPrs_PositionMgr.cpp index 31921298b..21b6dacb1 100644 --- a/src/SketcherPrs/SketcherPrs_PositionMgr.cpp +++ b/src/SketcherPrs/SketcherPrs_PositionMgr.cpp @@ -37,9 +37,9 @@ #include #include -#include #include #include +#include #include #include @@ -202,22 +202,11 @@ gp_Vec getVector(ObjectPtr theShape, GeomDirPtr theDir, gp_Pnt theP) std::shared_ptr(new GeomAPI_Curve(aShape)); if (aCurve->isCircle()) { - GeomEdgePtr aEdgePtr(new GeomAPI_Edge(aShape)); - GeomVertexPtr aVertexPtr(new GeomAPI_Vertex(theP.X(), theP.Y(), theP.Z())); - BRepExtrema_ExtPC aExtrema(aVertexPtr->impl(), - aEdgePtr->impl()); - int aNb = aExtrema.NbExt(); - if (aNb > 0) { - for (int i = 1; i <= aNb; i++) { - if (aExtrema.IsMin(i)) { - double aParam = aExtrema.Parameter(i); - Handle(Geom_Curve) aCurv = aCurve->impl(); - gp_Pnt aP; - aCurv->D1(aParam, aP, aVec); - break; - } - } - } + Handle(Geom_Curve) aCurv = aCurve->impl(); + GeomAPI_ProjectPointOnCurve anExtr(theP, aCurv); + double aParam = anExtr.LowerDistanceParameter(); + gp_Pnt aP; + aCurv->D1(aParam, aP, aVec); } else { GeomPointPtr aPnt1 = aCurve->getPoint(aCurve->endParam()); GeomPointPtr aPnt2 = aCurve->getPoint(aCurve->startParam());