Salome HOME
Merge multi-study removal branch.
[plugins/hybridplugin.git] / src / GUI / HYBRIDPluginGUI_HypothesisCreator.cxx
index 820bd432b5813b2d0ffa04c606b718c7ad5ffc63..20b21ce927476cef686a47ea22fdcddfd7c08afe 100644 (file)
 
 #include <GeometryGUI.h>
 
-#include <SMESHGUI_Utils.h>
-#include <SMESHGUI_SpinBox.h>
 #include <SMESHGUI_HypothesesUtils.h>
+#include <SMESHGUI_SpinBox.h>
+#include <SMESHGUI_Utils.h>
 #include <SMESH_NumberFilter.hxx>
 #include <SMESH_TypeFilter.hxx>
 #include <StdMeshersGUI_ObjectReferenceParamWdg.h>
+#include <StdMeshersGUI_SubShapeSelectorWdg.h>
 
 #include <LightApp_SelectionMgr.h>
 #include <SUIT_Session.h>
@@ -350,9 +351,8 @@ HYBRIDPluginGUI_HypothesisCreator::~HYBRIDPluginGUI_HypothesisCreator()
 GeomSelectionTools* HYBRIDPluginGUI_HypothesisCreator::getGeomSelectionTool()
 {
   HYBRIDPluginGUI_HypothesisCreator* that = (HYBRIDPluginGUI_HypothesisCreator*)this;
-  _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
-  if (that->GeomToolSelected == NULL || that->GeomToolSelected->getMyStudy() != aStudy) {
-    that->GeomToolSelected = new GeomSelectionTools(aStudy);
+  if (that->GeomToolSelected == NULL) {
+    that->GeomToolSelected = new GeomSelectionTools();
   }
   return that->GeomToolSelected;
 }
@@ -414,7 +414,7 @@ QFrame* HYBRIDPluginGUI_HypothesisCreator::buildFrame()
   aStdLayout->addWidget( myBoundaryLayersGrowthCombo, row++, 1, 1, 1 );
   
   QStringList typesBoundaryLayersGrowth;
-  typesBoundaryLayersGrowth << tr( "HYBRID_LAYER_GROWTH_UPWARD" ) << tr( "HYBRID_LAYER_GROWTH_DOWNWARD" );
+  typesBoundaryLayersGrowth << tr( "HYBRID_LAYER_GROWTH_DOWNWARD" ) << tr( "HYBRID_LAYER_GROWTH_UPWARD" );
   myBoundaryLayersGrowthCombo->addItems( typesBoundaryLayersGrowth );
   
   aStdLayout->addWidget( new QLabel( tr( "HYBRID_HeightFirstLayer" ), myStdGroup ), row, 0, 1, 1 );
@@ -444,9 +444,14 @@ QFrame* HYBRIDPluginGUI_HypothesisCreator::buildFrame()
   aStdLayout->addWidget( myElementGenerationCombo, row++, 1, 1, 1 );
   
   QStringList typesElementGeneration;
-  typesElementGeneration << tr( "HYBRID_GENERATION_TETRA_DOMINANT" ) << tr( "HYBRID_GENERATION_HEXA_DOMINANT" );
+  typesElementGeneration << tr( "HYBRID_GENERATION_TETRA_DOMINANT" ) << tr( "HYBRID_GENERATION_HEXA_DOMINANT" ) << tr( "HYBRID_GENERATION_CARTESIAN_CORE" );
   myElementGenerationCombo->addItems( typesElementGeneration );
   
+  aStdLayout->addWidget( new QLabel( tr( "HYBRID_CORE_SIZE" ), myStdGroup ), row, 0, 1, 1 );
+  myCoreSizeSpin = new SMESHGUI_SpinBox( myStdGroup );
+  myCoreSizeSpin->RangeStepAndValidator(0., COORD_MAX, 10., "length_precision");
+  aStdLayout->addWidget( myCoreSizeSpin, row++, 1, 1, 1 );
+
   myAddMultinormalsCheck = new QCheckBox( tr( "HYBRID_ADD_MULTINORMALS" ), myStdGroup );
   aStdLayout->addWidget( myAddMultinormalsCheck, row++, 0, 1, 1 );
   
@@ -601,7 +606,6 @@ QFrame* HYBRIDPluginGUI_HypothesisCreator::buildFrame()
 
   // Enforced meshes parameters
   myEnfMeshGroup = new QWidget();
-  myLayersOnAllWrapCheck = new QCheckBox( tr( "HYBRID_LAYERS_ON_ALL_WRAP" ), myEnfMeshGroup );
   QGridLayout* anEnfMeshLayout = new QGridLayout(myEnfMeshGroup);
   
   myEnforcedMeshTableWidget = new QTableWidget(myEnfGroup);
@@ -665,8 +669,8 @@ QFrame* HYBRIDPluginGUI_HypothesisCreator::buildFrame()
   // GroupBox2VLayout->addWidget( info2 );
   
   // anEnfMeshLayout->addWidget( GroupBox2,                ENF_MESH_WARNING, 0, 1, 2 );
-  anEnfMeshLayout->addWidget(myLayersOnAllWrapCheck, ENF_MESH_MESH, 0, 1 , 1);
-  anEnfMeshLayout->addWidget(myEnforcedMeshTableWidget, ENF_MESH_MESH+1, 0, ENF_MESH_NB_LINES , 1);
+  //anEnfMeshLayout->addWidget(myLayersOnAllWrapCheck, ENF_MESH_MESH, 0, 1 , 1);
+  anEnfMeshLayout->addWidget(myEnforcedMeshTableWidget, ENF_MESH_MESH, 0, ENF_MESH_NB_LINES , 1);
   
   QGridLayout* anEnfMeshLayout2 = new QGridLayout(myEnfMeshGroup);
   anEnfMeshLayout2->addWidget(myEnfMeshWdg,             ENF_MESH_MESH, 0, 1, 2);
@@ -679,19 +683,54 @@ QFrame* HYBRIDPluginGUI_HypothesisCreator::buildFrame()
   anEnfMeshLayout2->addWidget(removeEnfMeshButton,      ENF_MESH_BTN, 1, 1, 1);
   anEnfMeshLayout2->setRowStretch(ENF_MESH_NB_LINES, 1);
   
-  anEnfMeshLayout->addLayout(anEnfMeshLayout2,          ENF_MESH_MESH+1, 1, ENF_MESH_NB_LINES, 1);
+  anEnfMeshLayout->addLayout(anEnfMeshLayout2,          ENF_MESH_MESH, 1, ENF_MESH_NB_LINES, 1);
   anEnfMeshLayout->setRowStretch(ENF_MESH_MESH, 10);
 
-  
+
+  // selection of faces for layers
+
+  QWidget* faceSelLayersGroup = new QWidget( dlg() );
+  myLayersOnAllWrapCheck = new QCheckBox( tr( "HYBRID_LAYERS_ON_ALL_WRAP" ), faceSelLayersGroup );
+  QGridLayout* faceSelLayersLayout = new QGridLayout( faceSelLayersGroup );
+  faceSelLayersLayout->addWidget(myLayersOnAllWrapCheck, 0, 0 );
+
+  myFacesLbl = new QLabel( tr("HYBRID_FACE_IDS"), faceSelLayersGroup );
+  faceSelLayersLayout->addWidget( myFacesLbl, 1, 0 );
+
+  myFaceSelectorLayers = new StdMeshersGUI_SubShapeSelectorWdg( faceSelLayersGroup, TopAbs_FACE, true, true );
+  QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
+  QString aSubEntry  = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
+  myFaceSelectorLayers->SetGeomShapeEntry( aSubEntry, aMainEntry );
+  faceSelLayersLayout->addWidget( myFaceSelectorLayers, 2, 0);
+  faceSelLayersLayout->setRowStretch( 2, 10);
+
+  // selection of faces for imprinting
+
+  QWidget* faceSelImprintingGroup = new QWidget( dlg() );
+  QGridLayout* faceSelImprintingLayout = new QGridLayout( faceSelImprintingGroup );
+
+  QLabel* facesLblImprinting = new QLabel( tr("HYBRID_FACE_IDS"), faceSelImprintingGroup );
+  faceSelImprintingLayout->addWidget( facesLblImprinting, 0, 0 );
+
+  myFaceSelectorImprinting = new StdMeshersGUI_SubShapeSelectorWdg( faceSelImprintingGroup, TopAbs_FACE, true, true );
+  myFaceSelectorImprinting->SetGeomShapeEntry( aSubEntry, aMainEntry );
+  faceSelImprintingLayout->addWidget( myFaceSelectorImprinting, 1, 0, 2, 2 );
+  faceSelImprintingLayout->setRowStretch( 1, 10);
+
   // add tabs
   tab->insertTab( STD_TAB, myStdGroup, tr( "SMESH_ARGUMENTS" ) );
   tab->insertTab( ADV_TAB, myAdvGroup, tr( "HYBRID_ADV_ARGS" ) );
-  //TODO remove or er usmay be lateful to select layers...
-  //tab->insertTab( ENF_VER_TAB, myEnfGroup, tr( "HYBRID_ENFORCED_VERTICES" ) );
+  if ( aMainEntry.isEmpty() && aSubEntry.isEmpty() ) // mesh not based of geometry
+    faceSelLayersGroup->hide();
+  else {
+    tab->insertTab( FACE_SEL_LAYERS_TAB, faceSelLayersGroup, tr( "HYBRID_FACES_LAYERS_TAB" ));
+    tab->insertTab( FACE_SEL_IMPRINTING_TAB, faceSelImprintingGroup, tr( "HYBRID_FACES_IMPRINTING_TAB" ));
+  }
   tab->insertTab( ENF_MESH_TAB, myEnfMeshGroup, tr( "HYBRID_ENFORCED_MESHES" ) );
   tab->setCurrentIndex( STD_TAB );
 
   // connections
+  connect( tab,              SIGNAL( currentChanged ( int )),       this,         SLOT( onTabChanged( int ) ) );
   //connect( myLayersOnAllWrapCheck,      SIGNAL( toggled( bool ) ), this, SLOT( onLayersOnAllWrap(bool)));
   connect( myLayersOnAllWrapCheck,      SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) );
   //connect( myToMeshHolesCheck,      SIGNAL( toggled( bool ) ), this, SLOT( onToMeshHoles(bool)));
