py3: gathering diff from Mod/Mesh
98a8275938388992ef1b7bb76dcd43438f61bf7e py3: make most of the unit test to succeed
This commit is contained in:
parent
2673f9ed59
commit
6c8c3dc71e
|
@ -1473,28 +1473,25 @@ PyObject* MeshPy::collapseFacets(PyObject *args)
|
|||
return 0; // NULL triggers exception
|
||||
|
||||
// if no mesh is given
|
||||
if (PyList_Check(pcObj)) {
|
||||
try {
|
||||
Py::Sequence list(pcObj);
|
||||
std::vector<unsigned long> facets;
|
||||
for (int i = 0; i < PyList_Size(pcObj); i++) {
|
||||
PyObject *idx = PyList_GetItem(pcObj, i);
|
||||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
if (PyLong_Check(idx)){
|
||||
unsigned long iIdx = PyLong_AsLong(idx);
|
||||
Py::Long idx(*it);
|
||||
unsigned long iIdx = static_cast<unsigned long>(idx);
|
||||
facets.push_back(iIdx);
|
||||
#else
|
||||
if (PyInt_Check(idx)){
|
||||
unsigned long iIdx = PyInt_AsLong(idx);
|
||||
Py::Int idx(*it);
|
||||
unsigned long iIdx = static_cast<unsigned long>(idx);
|
||||
facets.push_back(iIdx);
|
||||
#endif
|
||||
facets.push_back(iIdx);
|
||||
}
|
||||
else {
|
||||
Py_Error(Base::BaseExceptionFreeCADError, "list of integers needed");
|
||||
}
|
||||
}
|
||||
|
||||
getMeshObjectPtr()->collapseFacets(facets);
|
||||
}
|
||||
else {
|
||||
Py_Error(Base::BaseExceptionFreeCADError, "List of Integers needed");
|
||||
catch (const Py::Exception&) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Py_Return;
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
# (c) Juergen Riegel (juergen.riegel@web.de) 2007 LGPL
|
||||
|
||||
import FreeCAD, os, sys, unittest, Mesh
|
||||
import thread, time, tempfile, math
|
||||
import time, tempfile, math
|
||||
# http://python-kurs.eu/threads.php
|
||||
try:
|
||||
import _thread as thread
|
||||
except:
|
||||
import thread
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue
Block a user