]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
Add CreateEmptyMesh()
authoreap <eap@opencascade.com>
Thu, 4 May 2006 13:47:24 +0000 (13:47 +0000)
committereap <eap@opencascade.com>
Thu, 4 May 2006 13:47:24 +0000 (13:47 +0000)
src/SMESH_I/SMESH_Gen_i.cxx
src/SMESH_I/SMESH_Gen_i.hxx

index e75216c213501089aec3592be90112e9f141d4bd..a5e803837d0b85a1c313edbd58153b67d917efe2 100644 (file)
@@ -637,6 +637,37 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateMesh( GEOM::GEOM_Object_ptr theShapeObj
   return mesh._retn();
 }
 
+//=============================================================================
+/*!
+ *  SMESH_Gen_i::CreateEmptyMesh
+ *
+ *  Create empty mesh
+ */
+//=============================================================================
+
+SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateEmptyMesh()
+     throw ( SALOME::SALOME_Exception )
+{
+  Unexpect aCatch(SALOME_SalomeException);
+  if(MYDEBUG) MESSAGE( "SMESH_Gen_i::CreateMesh" );
+  // create mesh
+  SMESH::SMESH_Mesh_var mesh = this->createMesh();
+
+  // publish mesh in the study
+  if ( CanPublishInStudy( mesh ) ) {
+    SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
+    aStudyBuilder->NewCommand();  // There is a transaction
+    SALOMEDS::SObject_var aSO = PublishMesh( myCurrentStudy, mesh.in() );
+    aStudyBuilder->CommitCommand();
+    if ( !aSO->_is_nil() ) {
+      // Update Python script
+      TPythonDump() << aSO << " = " << this << ".CreateEmptyMesh()";
+    }
+  }
+
+  return mesh._retn();
+}
+
 //=============================================================================
 /*!
  *  SMESH_Gen_i::CreateMeshFromUNV
index 11f07f75d13158bf6c904dc8794f194ab82420a4..43dd6402b123e3f647090ceb1e6b3b0038fb3114 100644 (file)
@@ -192,6 +192,10 @@ public:
   SMESH::SMESH_Mesh_ptr CreateMesh( GEOM::GEOM_Object_ptr theShapeObject )
     throw ( SALOME::SALOME_Exception );
 
+  // Create empty mesh
+  SMESH::SMESH_Mesh_ptr CreateEmptyMesh()
+    throw ( SALOME::SALOME_Exception );
+
   //  Create mesh(es) and import data from UNV file
   SMESH::SMESH_Mesh_ptr CreateMeshesFromUNV( const char* theFileName )
     throw ( SALOME::SALOME_Exception );