@@ -794,7 +833,6 @@ This method updates the tooltip of a modified item. The QLineEdit widgets conten
 is synchronized with the coordinates of the enforced vertex clicked in the tree widget.
 */
 void HYBRIDPluginGUI_HypothesisCreator::updateEnforcedVertexValues(QTableWidgetItem* item) {
-//   MESSAGE("HYBRIDPluginGUI_HypothesisCreator::updateEnforcedVertexValues");
   int row = myEnforcedTableWidget->row(item);
       
   QVariant vertexName = myEnforcedTableWidget->item(row,ENF_VER_NAME_COLUMN)->data(Qt::EditRole);
@@ -825,7 +863,6 @@ void HYBRIDPluginGUI_HypothesisCreator::updateEnforcedVertexValues(QTableWidgetI
     if (!groupName.isEmpty())
       toolTip += QString(" [") + groupName + QString("]");
 
-//     MESSAGE("Tooltip: " << toolTip.toStdString());
     for (int col=0;col<ENF_VER_NB_COLUMNS;col++)
       myEnforcedTableWidget->item(row,col)->setToolTip(toolTip);
 
@@ -966,7 +1003,6 @@ This method adds in the tree widget an enforced mesh from mesh, submesh or group
 */
 void HYBRIDPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::string entry, int elementType, std::string groupName)
 {
-  MESSAGE("addEnforcedMesh(\"" << name << ", \"" << entry << "\", " << elementType << ", \"" << groupName << "\")");
   bool okToCreate = true;
   QString itemEntry = "";
   int itemElementType = 0;
@@ -974,23 +1010,19 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::s
   bool allColumns = true;
   for (int row = 0;row<rowCount;row++) {
     for (int col = 0 ; col < ENF_MESH_NB_COLUMNS ; col++) {
-      MESSAGE("col: " << col);
       if (col == ENF_MESH_CONSTRAINT_COLUMN){
         if (qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row, col)) == 0) {
           allColumns = false;
-          MESSAGE("allColumns = false");
           break;
         }
       }
       else if (myEnforcedMeshTableWidget->item(row, col) == 0) {
         allColumns = false;
-        MESSAGE("allColumns = false");
         break;
       }
       if (col == ENF_MESH_CONSTRAINT_COLUMN) {
         QComboBox* itemComboBox = qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row, col));
         itemElementType = itemComboBox->currentIndex();
-        MESSAGE("itemElementType: " << itemElementType);
       }
       else if (col == ENF_MESH_ENTRY_COLUMN)
         itemEntry = myEnforcedMeshTableWidget->item(row, col)->data(Qt::EditRole).toString();
