diff --git a/src/Mod/Sketcher/App/SketchObjectPy.xml b/src/Mod/Sketcher/App/SketchObjectPy.xml
index ca2d07f154..befa596d7e 100644
--- a/src/Mod/Sketcher/App/SketchObjectPy.xml
+++ b/src/Mod/Sketcher/App/SketchObjectPy.xml
@@ -172,6 +172,11 @@
add a copy of geometric objects to the sketch displaced by a vector3d
+
+
+ Moves the geometric objects in the sketch displaced by a vector3d
+
+
add an array of size cols by rows where each element is a copy of the selected geometric objects displaced by a vector3d in the cols direction and by a vector perpendicular to it in the rows direction
diff --git a/src/Mod/Sketcher/App/SketchObjectPyImp.cpp b/src/Mod/Sketcher/App/SketchObjectPyImp.cpp
index b0e6174b0f..4906de9b35 100644
--- a/src/Mod/Sketcher/App/SketchObjectPyImp.cpp
+++ b/src/Mod/Sketcher/App/SketchObjectPyImp.cpp
@@ -993,7 +993,7 @@ PyObject* SketchObjectPy::addCopy(PyObject *args)
#endif
}
- int ret = this->getSketchObjectPtr()->addCopy(geoIdList, vect, PyObject_IsTrue(clone) ? true : false) + 1;
+ int ret = this->getSketchObjectPtr()->addCopy(geoIdList, vect, false, PyObject_IsTrue(clone) ? true : false) + 1;
if(ret == -1)
throw Py::TypeError("Copy operation unsuccessful!");
@@ -1013,6 +1013,39 @@ PyObject* SketchObjectPy::addCopy(PyObject *args)
throw Py::TypeError(error);
}
+PyObject* SketchObjectPy::addMove(PyObject *args)
+{
+ PyObject *pcObj, *pcVect;
+
+ if (!PyArg_ParseTuple(args, "OO!", &pcObj, &(Base::VectorPy::Type), &pcVect))
+ return 0;
+
+ Base::Vector3d vect = static_cast(pcVect)->value();
+
+ if (PyObject_TypeCheck(pcObj, &(PyList_Type)) ||
+ PyObject_TypeCheck(pcObj, &(PyTuple_Type))) {
+ std::vector geoIdList;
+ Py::Sequence list(pcObj);
+ for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
+ #if PY_MAJOR_VERSION >= 3
+ if (PyLong_Check((*it).ptr()))
+ geoIdList.push_back(PyLong_AsLong((*it).ptr()));
+ #else
+ if (PyInt_Check((*it).ptr()))
+ geoIdList.push_back(PyInt_AsLong((*it).ptr()));
+ #endif
+ }
+
+ this->getSketchObjectPtr()->addCopy(geoIdList, vect, true);
+
+ Py_Return;
+ }
+
+ std::string error = std::string("type must be list of GeoIds, not ");
+ error += pcObj->ob_type->tp_name;
+ throw Py::TypeError(error);
+}
+
PyObject* SketchObjectPy::addRectangularArray(PyObject *args)
{
PyObject *pcObj, *pcVect;
@@ -1041,7 +1074,7 @@ PyObject* SketchObjectPy::addRectangularArray(PyObject *args)
#endif
}
- int ret = this->getSketchObjectPtr()->addCopy(geoIdList,vect, PyObject_IsTrue(clone) ? true : false,
+ int ret = this->getSketchObjectPtr()->addCopy(geoIdList,vect, false, PyObject_IsTrue(clone) ? true : false,
rows, cols, PyObject_IsTrue(constraindisplacement) ? true : false, perpscale) + 1;
if(ret == -1)