diff --git a/src/App/PropertyGeo.cpp b/src/App/PropertyGeo.cpp index 6765be8a9b30..fe694e1b7701 100644 --- a/src/App/PropertyGeo.cpp +++ b/src/App/PropertyGeo.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -567,6 +568,32 @@ void PropertyPlacement::getPaths(std::vector &paths) const << ObjectIdentifier::Component::SimpleComponent(ObjectIdentifier::String("z"))); } +void PropertyPlacement::setPathValue(const ObjectIdentifier &path, const boost::any &value) +{ + if (path.getSubPathStr() == ".Rotation.Angle") { + double avalue; + + if (value.type() == typeid(Base::Quantity)) + avalue = boost::any_cast(value).getValue(); + else if (value.type() == typeid(double)) + avalue = boost::any_cast(value); + else if (value.type() == typeid(int)) + avalue = boost::any_cast(value); + else if (value.type() == typeid(unsigned int)) + avalue = boost::any_cast(value); + else if (value.type() == typeid(short)) + avalue = boost::any_cast(value); + else if (value.type() == typeid(unsigned short)) + avalue = boost::any_cast(value); + else + throw std::bad_cast(); + + Property::setPathValue(path, Base::toRadians(avalue)); + } + else + Property::setPathValue(path, value); +} + PyObject *PropertyPlacement::getPyObject(void) { return new Base::PlacementPy(new Base::Placement(_cPos)); diff --git a/src/App/PropertyGeo.h b/src/App/PropertyGeo.h index 337f6db1a470..9bef38266a57 100644 --- a/src/App/PropertyGeo.h +++ b/src/App/PropertyGeo.h @@ -263,6 +263,8 @@ class AppExport PropertyPlacement: public Property /// Get valid paths for this property; used by auto completer void getPaths(std::vector &paths) const; + void setPathValue(const ObjectIdentifier &path, const boost::any &value); + const char* getEditorName(void) const { return "Gui::PropertyEditor::PropertyPlacementItem"; }