@@ -1002,7 +1034,6 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::s
     if (itemEntry == QString(entry.c_str()) && itemElementType == elementType) { 
 //       // update group name
 //       if (itemGroupName.toStdString() != groupName) {
-//         MESSAGE("Group is updated from \"" << itemGroupName.toStdString() << "\" to \"" << groupName << "\"");
 //         myEnforcedMeshTableWidget->item(row, ENF_MESH_GROUP_COLUMN)->setData( Qt::EditRole, QVariant(groupName.c_str()));
 //       }
       okToCreate = false;
@@ -1014,13 +1045,11 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::s
   if (!okToCreate)
     return;
   
-  MESSAGE("Creation of enforced mesh");
 
   myEnforcedMeshTableWidget->setRowCount(rowCount+1);
   myEnforcedMeshTableWidget->setSortingEnabled(false);
   
   for (int col=0;col<ENF_MESH_NB_COLUMNS;col++) {
-    MESSAGE("Column: " << col);
     if (col == ENF_MESH_CONSTRAINT_COLUMN) {
       QComboBox* comboBox = new QComboBox();
       QPalette pal = comboBox->palette();
@@ -1029,7 +1058,6 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::s
       comboBox->insertItems(0,myEnfMeshConstraintLabels);
       comboBox->setEditable(false);
       comboBox->setCurrentIndex(elementType);
-      MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << comboBox->currentText().toStdString());
       myEnforcedMeshTableWidget->setCellWidget(rowCount,col,comboBox);
     }
     else {
@@ -1039,25 +1067,21 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::s
         case ENF_MESH_NAME_COLUMN:
           item->setData( 0, name.c_str() );
           item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
-          MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
           myEnforcedMeshTableWidget->setItem(rowCount,col,item);
           break;
         case ENF_MESH_ENTRY_COLUMN:
           item->setData( 0, entry.c_str() );
           item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
-          MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
           myEnforcedMeshTableWidget->setItem(rowCount,col,item);
           break;
         case ENF_MESH_GROUP_COLUMN:
           item->setData( 0, groupName.c_str() );
-          MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
           myEnforcedMeshTableWidget->setItem(rowCount,col,item);
           break;
         default:
           break;
       }
     }
-    MESSAGE("Done");
   }
 
 //   connect( myEnforcedMeshTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this,  SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
@@ -1073,7 +1097,6 @@ This method adds in the tree widget an enforced vertex with given size and coord
 */
 void HYBRIDPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, double z, double size, std::string vertexName, std::string geomEntry, std::string groupName, bool isCompound)
 {
-  MESSAGE("addEnforcedVertex(" << x << ", " << y << ", " << z << ", " << size << ", \"" << vertexName << ", \"" << geomEntry << "\", \"" << groupName << "\", " << isCompound << ")");
   myEnforcedTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *)));
   bool okToCreate = true;
   double itemX,itemY,itemZ,itemSize = 0;
@@ -1127,12 +1150,10 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, do
     if (( !isCompound && ((itemX == x) && (itemY == y) && (itemZ == z))) || /*( (itemEntry.toStdString() != "") && */ (itemEntry.toStdString() == geomEntry)/*)*/) {
       // update size
       if (itemSize != size) {
-        MESSAGE("Size is updated from \"" << itemSize << "\" to \"" << size << "\"");
         myEnforcedTableWidget->item(row, ENF_VER_SIZE_COLUMN)->setData( Qt::EditRole, QVariant(size));
       }
       // update group name
       if (itemGroupName.toStdString() != groupName) {
-        MESSAGE("Group is updated from \"" << itemGroupName.toStdString() << "\" to \"" << groupName << "\"");
         myEnforcedTableWidget->item(row, ENF_VER_GROUP_COLUMN)->setData( Qt::EditRole, QVariant(groupName.c_str()));
       }
       okToCreate = false;
@@ -1141,19 +1162,15 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, do
   } // for
   if (!okToCreate) {
     if (geomEntry.empty()) {
-      MESSAGE("Vertex with coords " << x << ", " << y << ", " << z << " already exist: dont create again");
     }
     else {
-      MESSAGE("Vertex with entry " << geomEntry << " already exist: dont create again");
     }
     return;
   }
     
   if (geomEntry.empty()) {
-    MESSAGE("Vertex with coords " << x << ", " << y << ", " << z<< " is created");
   }
   else {
-    MESSAGE("Vertex with geom entry " << geomEntry << " is created");
   }
 
   int vertexIndex=0;
@@ -1175,11 +1192,9 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, do
     }
   }
   
-  MESSAGE("myVertexName is \"" << myVertexName.toStdString() << "\"");
   myEnforcedTableWidget->setRowCount(rowCount+1);
   myEnforcedTableWidget->setSortingEnabled(false);
   for (int col=0;col<ENF_VER_NB_COLUMNS;col++) {
-    MESSAGE("Column: " << col);
     QTableWidgetItem* item = new QTableWidgetItem();
     item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
     switch (col) {
@@ -1223,9 +1238,7 @@ void HYBRIDPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, do
         break;
     }
     
-    MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
     myEnforcedTableWidget->setItem(rowCount,col,item);
-    MESSAGE("Done");
   }
 
   connect( myEnforcedTableWidget,SIGNAL( itemChanged(QTableWidgetItem *)), this,  SLOT( updateEnforcedVertexValues(QTableWidgetItem *) ) );
