diff --git a/src/App/PropertyLinks.cpp b/src/App/PropertyLinks.cpp index d03a4f951..cbf512425 100644 --- a/src/App/PropertyLinks.cpp +++ b/src/App/PropertyLinks.cpp @@ -246,10 +246,10 @@ void PropertyLinkSub::setPyObject(PyObject *value) Py::Tuple tup(value); if (PyObject_TypeCheck(tup[0].ptr(), &(DocumentObjectPy::Type))){ DocumentObjectPy *pcObj = (DocumentObjectPy*)tup[0].ptr(); - Py::List list(tup[1]); + Py::Sequence list(tup[1]); std::vector vals(list.size()); unsigned int i=0; - for(Py::List::iterator it = list.begin();it!=list.end();++it,++i) + for(Py::Sequence::iterator it = list.begin();it!=list.end();++it,++i) vals[i] = Py::String(*it); setValue(pcObj->getDocumentObjectPtr(),vals); diff --git a/src/Gui/ViewProviderPythonFeature.cpp b/src/Gui/ViewProviderPythonFeature.cpp index cde1d8e19..dab7c85b9 100644 --- a/src/Gui/ViewProviderPythonFeature.cpp +++ b/src/Gui/ViewProviderPythonFeature.cpp @@ -578,8 +578,8 @@ std::vector ViewProviderPythonFeatureImp::getDisplayModes(void) con if (vp.hasAttr("__object__")) { Py::Callable method(vp.getAttr(std::string("getDisplayModes"))); Py::Tuple args(0); - Py::List list(method.apply(args)); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + Py::Sequence list(method.apply(args)); + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Py::String str(*it); modes.push_back(str.as_std_string()); } @@ -588,8 +588,8 @@ std::vector ViewProviderPythonFeatureImp::getDisplayModes(void) con Py::Callable method(vp.getAttr(std::string("getDisplayModes"))); Py::Tuple args(1); args.setItem(0, Py::Object(object->getPyObject(), true)); - Py::List list(method.apply(args)); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + Py::Sequence list(method.apply(args)); + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Py::String str(*it); modes.push_back(str.as_std_string()); } diff --git a/src/Mod/Drawing/Gui/AppDrawingGuiPy.cpp b/src/Mod/Drawing/Gui/AppDrawingGuiPy.cpp index 1ff6170e6..d1e7d7c5c 100644 --- a/src/Mod/Drawing/Gui/AppDrawingGuiPy.cpp +++ b/src/Mod/Drawing/Gui/AppDrawingGuiPy.cpp @@ -112,8 +112,8 @@ exporter(PyObject *self, PyObject *args) return NULL; PY_TRY { - Py::List list(object); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + Py::Sequence list(object); + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { PyObject* item = (*it).ptr(); if (PyObject_TypeCheck(item, &(App::DocumentObjectPy::Type))) { App::DocumentObject* obj = static_cast(item)->getDocumentObjectPtr(); diff --git a/src/Mod/Fem/App/AppFemPy.cpp b/src/Mod/Fem/App/AppFemPy.cpp index f4475b175..54ce718a0 100755 --- a/src/Mod/Fem/App/AppFemPy.cpp +++ b/src/Mod/Fem/App/AppFemPy.cpp @@ -540,9 +540,9 @@ static PyObject * exporter(PyObject *self, PyObject *args) return NULL; PY_TRY { - Py::List list(object); + Py::Sequence list(object); Base::Type meshId = Base::Type::fromName("Fem::FemMeshObject"); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { PyObject* item = (*it).ptr(); if (PyObject_TypeCheck(item, &(App::DocumentObjectPy::Type))) { App::DocumentObject* obj = static_cast(item)->getDocumentObjectPtr(); diff --git a/src/Mod/Import/App/AppImportPy.cpp b/src/Mod/Import/App/AppImportPy.cpp index 4399f17ba..25bfa7169 100644 --- a/src/Mod/Import/App/AppImportPy.cpp +++ b/src/Mod/Import/App/AppImportPy.cpp @@ -183,8 +183,8 @@ static PyObject * exporter(PyObject *self, PyObject *args) hApp->NewDocument(TCollection_ExtendedString("MDTV-CAF"), hDoc); Import::ExportOCAF ocaf(hDoc); - Py::List list(object); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + Py::Sequence list(object); + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { PyObject* item = (*it).ptr(); if (PyObject_TypeCheck(item, &(App::DocumentObjectPy::Type))) { App::DocumentObject* obj = static_cast(item)->getDocumentObjectPtr(); diff --git a/src/Mod/Import/Gui/AppImportGuiPy.cpp b/src/Mod/Import/Gui/AppImportGuiPy.cpp index 65e8af25f..4563f1466 100644 --- a/src/Mod/Import/Gui/AppImportGuiPy.cpp +++ b/src/Mod/Import/Gui/AppImportGuiPy.cpp @@ -217,8 +217,8 @@ static PyObject * exporter(PyObject *self, PyObject *args) hApp->NewDocument(TCollection_ExtendedString("MDTV-CAF"), hDoc); Import::ExportOCAF ocaf(hDoc); - Py::List list(object); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + Py::Sequence list(object); + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { PyObject* item = (*it).ptr(); if (PyObject_TypeCheck(item, &(App::DocumentObjectPy::Type))) { App::DocumentObject* obj = static_cast(item)->getDocumentObjectPtr(); diff --git a/src/Mod/Mesh/App/MeshPyImp.cpp b/src/Mod/Mesh/App/MeshPyImp.cpp index 2df63d65d..d30eb5421 100644 --- a/src/Mod/Mesh/App/MeshPyImp.cpp +++ b/src/Mod/Mesh/App/MeshPyImp.cpp @@ -240,15 +240,15 @@ PyObject* MeshPy::crossSections(PyObject *args) PyObject *obj; PyObject *poly=Py_False; float min_eps = 1.0e-2f; - if (!PyArg_ParseTuple(args, "O!|fO!", &PyList_Type, &obj, &min_eps, &PyBool_Type, &poly)) + if (!PyArg_ParseTuple(args, "O|fO!", &obj, &min_eps, &PyBool_Type, &poly)) return 0; - Py::List list(obj); + Py::Sequence list(obj); union PyType_Object pyType = {&(Base::VectorPy::Type)}; Py::Type vType(pyType.o); std::vector csPlanes; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Py::Tuple pair(*it); Py::Object p1 = pair.getItem(0); Py::Object p2 = pair.getItem(1); @@ -578,12 +578,12 @@ PyObject* MeshPy::addFacets(PyObject *args) PyObject* MeshPy::removeFacets(PyObject *args) { PyObject* list; - if (!PyArg_ParseTuple(args, "O!", &PyList_Type, &list)) + if (!PyArg_ParseTuple(args, "O", &list)) return 0; std::vector indices; - Py::List ary(list); - for (Py::List::iterator it = ary.begin(); it != ary.end(); ++it) { + Py::Sequence ary(list); + for (Py::Sequence::iterator it = ary.begin(); it != ary.end(); ++it) { Py::Int f(*it); indices.push_back((long)f); } @@ -726,12 +726,12 @@ PyObject* MeshPy::getPointSelection(PyObject *args) PyObject* MeshPy::meshFromSegment(PyObject *args) { PyObject* list; - if (!PyArg_ParseTuple(args, "O!", &PyList_Type, &list)) + if (!PyArg_ParseTuple(args, "O", &list)) return 0; std::vector segment; - Py::List ary(list); - for (Py::List::iterator it = ary.begin(); it != ary.end(); ++it) { + Py::Sequence ary(list); + for (Py::Sequence::iterator it = ary.begin(); it != ary.end(); ++it) { Py::Int f(*it); segment.push_back((long)f); } @@ -1284,13 +1284,13 @@ PyObject* MeshPy::cut(PyObject *args) { PyObject* poly; int mode; - if (!PyArg_ParseTuple(args, "O!i", &PyList_Type, &poly, &mode)) + if (!PyArg_ParseTuple(args, "Oi", &poly, &mode)) return NULL; - Py::List list(poly); + Py::Sequence list(poly); std::vector polygon; polygon.reserve(list.size()); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Base::Vector3d pnt = Py::Vector(*it).toVector(); polygon.push_back(Base::convertTo(pnt)); } @@ -1318,13 +1318,13 @@ PyObject* MeshPy::trim(PyObject *args) { PyObject* poly; int mode; - if (!PyArg_ParseTuple(args, "O!i", &PyList_Type, &poly, &mode)) + if (!PyArg_ParseTuple(args, "Oi", &poly, &mode)) return NULL; - Py::List list(poly); + Py::Sequence list(poly); std::vector polygon; polygon.reserve(list.size()); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Base::Vector3d pnt = Py::Vector(*it).toVector(); polygon.push_back(Base::convertTo(pnt)); } @@ -1453,7 +1453,7 @@ PyObject* MeshPy::getPlanarSegments(PyObject *args) PyObject* MeshPy::getSegmentsByCurvature(PyObject *args) { PyObject* l; - if (!PyArg_ParseTuple(args, "O!",&PyList_Type,&l)) + if (!PyArg_ParseTuple(args, "O",&l)) return NULL; const MeshCore::MeshKernel& kernel = getMeshObjectPtr()->getKernel(); @@ -1461,9 +1461,9 @@ PyObject* MeshPy::getSegmentsByCurvature(PyObject *args) MeshCore::MeshCurvature meshCurv(kernel); meshCurv.ComputePerVertex(); - Py::List func(l); + Py::Sequence func(l); std::vector segm; - for (Py::List::iterator it = func.begin(); it != func.end(); ++it) { + for (Py::Sequence::iterator it = func.begin(); it != func.end(); ++it) { Py::Tuple t(*it); float c1 = (float)Py::Float(t[0]); float c2 = (float)Py::Float(t[1]); diff --git a/src/Mod/Part/App/AppPartPy.cpp b/src/Mod/Part/App/AppPartPy.cpp index e87f267eb..9776c222b 100644 --- a/src/Mod/Part/App/AppPartPy.cpp +++ b/src/Mod/Part/App/AppPartPy.cpp @@ -389,7 +389,7 @@ static PyObject * makeCompound(PyObject *self, PyObject *args) { PyObject *pcObj; - if (!PyArg_ParseTuple(args, "O!", &(PyList_Type), &pcObj)) // convert args: Python->C + if (!PyArg_ParseTuple(args, "O", &pcObj)) // convert args: Python->C return NULL; // NULL triggers exception PY_TRY { @@ -398,8 +398,8 @@ makeCompound(PyObject *self, PyObject *args) builder.MakeCompound(Comp); try { - Py::List list(pcObj); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + Py::Sequence list(pcObj); + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { if (PyObject_TypeCheck((*it).ptr(), &(Part::TopoShapePy::Type))) { const TopoDS_Shape& sh = static_cast((*it).ptr())-> getTopoShapePtr()->_Shape; @@ -423,16 +423,16 @@ static PyObject * makeFilledFace(PyObject *self, PyObject *args) // http://opencascade.blogspot.com/2010/03/surface-modeling-part6.html // TODO: GeomPlate_BuildPlateSurface PyObject *obj; - if (!PyArg_ParseTuple(args, "O!", &(PyList_Type), &obj)) + if (!PyArg_ParseTuple(args, "O", &obj)) return NULL; PY_TRY { BRepFill_Filling builder; try { - Py::List list(obj); + Py::Sequence list(obj); int countEdges = 0; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { if (PyObject_TypeCheck((*it).ptr(), &(Part::TopoShapeEdgePy::Type))) { const TopoDS_Shape& sh = static_cast((*it).ptr())-> getTopoShapePtr()->_Shape; @@ -468,7 +468,7 @@ static PyObject * makeFilledFace(PyObject *self, PyObject *args) static PyObject * makeShell(PyObject *self, PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args, "O!", &(PyList_Type), &obj)) + if (!PyArg_ParseTuple(args, "O", &obj)) return NULL; PY_TRY { @@ -479,8 +479,8 @@ static PyObject * makeShell(PyObject *self, PyObject *args) builder.MakeShell(shell); try { - Py::List list(obj); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + Py::Sequence list(obj); + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { if (PyObject_TypeCheck((*it).ptr(), &(Part::TopoShapeFacePy::Type))) { const TopoDS_Shape& sh = static_cast((*it).ptr())-> getTopoShapePtr()->_Shape; @@ -954,14 +954,14 @@ static PyObject * makeLine(PyObject *self, PyObject *args) static PyObject * makePolygon(PyObject *self, PyObject *args) { PyObject *pcObj; - if (!PyArg_ParseTuple(args, "O!", &(PyList_Type), &pcObj)) // convert args: Python->C + if (!PyArg_ParseTuple(args, "O", &pcObj)) // convert args: Python->C return NULL; // NULL triggers exception PY_TRY { BRepBuilderAPI_MakePolygon mkPoly; try { - Py::List list(pcObj); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + Py::Sequence list(pcObj); + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { if (PyObject_TypeCheck((*it).ptr(), &(Base::VectorPy::Type))) { Base::Vector3d v = static_cast((*it).ptr())->value(); mkPoly.Add(gp_Pnt(v.x,v.y,v.z)); @@ -1176,12 +1176,12 @@ static PyObject * makeLoft(PyObject *self, PyObject *args) { #if 0 PyObject *pcObj; - if (!PyArg_ParseTuple(args, "O!", &(PyList_Type), &pcObj)) // convert args: Python->C + if (!PyArg_ParseTuple(args, "O", &pcObj)) // convert args: Python->C return NULL; // NULL triggers exception NCollection_List theSections; - Py::List list(pcObj); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + Py::Sequence list(pcObj); + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { if (PyObject_TypeCheck((*it).ptr(), &(Part::GeometryCurvePy::Type))) { Handle_Geom_Curve hCurve = Handle_Geom_Curve::DownCast( static_cast((*it).ptr())->getGeomCurvePtr()->handle()); @@ -1221,15 +1221,15 @@ static PyObject * makeLoft(PyObject *self, PyObject *args) PyObject *pcObj; PyObject *psolid=Py_False; PyObject *pruled=Py_False; - if (!PyArg_ParseTuple(args, "O!|O!O!", &(PyList_Type), &pcObj, - &(PyBool_Type), &psolid, - &(PyBool_Type), &pruled)) + if (!PyArg_ParseTuple(args, "O|O!O!", &pcObj, + &(PyBool_Type), &psolid, + &(PyBool_Type), &pruled)) return NULL; try { TopTools_ListOfShape profiles; - Py::List list(pcObj); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + Py::Sequence list(pcObj); + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { if (PyObject_TypeCheck((*it).ptr(), &(Part::TopoShapePy::Type))) { const TopoDS_Shape& sh = static_cast((*it).ptr())-> getTopoShapePtr()->_Shape; @@ -1393,14 +1393,14 @@ static std::list sort_Edges(double tol3d, const std::vector edges; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { PyObject* item = (*it).ptr(); if (PyObject_TypeCheck(item, &(Part::TopoShapePy::Type))) { const TopoDS_Shape& sh = static_cast(item)->getTopoShapePtr()->_Shape; @@ -1436,15 +1436,15 @@ static PyObject * getSortedClusters(PyObject *self, PyObject *args) static PyObject * sortEdges(PyObject *self, PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args, "O!", &(PyList_Type), &obj)) { + if (!PyArg_ParseTuple(args, "O", &obj)) { PyErr_SetString(PyExc_Exception, "list of edges expected"); return 0; } - Py::List list(obj); + Py::Sequence list(obj); std::vector edges; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { PyObject* item = (*it).ptr(); if (PyObject_TypeCheck(item, &(Part::TopoShapePy::Type))) { const TopoDS_Shape& sh = static_cast(item)->getTopoShapePtr()->_Shape; diff --git a/src/Mod/Part/App/BSplineCurvePyImp.cpp b/src/Mod/Part/App/BSplineCurvePyImp.cpp index b94b99213..17c85828a 100644 --- a/src/Mod/Part/App/BSplineCurvePyImp.cpp +++ b/src/Mod/Part/App/BSplineCurvePyImp.cpp @@ -200,23 +200,23 @@ PyObject* BSplineCurvePy::insertKnots(PyObject * args) PyObject* add = Py_True; PyObject* obj1; PyObject* obj2; - if (!PyArg_ParseTuple(args, "O!O!|dO!", &PyList_Type, &obj1, - &PyList_Type, &obj2, - &tol, &PyBool_Type, &add)) + if (!PyArg_ParseTuple(args, "OO|dO!", &obj1, + &obj2, + &tol, &PyBool_Type, &add)) return 0; try { - Py::List knots(obj1); + Py::Sequence knots(obj1); TColStd_Array1OfReal k(1,knots.size()); int index=1; - for (Py::List::iterator it = knots.begin(); it != knots.end(); ++it) { + for (Py::Sequence::iterator it = knots.begin(); it != knots.end(); ++it) { Py::Float val(*it); k(index++) = (double)val; } - Py::List mults(obj2); + Py::Sequence mults(obj2); TColStd_Array1OfInteger m(1,mults.size()); index=1; - for (Py::List::iterator it = mults.begin(); it != mults.end(); ++it) { + for (Py::Sequence::iterator it = mults.begin(); it != mults.end(); ++it) { Py::Int val(*it); m(index++) = (int)val; } @@ -315,13 +315,13 @@ PyObject* BSplineCurvePy::getKnot(PyObject * args) PyObject* BSplineCurvePy::setKnots(PyObject * args) { PyObject* obj; - if (!PyArg_ParseTuple(args, "O!", &PyList_Type, &obj)) + if (!PyArg_ParseTuple(args, "O", &obj)) return 0; try { - Py::List list(obj); + Py::Sequence list(obj); TColStd_Array1OfReal k(1,list.size()); int index=1; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Py::Float val(*it); k(index++) = (double)val; } @@ -703,13 +703,13 @@ Py::List BSplineCurvePy::getKnotSequence(void) const PyObject* BSplineCurvePy::approximate(PyObject *args) { PyObject* obj; - if (!PyArg_ParseTuple(args, "O!",&(PyList_Type), &obj)) + if (!PyArg_ParseTuple(args, "O", &obj)) return 0; try { - Py::List list(obj); + Py::Sequence list(obj); TColgp_Array1OfPnt pnts(1,list.size()); Standard_Integer index = 1; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Base::Vector3d vec = Py::Vector(*it).toVector(); pnts(index++) = gp_Pnt(vec.x,vec.y,vec.z); } @@ -738,14 +738,14 @@ PyObject* BSplineCurvePy::interpolate(PyObject *args) double tol3d = Precision::Approximation(); PyObject* closed = Py_False; PyObject* t1=0; PyObject* t2=0; - if (!PyArg_ParseTuple(args, "O!|O!dO!O!",&(PyList_Type), &obj, &PyBool_Type, &closed, &tol3d, - &Base::VectorPy::Type, &t1, &Base::VectorPy::Type, &t2)) + if (!PyArg_ParseTuple(args, "O|O!dO!O!",&obj, &PyBool_Type, &closed, &tol3d, + &Base::VectorPy::Type, &t1, &Base::VectorPy::Type, &t2)) return 0; try { - Py::List list(obj); + Py::Sequence list(obj); Handle_TColgp_HArray1OfPnt interpolationPoints = new TColgp_HArray1OfPnt(1, list.size()); Standard_Integer index = 1; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Py::Vector v(*it); Base::Vector3d pnt = v.toVector(); interpolationPoints->SetValue(index++, gp_Pnt(pnt.x,pnt.y,pnt.z)); @@ -787,13 +787,13 @@ PyObject* BSplineCurvePy::buildFromPoles(PyObject *args) PyObject* obj; int degree = 3; PyObject* closed = Py_False; - if (!PyArg_ParseTuple(args, "O!|O!i",&(PyList_Type), &obj, &PyBool_Type, &closed, °ree)) + if (!PyArg_ParseTuple(args, "O|O!i",&obj, &PyBool_Type, &closed, °ree)) return 0; try { - Py::List list(obj); + Py::Sequence list(obj); TColgp_Array1OfPnt poles(1, list.size()); Standard_Integer index = 1; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Py::Vector v(*it); Base::Vector3d pnt = v.toVector(); poles(index++) = gp_Pnt(pnt.x,pnt.y,pnt.z); diff --git a/src/Mod/Part/App/BSplineSurfacePyImp.cpp b/src/Mod/Part/App/BSplineSurfacePyImp.cpp index b299e4ac5..3911b65a0 100644 --- a/src/Mod/Part/App/BSplineSurfacePyImp.cpp +++ b/src/Mod/Part/App/BSplineSurfacePyImp.cpp @@ -310,23 +310,23 @@ PyObject* BSplineSurfacePy::insertUKnots(PyObject *args) PyObject* add = Py_True; PyObject* obj1; PyObject* obj2; - if (!PyArg_ParseTuple(args, "O!O!|dO!", &PyList_Type, &obj1, - &PyList_Type, &obj2, - &tol, &PyBool_Type, &add)) + if (!PyArg_ParseTuple(args, "OO|dO!", &obj1, + &obj2, + &tol, &PyBool_Type, &add)) return 0; try { - Py::List knots(obj1); + Py::Sequence knots(obj1); TColStd_Array1OfReal k(1,knots.size()); int index=1; - for (Py::List::iterator it = knots.begin(); it != knots.end(); ++it) { + for (Py::Sequence::iterator it = knots.begin(); it != knots.end(); ++it) { Py::Float val(*it); k(index++) = (double)val; } - Py::List mults(obj2); + Py::Sequence mults(obj2); TColStd_Array1OfInteger m(1,mults.size()); index=1; - for (Py::List::iterator it = mults.begin(); it != mults.end(); ++it) { + for (Py::Sequence::iterator it = mults.begin(); it != mults.end(); ++it) { Py::Int val(*it); m(index++) = (int)val; } @@ -373,23 +373,23 @@ PyObject* BSplineSurfacePy::insertVKnots(PyObject *args) PyObject* add = Py_True; PyObject* obj1; PyObject* obj2; - if (!PyArg_ParseTuple(args, "O!O!|dO!", &PyList_Type, &obj1, - &PyList_Type, &obj2, - &tol, &PyBool_Type, &add)) + if (!PyArg_ParseTuple(args, "OO|dO!", &obj1, + &obj2, + &tol, &PyBool_Type, &add)) return 0; try { - Py::List knots(obj1); + Py::Sequence knots(obj1); TColStd_Array1OfReal k(1,knots.size()); int index=1; - for (Py::List::iterator it = knots.begin(); it != knots.end(); ++it) { + for (Py::Sequence::iterator it = knots.begin(); it != knots.end(); ++it) { Py::Float val(*it); k(index++) = (double)val; } - Py::List mults(obj2); + Py::Sequence mults(obj2); TColStd_Array1OfInteger m(1,mults.size()); index=1; - for (Py::List::iterator it = mults.begin(); it != mults.end(); ++it) { + for (Py::Sequence::iterator it = mults.begin(); it != mults.end(); ++it) { Py::Int val(*it); m(index++) = (int)val; } @@ -547,13 +547,13 @@ PyObject* BSplineSurfacePy::getVKnot(PyObject *args) PyObject* BSplineSurfacePy::setUKnots(PyObject *args) { PyObject* obj; - if (!PyArg_ParseTuple(args, "O!", &PyList_Type, &obj)) + if (!PyArg_ParseTuple(args, "O", &obj)) return 0; try { - Py::List list(obj); + Py::Sequence list(obj); TColStd_Array1OfReal k(1,list.size()); int index=1; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Py::Float val(*it); k(index++) = (double)val; } @@ -573,13 +573,13 @@ PyObject* BSplineSurfacePy::setUKnots(PyObject *args) PyObject* BSplineSurfacePy::setVKnots(PyObject *args) { PyObject* obj; - if (!PyArg_ParseTuple(args, "O!", &PyList_Type, &obj)) + if (!PyArg_ParseTuple(args, "O", &obj)) return 0; try { - Py::List list(obj); + Py::Sequence list(obj); TColStd_Array1OfReal k(1,list.size()); int index=1; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Py::Float val(*it); k(index++) = (double)val; } @@ -670,13 +670,13 @@ PyObject* BSplineSurfacePy::setPoleCol(PyObject *args) int vindex; PyObject* obj; PyObject* obj2=0; - if (!PyArg_ParseTuple(args, "iO!|O!",&vindex,&PyList_Type,&obj,&PyList_Type,&obj2)) + if (!PyArg_ParseTuple(args, "iO|O",&vindex,&obj,&obj2)) return 0; try { - Py::List list(obj); + Py::Sequence list(obj); TColgp_Array1OfPnt poles(1, list.size()); int index=1; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Py::Vector p(*it); Base::Vector3d v = p.toVector(); poles(index++) = gp_Pnt(v.x,v.y,v.z); @@ -688,10 +688,10 @@ PyObject* BSplineSurfacePy::setPoleCol(PyObject *args) surf->SetPoleCol(vindex, poles); } else { - Py::List list(obj2); + Py::Sequence list(obj2); TColStd_Array1OfReal weights(1, list.size()); int index=1; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { weights(index++) = (double)Py::Float(*it); } surf->SetPoleCol(vindex, poles, weights); @@ -711,13 +711,13 @@ PyObject* BSplineSurfacePy::setPoleRow(PyObject *args) int uindex; PyObject* obj; PyObject* obj2=0; - if (!PyArg_ParseTuple(args, "iO!|O!",&uindex,&PyList_Type,&obj,&PyList_Type,&obj2)) + if (!PyArg_ParseTuple(args, "iO|O",&uindex,&obj,&obj2)) return 0; try { - Py::List list(obj); + Py::Sequence list(obj); TColgp_Array1OfPnt poles(1, list.size()); int index=1; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Py::Vector p(*it); Base::Vector3d v = p.toVector(); poles(index++) = gp_Pnt(v.x,v.y,v.z); @@ -729,10 +729,10 @@ PyObject* BSplineSurfacePy::setPoleRow(PyObject *args) surf->SetPoleRow(uindex, poles); } else { - Py::List list(obj2); + Py::Sequence list(obj2); TColStd_Array1OfReal weights(1, list.size()); int index=1; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { weights(index++) = (double)Py::Float(*it); } surf->SetPoleRow(uindex, poles, weights); @@ -821,13 +821,13 @@ PyObject* BSplineSurfacePy::setWeightCol(PyObject *args) { int vindex; PyObject* obj; - if (!PyArg_ParseTuple(args, "iO!",&vindex,&PyList_Type,&obj)) + if (!PyArg_ParseTuple(args, "iO",&vindex,&obj)) return 0; try { - Py::List list(obj); + Py::Sequence list(obj); TColStd_Array1OfReal weights(1, list.size()); int index=1; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { weights(index++) = (double)Py::Float(*it); } @@ -847,13 +847,13 @@ PyObject* BSplineSurfacePy::setWeightRow(PyObject *args) { int uindex; PyObject* obj; - if (!PyArg_ParseTuple(args, "iO!",&uindex,&PyList_Type,&obj)) + if (!PyArg_ParseTuple(args, "iO",&uindex,&obj)) return 0; try { - Py::List list(obj); + Py::Sequence list(obj); TColStd_Array1OfReal weights(1, list.size()); int index=1; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { weights(index++) = (double)Py::Float(*it); } @@ -1260,12 +1260,12 @@ PyObject* BSplineSurfacePy::approximate(PyObject *args) int len = PyTuple_GET_SIZE(args); - if (!PyArg_ParseTuple(args, "O!iiid|dddd",&(PyList_Type), &obj, °Min, °Max, &continuity, &tol3d, &X0, &dX, &Y0, &dY)) + if (!PyArg_ParseTuple(args, "Oiiid|dddd", &obj, °Min, °Max, &continuity, &tol3d, &X0, &dX, &Y0, &dY)) return 0; try { - Py::List list(obj); + Py::Sequence list(obj); Standard_Integer lu = list.size(); - Py::List col(list.getItem(0)); + Py::Sequence col(list.getItem(0)); Standard_Integer lv = col.size(); TColgp_Array2OfPnt interpolationPoints(1, lu, 1, lv); TColStd_Array2OfReal zPoints(1, lu, 1, lv); @@ -1273,38 +1273,38 @@ PyObject* BSplineSurfacePy::approximate(PyObject *args) Standard_Integer index1 = 0; Standard_Integer index2 = 0; - for (Py::List::iterator it1 = list.begin(); it1 != list.end(); ++it1) { + for (Py::Sequence::iterator it1 = list.begin(); it1 != list.end(); ++it1) { index1++; index2=0; - Py::List row(*it1); - for (Py::List::iterator it2 = row.begin(); it2 != row.end(); ++it2) { + Py::Sequence row(*it1); + for (Py::Sequence::iterator it2 = row.begin(); it2 != row.end(); ++it2) { index2++; if(len == 5){ - Py::Vector v(*it2); - Base::Vector3d pnt = v.toVector(); - gp_Pnt newPoint(pnt.x,pnt.y,pnt.z); - interpolationPoints.SetValue(index1, index2, newPoint); + Py::Vector v(*it2); + Base::Vector3d pnt = v.toVector(); + gp_Pnt newPoint(pnt.x,pnt.y,pnt.z); + interpolationPoints.SetValue(index1, index2, newPoint); } else { - Standard_Real val = PyFloat_AsDouble((*it2).ptr()); - zPoints.SetValue(index1, index2, val); + Standard_Real val = PyFloat_AsDouble((*it2).ptr()); + zPoints.SetValue(index1, index2, val); } } } if(continuity<0 || continuity>3){ - Standard_Failure::Raise("continuity must be between 0 and 3"); + Standard_Failure::Raise("continuity must be between 0 and 3"); } GeomAbs_Shape c; switch(continuity){ case 0: - c = GeomAbs_C0; + c = GeomAbs_C0; case 1: - c = GeomAbs_C1; + c = GeomAbs_C1; case 2: - c = GeomAbs_C2; + c = GeomAbs_C2; case 3: - c = GeomAbs_C3; + c = GeomAbs_C3; } if (interpolationPoints.RowLength() < 2 || interpolationPoints.ColLength() < 2) { @@ -1313,10 +1313,10 @@ PyObject* BSplineSurfacePy::approximate(PyObject *args) GeomAPI_PointsToBSplineSurface surInterpolation; if(len == 5){ - surInterpolation.Init(interpolationPoints, degMin, degMax, c, tol3d); + surInterpolation.Init(interpolationPoints, degMin, degMax, c, tol3d); } else { - surInterpolation.Init(zPoints, X0, dX, Y0, dY, degMin, degMax, c, tol3d); + surInterpolation.Init(zPoints, X0, dX, Y0, dY, degMin, degMax, c, tol3d); } Handle_Geom_BSplineSurface sur(surInterpolation.Surface()); this->getGeomBSplineSurfacePtr()->setHandle(sur); @@ -1342,33 +1342,33 @@ PyObject* BSplineSurfacePy::interpolate(PyObject *args) int len = PyTuple_GET_SIZE(args); - if (!PyArg_ParseTuple(args, "O!|dddd",&(PyList_Type), &obj, &X0, &dX, &Y0, &dY)) + if (!PyArg_ParseTuple(args, "O|dddd", &obj, &X0, &dX, &Y0, &dY)) return 0; try { - Py::List list(obj); + Py::Sequence list(obj); Standard_Integer lu = list.size(); - Py::List col(list.getItem(0)); + Py::Sequence col(list.getItem(0)); Standard_Integer lv = col.size(); TColgp_Array2OfPnt interpolationPoints(1, lu, 1, lv); TColStd_Array2OfReal zPoints(1, lu, 1, lv); Standard_Integer index1 = 0; Standard_Integer index2 = 0; - for (Py::List::iterator it1 = list.begin(); it1 != list.end(); ++it1) { + for (Py::Sequence::iterator it1 = list.begin(); it1 != list.end(); ++it1) { index1++; index2=0; - Py::List row(*it1); - for (Py::List::iterator it2 = row.begin(); it2 != row.end(); ++it2) { + Py::Sequence row(*it1); + for (Py::Sequence::iterator it2 = row.begin(); it2 != row.end(); ++it2) { index2++; if(len == 1){ - Py::Vector v(*it2); - Base::Vector3d pnt = v.toVector(); - gp_Pnt newPoint(pnt.x,pnt.y,pnt.z); - interpolationPoints.SetValue(index1, index2, newPoint); + Py::Vector v(*it2); + Base::Vector3d pnt = v.toVector(); + gp_Pnt newPoint(pnt.x,pnt.y,pnt.z); + interpolationPoints.SetValue(index1, index2, newPoint); } else { - Standard_Real val = PyFloat_AsDouble((*it2).ptr()); - zPoints.SetValue(index1, index2, val); + Standard_Real val = PyFloat_AsDouble((*it2).ptr()); + zPoints.SetValue(index1, index2, val); } } } @@ -1379,10 +1379,10 @@ PyObject* BSplineSurfacePy::interpolate(PyObject *args) GeomAPI_PointsToBSplineSurface surInterpolation; if(len == 1){ - surInterpolation.Interpolate (interpolationPoints); + surInterpolation.Interpolate (interpolationPoints); } else { - surInterpolation.Interpolate(zPoints, X0, dX, Y0, dY); + surInterpolation.Interpolate(zPoints, X0, dX, Y0, dY); } Handle_Geom_BSplineSurface sur(surInterpolation.Surface()); this->getGeomBSplineSurfacePtr()->setHandle(sur); diff --git a/src/Mod/Part/App/BezierCurvePyImp.cpp b/src/Mod/Part/App/BezierCurvePyImp.cpp index 8acbb4bcc..9c7c69350 100644 --- a/src/Mod/Part/App/BezierCurvePyImp.cpp +++ b/src/Mod/Part/App/BezierCurvePyImp.cpp @@ -273,13 +273,13 @@ PyObject* BezierCurvePy::getPoles(PyObject * args) PyObject* BezierCurvePy::setPoles(PyObject * args) { PyObject* plist; - if (!PyArg_ParseTuple(args, "O!", &(PyList_Type), &plist)) + if (!PyArg_ParseTuple(args, "O", &plist)) return 0; try { - Py::List list(plist); + Py::Sequence list(plist); TColgp_Array1OfPnt poles(1,list.size()); int index = poles.Lower(); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Py::Vector v(*it); Base::Vector3d pole = v.toVector(); poles.SetValue(index++, gp_Pnt(pole.x,pole.y,pole.z)); diff --git a/src/Mod/Part/App/BezierSurfacePyImp.cpp b/src/Mod/Part/App/BezierSurfacePyImp.cpp index 6e9dea1be..31f536be7 100644 --- a/src/Mod/Part/App/BezierSurfacePyImp.cpp +++ b/src/Mod/Part/App/BezierSurfacePyImp.cpp @@ -208,13 +208,13 @@ PyObject* BezierSurfacePy::insertPoleColAfter(PyObject *args) int vindex; PyObject* obj; PyObject* obj2=0; - if (!PyArg_ParseTuple(args, "iO!|O!",&vindex,&PyList_Type,&obj,&PyList_Type,&obj2)) + if (!PyArg_ParseTuple(args, "iO|O",&vindex,&obj,&obj2)) return 0; try { - Py::List list(obj); + Py::Sequence list(obj); TColgp_Array1OfPnt poles(1, list.size()); int index=1; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Py::Vector p(*it); Base::Vector3d v = p.toVector(); poles(index++) = gp_Pnt(v.x,v.y,v.z); @@ -226,10 +226,10 @@ PyObject* BezierSurfacePy::insertPoleColAfter(PyObject *args) surf->InsertPoleColAfter(vindex, poles); } else { - Py::List list(obj2); + Py::Sequence list(obj2); TColStd_Array1OfReal weights(1, list.size()); int index=1; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { weights(index++) = (double)Py::Float(*it); } surf->InsertPoleColAfter(vindex, poles, weights); @@ -249,13 +249,13 @@ PyObject* BezierSurfacePy::insertPoleRowAfter(PyObject *args) int uindex; PyObject* obj; PyObject* obj2=0; - if (!PyArg_ParseTuple(args, "iO!|O!",&uindex,&PyList_Type,&obj,&PyList_Type,&obj2)) + if (!PyArg_ParseTuple(args, "iO|O",&uindex,&obj,&obj2)) return 0; try { - Py::List list(obj); + Py::Sequence list(obj); TColgp_Array1OfPnt poles(1, list.size()); int index=1; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Py::Vector p(*it); Base::Vector3d v = p.toVector(); poles(index++) = gp_Pnt(v.x,v.y,v.z); @@ -267,10 +267,10 @@ PyObject* BezierSurfacePy::insertPoleRowAfter(PyObject *args) surf->InsertPoleRowAfter(uindex, poles); } else { - Py::List list(obj2); + Py::Sequence list(obj2); TColStd_Array1OfReal weights(1, list.size()); int index=1; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { weights(index++) = (double)Py::Float(*it); } surf->InsertPoleRowAfter(uindex, poles, weights); @@ -290,13 +290,13 @@ PyObject* BezierSurfacePy::insertPoleColBefore(PyObject *args) int vindex; PyObject* obj; PyObject* obj2=0; - if (!PyArg_ParseTuple(args, "iO!|O!",&vindex,&PyList_Type,&obj,&PyList_Type,&obj2)) + if (!PyArg_ParseTuple(args, "iO|O",&vindex,&obj,&obj2)) return 0; try { - Py::List list(obj); + Py::Sequence list(obj); TColgp_Array1OfPnt poles(1, list.size()); int index=1; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Py::Vector p(*it); Base::Vector3d v = p.toVector(); poles(index++) = gp_Pnt(v.x,v.y,v.z); @@ -308,10 +308,10 @@ PyObject* BezierSurfacePy::insertPoleColBefore(PyObject *args) surf->InsertPoleColBefore(vindex, poles); } else { - Py::List list(obj2); + Py::Sequence list(obj2); TColStd_Array1OfReal weights(1, list.size()); int index=1; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { weights(index++) = (double)Py::Float(*it); } surf->InsertPoleColBefore(vindex, poles, weights); @@ -331,13 +331,13 @@ PyObject* BezierSurfacePy::insertPoleRowBefore(PyObject *args) int uindex; PyObject* obj; PyObject* obj2=0; - if (!PyArg_ParseTuple(args, "iO!|O!",&uindex,&PyList_Type,&obj,&PyList_Type,&obj2)) + if (!PyArg_ParseTuple(args, "iO|O",&uindex,&obj,&obj2)) return 0; try { - Py::List list(obj); + Py::Sequence list(obj); TColgp_Array1OfPnt poles(1, list.size()); int index=1; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Py::Vector p(*it); Base::Vector3d v = p.toVector(); poles(index++) = gp_Pnt(v.x,v.y,v.z); @@ -349,10 +349,10 @@ PyObject* BezierSurfacePy::insertPoleRowBefore(PyObject *args) surf->InsertPoleRowBefore(uindex, poles); } else { - Py::List list(obj2); + Py::Sequence list(obj2); TColStd_Array1OfReal weights(1, list.size()); int index=1; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { weights(index++) = (double)Py::Float(*it); } surf->InsertPoleRowBefore(uindex, poles, weights); @@ -450,13 +450,13 @@ PyObject* BezierSurfacePy::setPoleCol(PyObject *args) int vindex; PyObject* obj; PyObject* obj2=0; - if (!PyArg_ParseTuple(args, "iO!|O!",&vindex,&PyList_Type,&obj,&PyList_Type,&obj2)) + if (!PyArg_ParseTuple(args, "iO|O",&vindex,&obj,&obj2)) return 0; try { - Py::List list(obj); + Py::Sequence list(obj); TColgp_Array1OfPnt poles(1, list.size()); int index=1; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Py::Vector p(*it); Base::Vector3d v = p.toVector(); poles(index++) = gp_Pnt(v.x,v.y,v.z); @@ -468,10 +468,10 @@ PyObject* BezierSurfacePy::setPoleCol(PyObject *args) surf->SetPoleCol(vindex, poles); } else { - Py::List list(obj2); + Py::Sequence list(obj2); TColStd_Array1OfReal weights(1, list.size()); int index=1; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { weights(index++) = (double)Py::Float(*it); } surf->SetPoleCol(vindex, poles, weights); @@ -491,13 +491,13 @@ PyObject* BezierSurfacePy::setPoleRow(PyObject *args) int uindex; PyObject* obj; PyObject* obj2=0; - if (!PyArg_ParseTuple(args, "iO!|O!",&uindex,&PyList_Type,&obj,&PyList_Type,&obj2)) + if (!PyArg_ParseTuple(args, "iO|O",&uindex,&obj,&obj2)) return 0; try { - Py::List list(obj); + Py::Sequence list(obj); TColgp_Array1OfPnt poles(1, list.size()); int index=1; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Py::Vector p(*it); Base::Vector3d v = p.toVector(); poles(index++) = gp_Pnt(v.x,v.y,v.z); @@ -509,10 +509,10 @@ PyObject* BezierSurfacePy::setPoleRow(PyObject *args) surf->SetPoleRow(uindex, poles); } else { - Py::List list(obj2); + Py::Sequence list(obj2); TColStd_Array1OfReal weights(1, list.size()); int index=1; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { weights(index++) = (double)Py::Float(*it); } surf->SetPoleRow(uindex, poles, weights); @@ -599,13 +599,13 @@ PyObject* BezierSurfacePy::setWeightCol(PyObject *args) { int vindex; PyObject* obj; - if (!PyArg_ParseTuple(args, "iO!",&vindex,&PyList_Type,&obj)) + if (!PyArg_ParseTuple(args, "iO",&vindex,&obj)) return 0; try { - Py::List list(obj); + Py::Sequence list(obj); TColStd_Array1OfReal weights(1, list.size()); int index=1; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { weights(index++) = (double)Py::Float(*it); } @@ -625,13 +625,13 @@ PyObject* BezierSurfacePy::setWeightRow(PyObject *args) { int uindex; PyObject* obj; - if (!PyArg_ParseTuple(args, "iO!",&uindex,&PyList_Type,&obj)) + if (!PyArg_ParseTuple(args, "iO",&uindex,&obj)) return 0; try { - Py::List list(obj); + Py::Sequence list(obj); TColStd_Array1OfReal weights(1, list.size()); int index=1; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { weights(index++) = (double)Py::Float(*it); } diff --git a/src/Mod/Part/App/PropertyTopoShape.cpp b/src/Mod/Part/App/PropertyTopoShape.cpp index 830f50445..38f802ba0 100644 --- a/src/Mod/Part/App/PropertyTopoShape.cpp +++ b/src/Mod/Part/App/PropertyTopoShape.cpp @@ -462,10 +462,10 @@ PyObject *PropertyFilletEdges::getPyObject(void) void PropertyFilletEdges::setPyObject(PyObject *value) { - Py::List list(value); + Py::Sequence list(value); std::vector values; values.reserve(list.size()); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { FilletElement fe; Py::Tuple ent(*it); fe.edgeid = (int)Py::Int(ent.getItem(0)); diff --git a/src/Mod/Part/App/TopoShapeCompSolidPyImp.cpp b/src/Mod/Part/App/TopoShapeCompSolidPyImp.cpp index c329042c8..d625d84b9 100644 --- a/src/Mod/Part/App/TopoShapeCompSolidPyImp.cpp +++ b/src/Mod/Part/App/TopoShapeCompSolidPyImp.cpp @@ -52,7 +52,7 @@ PyObject *TopoShapeCompSolidPy::PyMake(struct _typeobject *, PyObject *, PyObjec int TopoShapeCompSolidPy::PyInit(PyObject* args, PyObject* /*kwd*/) { PyObject *pcObj; - if (!PyArg_ParseTuple(args, "O!", &(PyList_Type), &pcObj)) + if (!PyArg_ParseTuple(args, "O", &pcObj)) return -1; BRep_Builder builder; @@ -60,8 +60,8 @@ int TopoShapeCompSolidPy::PyInit(PyObject* args, PyObject* /*kwd*/) builder.MakeCompSolid(Comp); try { - Py::List list(pcObj); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + Py::Sequence list(pcObj); + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { if (PyObject_TypeCheck((*it).ptr(), &(Part::TopoShapeSolidPy::Type))) { const TopoDS_Shape& sh = static_cast((*it).ptr())-> getTopoShapePtr()->_Shape; diff --git a/src/Mod/Part/App/TopoShapeCompoundPyImp.cpp b/src/Mod/Part/App/TopoShapeCompoundPyImp.cpp index 50391d564..7f8e3cdcd 100644 --- a/src/Mod/Part/App/TopoShapeCompoundPyImp.cpp +++ b/src/Mod/Part/App/TopoShapeCompoundPyImp.cpp @@ -55,7 +55,7 @@ PyObject *TopoShapeCompoundPy::PyMake(struct _typeobject *, PyObject *, PyObject int TopoShapeCompoundPy::PyInit(PyObject* args, PyObject* /*kwd*/) { PyObject *pcObj; - if (!PyArg_ParseTuple(args, "O!", &(PyList_Type), &pcObj)) + if (!PyArg_ParseTuple(args, "O", &pcObj)) return -1; BRep_Builder builder; @@ -63,8 +63,8 @@ int TopoShapeCompoundPy::PyInit(PyObject* args, PyObject* /*kwd*/) builder.MakeCompound(Comp); try { - Py::List list(pcObj); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + Py::Sequence list(pcObj); + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { if (PyObject_TypeCheck((*it).ptr(), &(Part::TopoShapePy::Type))) { const TopoDS_Shape& sh = static_cast((*it).ptr())-> getTopoShapePtr()->_Shape; diff --git a/src/Mod/Part/App/TopoShapeEdgePyImp.cpp b/src/Mod/Part/App/TopoShapeEdgePyImp.cpp index 9ab68d81f..924a01913 100644 --- a/src/Mod/Part/App/TopoShapeEdgePyImp.cpp +++ b/src/Mod/Part/App/TopoShapeEdgePyImp.cpp @@ -503,9 +503,9 @@ PyObject* TopoShapeEdgePy::split(PyObject *args) } par.push_back(val); } - else if (PyList_Check(float_or_list)) { - Py::List list(float_or_list); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + else if (PySequence_Check(float_or_list)) { + Py::Sequence list(float_or_list); + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { double val = (double)Py::Float(*it); if (val == f || val == l) { PyErr_SetString(PyExc_ValueError, "Cannot split edge at start or end point"); diff --git a/src/Mod/Part/App/TopoShapePyImp.cpp b/src/Mod/Part/App/TopoShapePyImp.cpp index aece8792a..c1404337d 100644 --- a/src/Mod/Part/App/TopoShapePyImp.cpp +++ b/src/Mod/Part/App/TopoShapePyImp.cpp @@ -111,15 +111,15 @@ PyObject *TopoShapePy::PyMake(struct _typeobject *, PyObject *, PyObject *) // int TopoShapePy::PyInit(PyObject* args, PyObject*) { PyObject *pcObj=0; - if (!PyArg_ParseTuple(args, "|O!", &(PyList_Type), &pcObj)) + if (!PyArg_ParseTuple(args, "|O", &pcObj)) return -1; if (pcObj) { TopoShape shape; try { - Py::List list(pcObj); + Py::Sequence list(pcObj); bool first = true; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { if (PyObject_TypeCheck((*it).ptr(), &(Part::GeometryPy::Type))) { TopoDS_Shape sh = static_cast((*it).ptr())-> getGeometryPtr()->toShape(); @@ -168,13 +168,13 @@ PyObject* TopoShapePy::copy(PyObject *args) PyObject* TopoShapePy::replaceShape(PyObject *args) { PyObject *l; - if (!PyArg_ParseTuple(args, "O!",&PyList_Type,&l)) + if (!PyArg_ParseTuple(args, "O",&l)) return NULL; try { - Py::List list(l); + Py::Sequence list(l); std::vector< std::pair > shapes; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Py::Tuple tuple(*it); Py::TopoShape sh1(tuple[0]); Py::TopoShape sh2(tuple[1]); @@ -201,13 +201,13 @@ PyObject* TopoShapePy::replaceShape(PyObject *args) PyObject* TopoShapePy::removeShape(PyObject *args) { PyObject *l; - if (!PyArg_ParseTuple(args, "O!",&PyList_Type,&l)) + if (!PyArg_ParseTuple(args, "O",&l)) return NULL; try { - Py::List list(l); + Py::Sequence list(l); std::vector shapes; - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { Py::TopoShape sh(*it); shapes.push_back( sh.extensionObject()->getTopoShapePtr()->_Shape @@ -661,16 +661,15 @@ PyObject* TopoShapePy::slice(PyObject *args) PyObject* TopoShapePy::slices(PyObject *args) { PyObject *dir, *dist; - if (!PyArg_ParseTuple(args, "O!O!", &(Base::VectorPy::Type), &dir, - &PyList_Type, &dist)) + if (!PyArg_ParseTuple(args, "O!O", &(Base::VectorPy::Type), &dir, &dist)) return NULL; try { Base::Vector3d vec = Py::Vector(dir, false).toVector(); - Py::List list(dist); + Py::Sequence list(dist); std::vector d; d.reserve(list.size()); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) d.push_back((double)Py::Float(*it)); TopoDS_Compound slice = this->getTopoShapePtr()->slices(vec, d); return new TopoShapeCompoundPy(new TopoShape(slice)); @@ -893,20 +892,20 @@ PyObject* TopoShapePy::scale(PyObject *args) PyObject* TopoShapePy::makeFillet(PyObject *args) { - // use one radius for all edges - double radius; + // use two radii for all edges + double radius1, radius2; PyObject *obj; - if (PyArg_ParseTuple(args, "dO!", &radius, &(PyList_Type), &obj)) { + if (PyArg_ParseTuple(args, "ddO", &radius1, &radius2, &obj)) { try { const TopoDS_Shape& shape = this->getTopoShapePtr()->_Shape; BRepFilletAPI_MakeFillet mkFillet(shape); - Py::List list(obj); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + Py::Sequence list(obj); + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { if (PyObject_TypeCheck((*it).ptr(), &(Part::TopoShapePy::Type))) { const TopoDS_Shape& edge = static_cast((*it).ptr())->getTopoShapePtr()->_Shape; if (edge.ShapeType() == TopAbs_EDGE) { //Add edge to fillet algorithm - mkFillet.Add(radius, TopoDS::Edge(edge)); + mkFillet.Add(radius1, radius2, TopoDS::Edge(edge)); } } } @@ -919,20 +918,20 @@ PyObject* TopoShapePy::makeFillet(PyObject *args) } } - // use two radii for all edges PyErr_Clear(); - double radius1, radius2; - if (PyArg_ParseTuple(args, "ddO!", &radius1, &radius2, &(PyList_Type), &obj)) { + // use one radius for all edges + double radius; + if (PyArg_ParseTuple(args, "dO", &radius, &obj)) { try { const TopoDS_Shape& shape = this->getTopoShapePtr()->_Shape; BRepFilletAPI_MakeFillet mkFillet(shape); - Py::List list(obj); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + Py::Sequence list(obj); + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { if (PyObject_TypeCheck((*it).ptr(), &(Part::TopoShapePy::Type))) { const TopoDS_Shape& edge = static_cast((*it).ptr())->getTopoShapePtr()->_Shape; if (edge.ShapeType() == TopAbs_EDGE) { //Add edge to fillet algorithm - mkFillet.Add(radius1, radius2, TopoDS::Edge(edge)); + mkFillet.Add(radius, TopoDS::Edge(edge)); } } } @@ -953,10 +952,10 @@ PyObject* TopoShapePy::makeFillet(PyObject *args) PyObject* TopoShapePy::makeChamfer(PyObject *args) { - // use one radius for all edges - double radius; + // use two radii for all edges + double radius1, radius2; PyObject *obj; - if (PyArg_ParseTuple(args, "dO!", &radius, &(PyList_Type), &obj)) { + if (PyArg_ParseTuple(args, "ddO", &radius1, &radius2, &obj)) { try { const TopoDS_Shape& shape = this->getTopoShapePtr()->_Shape; BRepFilletAPI_MakeChamfer mkChamfer(shape); @@ -964,14 +963,14 @@ PyObject* TopoShapePy::makeChamfer(PyObject *args) TopTools_IndexedDataMapOfShapeListOfShape mapEdgeFace; TopExp::MapShapesAndAncestors(shape, TopAbs_EDGE, TopAbs_FACE, mapEdgeFace); TopExp::MapShapes(shape, TopAbs_EDGE, mapOfEdges); - Py::List list(obj); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + Py::Sequence list(obj); + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { if (PyObject_TypeCheck((*it).ptr(), &(Part::TopoShapePy::Type))) { const TopoDS_Shape& edge = static_cast((*it).ptr())->getTopoShapePtr()->_Shape; if (edge.ShapeType() == TopAbs_EDGE) { //Add edge to fillet algorithm const TopoDS_Face& face = TopoDS::Face(mapEdgeFace.FindFromKey(edge).First()); - mkChamfer.Add(radius, TopoDS::Edge(edge), face); + mkChamfer.Add(radius1, radius2, TopoDS::Edge(edge), face); } } } @@ -984,10 +983,10 @@ PyObject* TopoShapePy::makeChamfer(PyObject *args) } } - // use two radii for all edges PyErr_Clear(); - double radius1, radius2; - if (PyArg_ParseTuple(args, "ddO!", &radius1, &radius2, &(PyList_Type), &obj)) { + // use one radius for all edges + double radius; + if (PyArg_ParseTuple(args, "dO", &radius, &obj)) { try { const TopoDS_Shape& shape = this->getTopoShapePtr()->_Shape; BRepFilletAPI_MakeChamfer mkChamfer(shape); @@ -995,14 +994,14 @@ PyObject* TopoShapePy::makeChamfer(PyObject *args) TopTools_IndexedDataMapOfShapeListOfShape mapEdgeFace; TopExp::MapShapesAndAncestors(shape, TopAbs_EDGE, TopAbs_FACE, mapEdgeFace); TopExp::MapShapes(shape, TopAbs_EDGE, mapOfEdges); - Py::List list(obj); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + Py::Sequence list(obj); + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { if (PyObject_TypeCheck((*it).ptr(), &(Part::TopoShapePy::Type))) { const TopoDS_Shape& edge = static_cast((*it).ptr())->getTopoShapePtr()->_Shape; if (edge.ShapeType() == TopAbs_EDGE) { //Add edge to fillet algorithm const TopoDS_Face& face = TopoDS::Face(mapEdgeFace.FindFromKey(edge).First()); - mkChamfer.Add(radius1, radius2, TopoDS::Edge(edge), face); + mkChamfer.Add(radius, TopoDS::Edge(edge), face); } } } @@ -1028,8 +1027,8 @@ PyObject* TopoShapePy::makeThickness(PyObject *args) PyObject* inter = Py_False; PyObject* self_inter = Py_False; short offsetMode = 0, join = 0; - if (!PyArg_ParseTuple(args, "O!dd|O!O!hh", - &(PyList_Type), &obj, + if (!PyArg_ParseTuple(args, "Odd|O!O!hh", + &obj, &offset, &tolerance, &(PyBool_Type), &inter, &(PyBool_Type), &self_inter, @@ -1038,8 +1037,8 @@ PyObject* TopoShapePy::makeThickness(PyObject *args) try { TopTools_ListOfShape facesToRemove; - Py::List list(obj); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + Py::Sequence list(obj); + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { if (PyObject_TypeCheck((*it).ptr(), &(Part::TopoShapePy::Type))) { const TopoDS_Shape& shape = static_cast((*it).ptr())->getTopoShapePtr()->_Shape; facesToRemove.Append(shape); @@ -1245,10 +1244,10 @@ PyObject* TopoShapePy::project(PyObject *args) BRepAlgo_NormalProjection algo; algo.Init(this->getTopoShapePtr()->_Shape); - if (PyArg_ParseTuple(args, "O!", &(PyList_Type), &obj)) { + if (PyArg_ParseTuple(args, "O", &obj)) { try { - Py::List list(obj); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + Py::Sequence list(obj); + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { if (PyObject_TypeCheck((*it).ptr(), &(Part::TopoShapePy::Type))) { const TopoDS_Shape& shape = static_cast((*it).ptr())->getTopoShapePtr()->_Shape; algo.Add(shape); @@ -1280,16 +1279,16 @@ PyObject* TopoShapePy::makeShapeFromMesh(PyObject *args) try { Py::Tuple tuple(tup); - Py::List vertex(tuple[0]); - Py::List facets(tuple[1]); + Py::Sequence vertex(tuple[0]); + Py::Sequence facets(tuple[1]); std::vector Points; - for (Py::List::iterator it = vertex.begin(); it != vertex.end(); ++it) { + for (Py::Sequence::iterator it = vertex.begin(); it != vertex.end(); ++it) { Py::Vector vec(*it); Points.push_back(vec.toVector()); } std::vector Facets; - for (Py::List::iterator it = facets.begin(); it != facets.end(); ++it) { + for (Py::Sequence::iterator it = facets.begin(); it != facets.end(); ++it) { Data::ComplexGeoData::Facet face; Py::Tuple f(*it); face.I1 = (int)Py::Int(f[0]); diff --git a/src/Mod/Part/App/TopoShapeShellPyImp.cpp b/src/Mod/Part/App/TopoShapeShellPyImp.cpp index fc186b0ce..743d8e3b1 100644 --- a/src/Mod/Part/App/TopoShapeShellPyImp.cpp +++ b/src/Mod/Part/App/TopoShapeShellPyImp.cpp @@ -73,7 +73,7 @@ PyObject *TopoShapeShellPy::PyMake(struct _typeobject *, PyObject *, PyObject *) int TopoShapeShellPy::PyInit(PyObject* args, PyObject* /*kwd*/) { PyObject *obj; - if (!PyArg_ParseTuple(args, "O!", &(PyList_Type), &obj)) + if (!PyArg_ParseTuple(args, "O", &obj)) return -1; BRep_Builder builder; @@ -83,8 +83,8 @@ int TopoShapeShellPy::PyInit(PyObject* args, PyObject* /*kwd*/) builder.MakeShell(shell); try { - Py::List list(obj); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + Py::Sequence list(obj); + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { if (PyObject_TypeCheck((*it).ptr(), &(Part::TopoShapeFacePy::Type))) { const TopoDS_Shape& sh = static_cast((*it).ptr())-> getTopoShapePtr()->_Shape; diff --git a/src/Mod/Part/App/TopoShapeWirePyImp.cpp b/src/Mod/Part/App/TopoShapeWirePyImp.cpp index 70af3afa0..49e747acd 100644 --- a/src/Mod/Part/App/TopoShapeWirePyImp.cpp +++ b/src/Mod/Part/App/TopoShapeWirePyImp.cpp @@ -99,10 +99,10 @@ int TopoShapeWirePy::PyInit(PyObject* args, PyObject* /*kwd*/) } PyErr_Clear(); - if (PyArg_ParseTuple(args, "O!", &(PyList_Type), &pcObj)) { + if (PyArg_ParseTuple(args, "O", &pcObj)) { BRepBuilderAPI_MakeWire mkWire; - Py::List list(pcObj); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + Py::Sequence list(pcObj); + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { PyObject* item = (*it).ptr(); if (PyObject_TypeCheck(item, &(Part::TopoShapePy::Type))) { const TopoDS_Shape& sh = static_cast(item)->getTopoShapePtr()->_Shape; @@ -246,11 +246,11 @@ PyObject* TopoShapeWirePy::makePipeShell(PyObject *args) int is_Frenet = 0; int transition = 0; - if (PyArg_ParseTuple(args, "O!|iii", &(PyList_Type), &obj, &make_solid, &is_Frenet, &transition)) { + if (PyArg_ParseTuple(args, "O|iii", &obj, &make_solid, &is_Frenet, &transition)) { try { TopTools_ListOfShape sections; - Py::List list(obj); - for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { + Py::Sequence list(obj); + for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { if (PyObject_TypeCheck((*it).ptr(), &(Part::TopoShapePy::Type))) { const TopoDS_Shape& shape = static_cast((*it).ptr())->getTopoShapePtr()->_Shape; sections.Append(shape); diff --git a/src/Mod/ReverseEngineering/App/AppReverseEngineeringPy.cpp b/src/Mod/ReverseEngineering/App/AppReverseEngineeringPy.cpp index 1282cbb42..3d2d116d7 100644 --- a/src/Mod/ReverseEngineering/App/AppReverseEngineeringPy.cpp +++ b/src/Mod/ReverseEngineering/App/AppReverseEngineeringPy.cpp @@ -48,11 +48,11 @@ static PyObject * approxSurface(PyObject *self, PyObject *args) return NULL; PY_TRY { - Py::List l(o); + Py::Sequence l(o); TColgp_Array1OfPnt clPoints(0, l.size()-1); int index=0; - for (Py::List::iterator it = l.begin(); it != l.end(); ++it) { + for (Py::Sequence::iterator it = l.begin(); it != l.end(); ++it) { Py::Tuple t(*it); clPoints(index++) = gp_Pnt( (double)Py::Float(t.getItem(0)),