When moving an angle, we did not take into account the case where they are reversed. This fixes that.
This commit is contained in:
@@ -664,7 +664,12 @@ void SketchObject::reverseAngleConstraintToSupplementary(Constraint* constr, int
|
||||
{
|
||||
std::swap(constr->First, constr->Second);
|
||||
std::swap(constr->FirstPos, constr->SecondPos);
|
||||
constr->FirstPos = (constr->FirstPos == Sketcher::PointPos::start) ? Sketcher::PointPos::end : Sketcher::PointPos::start;
|
||||
if (constr->FirstPos == constr->SecondPos) {
|
||||
constr->FirstPos = (constr->FirstPos == Sketcher::PointPos::start) ? Sketcher::PointPos::end : Sketcher::PointPos::start;
|
||||
}
|
||||
else {
|
||||
constr->SecondPos = (constr->SecondPos == Sketcher::PointPos::start) ? Sketcher::PointPos::end : Sketcher::PointPos::start;
|
||||
}
|
||||
|
||||
// Edit the expression if any, else modify constraint value directly
|
||||
if (constraintHasExpression(constNum)) {
|
||||
@@ -677,6 +682,12 @@ void SketchObject::reverseAngleConstraintToSupplementary(Constraint* constr, int
|
||||
}
|
||||
}
|
||||
|
||||
void SketchObject::inverseAngleConstraint(Constraint* constr)
|
||||
{
|
||||
constr->FirstPos = (constr->FirstPos == Sketcher::PointPos::start) ? Sketcher::PointPos::end : Sketcher::PointPos::start;
|
||||
constr->SecondPos = (constr->SecondPos == Sketcher::PointPos::start) ? Sketcher::PointPos::end : Sketcher::PointPos::start;
|
||||
}
|
||||
|
||||
bool SketchObject::constraintHasExpression(int constNum) const
|
||||
{
|
||||
App::ObjectIdentifier path = Constraints.createPath(constNum);
|
||||
|
||||
@@ -271,6 +271,7 @@ public:
|
||||
|
||||
/// Change an angle constraint to its supplementary angle.
|
||||
void reverseAngleConstraintToSupplementary(Constraint* constr, int constNum);
|
||||
void inverseAngleConstraint(Constraint* constr);
|
||||
/// Modify an angle constraint expression string to its supplementary angle
|
||||
static std::string reverseAngleConstraintExpression(std::string expression);
|
||||
|
||||
|
||||
@@ -1918,8 +1918,12 @@ void ViewProviderSketch::moveAngleConstraint(int constNum, const Base::Vector2d&
|
||||
sign2 = isLeftOfLine(p21, p22, ap3);
|
||||
}
|
||||
|
||||
bool inverse = !(sign1 == sign3 && sign2 == sign4);
|
||||
if (inverse) {
|
||||
obj->inverseAngleConstraint(constr);
|
||||
}
|
||||
|
||||
p0 = Base::Vector3d(intersection.x, intersection.y, 0.);
|
||||
factor *= (sign1 == sign3 && sign2 == sign4) ? 1. : -1.;
|
||||
}
|
||||
else {// angle-via-point
|
||||
Base::Vector3d p = getSolvedSketch().getPoint(constr->Third, constr->ThirdPos);
|
||||
|
||||
Reference in New Issue
Block a user