]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
Debug
authorouv <ouv@opencascade.com>
Wed, 16 Dec 2009 12:01:42 +0000 (12:01 +0000)
committerouv <ouv@opencascade.com>
Wed, 16 Dec 2009 12:01:42 +0000 (12:01 +0000)
src/SMESH_I/SMESH_2smeshpy.cxx
src/SMESH_I/SMESH_Gen_i_1.cxx
src/SMESH_I/SMESH_Hypothesis_i.cxx
src/SMESH_I/SMESH_MeshEditor_i.cxx
src/SMESH_I/SMESH_Mesh_i.cxx
src/SMESH_I/SMESH_Mesh_i.hxx
src/SMESH_I/SMESH_NoteBook.cxx
src/SMESH_SWIG/smeshDC.py

index 8d3cacc1306773924d4e2b22511c5bc123337d07..080f15a19075c2852fec4fec123185c6f50ddf3d 100644 (file)
@@ -1074,6 +1074,7 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
       "RotationSweep","RotationSweepObject","RotationSweepObject1D","RotationSweepObject2D",
       "ExtrusionSweep","AdvancedExtrusion","ExtrusionSweepObject","ExtrusionSweepObject1D","ExtrusionSweepObject2D",
       "ExtrusionAlongPath","ExtrusionAlongPathObject","ExtrusionAlongPathObject1D","ExtrusionAlongPathObject2D",
+      "ExtrusionAlongPathX","ExtrusionAlongPathObjX",
       "Mirror","MirrorObject","Translate","TranslateObject","Rotate","RotateObject",
       "FindCoincidentNodes","FindCoincidentNodesOnPart","MergeNodes","FindEqualElements",
       "MergeElements","MergeEqualElements","SewFreeBorders","SewConformFreeBorders",
index 2441aa14c69c31f570f5d1778631f8d3435121a0..b86e9e5c1bd7f27ca1038bed74ac99835ce0387a 100644 (file)
@@ -561,8 +561,9 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishMesh (SALOMEDS::Study_ptr   theStudy,
   }
 
   // Update string attribute (to display used variables)
-  if( SMESH_Mesh_i* aServant = dynamic_cast<SMESH_Mesh_i*>( GetServant( theMesh ).in() ) )
-    aServant->UpdateStringAttribute();
+  // Temporarily commented (see implementation of SMESH_Mesh_i::UpdateStringAttribute())
+  //if( SMESH_Mesh_i* aServant = dynamic_cast<SMESH_Mesh_i*>( GetServant( theMesh ).in() ) )
+  //  aServant->UpdateStringAttribute();
 
   if(MYDEBUG) MESSAGE("PublishMesh_END");
   return aMeshSO._retn();
index 219c1e12699fe2a141673a6e6ae12639bf2459dd..cd45593fb523fb7e74006048a41a7bdaf8037796 100644 (file)
@@ -230,34 +230,29 @@ void SMESH_Hypothesis_i::Update( SALOME::Notebook_ptr theNotebook )
 //=============================================================================
 void SMESH_Hypothesis_i::UpdateStringAttribute()
 {
+  // implementation of the method has been temporarily changed
+  // previous implementation can be found in revision 1.12.14.8
   SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
 
-  SALOME::Notebook_ptr aNotebook = aSMESHGen->GetNotebook( myBaseImpl->GetStudyId() );
-
-  SALOME::StringArray* anObjectParameters = aNotebook->GetObjectParameters( GetComponent(), GetEntry() );
-  int aParametersLength = anObjectParameters ? anObjectParameters->length() : 0;
-  if( aParametersLength == 0 )
-    return;
-
   SALOMEDS::Study_ptr aStudy = aSMESHGen->GetStudy( myBaseImpl->GetStudyId() );
   SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
   SALOMEDS::SObject_var aSObject = SMESH_Gen_i::ObjectToSObject( aStudy, SMESH::SMESH_Hypothesis::_narrow( _this() ) );
   if( CORBA::is_nil( aSObject ) )
     return;
 
+  SALOME::StringArray* aParameters = GetParameters();
+
   SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute( aSObject, "AttributeString" );
   SALOMEDS::AttributeString_var aStringAttrib = SALOMEDS::AttributeString::_narrow( anAttr );
 
   std::string aString;
-  for( int i = 0, n = anObjectParameters->length(); i < n; i++ ) {
-    std::string aParameter = anObjectParameters->operator[](i).in();
-    if( aParameter != "" )
-    {
-      if( aString != "" )
-        aString += ", ";
-      aString += aParameter;
-    }
+  for( int i = 0, n = aParameters->length(); i < n; i++ ) {
+    std::string aParameter = aParameters->operator[](i).in();
+    aString += aParameter;
+    if( i != n-1 )
+      aString += ":";
   }
+
   aStringAttrib->SetValue( aString.c_str() );
   aStringAttrib->Destroy();
 }
index 000bc95e84c79b38ceecd757025d65c5e847562e..f0f7c923bf1bcb50ab0768486b490a4d36f24d6d 100644 (file)
@@ -2627,6 +2627,7 @@ ExtrusionAlongPathX(const SMESH::long_array&   IDsOfElements,
                 << ( HasRefPoint ? RefPoint.x : 0 ) << ", "
                 << ( HasRefPoint ? RefPoint.y : 0 ) << ", "
                 << ( HasRefPoint ? RefPoint.z : 0 ) << " ), "
+                << MakeGroups << ", "
                 << ElemType << " )";
   }
   return aGroups;
index 66a53a4bcc6ec0461cc692e213e243df862c92dd..e67f5f86c1ce9f0d43ac6eec4e1533ab11149011 100644 (file)
@@ -3431,7 +3431,7 @@ void SMESH_Mesh_i::SetParameters( SALOME::Notebook_ptr theNotebook, const SALOME
   }
   _impl->SetParameters( aParams );
 
-  UpdateStringAttribute();
+  UpdateStringAttribute( theParameters );
 }
 
 //=============================================================================
@@ -3464,17 +3464,12 @@ void SMESH_Mesh_i::Update( SALOME::Notebook_ptr theNotebook )
  * \brief Update string attribute of mesh
  */
 //=============================================================================
