Sketcher: Empty list means all geometry for Python addCopy addRectangularArray and addMove

This commit is contained in:
Abdullah Tahiri
2018-05-28 23:35:54 +02:00
committed by wmayer
parent fbf5114073
commit 8ebb8ce90b
2 changed files with 35 additions and 28 deletions

View File

@@ -1025,16 +1025,16 @@ PyObject* SketchObjectPy::addMove(PyObject *args)
if (PyObject_TypeCheck(pcObj, &(PyList_Type)) ||
PyObject_TypeCheck(pcObj, &(PyTuple_Type))) {
std::vector<int> 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
}
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);