Managing group during reload mesh

This commit is contained in:
asozinov 2024-10-17 15:40:19 +01:00
parent 224dbbb87e
commit f8ea158a33
2 changed files with 25 additions and 2 deletions

View File

@ -1115,12 +1115,28 @@ namespace
}
SMESH::SMESH_Mesh_var aMeshByIO = SMESH::GetMeshByIO(anIObject);
SMESH::SelectionProxy aMesh = SMESH::SelectionProxy(aMeshItem);
SMESH::MedInfo anInfo = aMesh.medFileInfo();
if (!anInfo.isValid())
continue;
SMESH::ListOfGroups aGroups = *aMeshByIO->GetGroups();
for (int i = 0; i < aGroups.length(); ++i)
{
auto X = aGroups[i];
_PTR(SObject) aGroupSObject = SMESH::FindSObject(X);
SMESH_Actor* anActor = SMESH::FindActorByEntry(aGroupSObject->GetID().c_str());
SMESH::smIdType_array aMeshInfo = *X->GetMeshInfo();
if (anActor)
{
vtkTypeBool isVisib = anActor->GetVisibility();
SMESH::UpdateView(!isVisib ? SMESH::eDisplay : SMESH::eErase, aGroupSObject->GetID().c_str());
}
else
SMESH::UpdateView(SMESH::eErase, aGroupSObject->GetID().c_str());
}
SMESH::mesh_array_var aMeshes = new SMESH::mesh_array;
{
// re-import mesh
@ -1138,7 +1154,7 @@ namespace
anApp->browseObjects(anEntryList);
}
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(aMeshItem);\
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(aMeshItem);
QString aMeshName = anIObject->getName();
aMeshList.append(QPair< SMESH::SMESH_IDSource_var, QString >(aMeshItem, aMeshName));

View File

@ -1603,6 +1603,7 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromMED( const char*
SMESH::mesh_array* SMESH_Gen_i::ReloadMeshesFromMED(const char* theFileName, SMESH::SMESH_Mesh_ptr sourceMesh, SMESH::DriverMED_ReadStatus& theStatus)
{
SMESH::ListOfGroups anOldGroups = *sourceMesh->GetGroups();
checkFileReadable(theFileName);
#ifdef WIN32
@ -1663,7 +1664,13 @@ SMESH::mesh_array* SMESH_Gen_i::ReloadMeshesFromMED(const char* theFileName, SME
if (status1 > theStatus)
theStatus = status1;
for (int i = 0; i < anOldGroups.length(); ++i)
{
//auto X = anOldGroups[i];
sourceMesh->RemoveGroup(anOldGroups[i]);
}
aResult[i++] = SMESH::SMESH_Mesh::_duplicate(sourceMesh);
meshServant->GetImpl().GetMeshDS()->Modified();
}
if (!aStudyBuilder->_is_nil())