-void SMESH_Mesh_i::UpdateStringAttribute()
+void SMESH_Mesh_i::UpdateStringAttribute( const SALOME::StringArray& theParameters )
 {
+  // implementation of the method has been temporarily changed
+  // previous implementation can be found in revision 1.23.2.7.2.2.2.6
   SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
 
-  SALOME::Notebook_ptr aNotebook = aSMESHGen->GetNotebook( GetStudyId() );
-
-  SALOME::StringArray* anObjectParameters = aNotebook->GetObjectParameters( GetComponent(), GetEntry() );
-  int aParametersLength = anObjectParameters ? anObjectParameters->length() : 0;
-  if( aParametersLength == 0 )
-    return;
-
   SALOMEDS::Study_ptr aStudy = aSMESHGen->GetStudy( GetStudyId() );
   SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
   SALOMEDS::SObject_var aSObject = SMESH_Gen_i::ObjectToSObject( aStudy, SMESH::SMESH_Mesh::_narrow( _this() ) );
@@ -3484,16 +3479,18 @@ void SMESH_Mesh_i::UpdateStringAttribute()
   SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute( aSObject, "AttributeString" );
   SALOMEDS::AttributeString_var aStringAttrib = SALOMEDS::AttributeString::_narrow( anAttr );
 
+  std::string aCurrentString = aStringAttrib->Value();
   std::string aString;
-  for( int i = 0, n = anObjectParameters->length(); i < n; i++ ) {
-    std::string aParameter = anObjectParameters->operator[](i).in();
-    if( aParameter != "" )
-    {
-      if( aString != "" )
-        aString += ", ";
-      aString += aParameter;
-    }
+  if( aCurrentString != "" )
+    aString = aCurrentString + "|";
+
+  for( int i = 0, n = theParameters.length(); i < n; i++ ) {
+    std::string aParameter = theParameters[i].in();
+    aString += aParameter;
+    if( i != n-1 )
+      aString += ":";
   }
+
   aStringAttrib->SetValue( aString.c_str() );
   aStringAttrib->Destroy();
 }
index c36146eccd0029fcb63aa91c8238a21179092c28..13862b9a117370a72cd5ac9eb1310939c33f9d61 100644 (file)
@@ -504,7 +504,7 @@ public:
   /*!
    * Update string attribute of mesh
    */
-  virtual void UpdateStringAttribute();
+  virtual void UpdateStringAttribute( const SALOME::StringArray& theParameters );
 
   /*!
    * Returns statistic of mesh elements
index 09083c3b956a201cd057e3bdd1faca74a2c553fb..f5f8a12a3be1f478f1310203f32c9d9aaea7e919 100644 (file)
@@ -258,12 +258,14 @@ void SMESH_NoteBook::ReplaceVariables()
         if(aMethod.IsEqual("SetLength")) {
           if(!aStates->GetCurrectState().at(0).IsEmpty() )
             aCmd->SetArg(1,aStates->GetCurrectState().at(0));
-          aStates->IncrementState();
+          // here and below IncrementState() is commented for hypothesis commands
+          // because at the current moment all hypotheses have only one state
+          //aStates->IncrementState();
         }
         else if(aMethod.IsEqual("SetPrecision")) {
           if(!aStates->GetCurrectState().at(1).IsEmpty() )
             aCmd->SetArg(1,aStates->GetCurrectState().at(1));
-          aStates->IncrementState();
+          //aStates->IncrementState();
         }
       }
       
@@ -273,7 +275,7 @@ void SMESH_NoteBook::ReplaceVariables()
         if(aMethod == "SetLength") {
           if(!aStates->GetCurrectState().at(0).IsEmpty() )
             aCmd->SetArg(1,aStates->GetCurrectState().at(0));
-          aStates->IncrementState();
+          //aStates->IncrementState();
         }
       }
 
@@ -286,7 +288,7 @@ void SMESH_NoteBook::ReplaceVariables()
             aCmd->SetArg(1,aStates->GetCurrectState().at(0));
           else if(!aStates->GetCurrectState().at(1).IsEmpty())
             aCmd->SetArg(1,aStates->GetCurrectState().at(1));
-          aStates->IncrementState();
+          //aStates->IncrementState();
         }
       }
       
@@ -295,7 +297,7 @@ void SMESH_NoteBook::ReplaceVariables()
         if(aMethod == "SetDeflection" && aStates->GetCurrectState().size() >= 1) {
           if(!aStates->GetCurrectState().at(0).IsEmpty() )
             aCmd->SetArg(1,aStates->GetCurrectState().at(0));
-          aStates->IncrementState();
+          //aStates->IncrementState();
         }
       }
       
@@ -314,7 +316,7 @@ void SMESH_NoteBook::ReplaceVariables()
         if(aMethod == "SetMaxElementArea" && aStates->GetCurrectState().size() >= 1) {
           if(!aStates->GetCurrectState().at(0).IsEmpty() )
             aCmd->SetArg(1,aStates->GetCurrectState().at(0));
-          aStates->IncrementState();
+          //aStates->IncrementState();
         }
       }
 
@@ -323,7 +325,7 @@ void SMESH_NoteBook::ReplaceVariables()
         if(aMethod == "SetMaxElementVolume" && aStates->GetCurrectState().size() >= 1) {
           if(!aStates->GetCurrectState().at(0).IsEmpty() )
             aCmd->SetArg(1,aStates->GetCurrectState().at(0));
-          aStates->IncrementState();
+          //aStates->IncrementState();
         }
       }
 
@@ -333,22 +335,22 @@ void SMESH_NoteBook::ReplaceVariables()
         if(aMethod == "SetMaxSize" && aStates->GetCurrectState().size() >= 1) {
           if(!aStates->GetCurrectState().at(0).IsEmpty() )
             aCmd->SetArg(1,aStates->GetCurrectState().at(0));
-          aStates->IncrementState();
+          //aStates->IncrementState();
         }
         else if(aMethod == "SetGrowthRate" && aStates->GetCurrectState().size() >= 2) {
           if(!aStates->GetCurrectState().at(1).IsEmpty() )
             aCmd->SetArg(1,aStates->GetCurrectState().at(1));
-          aStates->IncrementState();
+          //aStates->IncrementState();
         }
         else if(aMethod == "SetNbSegPerEdge" && aStates->GetCurrectState().size() >= 3) {
           if(!aStates->GetCurrectState().at(2).IsEmpty() )
             aCmd->SetArg(1,aStates->GetCurrectState().at(2));
-          aStates->IncrementState();
+          //aStates->IncrementState();
         } 
         else if(aMethod == "SetNbSegPerRadius" && aStates->GetCurrectState().size() >= 4) {
           if(!aStates->GetCurrectState().at(3).IsEmpty() )
             aCmd->SetArg(1,aStates->GetCurrectState().at(3));
-          aStates->IncrementState();
+          //aStates->IncrementState();
         } 
       }
 
@@ -360,29 +362,30 @@ void SMESH_NoteBook::ReplaceVariables()
            aStates->GetCurrectState().size() >= 1) {
           if(!aStates->GetCurrectState().at(0).IsEmpty() )
             aCmd->SetArg(1,aStates->GetCurrectState().at(0));
-          aStates->IncrementState();
+          //aStates->IncrementState();
         }
         else if(aMethod == "SetMaxElementArea" && aStates->GetCurrectState().size() >= 2) {
           if(!aStates->GetCurrectState().at(1).IsEmpty() )
             aCmd->SetArg(1,aStates->GetCurrectState().at(1));
-          aStates->IncrementState();
+          //aStates->IncrementState();
         }
         else if(aMethod == "SetMaxElementVolume" && aStates->GetCurrectState().size() >= 3) {
           if(!aStates->GetCurrectState().at(2).IsEmpty() )
             aCmd->SetArg(1,aStates->GetCurrectState().at(2));
-          aStates->IncrementState();
+          //aStates->IncrementState();
         }
         else if(aMethod == "LengthFromEdges" || aMethod == "LengthFromFaces"){
-          aStates->IncrementState();
+          //aStates->IncrementState();
         }
       }
       
-      // Case for NumberOfLayers hypothesis
-      else if(aStates->GetObjectType().IsEqual("NumberOfLayers")){
+      // Case for NumberOfLayers or NumberOfLayers2D hypothesis
+      else if(aStates->GetObjectType().IsEqual("NumberOfLayers") ||
+              aStates->GetObjectType().IsEqual("NumberOfLayers2D")){
         if(aMethod == "SetNumberOfLayers" && aStates->GetCurrectState().size() >= 1) {
           if(!aStates->GetCurrectState().at(0).IsEmpty() )
             aCmd->SetArg(1,aStates->GetCurrectState().at(0));
-          aStates->IncrementState();
+          //aStates->IncrementState();
         }
       }
 
@@ -391,13 +394,13 @@ void SMESH_NoteBook::ReplaceVariables()
         if(aMethod == "SetNumberOfSegments" && aStates->GetCurrectState().size() >= 1) {
           if(!aStates->GetCurrectState().at(0).IsEmpty() )
             aCmd->SetArg(1,aStates->GetCurrectState().at(0));
-          if(aStates->GetCurrectState().size()==1)
-            aStates->IncrementState();
+          //if(aStates->GetCurrectState().size()==1)
+          //  aStates->IncrementState();
         }
         else if (aMethod == "SetScaleFactor" && aStates->GetCurrectState().size() >= 2) {
           if(!aStates->GetCurrectState().at(1).IsEmpty() )
             aCmd->SetArg(1,aStates->GetCurrectState().at(1));
-          aStates->IncrementState();
+          //aStates->IncrementState();
         }
       }
       
@@ -552,7 +555,9 @@ void SMESH_NoteBook::ReplaceVariables()
           }
           aStates->IncrementState();
         }
-        else if(aMethod.IsEqual("ExtrusionAlongPath") ||
+        else if(aMethod.IsEqual("ExtrusionAlongPathX") ||    // new version of extrusion along path (issue 20003)
+                aMethod.IsEqual("ExtrusionAlongPathObjX") || // no comments 0_o
+                aMethod.IsEqual("ExtrusionAlongPath") ||
                 aMethod.IsEqual("ExtrusionAlongPathObject") ||
                 aMethod.IsEqual("ExtrusionAlongPathObject1D") ||
                 aMethod.IsEqual("ExtrusionAlongPathObject2D") ||
@@ -570,26 +575,33 @@ void SMESH_NoteBook::ReplaceVariables()
           int anArgIndex = 0;
           for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) {
             if(aCmd->GetArg(i).IsEqual("SMESH.PointStruct")) {
-              anArgIndex = i-1-aNbAngles;
+              anArgIndex = i-3;
               break;
             }
           }
-          if(anArgIndex > 0) {
-            int j = 0;
-            for(; j < aNbAngles; j++) {
-              if(!aCurrentState.at(j).IsEmpty()) {
-                aCmd->SetArg(anArgIndex+j-1, aCurrentState.at(j));
+          if(anArgIndex > 0) { // the argument should be parsed like that: [ 1, 2, 3 ] -> [ "a", 2, "b" ]
+            TCollection_AsciiString anAngleArg = aCmd->GetArg(anArgIndex);
+            for(int anIndex = 1; anIndex <= aNbAngles; anIndex++) {
+              int aPos1 = anIndex == 1 ? 1 : anAngleArg.Location(anIndex-1, ',', 1, anAngleArg.Length());
+              int aPos2 = anIndex == aNbAngles ? anAngleArg.Length() : anAngleArg.Location(anIndex, ',', 1, anAngleArg.Length());
+              TCollection_AsciiString aParameter = anAngleArg.SubString(aPos1+1, aPos2-1);
+              if(!aCurrentState.at(anIndex-1).IsEmpty()) {
+                TCollection_AsciiString aSubst = aCurrentState.at(anIndex-1);
+                aSubst.Prepend(TCollection_AsciiString(" "));
+                anAngleArg.Remove(aPos1+1, aPos2-aPos1-1);
+                anAngleArg.Insert(aPos1+1, aSubst);
               }
             }
-            for(; j < aNbAngles+3; j++) {
-              if(!aCurrentState.at(j).IsEmpty()) {
+            aCmd->SetArg(anArgIndex, anAngleArg);
+            for(int j = 0; j < 3; j++) {
+              if(!aCurrentState.at(j+aNbAngles).IsEmpty()) {
                 isSubstitute = true;
-                aCmd->SetArg(anArgIndex+j+2, aCurrentState.at(j));
+                aCmd->SetArg(anArgIndex+4+j, aCurrentState.at(j+aNbAngles));
               }
             }
           }
           if(isSubstitute)
-            aCmd->SetArg(anArgIndex + aNbAngles + 1,
+            aCmd->SetArg(anArgIndex + 3,
                          TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".PointStructStr");
           aStates->IncrementState();
         }
@@ -632,6 +644,51 @@ void SMESH_NoteBook::ReplaceVariables()
   
   ProcessLayerDistribution();
 }
+
+//============================================================================
+// function : splitString
+// purpose  : The functions returns a list of substring of initial string 
+//            divided by given separator include empty strings
+//============================================================================
+std::vector<std::string> splitString(const std::string& theValue, char sep)
+{
+  std::vector<std::string> aResult;
+  if(theValue[0] == sep ) aResult.push_back(std::string());
+  int pos = theValue.find(sep);
+  if(pos < 0 ) {
+    aResult.push_back(theValue);
+    return aResult;
+  }
+
+  std::string s = theValue;
+  if(s[0] == sep) s = s.substr(1, s.size());
+  while((pos = s.find(sep)) >= 0) {
+    aResult.push_back(s.substr(0, pos));
+    s = s.substr(pos+1, s.size());
+  }
+
+  if(!s.empty() && s[0] != sep) aResult.push_back(s);
+  if(theValue[theValue.size()-1] == sep) aResult.push_back(std::string());
+
+  return aResult;
+}
+
+//============================================================================
+// function : splitString
+// purpose  : The functions returns a list of lists of substrings of initial string 
+//            divided by two given separators include empty strings
+//============================================================================
+std::vector< std::vector<std::string> > splitString(const std::string& theValue, char sep1, char sep2)
+{
+  std::vector< std::vector<std::string> > aResult;
+  if(theValue.size() > 0) {
+    std::vector<std::string> aSections = splitString( theValue, sep1 );
+    for( int i = 0, n = aSections.size(); i < n; i++ )
+      aResult.push_back( splitString( aSections[i], sep2 ) );
+  }
+  return aResult;
+}
+
 //================================================================================
 /*!
  * \brief Private method
@@ -639,7 +696,6 @@ void SMESH_NoteBook::ReplaceVariables()
 //================================================================================
 void SMESH_NoteBook::InitObjectMap()
 {
-  /* ouv: temporarily disabled
   SMESH_Gen_i *aGen = SMESH_Gen_i::GetSMESHGen();
   if(!aGen)
     return;
@@ -653,13 +709,13 @@ void SMESH_NoteBook::InitObjectMap()
     return;
   
   SALOMEDS::ChildIterator_var Itr = aStudy->NewChildIterator(aSO);
-  char* aParameters;
+  std::string aParameters;
   for(Itr->InitEx(true); Itr->More(); Itr->Next()) {
     SALOMEDS::SObject_var aSObject = Itr->Value();
     SALOMEDS::GenericAttribute_var anAttr;
     if ( aSObject->FindAttribute(anAttr, "AttributeString")) {
       aParameters = SALOMEDS::AttributeString::_narrow(anAttr)->Value();
-      SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(aParameters);
+      std::vector< std::vector<string> > aSections = splitString(aParameters, '|', ':');
       if(MYDEBUG) {
         cout<<"Entry : "<< aSObject->GetID()<<endl;
         cout<<"aParameters : "<<aParameters<<endl;
@@ -682,12 +738,12 @@ void SMESH_NoteBook::InitObjectMap()
       else
         aState = new  ObjectStates(anObjType);
       
-      for(int i = 0; i < aSections->length(); i++) {
+      for(int i = 0; i < aSections.size(); i++) {
         TState aVars;
-        SALOMEDS::ListOfStrings aListOfVars = aSections[i];
-        for(int j = 0;j<aListOfVars.length();j++) {
-          TCollection_AsciiString aVar(aListOfVars[j].in());
-          if(!aVar.IsEmpty() && aStudy->IsVariable(aVar.ToCString())) {
+        std::vector<string> aListOfVars = aSections[i];
+        for(int j = 0;j<aListOfVars.size();j++) {
+          TCollection_AsciiString aVar(aListOfVars[j].c_str());
+          if(!aVar.IsEmpty()) {
             aVar.InsertBefore(1,"\"");
             aVar.InsertAfter(aVar.Length(),"\"");
           }
@@ -701,7 +757,24 @@ void SMESH_NoteBook::InitObjectMap()
       _objectMap.insert(pair<TCollection_AsciiString,ObjectStates*>(TCollection_AsciiString(aSObject->GetID()),aState));
     }
   }
-  */
+
+  if(MYDEBUG) {
+    printf( "_objectMap:\n" );
+    std::map<TCollection_AsciiString,ObjectStates*>::const_iterator it1 = _objectMap.begin();
+    for( ; it1 != _objectMap.end(); ++it1 ) {
+      TCollection_AsciiString aName = (*it1).first;
+      ObjectStates* aStates = (*it1).second;
+      printf( "  Name = %s\n", aName.ToCString() );
+      TAllStates anAllStates = aStates->GetAllStates();
+      for( int i = 0; i < anAllStates.size(); i++ ) {
+        TState aState = anAllStates[i];
+        printf( "  %d - ( ", i );
+        for( int j = 0; j < aState.size(); j++ )
+          printf( "%s ", aState[j].ToCString() );
+        printf( ")\n" );
+      }
+    }
+  }
 }
 
 //================================================================================
