diff --git a/src/Base/Matrix.h b/src/Base/Matrix.h index 064843a19e..97abecb3b7 100644 --- a/src/Base/Matrix.h +++ b/src/Base/Matrix.h @@ -157,6 +157,11 @@ public: /// scale for the x,y,z value void scale (const Vector3f& rclVct); void scale (const Vector3d& rclVct); + /// uniform scale + void scale (float scalexyz) + { scale(Vector3f(scalexyz, scalexyz, scalexyz)); } + void scale (double scalexyz) + { scale(Vector3d(scalexyz, scalexyz, scalexyz)); } /// Check for scaling factor, 0: not scale, 1: uniform scale, or else -1 int hasScale(double tol=0.0) const; /// Rotate around the X axis (in transformed space) for the given value in radians diff --git a/src/Base/MatrixPyImp.cpp b/src/Base/MatrixPyImp.cpp index 90a7282606..69003eddd2 100644 --- a/src/Base/MatrixPyImp.cpp +++ b/src/Base/MatrixPyImp.cpp @@ -315,13 +315,19 @@ PyObject* MatrixPy::scale(PyObject * args) } // clears the error from previous PyArg_ParseTuple() PyErr_Clear(); + if (PyArg_ParseTuple(args, "d", &x)) { + vec.x = vec.y = vec.z = x; + break; + } + // clears the error from previous PyArg_ParseTuple() + PyErr_Clear(); if (PyArg_ParseTuple(args, "O!", &PyTuple_Type, &pcVecObj)) { vec = getVectorFromTuple(pcVecObj); break; } // clears the error from previous PyArg_ParseTuple() PyErr_Clear(); - if (PyArg_ParseTuple(args, "O!;three floats, or a tuple, or a vector is needed", + if (PyArg_ParseTuple(args, "O!;one or three floats, or a tuple, or a vector is needed", &(Base::VectorPy::Type), &pcVecObj)) { Base::VectorPy *pcObject = static_cast(pcVecObj); Base::Vector3d* val = pcObject->getVectorPtr();