diff --git a/src/Mod/Sketcher/App/Constraint.cpp b/src/Mod/Sketcher/App/Constraint.cpp index 35e78685e..264903720 100644 --- a/src/Mod/Sketcher/App/Constraint.cpp +++ b/src/Mod/Sketcher/App/Constraint.cpp @@ -137,11 +137,11 @@ double Constraint::getPresentationValue() const switch (Type) { case Distance: case Radius: - return std::abs(Value); + return Value; case DistanceX: case DistanceY: if (FirstPos == Sketcher::none || Second != Sketcher::Constraint::GeoUndef) - return std::abs(Value); + return Value; else return Value; case Angle: diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index 0175c311a..2b6921e46 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -128,7 +128,7 @@ void openEditDatumDialog(Sketcher::SketchObject* sketch, int ConstrNbr) ((Constr->Type == Sketcher::DistanceX || Constr->Type == Sketcher::DistanceY) && (Constr->FirstPos == Sketcher::none || Constr->Second != Sketcher::Constraint::GeoUndef))) // hide negative sign - init_val.setValue(std::abs(datum)); + init_val.setValue(datum); else // show negative sign init_val.setValue(datum); @@ -145,15 +145,6 @@ void openEditDatumDialog(Sketcher::SketchObject* sketch, int ConstrNbr) ui_ins_datum.labelEdit->pushToHistory(); double newDatum = newQuant.getValue(); - if (Constr->Type == Sketcher::Angle || - ((Constr->Type == Sketcher::DistanceX || Constr->Type == Sketcher::DistanceY) && - (Constr->FirstPos == Sketcher::none || Constr->Second != Sketcher::Constraint::GeoUndef))) { - // Permit negative values to flip the sign of the constraint - if (newDatum >= 0) // keep the old sign - newDatum = ((datum >= 0) ? 1 : -1) * std::abs(newDatum); - else // flip sign - newDatum = ((datum >= 0) ? -1 : 1) * std::abs(newDatum); - } try { if (ui_ins_datum.labelEdit->hasExpression()) diff --git a/src/Mod/Sketcher/Gui/EditDatumDialog.cpp b/src/Mod/Sketcher/Gui/EditDatumDialog.cpp index 8b2bd2388..04776d980 100644 --- a/src/Mod/Sketcher/Gui/EditDatumDialog.cpp +++ b/src/Mod/Sketcher/Gui/EditDatumDialog.cpp @@ -122,15 +122,7 @@ void EditDatumDialog::exec(bool atCursor) //ui_ins_datum.lineEdit->setParamGrpPath("User parameter:History/Sketcher/SetDatum"); - // e.g. an angle or a distance X or Y applied on a line or two vertexes - if (Constr->Type == Sketcher::Angle || - ((Constr->Type == Sketcher::DistanceX || Constr->Type == Sketcher::DistanceY) && - (Constr->FirstPos == Sketcher::none || Constr->Second != Sketcher::Constraint::GeoUndef))) - // hide negative sign - init_val.setValue(std::abs(datum)); - - else // show negative sign - init_val.setValue(datum); + init_val.setValue(datum); // Enable label if we are modifying a driving constraint ui_ins_datum.labelEdit->setEnabled(Constr->isDriving); @@ -150,15 +142,6 @@ void EditDatumDialog::exec(bool atCursor) ui_ins_datum.labelEdit->pushToHistory(); double newDatum = newQuant.getValue(); - if (Constr->Type == Sketcher::Angle || - ((Constr->Type == Sketcher::DistanceX || Constr->Type == Sketcher::DistanceY) && - (Constr->FirstPos == Sketcher::none || Constr->Second != Sketcher::Constraint::GeoUndef))) { - // Permit negative values to flip the sign of the constraint - if (newDatum >= 0) // keep the old sign - newDatum = ((datum >= 0) ? 1 : -1) * std::abs(newDatum); - else // flip sign - newDatum = ((datum >= 0) ? -1 : 1) * std::abs(newDatum); - } try { Gui::Command::openCommand("Modify sketch constraints"); diff --git a/src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp b/src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp index 90b095c6f..4ab90efaf 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp @@ -126,16 +126,16 @@ public: name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity(constraint->getPresentationValue(),Base::Unit::Length).getUserString()); break; case Sketcher::DistanceX: - name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity(std::abs(constraint->getPresentationValue()),Base::Unit::Length).getUserString()); + name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity(constraint->getPresentationValue(),Base::Unit::Length).getUserString()); break; case Sketcher::DistanceY: - name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity(std::abs(constraint->getPresentationValue()),Base::Unit::Length).getUserString()); + name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity(constraint->getPresentationValue(),Base::Unit::Length).getUserString()); break; case Sketcher::Radius: name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity(constraint->getPresentationValue(),Base::Unit::Length).getUserString()); break; case Sketcher::Angle: - name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity(Base::toDegrees(std::abs(constraint->getPresentationValue())),Base::Unit::Angle).getUserString()); + name = QString::fromLatin1("%1 (%2)").arg(name).arg(Base::Quantity(Base::toDegrees(constraint->getPresentationValue()),Base::Unit::Angle).getUserString()); break; case Sketcher::SnellsLaw: { double v = constraint->getPresentationValue(); diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 3fc73bd9b..850397670 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -3525,12 +3525,7 @@ Restart: break; SoDatumLabel *asciiText = dynamic_cast(sep->getChild(CONSTRAINT_SEPARATOR_INDEX_MATERIAL_OR_DATUMLABEL)); - if ((Constr->Type == DistanceX || Constr->Type == DistanceY) && - Constr->FirstPos != Sketcher::none && Constr->Second == Constraint::GeoUndef) - // display negative sign for absolute coordinates - asciiText->string = SbString(Base::Quantity(Constr->getPresentationValue(),Base::Unit::Length).getUserString().toUtf8().constData()); - else // hide negative sign - asciiText->string = SbString(Base::Quantity(std::abs(Constr->getPresentationValue()),Base::Unit::Length).getUserString().toUtf8().constData()); + asciiText->string = SbString(Base::Quantity(Constr->getPresentationValue(),Base::Unit::Length).getUserString().toUtf8().constData()); if (Constr->Type == Distance) asciiText->datumtype = SoDatumLabel::DISTANCE; @@ -3829,7 +3824,7 @@ Restart: break; SoDatumLabel *asciiText = dynamic_cast(sep->getChild(CONSTRAINT_SEPARATOR_INDEX_MATERIAL_OR_DATUMLABEL)); - asciiText->string = SbString(Base::Quantity(Base::toDegrees(std::abs(Constr->getPresentationValue())),Base::Unit::Angle).getUserString().toUtf8().constData()); + asciiText->string = SbString(Base::Quantity(Base::toDegrees(Constr->getPresentationValue()),Base::Unit::Angle).getUserString().toUtf8().constData()); asciiText->datumtype = SoDatumLabel::ANGLE; asciiText->param1 = Constr->LabelDistance; asciiText->param2 = startangle;