From c6e7976af59492fabe537c1a32950736fcbf12d5 Mon Sep 17 00:00:00 2001 From: George Peden Date: Sat, 20 Sep 2025 11:19:38 -0700 Subject: [PATCH] Fix ConstrainSymmetric two points + symmetry point workflow - Fix hint text to say 'pick symmetry line or symmetry point' for two points + symmetry point workflow - Add missing sequence {SelVertexOrRoot, SelVertexOrRoot, SelVertexOrRoot} to allowedSelSequences - Add case 8 to handle two points + symmetry point constraint creation - Fix duplicate constraint creation by adding return statement in case 8 - Add getSelection().clearSelection() for consistency Fixes reviewer comment #2 from PR #22282 --- src/Mod/Sketcher/Gui/CommandConstraints.cpp | 38 +++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index 071c0f4890..0a95dcae9c 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -1266,7 +1266,7 @@ public: } else if (selectionStep == 2 && !selSeq.empty()) { if (isVertex(selSeq[0].GeoId, selSeq[0].PosId) && isVertex(selSeq[1].GeoId, selSeq[1].PosId)) { // Point + Point + Edge workflow - return {{QObject::tr(PICK_SYMMETRY_LINE), {Gui::InputHint::UserInput::MouseLeft}}}; + return {{QObject::tr(PICK_SYMMETRY_LINE_OR_POINT), {Gui::InputHint::UserInput::MouseLeft}}}; } else if (isVertex(selSeq[0].GeoId, selSeq[0].PosId) && !isVertex(selSeq[1].GeoId, selSeq[1].PosId)) { // Point + Edge + Point workflow return {{QObject::tr(PICK_SYMMETRY_POINT), {Gui::InputHint::UserInput::MouseLeft}}}; @@ -9734,7 +9734,8 @@ CmdSketcherConstrainSymmetric::CmdSketcherConstrainSymmetric() {SelVertex, SelEdgeOrAxis, SelVertex}, {SelVertexOrRoot, SelVertexOrRoot, SelEdge}, {SelVertexOrRoot, SelVertexOrRoot, SelExternalEdge}, - {SelVertex, SelVertex, SelEdgeOrAxis}}; + {SelVertex, SelVertex, SelEdgeOrAxis}, + {SelVertexOrRoot, SelVertexOrRoot, SelVertexOrRoot}}; } void CmdSketcherConstrainSymmetric::activated(int iMsg) @@ -10012,6 +10013,39 @@ void CmdSketcherConstrainSymmetric::applyConstraint(std::vector& selS } return; } + case 8:// {SelVertexOrRoot, SelVertexOrRoot, SelVertexOrRoot} + { + // Simple point + point + point symmetry + GeoId1 = selSeq.at(0).GeoId; + GeoId2 = selSeq.at(1).GeoId; + GeoId3 = selSeq.at(2).GeoId; + PosId1 = selSeq.at(0).PosId; + PosId2 = selSeq.at(1).PosId; + PosId3 = selSeq.at(2).PosId; + + if (areAllPointsOrSegmentsFixed(Obj, GeoId1, GeoId2, GeoId3)) { + showNoConstraintBetweenFixedGeometry(Obj); + return; + } + + // undo command open + openCommand(QT_TRANSLATE_NOOP("Command", "Add symmetric constraint")); + Gui::cmdAppObjectArgs( + Obj, + "addConstraint(Sketcher.Constraint('Symmetric',%d,%d,%d,%d,%d,%d))", + GeoId1, + static_cast(PosId1), + GeoId2, + static_cast(PosId2), + GeoId3, + static_cast(PosId3)); + + // finish the transaction and update + commitCommand(); + tryAutoRecompute(Obj); + getSelection().clearSelection(); + return; + } default: break; }