Fem: Add method to rename mesh group

This commit is contained in:
marioalexis
2025-10-29 00:38:41 -03:00
parent 5e42f6a48d
commit d018b3f8fb
4 changed files with 30 additions and 0 deletions

View File

@@ -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());
}
}

View File

@@ -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);
//@}

View File

@@ -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"""

View File

@@ -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
{