From b73cbd739ce88d0988983573191aec327026eeb9 Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Fri, 28 Sep 2018 17:08:04 +0200 Subject: [PATCH] Sketcher: Correct checking of compatible equality geometry ========================================================= Before this commit equality line to circle is allowed although the solver can not process it. Similar happens for several combinations of incompatible edges. --- src/Mod/Sketcher/Gui/CommandConstraints.cpp | 22 +++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index bf3b0930ce..2d8569a01e 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -6594,6 +6594,7 @@ void CmdSketcherConstrainEqual::activated(int iMsg) std::vector ids; bool lineSel = false, arcSel = false, circSel = false, ellipsSel = false, arcEllipsSel=false, hasAlreadyExternal = false; + bool hyperbSel = false, parabSel=false; for (std::vector::const_iterator it=SubNames.begin(); it != SubNames.end(); ++it) { @@ -6631,16 +6632,20 @@ void CmdSketcherConstrainEqual::activated(int iMsg) return; } - if (geo->getTypeId() != Part::GeomLineSegment::getClassTypeId()) + if (geo->getTypeId() == Part::GeomLineSegment::getClassTypeId()) lineSel = true; - else if (geo->getTypeId() != Part::GeomArcOfCircle::getClassTypeId()) + else if (geo->getTypeId() == Part::GeomArcOfCircle::getClassTypeId()) arcSel = true; - else if (geo->getTypeId() != Part::GeomCircle::getClassTypeId()) + else if (geo->getTypeId() == Part::GeomCircle::getClassTypeId()) circSel = true; - else if (geo->getTypeId() != Part::GeomEllipse::getClassTypeId()) + else if (geo->getTypeId() == Part::GeomEllipse::getClassTypeId()) ellipsSel = true; - else if (geo->getTypeId() != Part::GeomArcOfEllipse::getClassTypeId()) + else if (geo->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId()) arcEllipsSel = true; + else if (geo->getTypeId() == Part::GeomArcOfHyperbola::getClassTypeId()) + hyperbSel = true; + else if (geo->getTypeId() == Part::GeomArcOfParabola::getClassTypeId()) + parabSel = true; else { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), QObject::tr("Select two or more edges of similar type")); @@ -6650,7 +6655,12 @@ void CmdSketcherConstrainEqual::activated(int iMsg) ids.push_back(GeoId); } - if (lineSel && (arcSel || circSel) && (ellipsSel || arcEllipsSel)) { + // Check for heterogeneous groups in selection + if ( (lineSel && ((arcSel || circSel) || (ellipsSel || arcEllipsSel) || hyperbSel || parabSel) ) || + ((arcSel || circSel) && ((ellipsSel || arcEllipsSel) || hyperbSel || parabSel)) || + ((ellipsSel || arcEllipsSel) && (hyperbSel || parabSel)) || + (hyperbSel && parabSel) ) { + QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), QObject::tr("Select two or more edges of similar type")); return;