@@ -1240,7 +1253,6 @@ This method is called when a item is added into the enforced meshes tree widget
 */
 void HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedMesh()
 {
-  MESSAGE("HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedMesh()");
 
   HYBRIDPluginGUI_HypothesisCreator* that = (HYBRIDPluginGUI_HypothesisCreator*)this;
   
@@ -1265,18 +1277,16 @@ void HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedMesh()
   int elementType = myEnfMeshConstraint->currentIndex();
   
   
-  _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+  _PTR(Study) aStudy = SMESH::getStudy();
   _PTR(SObject) aSObj; //SMESH::SMESH_IDSource::_nil;
   QString meshEntry = myEnfMeshWdg->GetValue();
-  MESSAGE("myEnfMeshWdg->GetValue()" << meshEntry.toStdString());
   
   if (selEnfMeshes == 1)
   {
-    MESSAGE("1 SMESH object selected");
 //     myEnfMesh = myEnfMeshWdg->GetObject< SMESH::SMESH_IDSource >();
 //     std::string entry = myEnfMeshWdg->GetValue();
     aSObj = aStudy->FindObjectID(meshEntry.toStdString().c_str());
-    CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy);
+    CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj);
     if (!CORBA::is_nil(anObj)) {
 //       SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
       addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
@@ -1284,12 +1294,11 @@ void HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedMesh()
   }
   else
   {
-    MESSAGE(selEnfMeshes << " SMESH objects selected");
     QStringList meshEntries = meshEntry.split(" ", QString::SkipEmptyParts);
     QStringListIterator meshEntriesIt (meshEntries);
     while (meshEntriesIt.hasNext()) {
       aSObj = aStudy->FindObjectID(meshEntriesIt.next().toStdString().c_str());
-      CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy);
+      CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj);
       if (!CORBA::is_nil(anObj)) {
 //         SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
         addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
@@ -1309,7 +1318,6 @@ This method is called when a item is added into the enforced vertices tree widge
 */
 void HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedVertex()
 {
-  MESSAGE("HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedVertex()");
 
   HYBRIDPluginGUI_HypothesisCreator* that = (HYBRIDPluginGUI_HypothesisCreator*)this;
   
@@ -1336,7 +1344,6 @@ void HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedVertex()
   
   if (selEnfVertex <= 1)
   {
-    MESSAGE("0 or 1 GEOM object selected");
     double x = 0, y = 0, z=0;
     if (myXCoord->GetString() != "") {
       x = myXCoord->GetValue();
@@ -1344,7 +1351,6 @@ void HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedVertex()
       z = myZCoord->GetValue();
     }
     if (selEnfVertex == 1) {
-      MESSAGE("1 GEOM object selected");
       myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >();
       std::string entry = "";
       if (myEnfVertex != GEOM::GEOM_Object::_nil())
@@ -1352,8 +1358,6 @@ void HYBRIDPluginGUI_HypothesisCreator::onAddEnforcedVertex()
       addEnforcedVertex(x, y, z, size, myEnfVertex->GetName(),entry, groupName, myEnfVertex->GetShapeType() == GEOM::COMPOUND);
     }
     else {
-      MESSAGE("0 GEOM object selected");
-      MESSAGE("Coords: ("<<x<<","<<y<<","<<z<<")");
       addEnforcedVertex(x, y, z, size, "", "", groupName);
     }
   }
@@ -1408,7 +1412,6 @@ void HYBRIDPluginGUI_HypothesisCreator::onRemoveEnforcedMesh()
   it.toBack();
   while ( it.hasPrevious() ) {
       row = it.previous();
-      MESSAGE("delete row #"<< row);
       myEnforcedMeshTableWidget->removeRow(row );
   }
 
@@ -1435,7 +1438,6 @@ void HYBRIDPluginGUI_HypothesisCreator::onRemoveEnforcedVertex()
   it.toBack();
   while ( it.hasPrevious() ) {
       row = it.previous();
-      MESSAGE("delete row #"<< row);
       myEnforcedTableWidget->removeRow(row );
   }
 
@@ -1463,6 +1465,16 @@ void HYBRIDPluginGUI_HypothesisCreator::onDirBtnClicked()
     myAdvWidget->workingDirectoryLineEdit->setText( dir );
 }
 
+void HYBRIDPluginGUI_HypothesisCreator::onTabChanged( int )
+{
+  myEnfVertexWdg->deactivateSelection();
+  myEnfMeshWdg->deactivateSelection();
+  myFaceSelectorLayers->ActivateSelection( false );
+  myFaceSelectorLayers->ShowPreview( false );
+  myFaceSelectorImprinting->ActivateSelection( false );
+  myFaceSelectorImprinting->ShowPreview( false );
+}
+
 void HYBRIDPluginGUI_HypothesisCreator::updateWidgets()
 {
   //customs automatic set
@@ -1481,16 +1493,15 @@ void HYBRIDPluginGUI_HypothesisCreator::updateWidgets()
     myAdvWidget->removeLogOnSuccessCheck->setEnabled( logFileRemovable );
   }
   bool enabled = !myLayersOnAllWrapCheck->isChecked();
-  myEnforcedMeshTableWidget->setEnabled(enabled);
-  addEnfMeshButton->setEnabled(enabled);
-  removeEnfMeshButton->setEnabled(enabled);
-  myEnfMeshWdg->setEnabled(enabled);
-  //xxx->setEnabled(enabled);
+  myFacesLbl->setEnabled(enabled);
+  myFaceSelectorLayers->setEnabled(enabled);
+  if ( QTabWidget* tab = qobject_cast<QTabWidget*>( myStdGroup->parentWidget()->parentWidget() )) {
+    tab->setTabEnabled( FACE_SEL_IMPRINTING_TAB, enabled );
+  }
 }
 
 bool HYBRIDPluginGUI_HypothesisCreator::checkParams(QString& msg) const
 {
-  MESSAGE("HYBRIDPluginGUI_HypothesisCreator::checkParams");
 
   if ( !QFileInfo( myAdvWidget->workingDirectoryLineEdit->text().trimmed() ).isWritable() ) {
     SUIT_MessageBox::warning( dlg(),
@@ -1504,7 +1515,6 @@ bool HYBRIDPluginGUI_HypothesisCreator::checkParams(QString& msg) const
 
 void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const
 {
-  MESSAGE("HYBRIDPluginGUI_HypothesisCreator::retrieveParams");
   HYBRIDPluginGUI_HypothesisCreator* that = (HYBRIDPluginGUI_HypothesisCreator*)this;
   HYBRIDHypothesisData data;
   readParamsFromHypo( data );
@@ -1522,15 +1532,21 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const
   myAdvWidget->initialMemorySpin              ->setValue      ( qMax( data.myInitialMemory,
                                                                       myAdvWidget->initialMemorySpin->minimum() ));
 
-  myCollisionModeCombo ->setCurrentIndex( data.myCollisionMode );
-  myBoundaryLayersGrowthCombo ->setCurrentIndex( data.myBoundaryLayersGrowth );
-  myElementGenerationCombo ->setCurrentIndex( data.myElementGeneration );
-  myAddMultinormalsCheck -> setChecked ( data.myAddMultinormals );
-  mySmoothNormalsCheck -> setChecked ( data.mySmoothNormals );
-  myHeightFirstLayerSpin -> setValue( data.myHeightFirstLayer );
-  myNbOfBoundaryLayersSpin -> setValue( data.myNbOfBoundaryLayers );
+  myCollisionModeCombo            ->setCurrentIndex( data.myCollisionMode );
+  myBoundaryLayersGrowthCombo     ->setCurrentIndex( data.myBoundaryLayersGrowth );
+  myElementGenerationCombo        ->setCurrentIndex( data.myElementGeneration );
+  myAddMultinormalsCheck          -> setChecked ( data.myAddMultinormals );
+  mySmoothNormalsCheck            -> setChecked ( data.mySmoothNormals );
+  myHeightFirstLayerSpin          -> setValue( data.myHeightFirstLayer );
+  myNbOfBoundaryLayersSpin        -> setValue( data.myNbOfBoundaryLayers );
   myBoundaryLayersProgressionSpin -> setValue( data.myBoundaryLayersProgression );
-  myMultinormalsAngleSpin -> setValue( data.myMultinormalsAngle );
+  if (data.myCoreSize <= 0)
+    myCoreSizeSpin->setText("");
+  else
+    myCoreSizeSpin                -> setValue( data.myCoreSize );
+  myMultinormalsAngleSpin         -> setValue( data.myMultinormalsAngle );
+  myFaceSelectorLayers            ->SetListOfIDs( data.myFaceWLIds );
+  myFaceSelectorImprinting        ->SetListOfIDs( data.myFaceWIIds );
 
   myAdvWidget->workingDirectoryLineEdit       ->setText   ( data.myWorkingDir );
   myAdvWidget->keepWorkingFilesCheck          ->setChecked( data.myKeepFiles );
@@ -1540,7 +1556,7 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const
   myAdvWidget->boundaryRecoveryCheck          ->setChecked( data.myBoundaryRecovery );
   myAdvWidget->FEMCorrectionCheck             ->setChecked( data.myFEMCorrection );
   myAdvWidget->gradationSpinBox               ->setValue  ( data.myGradation );
-  myAdvWidget->myAdvOptionsTable        ->SetCustomOptions( data.myTextOption );
+  myAdvWidget->myAdvOptionsTable              ->SetCustomOptions( data.myTextOption );
   myAdvWidget->logInFileCheck                 ->setChecked( !data.myLogInStandardOutput );
   myAdvWidget->removeLogOnSuccessCheck        ->setChecked( data.myRemoveLogOnSuccess );
 
@@ -1555,8 +1571,6 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const
     myEnforcedTableWidget->setRowCount(rowCount+1);
 
     for (int col=0;col<ENF_VER_NB_COLUMNS;col++) {
-      MESSAGE("Column: " << col);
-//       MESSAGE("enfVertex->isCompound: " << enfVertex->isCompound);
       QTableWidgetItem* item = new QTableWidgetItem();
       item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
       switch (col) {
@@ -1568,50 +1582,41 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const
             else
               item->setIcon(QIcon(iconVertex.scaled(iconVertex.size()*0.7,Qt::KeepAspectRatio,Qt::SmoothTransformation)));
             
-            MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
           }
           break;
         case ENF_VER_X_COLUMN:
           if (!enfVertex->isCompound) {
             item->setData( 0, enfVertex->coords.at(0) );
-            MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
           }
           break;
         case ENF_VER_Y_COLUMN:
           if (!enfVertex->isCompound) {
             item->setData( 0, enfVertex->coords.at(1) );
-            MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
           }
           break;
         case ENF_VER_Z_COLUMN:
           if (!enfVertex->isCompound) {
             item->setData( 0, enfVertex->coords.at(2) );
-            MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
           }
           break;
         case ENF_VER_SIZE_COLUMN:
           item->setData( 0, enfVertex->size );
-          MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
           break;
         case ENF_VER_ENTRY_COLUMN:
           item->setData( 0, enfVertex->geomEntry.c_str() );
-          MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
           break;
         case ENF_VER_COMPOUND_COLUMN:
           item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
           item->setData( Qt::CheckStateRole, enfVertex->isCompound );
-          MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << enfVertex->isCompound);
           break;
         case ENF_VER_GROUP_COLUMN:
           item->setData( 0, enfVertex->groupName.c_str() );
-          MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
           break;
         default:
           break;
       }
       
       myEnforcedTableWidget->setItem(rowCount,col,item);
-      MESSAGE("Done");
     }
     that->updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
     rowCount++;
@@ -1635,7 +1640,6 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const
     myEnforcedMeshTableWidget->setRowCount(rowCount+1);
 
     for (int col=0;col<ENF_MESH_NB_COLUMNS;col++) {
-      MESSAGE("Column: " << col);
       if (col == ENF_MESH_CONSTRAINT_COLUMN) {
         QComboBox* comboBox = new QComboBox();
         QPalette pal = comboBox->palette();
@@ -1644,7 +1648,6 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const
         comboBox->insertItems(0,myEnfMeshConstraintLabels);
         comboBox->setEditable(false);
         comboBox->setCurrentIndex(enfMesh->elementType);
-        MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << comboBox->currentText().toStdString());
         myEnforcedMeshTableWidget->setCellWidget(rowCount,col,comboBox);
       }
       else {
@@ -1654,18 +1657,15 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const
           case ENF_MESH_NAME_COLUMN:
             item->setData( 0, enfMesh->name.c_str() );
             item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
-            MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
             myEnforcedMeshTableWidget->setItem(rowCount,col,item);
             break;
           case ENF_MESH_ENTRY_COLUMN:
             item->setData( 0, enfMesh->entry.c_str() );
             item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled);
-            MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
             myEnforcedMeshTableWidget->setItem(rowCount,col,item);
             break;
           case ENF_MESH_GROUP_COLUMN:
             item->setData( 0, enfMesh->groupName.c_str() );
-            MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
             myEnforcedMeshTableWidget->setItem(rowCount,col,item);
             break;
           default:
@@ -1674,7 +1674,6 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const
       }
       
 //       myEnforcedMeshTableWidget->setItem(rowCount,col,item);
-      MESSAGE("Done");
     }
 //     that->updateEnforcedVertexValues(myEnforcedTableWidget->item(rowCount,ENF_VER_NAME_COLUMN));
     rowCount++;
