diff --git a/src/Base/RotationPyImp.cpp b/src/Base/RotationPyImp.cpp index 0d73977ca6..c67567884c 100644 --- a/src/Base/RotationPyImp.cpp +++ b/src/Base/RotationPyImp.cpp @@ -385,6 +385,21 @@ PyObject *RotationPy::getCustomAttributes(const char* attr) const this->getRotationPtr()->getValue(mat); return new MatrixPy(mat); } + else if (strcmp(attr, "Yaw") == 0) { + double A,B,C; + this->getRotationPtr()->getYawPitchRoll(A,B,C); + return PyFloat_FromDouble(A); + } + else if (strcmp(attr, "Pitch") == 0) { + double A,B,C; + this->getRotationPtr()->getYawPitchRoll(A,B,C); + return PyFloat_FromDouble(B); + } + else if (strcmp(attr, "Roll") == 0) { + double A,B,C; + this->getRotationPtr()->getYawPitchRoll(A,B,C); + return PyFloat_FromDouble(C); + } return 0; } @@ -409,7 +424,34 @@ int RotationPy::setCustomAttributes(const char* attr, PyObject* obj) } } } - return 0; + else if (strcmp(attr, "Yaw") == 0) { + if (PyNumber_Check(obj)) { + double V = PyFloat_AsDouble(obj); + double A,B,C; + this->getRotationPtr()->getYawPitchRoll(A,B,C); + this->getRotationPtr()->setYawPitchRoll(V,B,C); + return 1; + } + } + else if (strcmp(attr, "Pitch") == 0) { + if (PyNumber_Check(obj)) { + double V = PyFloat_AsDouble(obj); + double A,B,C; + this->getRotationPtr()->getYawPitchRoll(A,B,C); + this->getRotationPtr()->setYawPitchRoll(A,V,C); + return 1; + } + } + else if (strcmp(attr, "Roll") == 0) { + if (PyNumber_Check(obj)) { + double V = PyFloat_AsDouble(obj); + double A,B,C; + this->getRotationPtr()->getYawPitchRoll(A,B,C); + this->getRotationPtr()->setYawPitchRoll(A,B,V); + return 1; + } + } + return 0; } PyObject* RotationPy::number_multiply_handler(PyObject *self, PyObject *other) diff --git a/src/Mod/Part/Gui/TaskAttacher.cpp b/src/Mod/Part/Gui/TaskAttacher.cpp index 8a7b1bb60d..bafc9fc99e 100644 --- a/src/Mod/Part/Gui/TaskAttacher.cpp +++ b/src/Mod/Part/Gui/TaskAttacher.cpp @@ -204,6 +204,11 @@ TaskAttacher::TaskAttacher(Gui::ViewProviderDocumentObject *ViewProvider, QWidge ui->attachmentOffsetX->bind(App::ObjectIdentifier::parse(ViewProvider->getObject(),std::string("AttachmentOffset.Base.x"))); ui->attachmentOffsetY->bind(App::ObjectIdentifier::parse(ViewProvider->getObject(),std::string("AttachmentOffset.Base.y"))); ui->attachmentOffsetZ->bind(App::ObjectIdentifier::parse(ViewProvider->getObject(),std::string("AttachmentOffset.Base.z"))); + + ui->attachmentOffsetYaw->bind(App::ObjectIdentifier::parse(ViewProvider->getObject(),std::string("AttachmentOffset.Rotation.Yaw"))); + ui->attachmentOffsetPitch->bind(App::ObjectIdentifier::parse(ViewProvider->getObject(),std::string("AttachmentOffset.Rotation.Pitch"))); + ui->attachmentOffsetRoll->bind(App::ObjectIdentifier::parse(ViewProvider->getObject(),std::string("AttachmentOffset.Rotation.Roll"))); + visibilityAutomation(true); updateAttachmentOffsetUI(); updateReferencesUI();