From: mpv Date: Fri, 7 Feb 2020 12:42:25 +0000 (+0300) Subject: Make the dead shape correctly referenced by SMESH mesh after loading the python dump... X-Git-Tag: V9_5_0a1~5^2~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4f9b4e3fb3c7eecfc9290b53b078bf1b99357648;p=modules%2Fsmesh.git Make the dead shape correctly referenced by SMESH mesh after loading the python dump script --- diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index 3f65f9f9b..8c2a1a91b 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -273,6 +273,18 @@ void SMESH_Mesh_i::ReplaceShape(GEOM::GEOM_Object_ptr theNewGeom) // re-assign global hypotheses to the new shape _mainShapeTick = -1; CheckGeomModif( true ); + + // update the reference to theNewGeom (needed for correct execution of a dumped python script) + SALOMEDS::SObject_var aSO = _gen_i->ObjectToSObject(_this()); + if (!aSO->_is_nil()) { + SALOMEDS::SObject_var aShapeRefSO; + if (aSO->FindSubObject(1, aShapeRefSO)) { + _gen_i->getStudyServant()->NewBuilder()->Addreference( + aShapeRefSO, _gen_i->getStudyServant()->FindObjectID(theNewGeom->GetStudyEntry())); + } + } + + TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ReplaceShape( " << theNewGeom->GetStudyEntry() << " )"; } //================================================================================