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.
This commit is contained in:
Abdullah Tahiri 2015-05-27 16:22:31 +02:00
parent 24b71377e1
commit 5676c632f6

View File

@ -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();
}
}