index 7b91e2fb8be90e6e8424fcc9729218fde237ebad..7352db05024f4ccf344b52203d2c5f215a88208b 100644 (file)
@@ -199,9 +199,6 @@ def DegreesToRadians(AngleInDegrees):
     from math import pi
     return AngleInDegrees * pi / 180.0
 
-# Salome notebook variable separator
-var_separator = ":"
-
 # Parametrized substitute for PointStruct
 class PointStructStr:
 
@@ -331,62 +328,91 @@ class DirStructStr:
     def __init__(self, pointStruct):
         self.pointStruct = pointStruct
 
+# Returns value of the parameter
+def ParseValue(Parameter, ConvertToRadians = False):
+    Result = Parameter
+    if isinstance(Parameter, str):
+        p = notebook.get(Parameter)
+        if p == None:
+            notebook.getNotebook().AddExpression(Parameter)
+            p = notebook.get(Parameter)
+        if ConvertToRadians:
+            p = DegreesToRadians(p)
+        Result = p
+    return Result
+
+# Returns the input parameter unchanged if it is a string or empty string otherwise
+def ParseString(Parameter):
+    Result = ""
+    if isinstance(Parameter, str):
+        Result = Parameter
+    return Result    
+
 # Returns list of variable values from salome notebook
 def ParsePointStruct(Point):
