Salome HOME
0020749: EDF 1291 SMESH : Create 2D Mesh from 3D improvement
[modules/smesh.git] / src / SMESH_I / SMESH_MeshEditor_i.cxx
index 5da4f5cebf84549a7f8dfcf361ffd89957f9787e..d0491e5d085f436fe326cdd4a4b062312d91de2b 100644 (file)
@@ -369,10 +369,12 @@ void SMESH_MeshEditor_i::initData(bool deleteSearchers)
 
 struct _IDSource : public POA_SMESH::SMESH_IDSource
 {
-  SMESH::long_array _ids;
-  SMESH::ElementType _type;
+  SMESH::long_array     _ids;
+  SMESH::ElementType    _type;
+  SMESH::SMESH_Mesh_ptr _mesh;
   SMESH::long_array* GetIDs()      { return new SMESH::long_array( _ids ); }
   SMESH::long_array* GetMeshInfo() { return 0; }
+  SMESH::SMESH_Mesh_ptr GetMesh()  { return SMESH::SMESH_Mesh::_duplicate( _mesh ); }
   SMESH::array_of_ElementType* GetTypes()
   {
     SMESH::array_of_ElementType_var types = new SMESH::array_of_ElementType;
@@ -388,6 +390,7 @@ SMESH::SMESH_IDSource_ptr SMESH_MeshEditor_i::MakeIDSource(const SMESH::long_arr
   _IDSource* anIDSource = new _IDSource;
   anIDSource->_ids = ids;
   anIDSource->_type = type;
+  anIDSource->_mesh = myMesh_i->_this();
   SMESH::SMESH_IDSource_var anIDSourceVar = anIDSource->_this();
 
   return anIDSourceVar._retn();
@@ -5245,7 +5248,7 @@ SMESH_MeshEditor_i::MakeBoundaryMesh(SMESH::SMESH_IDSource_ptr idSource,
     SMESH_Group* smesh_group = 0;
     if ( strlen(groupName) )
     {
-      group_var = mesh_i->CreateGroup( SMESH::ElementType(elemType),groupName);
+      group_var = mesh_i->CreateGroup( SMESH::ElementType(int(elemType)-1),groupName);
       if ( SMESH_GroupBase_i* group_i = SMESH::DownCast<SMESH_GroupBase_i*>( group_var ))
         smesh_group = group_i->GetSmeshGroup();
     }
@@ -5261,6 +5264,8 @@ SMESH_MeshEditor_i::MakeBoundaryMesh(SMESH::SMESH_IDSource_ptr idSource,
     storeResult( aMeshEditor );
   }
 
+  const char* dimName[] = { "BND_2DFROM3D", "BND_1DFROM3D", "BND_1DFROM2D" };
+
   // result of MakeBoundaryMesh() is a tuple (mesh, group)
   if ( mesh_var->_is_nil() )
     pyDump << myMesh_i->_this() << ", ";
@@ -5272,9 +5277,9 @@ SMESH_MeshEditor_i::MakeBoundaryMesh(SMESH::SMESH_IDSource_ptr idSource,
     pyDump << group_var << " = ";
   pyDump << this << ".MakeBoundaryMesh( "
          << idSource << ", "
-         << dim << ", "
-         << groupName << ", "
-         << meshName<< ", "
+         << "SMESH." << dimName[int(dim)] << ", "
+         << "'" << groupName << "', "
+         << "'" << meshName<< "', "
          << toCopyElements << ", "
          << toCopyExistingBondary << ")";