Part: [skip ci] support of expressions of Euler angles in attachment dialog
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user