-    Parameters = 2*var_separator
+    Parameters = []
     if isinstance(Point, PointStructStr):
-        Parameters = str(Point.xStr) + var_separator + str(Point.yStr) + var_separator + str(Point.zStr)
-        Point = PointStruct(Point.x, Point.y, Point.z)
+        Parameters.append(ParseString(Point.xStr))
+        Parameters.append(ParseString(Point.yStr))
+        Parameters.append(ParseString(Point.zStr))
+        Point = PointStruct(ParseValue(Point.x),
+                            ParseValue(Point.y),
+                            ParseValue(Point.z))
     return Point, Parameters
 
 # Returns list of variable values from salome notebook
 def ParseDirStruct(Dir):
-    Parameters = 2*var_separator
+    Parameters = []
     if isinstance(Dir, DirStructStr):
         pntStr = Dir.pointStruct
         if isinstance(pntStr, PointStructStr6):
-            Parameters = str(pntStr.x1Str) + var_separator + str(pntStr.x2Str) + var_separator
-            Parameters += str(pntStr.y1Str) + var_separator + str(pntStr.y2Str) + var_separator 
-            Parameters += str(pntStr.z1Str) + var_separator + str(pntStr.z2Str)
-            Point = PointStruct(pntStr.x2 - pntStr.x1, pntStr.y2 - pntStr.y1, pntStr.z2 - pntStr.z1)
+            Parameters.append(ParseString(pntStr.x1Str))
+            Parameters.append(ParseString(pntStr.x2Str))
+            Parameters.append(ParseString(pntStr.y1Str))
+            Parameters.append(ParseString(pntStr.y2Str))
+            Parameters.append(ParseString(pntStr.z1Str))
+            Parameters.append(ParseString(pntStr.z2Str))
+            Point = PointStruct(ParseValue(pntStr.x2) - ParseValue(pntStr.x1),
+                                ParseValue(pntStr.y2) - ParseValue(pntStr.y1),
+                                ParseValue(pntStr.z2) - ParseValue(pntStr.z1))
         else:
-            Parameters = str(pntStr.xStr) + var_separator + str(pntStr.yStr) + var_separator + str(pntStr.zStr)
-            Point = PointStruct(pntStr.x, pntStr.y, pntStr.z)
+            Parameters.append(ParseString(pntStr.xStr))
+            Parameters.append(ParseString(pntStr.yStr))
+            Parameters.append(ParseString(pntStr.zStr))
+            Point = PointStruct(ParseValue(pntStr.x),
+                                ParseValue(pntStr.y),
+                                ParseValue(pntStr.z))
         Dir = DirStruct(Point)
     return Dir, Parameters
 
 # Returns list of variable values from salome notebook
 def ParseAxisStruct(Axis):
-    Parameters = 5*var_separator
+    Parameters = []
     if isinstance(Axis, AxisStructStr):
-        Parameters = str(Axis.xStr) + var_separator + str(Axis.yStr) + var_separator + str(Axis.zStr) + var_separator
-        Parameters += str(Axis.dxStr) + var_separator + str(Axis.dyStr) + var_separator + str(Axis.dzStr)
-        Axis = AxisStruct(Axis.x, Axis.y, Axis.z, Axis.dx, Axis.dy, Axis.dz)
+        Parameters.append(ParseString(Axis.xStr))
+        Parameters.append(ParseString(Axis.yStr))
+        Parameters.append(ParseString(Axis.zStr))
+        Parameters.append(ParseString(Axis.dxStr))
+        Parameters.append(ParseString(Axis.dyStr))
+        Parameters.append(ParseString(Axis.dzStr))
+        Axis = AxisStruct(ParseValue(Axis.x),
+                          ParseValue(Axis.y),
+                          ParseValue(Axis.z),
+                          ParseValue(Axis.dx),
+                          ParseValue(Axis.dy),
+                          ParseValue(Axis.dz))
     return Axis, Parameters
 
 ## Return list of variable values from salome notebook
 def ParseAngles(list):
     Result = []
-    Parameters = ""
+    Parameters = []
     for parameter in list:
-        if isinstance(parameter,str) and notebook.isVariable(parameter):
-            Result.append(DegreesToRadians(notebook.get(parameter)))
-            pass
-        else:
-            Result.append(parameter)
-            pass
-        
-        Parameters = Parameters + str(parameter)
-        Parameters = Parameters + var_separator
+        Result.append(ParseValue(parameter, True))
+        Parameters.append(ParseString(parameter))
         pass
-    Parameters = Parameters[:len(Parameters)-1]
     return Result, Parameters
     
-## Wrapper for SetParameters method
-def SetParameters( obj, params ):
-    #obj.SetParameters( notebook.getNotebook(), params )
-    pass
-
 def IsEqual(val1, val2, tol=PrecisionConfusion):
     if abs(val1 - val2) < tol:
         return True
@@ -656,7 +682,7 @@ class smeshDC(SMESH._objref_SMESH_Gen):
         else:
             aSmeshMesh = SMESH._objref_SMESH_Gen.Concatenate(
                 self,meshes,uniteIdenticalGroups,mergeNodesAndElements,mergeTolerance)
-        SetParameters(aSmeshMesh, Parameters)
+        geompyDC.SetParameters(aSmeshMesh, Parameters)
         aMesh = Mesh(self, self.geompyD, aSmeshMesh)
         return aMesh
 
@@ -2044,7 +2070,7 @@ class Mesh:
     #  @ingroup l2_modif_add
     def AddNode(self, x, y, z):
         x,y,z,Parameters = geompyDC.ParseParameters(x,y,z)
-        SetParameters(self.mesh, Parameters)
+        geompyDC.SetParameters(self.mesh, Parameters)
         return self.editor.AddNode( x, y, z)
 
     ## Creates a 0D element on a node with given number.
@@ -2208,7 +2234,7 @@ class Mesh:
     #  @ingroup l2_modif_movenode
     def MoveNode(self, NodeID, x, y, z):
         x,y,z,Parameters = geompyDC.ParseParameters(x,y,z)
-        SetParameters(self.mesh, Parameters)
+        geompyDC.SetParameters(self.mesh, Parameters)
         return self.editor.MoveNode(NodeID, x, y, z)
 
     ## Finds the node closest to a point and moves it to a point location
@@ -2221,7 +2247,7 @@ class Mesh:
     #  @ingroup l2_modif_throughp
     def MoveClosestNodeToPoint(self, x, y, z, NodeID):
         x,y,z,Parameters = geompyDC.ParseParameters(x,y,z)
-        SetParameters(self.mesh, Parameters)
+        geompyDC.SetParameters(self.mesh, Parameters)
         return self.editor.MoveClosestNodeToPoint(x, y, z, NodeID)
 
     ## Finds the node closest to a point
@@ -2309,7 +2335,7 @@ class Mesh:
             MaxAngle = DegreesToRadians(MaxAngle)
         if IDsOfElements == []:
             IDsOfElements = self.GetElementsId()
-        SetParameters(self.mesh, Parameters)
+        geompyDC.SetParameters(self.mesh, Parameters)
         Functor = 0
        if ( isinstance( theCriterion, SMESH._objref_NumericalFunctor ) ):
             Functor = theCriterion