@@ -1692,84 +1691,94 @@ void HYBRIDPluginGUI_HypothesisCreator::retrieveParams() const
 
 QString HYBRIDPluginGUI_HypothesisCreator::storeParams() const
 {
-    MESSAGE("HYBRIDPluginGUI_HypothesisCreator::storeParams");
-    HYBRIDHypothesisData data;
-    readParamsFromWidgets( data );
-    storeParamsToHypo( data );
-    
-    QString valStr = "";
-    
-    if ( !data.myBoundaryRecovery )
-        valStr = "-c " + QString::number( !data.myToMeshHoles );
-    
-    if ( data.myOptimizationLevel >= 0 && data.myOptimizationLevel < 5 && !data.myBoundaryRecovery) {
-        const char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" };
-        valStr += " -o ";
-        valStr += level[ data.myOptimizationLevel ];
-    }
-    if ( data.myMaximumMemory > 0 ) {
-        valStr += " -m ";
-        valStr += QString::number( data.myMaximumMemory );
-    }
-    if ( data.myInitialMemory > 0 && !data.myBoundaryRecovery ) {
-        valStr += " -M ";
-        valStr += QString::number( data.myInitialMemory );
-    }
-    valStr += " -v ";
-    valStr += QString::number( data.myVerboseLevel );
-    
-    if ( !data.myToCreateNewNodes )
-        valStr += " -p0";
-    
-    if ( data.myRemoveInitialCentralPoint )
-        valStr += " -no_initial_central_point";
-    
-    if ( data.myBoundaryRecovery )
-        valStr += " -C";
-    
-    if ( data.myFEMCorrection )
-        valStr += " -FEM";
-    
-    if ( data.myGradation != 1.05 ) {
-      valStr += " -Dcpropa=";
-      valStr += QString::number( data.myGradation );
-    }
-    
-    valStr += " ";
-    valStr += data.myTextOption;
-    
-//     valStr += " #BEGIN ENFORCED VERTICES#";
-//     // Add size map parameters storage
-//     for (int i=0 ; i<mySmpModel->rowCount() ; i++) {
-//         valStr += " (";
-//         double x = mySmpModel->data(mySmpModel->index(i,ENF_VER_X_COLUMN)).toDouble();
-//         double y = mySmpModel->data(mySmpModel->index(i,ENF_VER_Y_COLUMN)).toDouble();
-//         double z = mySmpModel->data(mySmpModel->index(i,ENF_VER_Z_COLUMN)).toDouble();
-//         double size = mySmpModel->data(mySmpModel->index(i,ENF_VER_SIZE_COLUMN)).toDouble();
-//         valStr += QString::number( x );
-//         valStr += ",";
-//         valStr += QString::number( y );
-//         valStr += ",";
-//         valStr += QString::number( z );
-//         valStr += ")=";
-//         valStr += QString::number( size );
-//         if (i!=mySmpModel->rowCount()-1)
-//             valStr += ";";
-//     }
-//     valStr += " #END ENFORCED VERTICES#";
-//     MESSAGE(valStr.toStdString());
+  HYBRIDHypothesisData data;
+  readParamsFromWidgets( data );
+  storeParamsToHypo( data );
+
+  QString valStr = "";
+
+  if ( !data.myBoundaryRecovery )
+    valStr = "-c " + QString::number( !data.myToMeshHoles );
+
+  if ( data.myOptimizationLevel >= 0 && data.myOptimizationLevel < 5 && !data.myBoundaryRecovery) {
+    const char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" };
+    valStr += " -o ";
+    valStr += level[ data.myOptimizationLevel ];
+  }
+  if ( data.myMaximumMemory > 0 ) {
+    valStr += " -m ";
+    valStr += QString::number( data.myMaximumMemory );
+  }
+  if ( data.myInitialMemory > 0 && !data.myBoundaryRecovery ) {
+    valStr += " -M ";
+    valStr += QString::number( data.myInitialMemory );
+  }
+  valStr += " -v ";
+  valStr += QString::number( data.myVerboseLevel );
+
+  if ( !data.myToCreateNewNodes )
+    valStr += " -p0";
+
+  if ( data.myRemoveInitialCentralPoint )
+    valStr += " -no_initial_central_point";
+
+  if ( data.myBoundaryRecovery )
+    valStr += " -C";
+
+  if ( data.myFEMCorrection )
+    valStr += " -FEM";
+
+  if ( data.myGradation != 1.05 ) {
+    valStr += " -Dcpropa=";
+    valStr += QString::number( data.myGradation );
+  }
+
+  valStr += " ";
+  valStr += data.myTextOption;
+
+  //     valStr += " #BEGIN ENFORCED VERTICES#";
+  //     // Add size map parameters storage
+  //     for (int i=0 ; i<mySmpModel->rowCount() ; i++) {
+  //         valStr += " (";
+  //         double x = mySmpModel->data(mySmpModel->index(i,ENF_VER_X_COLUMN)).toDouble();
+  //         double y = mySmpModel->data(mySmpModel->index(i,ENF_VER_Y_COLUMN)).toDouble();
+  //         double z = mySmpModel->data(mySmpModel->index(i,ENF_VER_Z_COLUMN)).toDouble();
+  //         double size = mySmpModel->data(mySmpModel->index(i,ENF_VER_SIZE_COLUMN)).toDouble();
+  //         valStr += QString::number( x );
+  //         valStr += ",";
+  //         valStr += QString::number( y );
+  //         valStr += ",";
+  //         valStr += QString::number( z );
+  //         valStr += ")=";
+  //         valStr += QString::number( size );
+  //         if (i!=mySmpModel->rowCount()-1)
+  //             valStr += ";";
+  //     }
+  //     valStr += " #END ENFORCED VERTICES#";
   return valStr;
 }
 
 bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromHypo( HYBRIDHypothesisData& h_data ) const
 {
-  MESSAGE("HYBRIDPluginGUI_HypothesisCreator::readParamsFromHypo");
   HYBRIDPlugin::HYBRIDPlugin_Hypothesis_var h =
     HYBRIDPlugin::HYBRIDPlugin_Hypothesis::_narrow( initParamsHypothesis() );
 
   HypothesisData* data = SMESH::GetHypothesisData( hypType() );
   h_data.myName = isCreation() && data ? hypName() : "";
 
+  h_data.myCollisionMode              = h->GetCollisionMode();
+  h_data.myBoundaryLayersGrowth       = h->GetBoundaryLayersGrowth();
+  h_data.myElementGeneration          = h->GetElementGeneration();
+  h_data.myAddMultinormals            = h->GetAddMultinormals();
+  h_data.mySmoothNormals              = h->GetSmoothNormals();
+  h_data.myHeightFirstLayer           = h->GetHeightFirstLayer();
+  h_data.myBoundaryLayersProgression  = h->GetBoundaryLayersProgression();
+  h_data.myCoreSize                   = h->GetCoreSize();
+  h_data.myMultinormalsAngle          = h->GetMultinormalsAngle();
+  h_data.myNbOfBoundaryLayers         = h->GetNbOfBoundaryLayers();
+  h_data.myFaceWLIds                  = h->GetFacesWithLayers();
+  h_data.myFaceWIIds                  = h->GetFacesWithImprinting();
+
   h_data.myLayersOnAllWrap            = h->GetLayersOnAllWrap();
   h_data.myToMeshHoles                = h->GetToMeshHoles();
   h_data.myToMakeGroupsOfDomains      = /*h->GetToMeshHoles() &&*/ h->GetToMakeGroupsOfDomains();
@@ -1778,16 +1787,6 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromHypo( HYBRIDHypothesisData
   h_data.myInitialMemory              = h->GetInitialMemory();
   h_data.myOptimizationLevel          = h->GetOptimizationLevel();
   
-  h_data.myCollisionMode = h->GetCollisionMode();
-  h_data.myBoundaryLayersGrowth = h->GetBoundaryLayersGrowth();
-  h_data.myElementGeneration = h->GetElementGeneration();
-  h_data.myAddMultinormals = h->GetAddMultinormals();
-  h_data.mySmoothNormals = h->GetSmoothNormals();
-  h_data.myHeightFirstLayer = h->GetHeightFirstLayer();
-  h_data.myBoundaryLayersProgression = h->GetBoundaryLayersProgression();
-  h_data.myMultinormalsAngle = h->GetMultinormalsAngle();
-  h_data.myNbOfBoundaryLayers = h->GetNbOfBoundaryLayers();
-  
   h_data.myKeepFiles                  = h->GetKeepFiles();
   h_data.myWorkingDir                 = h->GetWorkingDirectory();
   h_data.myVerboseLevel               = h->GetVerboseLevel();
@@ -1801,7 +1800,6 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromHypo( HYBRIDHypothesisData
   h_data.myRemoveLogOnSuccess         = h->GetRemoveLogOnSuccess();
   
   HYBRIDPlugin::HYBRIDEnforcedVertexList_var vertices = h->GetEnforcedVertices();
-  MESSAGE("vertices->length(): " << vertices->length());
   h_data.myEnforcedVertices.clear();
   for (CORBA::ULong i=0 ; i<vertices->length() ; i++) {
     TEnfVertex* myVertex = new TEnfVertex();
@@ -1813,13 +1811,11 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromHypo( HYBRIDHypothesisData
     if (vertices[i].coords.length()) {
       for (CORBA::ULong c = 0; c < vertices[i].coords.length() ; c++)
         myVertex->coords.push_back(vertices[i].coords[c]);
-      MESSAGE("Add enforced vertex ("<< myVertex->coords.at(0) << ","<< myVertex->coords.at(1) << ","<< myVertex->coords.at(2) << ") ="<< myVertex->size);
     }
     h_data.myEnforcedVertices.insert(myVertex);
   }
   
   HYBRIDPlugin::HYBRIDEnforcedMeshList_var enfMeshes = h->GetEnforcedMeshes();
-  MESSAGE("enfMeshes->length(): " << enfMeshes->length());
   h_data.myEnforcedMeshes.clear();
   for (CORBA::ULong i=0 ; i<enfMeshes->length() ; i++) {
     TEnfMesh* myEnfMesh = new TEnfMesh();
@@ -1847,7 +1843,6 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromHypo( HYBRIDHypothesisData
 
 bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesisData& h_data ) const
 {
-  MESSAGE("HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo");
   HYBRIDPlugin::HYBRIDPlugin_Hypothesis_var h =
     HYBRIDPlugin::HYBRIDPlugin_Hypothesis::_narrow( hypothesis() );
 
@@ -1871,7 +1866,7 @@ bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesi
       h->SetInitialMemory    ( h_data.myInitialMemory );
     if ( h->GetOptimizationLevel() != h_data.myOptimizationLevel )
       h->SetOptimizationLevel( h_data.myOptimizationLevel );
-    
+
     if ( h->GetCollisionMode() != h_data.myCollisionMode )
       h->SetCollisionMode(        h_data.myCollisionMode );
     if ( h->GetBoundaryLayersGrowth() != h_data.myBoundaryLayersGrowth )
@@ -1887,11 +1882,15 @@ bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesi
       h->SetHeightFirstLayer       ( h_data.myHeightFirstLayer );
     if ( h->GetBoundaryLayersProgression() != h_data.myBoundaryLayersProgression )
       h->SetBoundaryLayersProgression       ( h_data.myBoundaryLayersProgression );
+    if ( h->GetCoreSize() != h_data.myCoreSize )
+      h->SetCoreSize       ( h_data.myCoreSize );
     if ( h->GetMultinormalsAngle() != h_data.myMultinormalsAngle )
       h->SetMultinormalsAngle       ( h_data.myMultinormalsAngle );
     if ( h->GetNbOfBoundaryLayers() != h_data.myNbOfBoundaryLayers )
       h->SetNbOfBoundaryLayers       ( h_data.myNbOfBoundaryLayers );
-    
+    h->SetFacesWithLayers( h_data.myFaceWLIds );
+    h->SetFacesWithImprinting( h_data.myFaceWIIds );
+
     if ( h->GetKeepFiles() != h_data.myKeepFiles)
       h->SetKeepFiles       ( h_data.myKeepFiles);
     if ( h->GetWorkingDirectory() != h_data.myWorkingDir )
@@ -1912,16 +1911,14 @@ bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesi
       h->SetAdvancedOption    ( h_data.myTextOption.toLatin1().constData() );
     if ( h->GetStandardOutputLog() != h_data.myLogInStandardOutput )
       h->SetStandardOutputLog       ( h_data.myLogInStandardOutput );
-     if ( h->GetRemoveLogOnSuccess() != h_data.myRemoveLogOnSuccess )
+    if ( h->GetRemoveLogOnSuccess() != h_data.myRemoveLogOnSuccess )
       h->SetRemoveLogOnSuccess        ( h_data.myRemoveLogOnSuccess );
     
     // Enforced vertices
-    int nbVertex = (int) h_data.myEnforcedVertices.size();
+    //int nbVertex = (int) h_data.myEnforcedVertices.size();
     HYBRIDPlugin::HYBRIDEnforcedVertexList_var vertexHyp = h->GetEnforcedVertices();
     int nbVertexHyp = vertexHyp->length();
     
-    MESSAGE("Store params for size maps: " << nbVertex << " enforced vertices");
-    MESSAGE("h->GetEnforcedVertices()->length(): " << nbVertexHyp);
     
     // 1. Clear all enforced vertices in hypothesis
     // 2. Add new enforced vertex according to h_data
@@ -1942,12 +1939,10 @@ bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesi
     } // for
     
     // Enforced Meshes
-    int nbEnfMeshes = (int) h_data.myEnforcedMeshes.size();
+    //int nbEnfMeshes = (int) h_data.myEnforcedMeshes.size();
     HYBRIDPlugin::HYBRIDEnforcedMeshList_var enfMeshListHyp = h->GetEnforcedMeshes();
     int nbEnfMeshListHyp = enfMeshListHyp->length();
     
-    MESSAGE("Store params for size maps: " << nbEnfMeshes << " enforced meshes");
-    MESSAGE("h->GetEnforcedMeshes()->length(): " << nbEnfMeshListHyp);
     
     // 1. Clear all enforced vertices in hypothesis
     // 2. Add new enforced vertex according to h_data
@@ -1956,7 +1951,7 @@ bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesi
     
     TEnfMeshList::const_iterator itEnfMesh;
 
-    _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+    _PTR(Study) aStudy = SMESH::getStudy();
 
     for(itEnfMesh = h_data.myEnforcedMeshes.begin() ; itEnfMesh != h_data.myEnforcedMeshes.end(); itEnfMesh++ ) {
       TEnfMesh* enfMesh = (*itEnfMesh);
@@ -1964,7 +1959,6 @@ bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesi
       _PTR(SObject) aSObj = aStudy->FindObjectID(enfMesh->entry.c_str());
       SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
 
-      MESSAGE("enfMesh->elementType: " << enfMesh->elementType);
       SMESH::ElementType elementType;
       switch(enfMesh->elementType) {
         case 0:
@@ -1998,7 +1992,6 @@ bool HYBRIDPluginGUI_HypothesisCreator::storeParamsToHypo( const HYBRIDHypothesi
 
 bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromWidgets( HYBRIDHypothesisData& h_data ) const
 {
-  MESSAGE("HYBRIDPluginGUI_HypothesisCreator::readParamsFromWidgets");
   h_data.myName                       = myName ? myName->text() : "";
   h_data.myLayersOnAllWrap            = myLayersOnAllWrapCheck->isChecked();
   h_data.myToMeshHoles                = myToMeshHolesCheck->isChecked();
@@ -2006,18 +1999,21 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromWidgets( HYBRIDHypothesisD
   h_data.myMaximumMemory              = myAdvWidget->maxMemoryCheck->isChecked() ? myAdvWidget->maxMemorySpin->value() : -1;
   h_data.myInitialMemory              = myAdvWidget->initialMemoryCheck->isChecked() ? myAdvWidget->initialMemorySpin->value() : -1;
   h_data.myOptimizationLevel          = myOptimizationLevelCombo->currentIndex();
-  
-  h_data.myCollisionMode        = myCollisionModeCombo->currentIndex();
-  h_data.myBoundaryLayersGrowth = myBoundaryLayersGrowthCombo->currentIndex();
-  h_data.myElementGeneration = myElementGenerationCombo->currentIndex();
-  h_data.myAddMultinormals = myAddMultinormalsCheck->isChecked();
-  h_data.mySmoothNormals = mySmoothNormalsCheck->isChecked();
-  
-  h_data.myHeightFirstLayer = myHeightFirstLayerSpin -> value();
-  h_data.myNbOfBoundaryLayers = myNbOfBoundaryLayersSpin -> value();
-  h_data.myBoundaryLayersProgression = myBoundaryLayersProgressionSpin -> value();
-  h_data.myMultinormalsAngle = myMultinormalsAngleSpin -> value();
-  
+
+  h_data.myCollisionMode              = myCollisionModeCombo->currentIndex();
+  h_data.myBoundaryLayersGrowth       = myBoundaryLayersGrowthCombo->currentIndex();
+  h_data.myElementGeneration          = myElementGenerationCombo->currentIndex();
+  h_data.myAddMultinormals            = myAddMultinormalsCheck->isChecked();
+  h_data.mySmoothNormals              = mySmoothNormalsCheck->isChecked();
+
+  h_data.myHeightFirstLayer           = myHeightFirstLayerSpin -> value();
+  h_data.myNbOfBoundaryLayers         = myNbOfBoundaryLayersSpin -> value();
+  h_data.myBoundaryLayersProgression  = myBoundaryLayersProgressionSpin -> value();
+  h_data.myCoreSize                   = myCoreSizeSpin->text().isEmpty() ? 0.0 : myCoreSizeSpin -> value();
+  h_data.myMultinormalsAngle          = myMultinormalsAngleSpin -> value();
+  h_data.myFaceWLIds                  = myFaceSelectorLayers->GetListOfIDs();
+  h_data.myFaceWIIds                  = myFaceSelectorImprinting->GetListOfIDs();
+
   h_data.myKeepFiles                  = myAdvWidget->keepWorkingFilesCheck->isChecked();
   h_data.myWorkingDir                 = myAdvWidget->workingDirectoryLineEdit->text().trimmed();
   h_data.myVerboseLevel               = myAdvWidget->verboseLevelSpin->value();
@@ -2029,7 +2025,7 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromWidgets( HYBRIDHypothesisD
   h_data.myTextOption                 = myAdvWidget->myAdvOptionsTable->GetCustomOptions();
   h_data.myLogInStandardOutput        = !myAdvWidget->logInFileCheck->isChecked();
   h_data.myRemoveLogOnSuccess         = myAdvWidget->removeLogOnSuccessCheck->isChecked();
-  
+
   // Enforced vertices
   h_data.myEnforcedVertices.clear();
   QVariant valueX, valueY, valueZ;
@@ -2037,13 +2033,10 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromWidgets( HYBRIDHypothesisD
     
     TEnfVertex *myVertex = new TEnfVertex();
     myVertex->name = myEnforcedTableWidget->item(row,ENF_VER_NAME_COLUMN)->data(Qt::EditRole).toString().toStdString();
-    MESSAGE("Add new enforced vertex \"" << myVertex->name << "\"" );
     myVertex->geomEntry = myEnforcedTableWidget->item(row,ENF_VER_ENTRY_COLUMN)->data(Qt::EditRole).toString().toStdString();
     if (myVertex->geomEntry.size())
-      MESSAGE("Geom entry is \"" << myVertex->geomEntry << "\"" );
     myVertex->groupName = myEnforcedTableWidget->item(row,ENF_VER_GROUP_COLUMN)->data(Qt::EditRole).toString().toStdString();
     if (myVertex->groupName.size())
-      MESSAGE("Group name is \"" << myVertex->groupName << "\"" );
     valueX = myEnforcedTableWidget->item(row,ENF_VER_X_COLUMN)->data(Qt::EditRole);
     valueY = myEnforcedTableWidget->item(row,ENF_VER_Y_COLUMN)->data(Qt::EditRole);
     valueZ = myEnforcedTableWidget->item(row,ENF_VER_Z_COLUMN)->data(Qt::EditRole);
@@ -2051,14 +2044,9 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromWidgets( HYBRIDHypothesisD
       myVertex->coords.push_back(valueX.toDouble());
       myVertex->coords.push_back(valueY.toDouble());
       myVertex->coords.push_back(valueZ.toDouble());
-      MESSAGE("Coords are (" << myVertex->coords.at(0) << ", "
-                             << myVertex->coords.at(1) << ", "
-                             << myVertex->coords.at(2) << ")");
     }
     myVertex->size = myEnforcedTableWidget->item(row,ENF_VER_SIZE_COLUMN)->data(Qt::EditRole).toDouble();
-    MESSAGE("Size is " << myVertex->size);
     myVertex->isCompound = myEnforcedTableWidget->item(row,ENF_VER_COMPOUND_COLUMN)->data(Qt::CheckStateRole).toBool();
-    MESSAGE("Is compound ? " << myVertex->isCompound);
     h_data.myEnforcedVertices.insert(myVertex);
   }
   
@@ -2069,14 +2057,10 @@ bool HYBRIDPluginGUI_HypothesisCreator::readParamsFromWidgets( HYBRIDHypothesisD
     
     TEnfMesh *myEnfMesh = new TEnfMesh();
     myEnfMesh->name = myEnforcedMeshTableWidget->item(row,ENF_MESH_NAME_COLUMN)->data(Qt::EditRole).toString().toStdString();
-    MESSAGE("Add new enforced mesh \"" << myEnfMesh->name << "\"" );
     myEnfMesh->entry = myEnforcedMeshTableWidget->item(row,ENF_MESH_ENTRY_COLUMN)->data(Qt::EditRole).toString().toStdString();
-    MESSAGE("Entry is \"" << myEnfMesh->entry << "\"" );
     myEnfMesh->groupName = myEnforcedMeshTableWidget->item(row,ENF_MESH_GROUP_COLUMN)->data(Qt::EditRole).toString().toStdString();
-    MESSAGE("Group name is \"" << myEnfMesh->groupName << "\"" );
     QComboBox* combo = qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row,ENF_MESH_CONSTRAINT_COLUMN));
     myEnfMesh->elementType = combo->currentIndex();
-    MESSAGE("Element type: " << myEnfMesh->elementType);
     h_data.myEnforcedMeshes.insert(myEnfMesh);
     std::cout << "h_data.myEnforcedMeshes.size(): " << h_data.myEnforcedMeshes.size() << std::endl;
   }