diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index fca1a0abf9..a3c35d1c82 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -664,7 +664,12 @@ void SketchObject::reverseAngleConstraintToSupplementary(Constraint* constr, int { std::swap(constr->First, constr->Second); std::swap(constr->FirstPos, constr->SecondPos); - constr->FirstPos = (constr->FirstPos == Sketcher::PointPos::start) ? Sketcher::PointPos::end : Sketcher::PointPos::start; + if (constr->FirstPos == constr->SecondPos) { + constr->FirstPos = (constr->FirstPos == Sketcher::PointPos::start) ? Sketcher::PointPos::end : Sketcher::PointPos::start; + } + else { + constr->SecondPos = (constr->SecondPos == Sketcher::PointPos::start) ? Sketcher::PointPos::end : Sketcher::PointPos::start; + } // Edit the expression if any, else modify constraint value directly if (constraintHasExpression(constNum)) { @@ -677,6 +682,12 @@ void SketchObject::reverseAngleConstraintToSupplementary(Constraint* constr, int } } +void SketchObject::inverseAngleConstraint(Constraint* constr) +{ + constr->FirstPos = (constr->FirstPos == Sketcher::PointPos::start) ? Sketcher::PointPos::end : Sketcher::PointPos::start; + constr->SecondPos = (constr->SecondPos == Sketcher::PointPos::start) ? Sketcher::PointPos::end : Sketcher::PointPos::start; +} + bool SketchObject::constraintHasExpression(int constNum) const { App::ObjectIdentifier path = Constraints.createPath(constNum); diff --git a/src/Mod/Sketcher/App/SketchObject.h b/src/Mod/Sketcher/App/SketchObject.h index f153ce3646..5e78fe4f16 100644 --- a/src/Mod/Sketcher/App/SketchObject.h +++ b/src/Mod/Sketcher/App/SketchObject.h @@ -271,6 +271,7 @@ public: /// Change an angle constraint to its supplementary angle. void reverseAngleConstraintToSupplementary(Constraint* constr, int constNum); + void inverseAngleConstraint(Constraint* constr); /// Modify an angle constraint expression string to its supplementary angle static std::string reverseAngleConstraintExpression(std::string expression); diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index f9716bc12b..abb44f2ec2 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -1918,8 +1918,12 @@ void ViewProviderSketch::moveAngleConstraint(int constNum, const Base::Vector2d& sign2 = isLeftOfLine(p21, p22, ap3); } + bool inverse = !(sign1 == sign3 && sign2 == sign4); + if (inverse) { + obj->inverseAngleConstraint(constr); + } + p0 = Base::Vector3d(intersection.x, intersection.y, 0.); - factor *= (sign1 == sign3 && sign2 == sign4) ? 1. : -1.; } else {// angle-via-point Base::Vector3d p = getSolvedSketch().getPoint(constr->Third, constr->ThirdPos);