@@ -2534,7 +2560,7 @@ class Mesh:
         if IDsOfElements == []:
             IDsOfElements = self.GetElementsId()
         MaxNbOfIterations,MaxAspectRatio,Parameters = geompyDC.ParseParameters(MaxNbOfIterations,MaxAspectRatio)
-        SetParameters(self.mesh, Parameters)
+        geompyDC.SetParameters(self.mesh, Parameters)
         return self.editor.Smooth(IDsOfElements, IDsOfFixedNodes,
                                   MaxNbOfIterations, MaxAspectRatio, Method)
 
@@ -2568,7 +2594,7 @@ class Mesh:
         if IDsOfElements == []:
             IDsOfElements = self.GetElementsId()
         MaxNbOfIterations,MaxAspectRatio,Parameters = geompyDC.ParseParameters(MaxNbOfIterations,MaxAspectRatio)
-        SetParameters(self.mesh, Parameters)
+        geompyDC.SetParameters(self.mesh, Parameters)
         return self.editor.SmoothParametric(IDsOfElements, IDsOfFixedNodes,
                                             MaxNbOfIterations, MaxAspectRatio, Method)
 
@@ -2645,8 +2671,8 @@ class Mesh:
         if TotalAngle and NbOfSteps:
             AngleInRadians /= NbOfSteps
         NbOfSteps,Tolerance,Parameters = geompyDC.ParseParameters(NbOfSteps,Tolerance)
-        Parameters = AxisParameters + var_separator + AngleParameters + var_separator + Parameters
-        SetParameters(self.mesh, Parameters)
+        Parameters = AxisParameters + AngleParameters + Parameters
+        geompyDC.SetParameters(self.mesh, Parameters)
         if MakeGroups:
             return self.editor.RotationSweepMakeGroups(IDsOfElements, Axis,
                                                        AngleInRadians, NbOfSteps, Tolerance)
@@ -2680,8 +2706,8 @@ class Mesh:
         if TotalAngle and NbOfSteps:
             AngleInRadians /= NbOfSteps
         NbOfSteps,Tolerance,Parameters = geompyDC.ParseParameters(NbOfSteps,Tolerance)
-        Parameters = AxisParameters + var_separator + AngleParameters + var_separator + Parameters
-        SetParameters(self.mesh, Parameters)
+        Parameters = AxisParameters + AngleParameters + Parameters
+        geompyDC.SetParameters(self.mesh, Parameters)
         if MakeGroups:
             return self.editor.RotationSweepObjectMakeGroups(theObject, Axis, AngleInRadians,
                                                              NbOfSteps, Tolerance)
@@ -2715,8 +2741,8 @@ class Mesh:
         if TotalAngle and NbOfSteps:
             AngleInRadians /= NbOfSteps
         NbOfSteps,Tolerance,Parameters = geompyDC.ParseParameters(NbOfSteps,Tolerance)
-        Parameters = AxisParameters + var_separator + AngleParameters + var_separator + Parameters
-        SetParameters(self.mesh, Parameters)
+        Parameters = AxisParameters + AngleParameters + Parameters
+        geompyDC.SetParameters(self.mesh, Parameters)
         if MakeGroups:
             return self.editor.RotationSweepObject1DMakeGroups(theObject, Axis, AngleInRadians,
                                                                NbOfSteps, Tolerance)
@@ -2750,8 +2776,8 @@ class Mesh:
         if TotalAngle and NbOfSteps:
             AngleInRadians /= NbOfSteps
         NbOfSteps,Tolerance,Parameters = geompyDC.ParseParameters(NbOfSteps,Tolerance)
-        Parameters = AxisParameters + var_separator + AngleParameters + var_separator + Parameters
-        SetParameters(self.mesh, Parameters)
+        Parameters = AxisParameters + AngleParameters + Parameters
+        geompyDC.SetParameters(self.mesh, Parameters)
         if MakeGroups:
             return self.editor.RotationSweepObject2DMakeGroups(theObject, Axis, AngleInRadians,
                                                              NbOfSteps, Tolerance)
@@ -2772,8 +2798,8 @@ class Mesh:
             StepVector = self.smeshpyD.GetDirStruct(StepVector)
         StepVector,StepVectorParameters = ParseDirStruct(StepVector)
         NbOfSteps,Parameters = geompyDC.ParseParameters(NbOfSteps)
-        Parameters = StepVectorParameters + var_separator + Parameters
-        SetParameters(self.mesh, Parameters)
+        Parameters = StepVectorParameters + Parameters
+        geompyDC.SetParameters(self.mesh, Parameters)
         if MakeGroups:
             return self.editor.ExtrusionSweepMakeGroups(IDsOfElements, StepVector, NbOfSteps)
         self.editor.ExtrusionSweep(IDsOfElements, StepVector, NbOfSteps)
@@ -2814,8 +2840,8 @@ class Mesh:
             StepVector = self.smeshpyD.GetDirStruct(StepVector)
         StepVector,StepVectorParameters = ParseDirStruct(StepVector)
         NbOfSteps,Parameters = geompyDC.ParseParameters(NbOfSteps)
-        Parameters = StepVectorParameters + var_separator + Parameters
-        SetParameters(self.mesh, Parameters)
+        Parameters = StepVectorParameters + Parameters
+        geompyDC.SetParameters(self.mesh, Parameters)
         if MakeGroups:
             return self.editor.ExtrusionSweepObjectMakeGroups(theObject, StepVector, NbOfSteps)
         self.editor.ExtrusionSweepObject(theObject, StepVector, NbOfSteps)
@@ -2835,8 +2861,8 @@ class Mesh:
             StepVector = self.smeshpyD.GetDirStruct(StepVector)
         StepVector,StepVectorParameters = ParseDirStruct(StepVector)
         NbOfSteps,Parameters = geompyDC.ParseParameters(NbOfSteps)
-        Parameters = StepVectorParameters + var_separator + Parameters
-        SetParameters(self.mesh, Parameters)
+        Parameters = StepVectorParameters + Parameters
+        geompyDC.SetParameters(self.mesh, Parameters)
         if MakeGroups:
             return self.editor.ExtrusionSweepObject1DMakeGroups(theObject, StepVector, NbOfSteps)
         self.editor.ExtrusionSweepObject1D(theObject, StepVector, NbOfSteps)
@@ -2856,8 +2882,8 @@ class Mesh:
             StepVector = self.smeshpyD.GetDirStruct(StepVector)
         StepVector,StepVectorParameters = ParseDirStruct(StepVector)
         NbOfSteps,Parameters = geompyDC.ParseParameters(NbOfSteps)
-        Parameters = StepVectorParameters + var_separator + Parameters
-        SetParameters(self.mesh, Parameters)
+        Parameters = StepVectorParameters + Parameters
+        geompyDC.SetParameters(self.mesh, Parameters)
         if MakeGroups:
             return self.editor.ExtrusionSweepObject2DMakeGroups(theObject, StepVector, NbOfSteps)
         self.editor.ExtrusionSweepObject2D(theObject, StepVector, NbOfSteps)
@@ -2891,8 +2917,8 @@ class Mesh:
         if ( isinstance( RefPoint, geompyDC.GEOM._objref_GEOM_Object)):
             RefPoint = self.smeshpyD.GetPointStruct(RefPoint)
             pass
-        Parameters = AnglesParameters + var_separator + RefPointParameters
-        SetParameters(self.mesh, Parameters)
+        Parameters = AnglesParameters + RefPointParameters
+        geompyDC.SetParameters(self.mesh, Parameters)
 
         if isinstance(Base,list):
             IDsOfElements = []
@@ -2943,8 +2969,8 @@ class Mesh:
         if HasAngles and Angles and LinearVariation:
             Angles = self.editor.LinearAnglesVariation( PathMesh, PathShape, Angles )
             pass
