diff --git a/src/Mod/TechDraw/App/DrawViewDimension.cpp b/src/Mod/TechDraw/App/DrawViewDimension.cpp index 0bd68aeb84..a1429776e9 100644 --- a/src/Mod/TechDraw/App/DrawViewDimension.cpp +++ b/src/Mod/TechDraw/App/DrawViewDimension.cpp @@ -42,6 +42,10 @@ # include # include # include +# include +# include +# include +# include # include # include # include @@ -745,7 +749,29 @@ pointPair DrawViewDimension::getPointsEdgeVert(ReferenceVector references) if (!vertex || !edge) { throw Base::RuntimeError("Missing geometry for dimension (4)"); } - return closestPoints(edge->getOCCEdge(), vertex->getOCCVertex()); + + //get curve from edge + double start, end; // curve parameters + const Handle(Geom_Surface) hplane = new Geom_Plane(gp_Ax3()); + auto const occCurve = BRep_Tool::CurveOnPlane(edge->getOCCEdge() + , hplane + , TopLoc_Location() + , start + , end); + auto const occPoint = gp_Pnt2d(vertex->x(), vertex->y()); + //project point on curve + auto projector = Geom2dAPI_ProjectPointOnCurve(occPoint, occCurve); + if (projector.NbPoints() > 0) { + auto p1 = Base::Vector3d(vertex->x(), vertex->y(), 0.0); + auto p2 = Base::Vector3d(projector.NearestPoint().X() + , projector.NearestPoint().Y() + , 0.0); + return pointPair(p1, p2); + } + else { + // unable to project + return closestPoints(edge->getOCCEdge(), vertex->getOCCVertex()); + } } //this is a 3d object