diff --git a/src/Mod/Fem/App/AppFem.cpp b/src/Mod/Fem/App/AppFem.cpp index f0c563c686ea..ebd41249c581 100644 --- a/src/Mod/Fem/App/AppFem.cpp +++ b/src/Mod/Fem/App/AppFem.cpp @@ -74,7 +74,7 @@ extern PyObject* initModule(); } /* Python entry */ -PyMODINIT_FUNC initFem() +PyMOD_INIT_FUNC(Fem) { // load dependend module try { @@ -83,7 +83,7 @@ PyMODINIT_FUNC initFem() } catch(const Base::Exception& e) { PyErr_SetString(PyExc_ImportError, e.what()); - return; + PyMOD_Return(0); } PyObject* femModule = Fem::initModule(); Base::Console().Log("Loading Fem module... done\n"); @@ -183,4 +183,6 @@ PyMODINIT_FUNC initFem() Fem::FemPostSphereFunction ::init(); Fem::PropertyPostDataObject ::init(); #endif + + PyMOD_Return(femModule); } diff --git a/src/Mod/Fem/App/FemMeshPy.xml b/src/Mod/Fem/App/FemMeshPy.xml index 7c079316122c..c5975f3dab3e 100755 --- a/src/Mod/Fem/App/FemMeshPy.xml +++ b/src/Mod/Fem/App/FemMeshPy.xml @@ -154,7 +154,7 @@ Number of nodes in the Mesh. - + @@ -166,7 +166,7 @@ Number of edges in the Mesh. - + @@ -178,25 +178,25 @@ Number of Faces in the Mesh. - + Number of Triangles in the Mesh. - + Number of Quadrangles in the Mesh. - + Number of Quadrangles in the Mesh. - + @@ -208,49 +208,49 @@ Number of Volumes in the Mesh. - + Number of Tetras in the Mesh. - + Number of Hexas in the Mesh. - + Number of Pyramids in the Mesh. - + Number of Prisms in the Mesh. - + Number of Polyhedrons in the Mesh. - + Number of SubMeshs in the Mesh. - + Number of Groups in the Mesh. - + diff --git a/src/Mod/Fem/App/FemMeshPyImp.cpp b/src/Mod/Fem/App/FemMeshPyImp.cpp index 31677cf57803..43f3273dc269 100644 --- a/src/Mod/Fem/App/FemMeshPyImp.cpp +++ b/src/Mod/Fem/App/FemMeshPyImp.cpp @@ -197,7 +197,7 @@ PyObject* FemMeshPy::addNode(PyObject *args) SMDS_MeshNode* node = meshDS->AddNode(x,y,z); if (!node) throw std::runtime_error("Failed to add node"); - return Py::new_reference_to(Py::Int(node->GetID())); + return Py::new_reference_to(Py::Long(node->GetID())); } catch (const std::exception& e) { PyErr_SetString(Base::BaseExceptionFreeCADError, e.what()); @@ -213,7 +213,7 @@ PyObject* FemMeshPy::addNode(PyObject *args) SMDS_MeshNode* node = meshDS->AddNodeWithID(x,y,z,i); if (!node) throw std::runtime_error("Failed to add node"); - return Py::new_reference_to(Py::Int(node->GetID())); + return Py::new_reference_to(Py::Long(node->GetID())); } catch (const std::exception& e) { PyErr_SetString(Base::BaseExceptionFreeCADError, e.what()); @@ -241,7 +241,7 @@ PyObject* FemMeshPy::addEdge(PyObject *args) SMDS_MeshEdge* edge = meshDS->AddEdge(node1, node2); if (!edge) throw std::runtime_error("Failed to add edge"); - return Py::new_reference_to(Py::Int(edge->GetID())); + return Py::new_reference_to(Py::Long(edge->GetID())); } catch (const std::exception& e) { PyErr_SetString(Base::BaseExceptionFreeCADError, e.what()); @@ -257,7 +257,11 @@ PyObject* FemMeshPy::addEdge(PyObject *args) Py::List list(obj); std::vector Nodes; for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { +#if PY_MAJOR_VERSION >= 3 + Py::Long NoNr(*it); +#else Py::Int NoNr(*it); +#endif const SMDS_MeshNode* node = meshDS->FindNode(NoNr); if (!node) throw std::runtime_error("Failed to get node of the given indices"); @@ -297,7 +301,11 @@ PyObject* FemMeshPy::addEdge(PyObject *args) throw std::runtime_error("Unknown node count, [2|3] are allowed"); //unknown edge type } } +#if PY_MAJOR_VERSION >= 3 + return Py::new_reference_to(Py::Long(edge->GetID())); +#else return Py::new_reference_to(Py::Int(edge->GetID())); +#endif } PyErr_SetString(PyExc_TypeError, "addEdge accepts:\n" "-- int,int\n" @@ -323,7 +331,7 @@ PyObject* FemMeshPy::addFace(PyObject *args) SMDS_MeshFace* face = meshDS->AddFace(node1, node2, node3); if (!face) throw std::runtime_error("Failed to add face"); - return Py::new_reference_to(Py::Int(face->GetID())); + return Py::new_reference_to(Py::Long(face->GetID())); } catch (const std::exception& e) { PyErr_SetString(Base::BaseExceptionFreeCADError, e.what()); @@ -339,7 +347,11 @@ PyObject* FemMeshPy::addFace(PyObject *args) Py::List list(obj); std::vector Nodes; for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { +#if PY_MAJOR_VERSION >= 3 + Py::Long NoNr(*it); +#else Py::Int NoNr(*it); +#endif const SMDS_MeshNode* node = meshDS->FindNode(NoNr); if (!node) throw std::runtime_error("Failed to get node of the given indices"); @@ -398,7 +410,9 @@ PyObject* FemMeshPy::addFace(PyObject *args) throw std::runtime_error("Unknown node count, [4|5|6|8] are allowed"); //unknown face type } } - return Py::new_reference_to(Py::Int(face->GetID())); + + return Py::new_reference_to(Py::Long(face->GetID())); + } PyErr_SetString(PyExc_TypeError, "addFace accepts:\n" "-- int,int,int\n" @@ -424,7 +438,7 @@ PyObject* FemMeshPy::addQuad(PyObject *args) SMDS_MeshFace* face = meshDS->AddFace(node1, node2, node3, node4); if (!face) throw std::runtime_error("Failed to add quad"); - return Py::new_reference_to(Py::Int(face->GetID())); + return Py::new_reference_to(Py::Long(face->GetID())); } catch (const std::exception& e) { PyErr_SetString(Base::BaseExceptionFreeCADError, e.what()); @@ -450,7 +464,7 @@ PyObject* FemMeshPy::addVolume(PyObject *args) SMDS_MeshVolume* vol = meshDS->AddVolume(node1, node2, node3, node4); if (!vol) throw std::runtime_error("Failed to add volume"); - return Py::new_reference_to(Py::Int(vol->GetID())); + return Py::new_reference_to(Py::Long(vol->GetID())); } catch (const std::exception& e) { PyErr_SetString(Base::BaseExceptionFreeCADError, e.what()); @@ -466,7 +480,11 @@ PyObject* FemMeshPy::addVolume(PyObject *args) Py::List list(obj); std::vector Nodes; for (Py::List::iterator it = list.begin(); it != list.end(); ++it) { +#if PY_MAJOR_VERSION >= 3 + Py::Long NoNr(*it); +#else Py::Int NoNr(*it); +#endif const SMDS_MeshNode* node = meshDS->FindNode(NoNr); if (!node) throw std::runtime_error("Failed to get node of the given indices"); @@ -563,7 +581,9 @@ PyObject* FemMeshPy::addVolume(PyObject *args) default: throw std::runtime_error("Unknown node count, [4|5|6|8|10|13|15|20] are allowed"); //unknown volume type } } - return Py::new_reference_to(Py::Int(vol->GetID())); + + return Py::new_reference_to(Py::Long(vol->GetID())); + } PyErr_SetString(PyExc_TypeError, "addVolume accepts:\n" "-- int,int,int,int\n" @@ -671,7 +691,11 @@ PyObject* FemMeshPy::getFacesByFace(PyObject *args) Py::List ret; std::list resultSet = getFemMeshPtr()->getFacesByFace(fc); for (std::list::const_iterator it = resultSet.begin();it!=resultSet.end();++it) { +#if PY_MAJOR_VERSION >= 3 + ret.append(Py::Long(*it)); +#else ret.append(Py::Int(*it)); +#endif } return Py::new_reference_to(ret); @@ -702,8 +726,8 @@ PyObject* FemMeshPy::getVolumesByFace(PyObject *args) std::list > resultSet = getFemMeshPtr()->getVolumesByFace(fc); for (std::list >::const_iterator it = resultSet.begin();it!=resultSet.end();++it) { Py::Tuple vol_face(2); - vol_face.setItem(0, Py::Int(it->first)); - vol_face.setItem(1, Py::Int(it->second)); + vol_face.setItem(0, Py::Long(it->first)); + vol_face.setItem(1, Py::Long(it->second)); ret.append(vol_face); } @@ -735,8 +759,8 @@ PyObject* FemMeshPy::getccxVolumesByFace(PyObject *args) std::map resultSet = getFemMeshPtr()->getccxVolumesByFace(fc); for (std::map::const_iterator it = resultSet.begin();it!=resultSet.end();++it) { Py::Tuple vol_face(2); - vol_face.setItem(0, Py::Int(it->first)); - vol_face.setItem(1, Py::Int(it->second)); + vol_face.setItem(0, Py::Long(it->first)); + vol_face.setItem(1, Py::Long(it->second)); ret.append(vol_face); } @@ -784,7 +808,7 @@ PyObject* FemMeshPy::getNodesBySolid(PyObject *args) Py::List ret; std::set resultSet = getFemMeshPtr()->getNodesBySolid(fc); for (std::set::const_iterator it = resultSet.begin();it!=resultSet.end();++it) - ret.append(Py::Int(*it)); + ret.append(Py::Long(*it)); return Py::new_reference_to(ret); @@ -812,7 +836,7 @@ PyObject* FemMeshPy::getNodesByFace(PyObject *args) Py::List ret; std::set resultSet = getFemMeshPtr()->getNodesByFace(fc); for (std::set::const_iterator it = resultSet.begin();it!=resultSet.end();++it) - ret.append(Py::Int(*it)); + ret.append(Py::Long(*it)); return Py::new_reference_to(ret); @@ -840,7 +864,7 @@ PyObject* FemMeshPy::getNodesByEdge(PyObject *args) Py::List ret; std::set resultSet = getFemMeshPtr()->getNodesByEdge(fc); for (std::set::const_iterator it = resultSet.begin();it!=resultSet.end();++it) - ret.append(Py::Int(*it)); + ret.append(Py::Long(*it)); return Py::new_reference_to(ret); @@ -868,7 +892,7 @@ PyObject* FemMeshPy::getNodesByVertex(PyObject *args) Py::List ret; std::set resultSet = getFemMeshPtr()->getNodesByVertex(fc); for (std::set::const_iterator it = resultSet.begin();it!=resultSet.end();++it) - ret.append(Py::Int(*it)); + ret.append(Py::Long(*it)); return Py::new_reference_to(ret); @@ -891,7 +915,7 @@ PyObject* FemMeshPy::getElementNodes(PyObject *args) Py::Tuple ret(resultSet.size()); int index = 0; for (std::list::const_iterator it = resultSet.begin();it!=resultSet.end();++it) - ret.setItem(index++, Py::Int(*it)); + ret.setItem(index++, Py::Long(*it)); return Py::new_reference_to(ret); } @@ -907,8 +931,11 @@ PyObject* FemMeshPy::getGroupName(PyObject *args) int id; if (!PyArg_ParseTuple(args, "i", &id)) return 0; - +#if PY_MAJOR_VERSION >= 3 + return PyBytes_FromString(getFemMeshPtr()->getSMesh()->GetGroup(id)->GetName()); +#else return PyString_FromString(getFemMeshPtr()->getSMesh()->GetGroup(id)->GetName()); +#endif } PyObject* FemMeshPy::getGroupElementType(PyObject *args) @@ -929,7 +956,11 @@ PyObject* FemMeshPy::getGroupElementType(PyObject *args) case SMDSAbs_Ball : typeString = "Ball"; break; default : typeString = "Unknown"; break; } +#if PY_MAJOR_VERSION >= 3 + return PyBytes_FromString(typeString); +#else return PyString_FromString(typeString); +#endif } PyObject* FemMeshPy::getGroupElements(PyObject *args) @@ -948,7 +979,11 @@ PyObject* FemMeshPy::getGroupElements(PyObject *args) Py::Tuple tuple(ids.size()); int index = 0; for (std::set::iterator it = ids.begin(); it != ids.end(); ++it) { +#if PY_MAJOR_VERSION >= 3 + tuple.setItem(index++, Py::Long(*it)); +#else tuple.setItem(index++, Py::Int(*it)); +#endif } return Py::new_reference_to(tuple); @@ -973,15 +1008,15 @@ Py::Dict FemMeshPy::getNodes(void) const vec = Mtrx * vec; int id = aNode->GetID(); - dict[Py::Int(id)] = Py::asObject(new Base::VectorPy( vec )); + dict[Py::Long(id)] = Py::asObject(new Base::VectorPy( vec )); } return dict; } -Py::Int FemMeshPy::getNodeCount(void) const +Py::Long FemMeshPy::getNodeCount(void) const { - return Py::Int(getFemMeshPtr()->getSMesh()->NbNodes()); + return Py::Long(getFemMeshPtr()->getSMesh()->NbNodes()); } Py::Tuple FemMeshPy::getEdges(void) const @@ -996,15 +1031,15 @@ Py::Tuple FemMeshPy::getEdges(void) const Py::Tuple tuple(ids.size()); int index = 0; for (std::set::iterator it = ids.begin(); it != ids.end(); ++it) { - tuple.setItem(index++, Py::Int(*it)); + tuple.setItem(index++, Py::Long(*it)); } return tuple; } -Py::Int FemMeshPy::getEdgeCount(void) const +Py::Long FemMeshPy::getEdgeCount(void) const { - return Py::Int(getFemMeshPtr()->getSMesh()->NbEdges()); + return Py::Long(getFemMeshPtr()->getSMesh()->NbEdges()); } Py::Tuple FemMeshPy::getFaces(void) const @@ -1019,30 +1054,30 @@ Py::Tuple FemMeshPy::getFaces(void) const Py::Tuple tuple(ids.size()); int index = 0; for (std::set::iterator it = ids.begin(); it != ids.end(); ++it) { - tuple.setItem(index++, Py::Int(*it)); + tuple.setItem(index++, Py::Long(*it)); } return tuple; } -Py::Int FemMeshPy::getFaceCount(void) const +Py::Long FemMeshPy::getFaceCount(void) const { - return Py::Int(getFemMeshPtr()->getSMesh()->NbFaces()); + return Py::Long(getFemMeshPtr()->getSMesh()->NbFaces()); } -Py::Int FemMeshPy::getTriangleCount(void) const +Py::Long FemMeshPy::getTriangleCount(void) const { - return Py::Int(getFemMeshPtr()->getSMesh()->NbTriangles()); + return Py::Long(getFemMeshPtr()->getSMesh()->NbTriangles()); } -Py::Int FemMeshPy::getQuadrangleCount(void) const +Py::Long FemMeshPy::getQuadrangleCount(void) const { - return Py::Int(getFemMeshPtr()->getSMesh()->NbQuadrangles()); + return Py::Long(getFemMeshPtr()->getSMesh()->NbQuadrangles()); } -Py::Int FemMeshPy::getPolygonCount(void) const +Py::Long FemMeshPy::getPolygonCount(void) const { - return Py::Int(getFemMeshPtr()->getSMesh()->NbPolygons()); + return Py::Long(getFemMeshPtr()->getSMesh()->NbPolygons()); } Py::Tuple FemMeshPy::getVolumes(void) const @@ -1057,50 +1092,50 @@ Py::Tuple FemMeshPy::getVolumes(void) const Py::Tuple tuple(ids.size()); int index = 0; for (std::set::iterator it = ids.begin(); it != ids.end(); ++it) { - tuple.setItem(index++, Py::Int(*it)); + tuple.setItem(index++, Py::Long(*it)); } return tuple; } -Py::Int FemMeshPy::getVolumeCount(void) const +Py::Long FemMeshPy::getVolumeCount(void) const { - return Py::Int(getFemMeshPtr()->getSMesh()->NbVolumes()); + return Py::Long(getFemMeshPtr()->getSMesh()->NbVolumes()); } -Py::Int FemMeshPy::getTetraCount(void) const +Py::Long FemMeshPy::getTetraCount(void) const { - return Py::Int(getFemMeshPtr()->getSMesh()->NbTetras()); + return Py::Long(getFemMeshPtr()->getSMesh()->NbTetras()); } -Py::Int FemMeshPy::getHexaCount(void) const +Py::Long FemMeshPy::getHexaCount(void) const { - return Py::Int(getFemMeshPtr()->getSMesh()->NbHexas()); + return Py::Long(getFemMeshPtr()->getSMesh()->NbHexas()); } -Py::Int FemMeshPy::getPyramidCount(void) const +Py::Long FemMeshPy::getPyramidCount(void) const { - return Py::Int(getFemMeshPtr()->getSMesh()->NbPyramids()); + return Py::Long(getFemMeshPtr()->getSMesh()->NbPyramids()); } -Py::Int FemMeshPy::getPrismCount(void) const +Py::Long FemMeshPy::getPrismCount(void) const { - return Py::Int(getFemMeshPtr()->getSMesh()->NbPrisms()); + return Py::Long(getFemMeshPtr()->getSMesh()->NbPrisms()); } -Py::Int FemMeshPy::getPolyhedronCount(void) const +Py::Long FemMeshPy::getPolyhedronCount(void) const { - return Py::Int(getFemMeshPtr()->getSMesh()->NbPolyhedrons()); + return Py::Long(getFemMeshPtr()->getSMesh()->NbPolyhedrons()); } -Py::Int FemMeshPy::getSubMeshCount(void) const +Py::Long FemMeshPy::getSubMeshCount(void) const { - return Py::Int(getFemMeshPtr()->getSMesh()->NbSubMesh()); + return Py::Long(getFemMeshPtr()->getSMesh()->NbSubMesh()); } -Py::Int FemMeshPy::getGroupCount(void) const +Py::Long FemMeshPy::getGroupCount(void) const { - return Py::Int(getFemMeshPtr()->getSMesh()->NbGroup()); + return Py::Long(getFemMeshPtr()->getSMesh()->NbGroup()); } Py::Tuple FemMeshPy::getGroups(void) const @@ -1110,7 +1145,11 @@ Py::Tuple FemMeshPy::getGroups(void) const Py::Tuple tuple(groupIDs.size()); int index = 0; for (std::list::iterator it = groupIDs.begin(); it != groupIDs.end(); ++it) { +#if PY_MAJOR_VERSION >= 3 + tuple.setItem(index++, Py::Long(*it)); +#else tuple.setItem(index++, Py::Int(*it)); +#endif } return tuple; @@ -1121,6 +1160,7 @@ Py::Object FemMeshPy::getVolume(void) const return Py::Object(new Base::QuantityPy(new Base::Quantity(getFemMeshPtr()->getVolume()))); } + // ===== custom attributes ============================================================ PyObject *FemMeshPy::getCustomAttributes(const char* /*attr*/) const diff --git a/src/Mod/Fem/App/HypothesisPy.cpp b/src/Mod/Fem/App/HypothesisPy.cpp index ed3f6d249e75..44babab6c0c8 100755 --- a/src/Mod/Fem/App/HypothesisPy.cpp +++ b/src/Mod/Fem/App/HypothesisPy.cpp @@ -928,7 +928,11 @@ StdMeshers_NumberOfSegmentsPy::~StdMeshers_NumberOfSegmentsPy() Py::Object StdMeshers_NumberOfSegmentsPy::setNumSegm(const Py::Tuple& args) { +#if PY_MAJOR_VERSION >= 3 + hypothesis()->SetNumberOfSegments((int)Py::Long(args[0])); +#else hypothesis()->SetNumberOfSegments((int)Py::Int(args[0])); +#endif return Py::None(); } @@ -936,7 +940,7 @@ Py::Object StdMeshers_NumberOfSegmentsPy::getNumSegm(const Py::Tuple& args) { if (!PyArg_ParseTuple(args.ptr(), "")) throw Py::Exception(); - return Py::Int(hypothesis()->GetNumberOfSegments()); + return Py::Long(hypothesis()->GetNumberOfSegments()); } // ---------------------------------------------------------------------------- @@ -961,7 +965,11 @@ StdMeshers_NumberOfLayersPy::~StdMeshers_NumberOfLayersPy() Py::Object StdMeshers_NumberOfLayersPy::setNumLayers(const Py::Tuple& args) { +#if PY_MAJOR_VERSION >= 3 + hypothesis()->SetNumberOfLayers((int)Py::Long(args[0])); +#else hypothesis()->SetNumberOfLayers((int)Py::Int(args[0])); +#endif return Py::None(); } @@ -969,7 +977,7 @@ Py::Object StdMeshers_NumberOfLayersPy::getNumLayers(const Py::Tuple& args) { if (!PyArg_ParseTuple(args.ptr(), "")) throw Py::Exception(); - return Py::Int(hypothesis()->GetNumberOfLayers()); + return Py::Long(hypothesis()->GetNumberOfLayers()); } // ---------------------------------------------------------------------------- @@ -1045,7 +1053,11 @@ StdMeshers_LengthFromEdgesPy::~StdMeshers_LengthFromEdgesPy() Py::Object StdMeshers_LengthFromEdgesPy::setMode(const Py::Tuple& args) { +#if PY_MAJOR_VERSION >= 3 + hypothesis()->SetMode((int)Py::Long(args[0])); +#else hypothesis()->SetMode((int)Py::Int(args[0])); +#endif return Py::None(); } @@ -1053,7 +1065,7 @@ Py::Object StdMeshers_LengthFromEdgesPy::getMode(const Py::Tuple& args) { if (!PyArg_ParseTuple(args.ptr(), "")) throw Py::Exception(); - return Py::Int(hypothesis()->GetMode()); + return Py::Long(hypothesis()->GetMode()); } // ---------------------------------------------------------------------------- diff --git a/src/Mod/Fem/Gui/AppFemGui.cpp b/src/Mod/Fem/Gui/AppFemGui.cpp index c8f5f42b1494..ff25b5c2fb65 100644 --- a/src/Mod/Fem/Gui/AppFemGui.cpp +++ b/src/Mod/Fem/Gui/AppFemGui.cpp @@ -92,14 +92,14 @@ extern PyObject* initModule(); /* Python entry */ -PyMODINIT_FUNC initFemGui() +PyMOD_INIT_FUNC(FemGui) { if (!Gui::Application::Instance) { PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application."); - return; + PyMOD_Return(0); } - (void) FemGui::initModule(); + PyObject* mod = FemGui::initModule(); Base::Console().Log("Loading GUI of Fem module... done\n"); // instantiating the commands @@ -161,4 +161,6 @@ PyMODINIT_FUNC initFemGui() // add resources and reloads the translators loadFemResource(); + + PyMOD_Return(mod); } diff --git a/src/Mod/Fem/Gui/ViewProviderFemMeshPyImp.cpp b/src/Mod/Fem/Gui/ViewProviderFemMeshPyImp.cpp index bcdf0e932fce..fbb64cd03d4c 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemMeshPyImp.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemMeshPyImp.cpp @@ -145,7 +145,7 @@ void ViewProviderFemMeshPy::setNodeColor(Py::Dict arg) //std::map NodeColorMap; //for( Py::Dict::iterator it = arg.begin(); it!= arg.end();++it){ - // Py::Int id((*it).first); + // Py::Long id((*it).first); // Py::Tuple color((*it).second); // NodeColorMap[id] = App::Color(Py::Float(color[0]),Py::Float(color[1]),Py::Float(color[2]),0); //} @@ -154,7 +154,7 @@ void ViewProviderFemMeshPy::setNodeColor(Py::Dict arg) long i = 0; for( Py::Dict::iterator it = arg.begin(); it!= arg.end();++it,i++){ - Py::Int id((*it).first); + Py::Long id((*it).first); Py::Tuple color((*it).second); NodeIds[i] = id; NodeColors[i] = App::Color(Py::Float(color[0]),Py::Float(color[1]),Py::Float(color[2]),0); @@ -181,7 +181,7 @@ void ViewProviderFemMeshPy::setElementColor(Py::Dict arg) std::map NodeColorMap; for( Py::Dict::iterator it = arg.begin(); it!= arg.end();++it){ - Py::Int id((*it).first); + Py::Long id((*it).first); Py::Tuple color((*it).second); NodeColorMap[id] = App::Color(Py::Float(color[0]),Py::Float(color[1]),Py::Float(color[2]),0); } @@ -205,7 +205,7 @@ void ViewProviderFemMeshPy::setNodeDisplacement(Py::Dict arg) Py::Type vType(pyType.o); for( Py::Dict::iterator it = arg.begin(); it!= arg.end();++it){ - Py::Int id((*it).first); + Py::Long id((*it).first); if ((*it).second.isType(vType)) { Py::Vector p((*it).second); NodeDispMap[id] = p.toVector(); @@ -229,7 +229,7 @@ void ViewProviderFemMeshPy::setHighlightedNodes(Py::List arg) std::set res; for(Py::List::iterator it = arg.begin(); it!= arg.end();++it){ - long id = static_cast(Py::Int(*it)); + long id = static_cast(Py::Long(*it)); const SMDS_MeshNode *node = data->FindNode(id); if(node) res.insert(id); @@ -265,8 +265,8 @@ Py::List ViewProviderFemMeshPy::getVisibleElementFaces(void) const Py::Tuple tup(2); long element = *it>>3; long face = (*it&7)+1; - tup.setItem( 0,Py::Int( element ) ); - tup.setItem( 1,Py::Int( face ) ); + tup.setItem( 0,Py::Long( element ) ); + tup.setItem( 1,Py::Long( face ) ); result.setItem(i,tup); }