-        Parameters = AnglesParameters + var_separator + RefPointParameters
-        SetParameters(self.mesh, Parameters)
+        Parameters = AnglesParameters + RefPointParameters
+        geompyDC.SetParameters(self.mesh, Parameters)
         if MakeGroups:
             return self.editor.ExtrusionAlongPathMakeGroups(IDsOfElements, PathMesh,
                                                             PathShape, NodeStart, HasAngles,
@@ -2984,8 +3010,8 @@ class Mesh:
         if HasAngles and Angles and LinearVariation:
             Angles = self.editor.LinearAnglesVariation( PathMesh, PathShape, Angles )
             pass
-        Parameters = AnglesParameters + var_separator + RefPointParameters
-        SetParameters(self.mesh, Parameters)
+        Parameters = AnglesParameters + RefPointParameters
+        geompyDC.SetParameters(self.mesh, Parameters)
         if MakeGroups:
             return self.editor.ExtrusionAlongPathObjectMakeGroups(theObject, PathMesh,
                                                                   PathShape, NodeStart, HasAngles,
@@ -3026,8 +3052,8 @@ class Mesh:
         if HasAngles and Angles and LinearVariation:
             Angles = self.editor.LinearAnglesVariation( PathMesh, PathShape, Angles )
             pass
-        Parameters = AnglesParameters + var_separator + RefPointParameters
-        SetParameters(self.mesh, Parameters)
+        Parameters = AnglesParameters + RefPointParameters
+        geompyDC.SetParameters(self.mesh, Parameters)
         if MakeGroups:
             return self.editor.ExtrusionAlongPathObject1DMakeGroups(theObject, PathMesh,
                                                                     PathShape, NodeStart, HasAngles,
@@ -3068,8 +3094,8 @@ class Mesh:
         if HasAngles and Angles and LinearVariation:
             Angles = self.editor.LinearAnglesVariation( PathMesh, PathShape, Angles )
             pass
-        Parameters = AnglesParameters + var_separator + RefPointParameters
-        SetParameters(self.mesh, Parameters)
+        Parameters = AnglesParameters + RefPointParameters
+        geompyDC.SetParameters(self.mesh, Parameters)
         if MakeGroups:
             return self.editor.ExtrusionAlongPathObject2DMakeGroups(theObject, PathMesh,
                                                                     PathShape, NodeStart, HasAngles,
@@ -3093,7 +3119,7 @@ class Mesh:
         if ( isinstance( Mirror, geompyDC.GEOM._objref_GEOM_Object)):
             Mirror = self.smeshpyD.GetAxisStruct(Mirror)
         Mirror,Parameters = ParseAxisStruct(Mirror)
-        SetParameters(self.mesh, Parameters)
+        geompyDC.SetParameters(self.mesh, Parameters)
         if Copy and MakeGroups:
             return self.editor.MirrorMakeGroups(IDsOfElements, Mirror, theMirrorType)
         self.editor.Mirror(IDsOfElements, Mirror, theMirrorType, Copy)
@@ -3116,7 +3142,7 @@ class Mesh:
         Mirror,Parameters = ParseAxisStruct(Mirror)
         mesh = self.editor.MirrorMakeMesh(IDsOfElements, Mirror, theMirrorType,
                                           MakeGroups, NewMeshName)
-        SetParameters(mesh, Parameters)
+        geompyDC.SetParameters(mesh, Parameters)
         return Mesh(self.smeshpyD,self.geompyD,mesh)
 
     ## Creates a symmetrical copy of the object
@@ -3134,7 +3160,7 @@ class Mesh:
         if ( isinstance( Mirror, geompyDC.GEOM._objref_GEOM_Object)):
             Mirror = self.smeshpyD.GetAxisStruct(Mirror)
         Mirror,Parameters = ParseAxisStruct(Mirror)
-        SetParameters(self.mesh, Parameters)
+        geompyDC.SetParameters(self.mesh, Parameters)
         if Copy and MakeGroups:
             return self.editor.MirrorObjectMakeGroups(theObject, Mirror, theMirrorType)
         self.editor.MirrorObject(theObject, Mirror, theMirrorType, Copy)
@@ -3157,7 +3183,7 @@ class Mesh:
         Mirror,Parameters = ParseAxisStruct(Mirror)
         mesh = self.editor.MirrorObjectMakeMesh(theObject, Mirror, theMirrorType,
                                                 MakeGroups, NewMeshName)
-        SetParameters(mesh, Parameters)
+        geompyDC.SetParameters(mesh, Parameters)
         return Mesh( self.smeshpyD,self.geompyD,mesh )
 
     ## Translates the elements
@@ -3173,7 +3199,7 @@ class Mesh:
         if ( isinstance( Vector, geompyDC.GEOM._objref_GEOM_Object)):
             Vector = self.smeshpyD.GetDirStruct(Vector)
         Vector,Parameters = ParseDirStruct(Vector)
-        SetParameters(self.mesh, Parameters)
+        geompyDC.SetParameters(self.mesh, Parameters)
         if Copy and MakeGroups:
             return self.editor.TranslateMakeGroups(IDsOfElements, Vector)
         self.editor.Translate(IDsOfElements, Vector, Copy)
@@ -3193,7 +3219,7 @@ class Mesh:
             Vector = self.smeshpyD.GetDirStruct(Vector)
         Vector,Parameters = ParseDirStruct(Vector)
         mesh = self.editor.TranslateMakeMesh(IDsOfElements, Vector, MakeGroups, NewMeshName)
-        SetParameters(mesh, Parameters)
+        geompyDC.SetParameters(mesh, Parameters)
         return Mesh ( self.smeshpyD, self.geompyD, mesh )
 
     ## Translates the object
@@ -3209,7 +3235,7 @@ class Mesh:
         if ( isinstance( Vector, geompyDC.GEOM._objref_GEOM_Object)):
             Vector = self.smeshpyD.GetDirStruct(Vector)
         Vector,Parameters = ParseDirStruct(Vector)
-        SetParameters(self.mesh, Parameters)
+        geompyDC.SetParameters(self.mesh, Parameters)
         if Copy and MakeGroups:
             return self.editor.TranslateObjectMakeGroups(theObject, Vector)
         self.editor.TranslateObject(theObject, Vector, Copy)
@@ -3229,7 +3255,7 @@ class Mesh:
             Vector = self.smeshpyD.GetDirStruct(Vector)
         Vector,Parameters = ParseDirStruct(Vector)
         mesh = self.editor.TranslateObjectMakeMesh(theObject, Vector, MakeGroups, NewMeshName)
-        SetParameters(mesh, Parameters)
+        geompyDC.SetParameters(mesh, Parameters)
         return Mesh( self.smeshpyD, self.geompyD, mesh )
 
     ## Rotates the elements
@@ -3252,8 +3278,8 @@ class Mesh:
         if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)):
             Axis = self.smeshpyD.GetAxisStruct(Axis)
         Axis,AxisParameters = ParseAxisStruct(Axis)
-        Parameters = AxisParameters + var_separator + Parameters
-        SetParameters(self.mesh, Parameters)
+        Parameters = AxisParameters + Parameters
+        geompyDC.SetParameters(self.mesh, Parameters)
         if Copy and MakeGroups:
             return self.editor.RotateMakeGroups(IDsOfElements, Axis, AngleInRadians)
         self.editor.Rotate(IDsOfElements, Axis, AngleInRadians, Copy)
@@ -3279,10 +3305,10 @@ class Mesh:
         if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)):
             Axis = self.smeshpyD.GetAxisStruct(Axis)
         Axis,AxisParameters = ParseAxisStruct(Axis)
-        Parameters = AxisParameters + var_separator + Parameters
+        Parameters = AxisParameters + Parameters
         mesh = self.editor.RotateMakeMesh(IDsOfElements, Axis, AngleInRadians,
                                           MakeGroups, NewMeshName)
-        SetParameters(mesh, Parameters)
+        geompyDC.SetParameters(mesh, Parameters)
         return Mesh( self.smeshpyD, self.geompyD, mesh )
 
     ## Rotates the object
@@ -3305,8 +3331,8 @@ class Mesh:
         if (isinstance(Axis, geompyDC.GEOM._objref_GEOM_Object)):
             Axis = self.smeshpyD.GetAxisStruct(Axis)
         Axis,AxisParameters = ParseAxisStruct(Axis)
