Skip to content

Commit

Permalink
Sketcher: Fixed setPathValue to convert angles to radians before they…
Browse files Browse the repository at this point in the history
… are stored in the Constraint object. This mimics the setDatum implementation.
  • Loading branch information
eivindkv authored and wwmayer committed Dec 18, 2015
1 parent 24c6019 commit db2f868
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Mod/Sketcher/App/PropertyConstraintList.cpp
Expand Up @@ -32,6 +32,7 @@
#include <Base/Exception.h>
#include <Base/Reader.h>
#include <Base/Writer.h>
#include <Base/Tools.h>
#include <App/ObjectIdentifier.h>
#include <App/DocumentObject.h>

Expand Down Expand Up @@ -423,6 +424,13 @@ void PropertyConstraintList::setPathValue(const ObjectIdentifier &path, const bo
if (c0.isArray() && path.numSubComponents() == 1) {
if (c0.getIndex() >= _lValueList.size())
throw Base::Exception("Array out of bounds");
switch (_lValueList[c0.getIndex()]->Type) {
case Angle:
dvalue = Base::toRadians<double>(dvalue);
break;
default:
break;
}
aboutToSetValue();
_lValueList[c0.getIndex()]->setValue(dvalue);
hasSetValue();
Expand All @@ -433,6 +441,13 @@ void PropertyConstraintList::setPathValue(const ObjectIdentifier &path, const bo

for (std::vector<Constraint *>::const_iterator it = _lValueList.begin(); it != _lValueList.end(); ++it) {
if ((*it)->Name == c1.getName()) {
switch (_lValueList[c0.getIndex()]->Type) {
case Angle:
dvalue = Base::toRadians<double>(dvalue);
break;
default:
break;
}
aboutToSetValue();
_lValueList[it - _lValueList.begin()]->setValue(dvalue);
hasSetValue();
Expand Down

0 comments on commit db2f868

Please sign in to comment.