From d25a3e566ceba48097bed8d13a69a1d49ab34e7c Mon Sep 17 00:00:00 2001 From: 0penBrain <48731257+0penBrain@users.noreply.github.com> Date: Thu, 20 Jan 2022 17:32:24 +0100 Subject: [PATCH] [Sketcher] Fix check for fixed items in tangent+perpendicular --- src/Mod/Sketcher/Gui/CommandConstraints.cpp | 42 +++++++++++++++------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index 0d8a2b99b4..a05d08e69e 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -3725,12 +3725,6 @@ void CmdSketcherConstrainPerpendicular::applyConstraint(std::vector & int GeoId1 = GeoEnum::GeoUndef, GeoId2 = GeoEnum::GeoUndef, GeoId3 = GeoEnum::GeoUndef; Sketcher::PointPos PosId1 = Sketcher::PointPos::none, PosId2 = Sketcher::PointPos::none, PosId3 = Sketcher::PointPos::none; - // check if the edge already has a Block constraint - if ( areBothPointsOrSegmentsFixed(Obj,GeoId1,GeoId2) ) { - showNoConstraintBetweenFixedGeometry(); - return; - } - switch (seqIndex) { case 0: // {SelEdge, SelEdgeOrAxis} case 1: // {SelEdgeOrAxis, SelEdge} @@ -3739,6 +3733,12 @@ void CmdSketcherConstrainPerpendicular::applyConstraint(std::vector & { GeoId1 = selSeq.at(0).GeoId; GeoId2 = selSeq.at(1).GeoId; + // check if the edge already has a Block constraint + if ( areBothPointsOrSegmentsFixed(Obj,GeoId1,GeoId2) ) { + showNoConstraintBetweenFixedGeometry(); + return; + } + const Part::Geometry *geo1 = Obj->getGeometry(GeoId1); const Part::Geometry *geo2 = Obj->getGeometry(GeoId2); if (!geo1 || !geo2) { @@ -3915,6 +3915,12 @@ void CmdSketcherConstrainPerpendicular::applyConstraint(std::vector & if (isEdge(GeoId1, PosId1) && isEdge(GeoId2, PosId2) && isVertex(GeoId3, PosId3)) { + // check if the edge already has a Block constraint + if ( areBothPointsOrSegmentsFixed(Obj,GeoId1,GeoId2) ) { + showNoConstraintBetweenFixedGeometry(); + return; + } + if(isBsplinePole(Obj, GeoId1) || isBsplinePole(Obj, GeoId2)) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), QObject::tr("Select an edge that is not a B-spline weight")); @@ -4417,12 +4423,6 @@ void CmdSketcherConstrainTangent::applyConstraint(std::vector &selSeq int GeoId1 = GeoEnum::GeoUndef, GeoId2 = GeoEnum::GeoUndef, GeoId3 = GeoEnum::GeoUndef; Sketcher::PointPos PosId1 = Sketcher::PointPos::none, PosId2 = Sketcher::PointPos::none, PosId3 = Sketcher::PointPos::none; - // check if the edge already has a Block constraint - if ( areBothPointsOrSegmentsFixed(Obj,GeoId1,GeoId2) ) { - showNoConstraintBetweenFixedGeometry(); - return; - } - switch (seqIndex) { case 0: // {SelEdge, SelEdgeOrAxis} case 1: // {SelEdgeOrAxis, SelEdge} @@ -4431,6 +4431,12 @@ void CmdSketcherConstrainTangent::applyConstraint(std::vector &selSeq { GeoId1 = selSeq.at(0).GeoId; GeoId2 = selSeq.at(1).GeoId; + // check if the edge already has a Block constraint + if ( areBothPointsOrSegmentsFixed(Obj,GeoId1,GeoId2) ) { + showNoConstraintBetweenFixedGeometry(); + return; + } + const Part::Geometry *geom1 = Obj->getGeometry(GeoId1); const Part::Geometry *geom2 = Obj->getGeometry(GeoId2); @@ -4588,6 +4594,12 @@ void CmdSketcherConstrainTangent::applyConstraint(std::vector &selSeq GeoId1 = selSeq.at(0).GeoId; GeoId2 = selSeq.at(1).GeoId; PosId1 = selSeq.at(0).PosId; PosId2 = selSeq.at(1).PosId; + // check if the edge already has a Block constraint + if ( areBothPointsOrSegmentsFixed(Obj,GeoId1,GeoId2) ) { + showNoConstraintBetweenFixedGeometry(); + return; + } + if (isSimpleVertex(Obj, GeoId1, PosId1) || isSimpleVertex(Obj, GeoId2, PosId2)) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), @@ -4625,6 +4637,12 @@ void CmdSketcherConstrainTangent::applyConstraint(std::vector &selSeq if (isEdge(GeoId1, PosId1) && isEdge(GeoId2, PosId2) && isVertex(GeoId3, PosId3)) { + // check if the edge already has a Block constraint + if ( areBothPointsOrSegmentsFixed(Obj,GeoId1,GeoId2) ) { + showNoConstraintBetweenFixedGeometry(); + return; + } + if(isBsplinePole(Obj, GeoId1) || isBsplinePole(Obj, GeoId2)) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), QObject::tr("Select an edge that is not a B-spline weight"));