-        Parameters = AxisParameters + ":" + Parameters
-        SetParameters(self.mesh, Parameters)
+        Parameters = AxisParameters + Parameters
+        geompyDC.SetParameters(self.mesh, Parameters)
         if Copy and MakeGroups:
             return self.editor.RotateObjectMakeGroups(theObject, Axis, AngleInRadians)
         self.editor.RotateObject(theObject, Axis, AngleInRadians, Copy)
@@ -3332,10 +3358,10 @@ class Mesh:
         if (isinstance(Axis, geompyDC.GEOM._objref_GEOM_Object)):
             Axis = self.smeshpyD.GetAxisStruct(Axis)
         Axis,AxisParameters = ParseAxisStruct(Axis)
-        Parameters = AxisParameters + ":" + Parameters
+        Parameters = AxisParameters + Parameters
         mesh = self.editor.RotateObjectMakeMesh(theObject, Axis, AngleInRadians,
                                                        MakeGroups, NewMeshName)
-        SetParameters(mesh, Parameters)
+        geompyDC.SetParameters(mesh, Parameters)
         return Mesh( self.smeshpyD, self.geompyD, mesh )
 
     ## Finds groups of ajacent nodes within Tolerance.
@@ -5103,29 +5129,21 @@ import salome_notebook
 notebook = salome_notebook.notebook
 
 ##Return values of the notebook variables
-def ParseParameters(last, nbParams,nbParam, value):
+def ParseParameters(last, nbParams, nbParam, value):
+    #print "ParseParameters", last, nbParams, nbParam, value
     result = None
-    strResult = ""
+    strResult = []
     counter = 0
     listSize = len(last)
     for n in range(0,nbParams):
         if n+1 != nbParam:
             if counter < listSize:
-                strResult = strResult + last[counter]
+                strResult.append( last[counter] )
             else:
-                strResult = strResult + ""
+                strResult = strResult
         else:
-            if isinstance(value, str):
-                if notebook.isVariable(value):
-                    result = notebook.get(value)
-                    strResult=strResult+value
-                else:
-                    raise RuntimeError, "Variable with name '" + value + "' doesn't exist!!!"
-            else:
-                strResult=strResult+str(value)
-                result = value
-        if nbParams - 1 != counter:
-            strResult=strResult+var_separator #":"
+            strResult.append(ParseString(value))
+            result = ParseValue(value)
         counter = counter+1
     return result, strResult
 
@@ -5136,14 +5154,14 @@ class LocalLength(StdMeshers._objref_StdMeshers_LocalLength):
     #  @param length numerical value or name of variable from notebook
     def SetLength(self, length):
         length,parameters = ParseParameters(StdMeshers._objref_StdMeshers_LocalLength.GetParameters(self),2,1,length)
-        #StdMeshers._objref_StdMeshers_LocalLength.SetParameters(self,parameters)
+        geompyDC.SetParameters(self, parameters)
         StdMeshers._objref_StdMeshers_LocalLength.SetLength(self,length)
 
    ## Set Precision parameter value
    #  @param precision numerical value or name of variable from notebook
     def SetPrecision(self, precision):
         precision,parameters = ParseParameters(StdMeshers._objref_StdMeshers_LocalLength.GetParameters(self),2,2,precision)
-        #StdMeshers._objref_StdMeshers_LocalLength.SetParameters(self,parameters)
+        geompyDC.SetParameters(self, parameters)
         StdMeshers._objref_StdMeshers_LocalLength.SetPrecision(self, precision)
 
 #Registering the new proxy for LocalLength
