From 00b30e0d6c8319e0579d59a8cd1d3ad01b83a271 Mon Sep 17 00:00:00 2001 From: vsv Date: Fri, 27 Dec 2019 16:22:48 +0300 Subject: [PATCH] Replace shape in Mesh object --- idl/SMESH_Mesh.idl | 6 ++++++ src/SMESH/SMESH_Mesh.hxx | 3 +++ src/SMESH_I/SMESH_Mesh_i.cxx | 16 ++++++++++++++++ src/SMESH_I/SMESH_Mesh_i.hxx | 3 +++ 4 files changed, 28 insertions(+) diff --git a/idl/SMESH_Mesh.idl b/idl/SMESH_Mesh.idl index a18a7bd0c..b4ec14dc8 100644 --- a/idl/SMESH_Mesh.idl +++ b/idl/SMESH_Mesh.idl @@ -347,6 +347,12 @@ module SMESH GEOM::GEOM_Object GetShapeToMesh() raises (SALOME::SALOME_Exception); + /*! + * Replaces a shape in the mesh + */ + void ReplaceShape(in GEOM::GEOM_Object theNewGeom, in GEOM::GEOM_Object theOldGeom) + raises (SALOME::SALOME_Exception); + /*! * Return false if the mesh is not yet fully loaded from the study file */ diff --git a/src/SMESH/SMESH_Mesh.hxx b/src/SMESH/SMESH_Mesh.hxx index e20d578ce..5eadb13c2 100644 --- a/src/SMESH/SMESH_Mesh.hxx +++ b/src/SMESH/SMESH_Mesh.hxx @@ -86,6 +86,9 @@ class SMESH_EXPORT SMESH_Mesh * \brief Return true if there is a geometry to be meshed, not PseudoShape() */ bool HasShapeToMesh() const { return _isShapeToMesh; } + + void UndefShapeToMesh() { _isShapeToMesh = false; } + /*! * \brief Return diagonal size of bounding box of shape to mesh. */ diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index c2cf46593..1740de242 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -254,6 +254,22 @@ GEOM::GEOM_Object_ptr SMESH_Mesh_i::GetShapeToMesh() return aShapeObj._retn(); } +//================================================================================ +/*! +* \brief Replaces a shape in the mesh +*/ +//================================================================================ +void SMESH_Mesh_i::ReplaceShape(GEOM::GEOM_Object_ptr theNewGeom, GEOM::GEOM_Object_ptr theOldGeom) + throw (SALOME::SALOME_Exception) +{ + GEOM_Client* geomClient = _gen_i->GetShapeReader(); + GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine(theOldGeom); + CORBA::String_var groupIOR = geomGen->GetStringFromIOR(theOldGeom); + geomClient->RemoveShapeFromBuffer(groupIOR.in()); + _impl->UndefShapeToMesh(); + SetShape(theNewGeom); +} + //================================================================================ /*! * \brief Return false if the mesh is not yet fully loaded from the study file diff --git a/src/SMESH_I/SMESH_Mesh_i.hxx b/src/SMESH_I/SMESH_Mesh_i.hxx index 27c6142b5..9c564e176 100644 --- a/src/SMESH_I/SMESH_Mesh_i.hxx +++ b/src/SMESH_I/SMESH_Mesh_i.hxx @@ -74,6 +74,9 @@ public: GEOM::GEOM_Object_ptr GetShapeToMesh() throw (SALOME::SALOME_Exception); + virtual void ReplaceShape(GEOM::GEOM_Object_ptr theNewGeom, GEOM::GEOM_Object_ptr theOldGeom) + throw (SALOME::SALOME_Exception); + CORBA::Boolean IsLoaded() throw (SALOME::SALOME_Exception); -- 2.39.2