From 084e16313775c5277917eb89e265ab9430d47cd6 Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Sun, 25 Sep 2016 21:41:14 +0200 Subject: [PATCH] FEM: add GroupID to python mesh API --- src/Mod/Fem/App/FemMeshPy.xml | 6 ++++++ src/Mod/Fem/App/FemMeshPyImp.cpp | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/Mod/Fem/App/FemMeshPy.xml b/src/Mod/Fem/App/FemMeshPy.xml index 89ac7d668..59bde68f2 100755 --- a/src/Mod/Fem/App/FemMeshPy.xml +++ b/src/Mod/Fem/App/FemMeshPy.xml @@ -237,6 +237,12 @@ + + + Tuple of Group IDs. + + + Volume of the mesh. diff --git a/src/Mod/Fem/App/FemMeshPyImp.cpp b/src/Mod/Fem/App/FemMeshPyImp.cpp index f88d66753..562359fe3 100644 --- a/src/Mod/Fem/App/FemMeshPyImp.cpp +++ b/src/Mod/Fem/App/FemMeshPyImp.cpp @@ -1048,6 +1048,19 @@ Py::Int FemMeshPy::getGroupCount(void) const return Py::Int(getFemMeshPtr()->getSMesh()->NbGroup()); } +Py::Tuple FemMeshPy::getGroups(void) const +{ + std::list groupIDs = getFemMeshPtr()->getSMesh()->GetGroupIds(); + + Py::Tuple tuple(groupIDs.size()); + int index = 0; + for (std::list::iterator it = groupIDs.begin(); it != groupIDs.end(); ++it) { + tuple.setItem(index++, Py::Int(*it)); + } + + return tuple; +} + Py::Object FemMeshPy::getVolume(void) const { return Py::Object(new Base::QuantityPy(new Base::Quantity(getFemMeshPtr()->getVolume())));