@@ -5168,7 +5186,7 @@ class SegmentLengthAroundVertex(StdMeshers._objref_StdMeshers_SegmentLengthAroun
     #  @param length numerical value or name of variable from notebook    
     def SetLength(self, length):
         length,parameters = ParseParameters(StdMeshers._objref_StdMeshers_SegmentLengthAroundVertex.GetParameters(self),1,1,length)
-        #StdMeshers._objref_StdMeshers_SegmentLengthAroundVertex.SetParameters(self,parameters)
+        geompyDC.SetParameters(self, parameters)
         StdMeshers._objref_StdMeshers_SegmentLengthAroundVertex.SetLength(self,length)
 
 #Registering the new proxy for SegmentLengthAroundVertex
@@ -5186,7 +5204,7 @@ class Arithmetic1D(StdMeshers._objref_StdMeshers_Arithmetic1D):
         if isStart:
             nb = 1
         length,parameters = ParseParameters(StdMeshers._objref_StdMeshers_Arithmetic1D.GetParameters(self),2,nb,length)
-        #StdMeshers._objref_StdMeshers_Arithmetic1D.SetParameters(self,parameters)
+        geompyDC.SetParameters(self, parameters)
         StdMeshers._objref_StdMeshers_Arithmetic1D.SetLength(self,length,isStart)
         
 #Registering the new proxy for Arithmetic1D
@@ -5199,7 +5217,7 @@ class Deflection1D(StdMeshers._objref_StdMeshers_Deflection1D):
     #  @param deflection numerical value or name of variable from notebook    
     def SetDeflection(self, deflection):
         deflection,parameters = ParseParameters(StdMeshers._objref_StdMeshers_Deflection1D.GetParameters(self),1,1,deflection)
-        #StdMeshers._objref_StdMeshers_Deflection1D.SetParameters(self,parameters)
+        geompyDC.SetParameters(self, parameters)
         StdMeshers._objref_StdMeshers_Deflection1D.SetDeflection(self,deflection)
 
 #Registering the new proxy for Deflection1D
@@ -5216,7 +5234,7 @@ class StartEndLength(StdMeshers._objref_StdMeshers_StartEndLength):
         if isStart:
             nb = 1
         length,parameters = ParseParameters(StdMeshers._objref_StdMeshers_StartEndLength.GetParameters(self),2,nb,length)
-        #StdMeshers._objref_StdMeshers_StartEndLength.SetParameters(self,parameters)
+        geompyDC.SetParameters(self, parameters)
         StdMeshers._objref_StdMeshers_StartEndLength.SetLength(self,length,isStart)
         
 #Registering the new proxy for StartEndLength
@@ -5229,7 +5247,7 @@ class MaxElementArea(StdMeshers._objref_StdMeshers_MaxElementArea):
     #  @param area  numerical value or name of variable from notebook
     def SetMaxElementArea(self, area):
         area ,parameters = ParseParameters(StdMeshers._objref_StdMeshers_MaxElementArea.GetParameters(self),1,1,area)
-        #StdMeshers._objref_StdMeshers_MaxElementArea.SetParameters(self,parameters)
+        geompyDC.SetParameters(self, parameters)
         StdMeshers._objref_StdMeshers_MaxElementArea.SetMaxElementArea(self,area)
         
 #Registering the new proxy for MaxElementArea
@@ -5243,7 +5261,7 @@ class MaxElementVolume(StdMeshers._objref_StdMeshers_MaxElementVolume):
     #  @param volume numerical value or name of variable from notebook
     def SetMaxElementVolume(self, volume):
         volume ,parameters = ParseParameters(StdMeshers._objref_StdMeshers_MaxElementVolume.GetParameters(self),1,1,volume)
-        #StdMeshers._objref_StdMeshers_MaxElementVolume.SetParameters(self,parameters)
+        geompyDC.SetParameters(self, parameters)
         StdMeshers._objref_StdMeshers_MaxElementVolume.SetMaxElementVolume(self,volume)
         
 #Registering the new proxy for MaxElementVolume
@@ -5257,12 +5275,25 @@ class NumberOfLayers(StdMeshers._objref_StdMeshers_NumberOfLayers):
     #  @param nbLayers  numerical value or name of variable from notebook
     def SetNumberOfLayers(self, nbLayers):
         nbLayers ,parameters = ParseParameters(StdMeshers._objref_StdMeshers_NumberOfLayers.GetParameters(self),1,1,nbLayers)
-        #StdMeshers._objref_StdMeshers_NumberOfLayers.SetParameters(self,parameters)
+        geompyDC.SetParameters(self, parameters)
         StdMeshers._objref_StdMeshers_NumberOfLayers.SetNumberOfLayers(self,nbLayers)
         
 #Registering the new proxy for NumberOfLayers
 omniORB.registerObjref(StdMeshers._objref_StdMeshers_NumberOfLayers._NP_RepositoryId, NumberOfLayers)
 
+#Wrapper class for StdMeshers_NumberOfLayers2D hypothesis
+class NumberOfLayers2D(StdMeshers._objref_StdMeshers_NumberOfLayers2D):
+    
+    ## Set Number Of Layers parameter value
+    #  @param nbLayers  numerical value or name of variable from notebook
+    def SetNumberOfLayers(self, nbLayers):
+        nbLayers ,parameters = ParseParameters(StdMeshers._objref_StdMeshers_NumberOfLayers2D.GetParameters(self),1,1,nbLayers)
+        geompyDC.SetParameters(self, parameters)
+        StdMeshers._objref_StdMeshers_NumberOfLayers2D.SetNumberOfLayers(self,nbLayers)
+        
+#Registering the new proxy for NumberOfLayers2D
+omniORB.registerObjref(StdMeshers._objref_StdMeshers_NumberOfLayers2D._NP_RepositoryId, NumberOfLayers2D)
+
 #Wrapper class for StdMeshers_NumberOfSegments hypothesis
 class NumberOfSegments(StdMeshers._objref_StdMeshers_NumberOfSegments):
     
@@ -5271,14 +5302,14 @@ class NumberOfSegments(StdMeshers._objref_StdMeshers_NumberOfSegments):
     def SetNumberOfSegments(self, nbSeg):
         lastParameters = StdMeshers._objref_StdMeshers_NumberOfSegments.GetParameters(self)
         nbSeg , parameters = ParseParameters(lastParameters,1,1,nbSeg)
-        #StdMeshers._objref_StdMeshers_NumberOfSegments.SetParameters(self,parameters)
+        geompyDC.SetParameters(self, parameters)
         StdMeshers._objref_StdMeshers_NumberOfSegments.SetNumberOfSegments(self,nbSeg)
         
     ## Set Scale Factor parameter value
     #  @param factor numerical value or name of variable from notebook
     def SetScaleFactor(self, factor):
         factor, parameters = ParseParameters(StdMeshers._objref_StdMeshers_NumberOfSegments.GetParameters(self),2,2,factor)
-        #StdMeshers._objref_StdMeshers_NumberOfSegments.SetParameters(self,parameters)
+        geompyDC.SetParameters(self, parameters)
         StdMeshers._objref_StdMeshers_NumberOfSegments.SetScaleFactor(self,factor)
         
 #Registering the new proxy for NumberOfSegments
@@ -5293,7 +5324,7 @@ if not noNETGENPlugin:
         def SetMaxSize(self, maxsize):
             lastParameters = NETGENPlugin._objref_NETGENPlugin_Hypothesis.GetParameters(self)
             maxsize, parameters = ParseParameters(lastParameters,4,1,maxsize)
-            #NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetParameters(self,parameters)
+            geompyDC.SetParameters(self, parameters)
             NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetMaxSize(self,maxsize)
 
         ## Set Growth Rate parameter value
@@ -5301,7 +5332,7 @@ if not noNETGENPlugin:
         def SetGrowthRate(self, value):
             lastParameters = NETGENPlugin._objref_NETGENPlugin_Hypothesis.GetParameters(self)
             value, parameters = ParseParameters(lastParameters,4,2,value)
-            #NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetParameters(self,parameters)
+            geompyDC.SetParameters(self, parameters)
             NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetGrowthRate(self,value)
 
         ## Set Number of Segments per Edge parameter value
@@ -5309,7 +5340,7 @@ if not noNETGENPlugin:
         def SetNbSegPerEdge(self, value):
             lastParameters = NETGENPlugin._objref_NETGENPlugin_Hypothesis.GetParameters(self)
             value, parameters = ParseParameters(lastParameters,4,3,value)
-            #NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetParameters(self,parameters)
+            geompyDC.SetParameters(self, parameters)
             NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetNbSegPerEdge(self,value)
 
         ## Set Number of Segments per Radius parameter value
@@ -5317,7 +5348,7 @@ if not noNETGENPlugin:
         def SetNbSegPerRadius(self, value):
             lastParameters = NETGENPlugin._objref_NETGENPlugin_Hypothesis.GetParameters(self)
             value, parameters = ParseParameters(lastParameters,4,4,value)
-            #NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetParameters(self,parameters)
+            geompyDC.SetParameters(self, parameters)
             NETGENPlugin._objref_NETGENPlugin_Hypothesis.SetNbSegPerRadius(self,value)
 
     #Registering the new proxy for NETGENPlugin_Hypothesis
@@ -5339,7 +5370,7 @@ if not noNETGENPlugin:
         def SetNumberOfSegments(self, nbSeg):
             lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.GetParameters(self)
             nbSeg, parameters = ParseParameters(lastParameters,2,1,nbSeg)
-            #NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetParameters(self,parameters)
+            geompyDC.SetParameters(self, parameters)
             NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetNumberOfSegments(self, nbSeg)
 
         ## Set Local Length parameter value
@@ -5347,7 +5378,7 @@ if not noNETGENPlugin:
         def SetLocalLength(self, length):
             lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.GetParameters(self)
             length, parameters = ParseParameters(lastParameters,2,1,length)
-            #NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetParameters(self,parameters)
+            geompyDC.SetParameters(self, parameters)
             NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetLocalLength(self, length)
 
         ## Set Max Element Area parameter value
@@ -5355,14 +5386,14 @@ if not noNETGENPlugin:
         def SetMaxElementArea(self, area):
             lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.GetParameters(self)
             area, parameters = ParseParameters(lastParameters,2,2,area)
-            #NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetParameters(self,parameters)
+            geompyDC.SetParameters(self, parameters)
             NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetMaxElementArea(self, area)
 
         def LengthFromEdges(self):
             lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.GetParameters(self)
             value = 0;
             value, parameters = ParseParameters(lastParameters,2,2,value)
-            #NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.SetParameters(self,parameters)
+            geompyDC.SetParameters(self, parameters)
             NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_2D.LengthFromEdges(self)
 
     #Registering the new proxy for NETGEN_SimpleParameters_2D
@@ -5376,14 +5407,14 @@ if not noNETGENPlugin:
         def SetMaxElementVolume(self, volume):
             lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.GetParameters(self)
             volume, parameters = ParseParameters(lastParameters,3,3,volume)
-            #NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.SetParameters(self,parameters)
+            geompyDC.SetParameters(self, parameters)
             NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.SetMaxElementVolume(self, volume)
 
         def LengthFromFaces(self):
             lastParameters = NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.GetParameters(self)
             value = 0;
             value, parameters = ParseParameters(lastParameters,3,3,value)
-            #NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.SetParameters(self,parameters)
+            geompyDC.SetParameters(self, parameters)
             NETGENPlugin._objref_NETGENPlugin_SimpleHypothesis_3D.LengthFromFaces(self)
 
     #Registering the new proxy for NETGEN_SimpleParameters_3D
@@ -5400,7 +5431,7 @@ class Pattern(SMESH._objref_SMESH_Pattern):
         theNodeIndexOnKeyPoint1,Parameters = geompyDC.ParseParameters(theNodeIndexOnKeyPoint1)
         if flag:
             theNodeIndexOnKeyPoint1 -= 1
-        SetParameters(theMesh, Parameters)
+        geompyDC.SetParameters(theMesh, Parameters)
         return SMESH._objref_SMESH_Pattern.ApplyToMeshFaces( self, theMesh, theFacesIDs, theNodeIndexOnKeyPoint1, theReverse )
 
     def ApplyToHexahedrons(self, theMesh, theVolumesIDs, theNode000Index, theNode001Index):
@@ -5415,7 +5446,7 @@ class Pattern(SMESH._objref_SMESH_Pattern):
             theNode000Index -= 1
         if flag1:
             theNode001Index -= 1
-        SetParameters(theMesh, Parameters)
+        geompyDC.SetParameters(theMesh, Parameters)
         return SMESH._objref_SMESH_Pattern.ApplyToHexahedrons( self, theMesh, theVolumesIDs, theNode000Index, theNode001Index )
 
 #Registering the new proxy for Pattern