From 9d135bdc4ed2de8a58f9ceb296e22ccbd3480e18 Mon Sep 17 00:00:00 2001 From: DeepSOIC Date: Tue, 14 Oct 2014 03:21:25 +0400 Subject: [PATCH] Sketcher: Ellipse enhancement: Negative focus on creation to improve dragging Focus2 is thrown in automatically for ellipse arcs (cherry picked from commit 1ab814e6b07fd946dbb2910cc1bfb8588c61afb8) --- src/Mod/Sketcher/Gui/CommandCreateGeo.cpp | 32 ++++++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp index f66279476..404b9af2d 100644 --- a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp +++ b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp @@ -2290,10 +2290,20 @@ public: startAngle += M_PI/2; } - //startAngle=-M_PI/4; - //endAngle=M_PI/4; - + //calculate focus point vecF2 + double cf;//distance from center to focus + cf = sqrt( abs(a*a - b*b) );//using abs, avoided using different formula for a>b/a 0 ? 0 : 1); + startAngle, endAngle); + int iAOE = getHighestCurveIndex();//index of the arc of ellipse we just created + + Gui::Command::doCommand(Gui::Command::Doc, + "App.ActiveDocument.%s.addGeometry(Part.Point(App.Vector(%f,%f,0)))", + sketchgui->getObject()->getNameInDocument(), + vecF2.fX,vecF2.fY); + int iPointF2 = getHighestCurveIndex();//index of the point we just created + + Gui::Command::doCommand(Gui::Command::Doc, + "App.ActiveDocument.%s.addConstraint(Sketcher.Constraint('InternalAlignment:EllipseFocus2',%d,%d,%d)) ", + sketchgui->getObject()->getNameInDocument(), + iPointF2,Sketcher::start,iAOE); + + Gui::Command::commitCommand(); Gui::Command::updateActive();