From 5676c632f63b75955d3376f2fda09f4e892d490c Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Wed, 27 May 2015 16:22:31 +0200 Subject: [PATCH] Bug fix: Sketcher Polygon autoconstraints ========================================= The autoconstraints on creation of an hexagon were not working. How to reproduce? 1. In a sketch make a couple of lines 2. Create an hexagon (or other polygon of your choice) with center in one end of a line and with side coincident with the end point of the other line Result: Neither the center nor the side autoconstraints are properly created. Fix: Straightforward. Just correct the indexes. Last is always the circle. Last but one is always a side. --- src/Mod/Sketcher/Gui/CommandCreateGeo.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp index 073f913c79..85f1cc9b8b 100644 --- a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp +++ b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp @@ -4512,15 +4512,15 @@ public: Gui::Command::commitCommand(); Gui::Command::updateActive(); - // add auto constraints at the start of the first side + // add auto constraints at the center of the polygon if (sugConstr1.size() > 0) { - createAutoConstraints(sugConstr1, getHighestCurveIndex() - 3 , Sketcher::mid); + createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::mid); sugConstr1.clear(); } - // add auto constraints at the end of the second side + // add auto constraints to the last side of the polygon if (sugConstr2.size() > 0) { - createAutoConstraints(sugConstr2, getHighestCurveIndex() - 2, Sketcher::end); + createAutoConstraints(sugConstr2, getHighestCurveIndex() - 1, Sketcher::end); sugConstr2.clear(); } }