Fem: Add method to rename mesh group
This commit is contained in:
@@ -2705,3 +2705,11 @@ bool FemMesh::removeGroup(int GroupId)
|
||||
{
|
||||
return this->getSMesh()->RemoveGroup(GroupId);
|
||||
}
|
||||
|
||||
void FemMesh::renameGroup(int id, const std::string& name)
|
||||
{
|
||||
SMESH_Group* grp = this->getSMesh()->GetGroup(id);
|
||||
if (grp) {
|
||||
grp->SetName(name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,6 +180,8 @@ public:
|
||||
void addGroupElements(int, const std::set<int>&);
|
||||
/// Remove group (Name due to similarity to SMESH basis functions)
|
||||
bool removeGroup(int);
|
||||
/// Rename group
|
||||
void renameGroup(int id, const std::string& name);
|
||||
//@}
|
||||
|
||||
|
||||
|
||||
@@ -239,6 +239,14 @@ class FemMesh(ComplexGeoData):
|
||||
Returns boolean."""
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def renameGroup(self) -> Any:
|
||||
"""Rename a group with a given group ID
|
||||
renameGroup(id, name)
|
||||
groupid: int
|
||||
name: string"""
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def getElementType(self) -> Any:
|
||||
"""Return the element type of a given ID"""
|
||||
|
||||
@@ -1718,6 +1718,18 @@ PyObject* FemMeshPy::removeGroup(PyObject* args) const
|
||||
return PyBool_FromLong((long)(getFemMeshPtr()->removeGroup(theId)));
|
||||
}
|
||||
|
||||
PyObject* FemMeshPy::renameGroup(PyObject* args) const
|
||||
{
|
||||
int id;
|
||||
const char* name;
|
||||
if (!PyArg_ParseTuple(args, "is", &id, &name)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
getFemMeshPtr()->renameGroup(id, name);
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* FemMeshPy::getElementType(PyObject* args) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user