Salome HOME
Replace shape in Mesh object
authorvsv <vsv@opencascade.com>
Fri, 27 Dec 2019 13:22:48 +0000 (16:22 +0300)
committervsv <vsv@opencascade.com>
Fri, 27 Dec 2019 13:22:48 +0000 (16:22 +0300)
idl/SMESH_Mesh.idl
src/SMESH/SMESH_Mesh.hxx
src/SMESH_I/SMESH_Mesh_i.cxx
src/SMESH_I/SMESH_Mesh_i.hxx

index a18a7bd0c79604b931e8208f029fa4ec7d173134..b4ec14dc85fed7cbd527e3e4b6d52a0347c09c6a 100644 (file)
@@ -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
      */
index e20d578ce387abd36805185c5945bfecf2f99594..5eadb13c25de195710f9ba25553b68322bd5a0b3 100644 (file)
@@ -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.
    */
index c2cf46593175fbc9fa88719ef9ee54e5fcc20b5c..1740de242347054f9d51d193eae947569ac4a9bd 100644 (file)
@@ -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
index 27c6142b573ab861e604c22537f742ee0fe87cbc..9c564e1766e2b4d4c3edb6f0b03ff6bd99af7a56 100644 (file)
@@ -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);