From a6ffc9023cfb43be10203f685a035ec6d1b75742 Mon Sep 17 00:00:00 2001 From: eap Date: Thu, 4 May 2006 13:47:24 +0000 Subject: [PATCH] Add CreateEmptyMesh() --- src/SMESH_I/SMESH_Gen_i.cxx | 31 +++++++++++++++++++++++++++++++ src/SMESH_I/SMESH_Gen_i.hxx | 4 ++++ 2 files changed, 35 insertions(+) diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index e75216c21..a5e803837 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -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 diff --git a/src/SMESH_I/SMESH_Gen_i.hxx b/src/SMESH_I/SMESH_Gen_i.hxx index 11f07f75d..43dd6402b 100644 --- a/src/SMESH_I/SMESH_Gen_i.hxx +++ b/src/SMESH_I/SMESH_Gen_i.hxx @@ -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 ); -- 2.39.2