From 3810381d9207a64495ca3a4af552e5129491013c Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Sat, 22 Jun 2019 08:17:51 +0200 Subject: [PATCH] Sketcher: fixes no horizontal/vertical on segment after horizontal/vertical alignment ===================================================================================== Selecting first the horizontal/vertical constraint and applying to a line segment with a previous horizontal/vertical alignment constraint caused FreeCAD to refuse applying it. fixes #4013 --- src/Mod/Sketcher/Gui/CommandConstraints.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index 9b1886c73a..b2fee3ab96 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -1341,12 +1341,12 @@ void CmdSketcherConstrainHorizontal::applyConstraint(std::vector &sel // check if the edge already has a Horizontal/Vertical/Block constraint for (std::vector< Sketcher::Constraint * >::const_iterator it= vals.begin(); it != vals.end(); ++it) { - if ((*it)->Type == Sketcher::Horizontal && (*it)->First == CrvId){ + if ((*it)->Type == Sketcher::Horizontal && (*it)->First == CrvId && (*it)->FirstPos == Sketcher::none){ QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Double constraint"), QObject::tr("The selected edge already has a horizontal constraint!")); return; } - if ((*it)->Type == Sketcher::Vertical && (*it)->First == CrvId) { + if ((*it)->Type == Sketcher::Vertical && (*it)->First == CrvId && (*it)->FirstPos == Sketcher::none) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Impossible constraint"), QObject::tr("The selected edge already has a vertical constraint!")); return; @@ -1588,12 +1588,12 @@ void CmdSketcherConstrainVertical::applyConstraint(std::vector &selSe // check if the edge already has a Horizontal or Vertical constraint for (std::vector< Sketcher::Constraint * >::const_iterator it= vals.begin(); it != vals.end(); ++it) { - if ((*it)->Type == Sketcher::Horizontal && (*it)->First == CrvId){ + if ((*it)->Type == Sketcher::Horizontal && (*it)->First == CrvId && (*it)->FirstPos == Sketcher::none){ QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Impossible constraint"), QObject::tr("The selected edge already has a horizontal constraint!")); return; } - if ((*it)->Type == Sketcher::Vertical && (*it)->First == CrvId) { + if ((*it)->Type == Sketcher::Vertical && (*it)->First == CrvId && (*it)->FirstPos == Sketcher::none) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Double constraint"), QObject::tr("The selected edge already has a vertical constraint!")); return;