From 52dc0dda4765ea735f8d6020c21cf29692b91db4 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 2 Dec 2014 19:19:23 +0100 Subject: [PATCH] + allow to modify placement via sub-attributes --- src/Base/RotationPy.xml | 4 ++-- src/Base/RotationPyImp.cpp | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/Base/RotationPy.xml b/src/Base/RotationPy.xml index 70f9ad492..867c3c816 100644 --- a/src/Base/RotationPy.xml +++ b/src/Base/RotationPy.xml @@ -72,13 +72,13 @@ - + The rotation axis of the quaternion - + The rotation angle of the quaternion diff --git a/src/Base/RotationPyImp.cpp b/src/Base/RotationPyImp.cpp index 8e08e321d..d9bc2f9ce 100644 --- a/src/Base/RotationPyImp.cpp +++ b/src/Base/RotationPyImp.cpp @@ -197,6 +197,14 @@ Py::Object RotationPy::getAxis(void) const return Py::Vector(axis); } +void RotationPy::setAxis(Py::Object arg) +{ + Base::Vector3d axis; double angle; + this->getRotationPtr()->getValue(axis, angle); + axis = Py::Vector(arg).toVector(); + this->getRotationPtr()->setValue(axis, angle); +} + Py::Float RotationPy::getAngle(void) const { Base::Vector3d axis; double angle; @@ -204,6 +212,14 @@ Py::Float RotationPy::getAngle(void) const return Py::Float(angle); } +void RotationPy::setAngle(Py::Float arg) +{ + Base::Vector3d axis; double angle; + this->getRotationPtr()->getValue(axis, angle); + angle = static_cast(arg); + this->getRotationPtr()->setValue(axis, angle); +} + PyObject *RotationPy::getCustomAttributes(const char* /*attr*/) const { return 0;