Skip to content

Commit

Permalink
Bug fix: Sketcher Polygon autoconstraints
Browse files Browse the repository at this point in the history
=========================================

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.
  • Loading branch information
abdullahtahiriyo committed May 27, 2015
1 parent 24b7137 commit 5676c63
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Mod/Sketcher/Gui/CommandCreateGeo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4512,15 +4512,15 @@ class DrawSketchHandlerRegularPolygon: public DrawSketchHandler
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();
}
}
Expand Down

0 comments on commit 5676c63

Please sign in to comment.