Salome HOME
Restore some lost modifications.
[modules/smesh.git] / src / SMESH_SWIG / smeshDC.py
index aea2f0569c9b38a9bf98cddf7cd36a18c169bbb0..72f802242102ae9782e2d49e71134c3fd43d30b2 100644 (file)
@@ -15,7 +15,7 @@
 #  License along with this library; if not, write to the Free Software
 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 #
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 #  File   : smesh.py
 #  Author : Francis KLOSS, OCC
@@ -43,7 +43,7 @@ try:
 except ImportError:
     noNETGENPlugin = 1
     pass
-    
+
 # Types of algo
 REGULAR    = 1
 PYTHON     = 2
@@ -57,10 +57,13 @@ NETGEN_2D     = 7
 NETGEN_1D2D   = NETGEN
 NETGEN_1D2D3D = FULL_NETGEN
 NETGEN_FULL   = FULL_NETGEN
+Hexa    = 8
+Hexotic = 9
+BLSURF  = 10
 
 # MirrorType enumeration
 POINT = SMESH_MeshEditor.POINT
-AXIS =  SMESH_MeshEditor.AXIS 
+AXIS =  SMESH_MeshEditor.AXIS
 PLANE = SMESH_MeshEditor.PLANE
 
 # Smooth_Method enumeration
@@ -136,10 +139,10 @@ def TreatHypoStatus(status, hypName, geomName, isAlgo):
 class smeshDC(SMESH._objref_SMESH_Gen):
 
     def init_smesh(self,theStudy,geompyD):
-        self.SetCurrentStudy(theStudy)
         self.geompyD=geompyD
         self.SetGeomEngine(geompyD)
-            
+        self.SetCurrentStudy(theStudy)
+
     def Mesh(self, obj=0, name=0):
       return Mesh(self,self.geompyD,obj,name)
 
@@ -168,7 +171,14 @@ class smeshDC(SMESH._objref_SMESH_Gen):
         pnt = PointStruct(p2[0]-p1[0], p2[1]-p1[1], p2[2]-p1[2])
         dirst = DirStruct(pnt)
         return dirst
-    
+
+    ## Make DirStruct from a triplet
+    #  @param x,y,z are vector components
+    #  @return SMESH.DirStruct
+    def MakeDirStruct(self,x,y,z):
+        pnt = PointStruct(x,y,z)
+        return DirStruct(pnt)
+
     ## Get AxisStruct from object
     #  @param theObj is GEOM object(line or plane)
     #  @return SMESH.AxisStruct
@@ -196,12 +206,12 @@ class smeshDC(SMESH._objref_SMESH_Gen):
 
     # From SMESH_Gen interface:
     # ------------------------
-    
+
     ## Set the current mode
     def SetEmbeddedMode( self,theMode ):
         #self.SetEmbeddedMode(theMode)
         SMESH._objref_SMESH_Gen.SetEmbeddedMode(self,theMode)
-        
+
     ## Get the current mode
     def IsEmbeddedMode(self):
         #return self.IsEmbeddedMode()
@@ -233,14 +243,14 @@ class smeshDC(SMESH._objref_SMESH_Gen):
             aMesh = Mesh(self,self.geompyD,aSmeshMeshes[iMesh])
             aMeshes.append(aMesh)
         return aMeshes, aStatus
-    
+
     ## Create Mesh object importing data from given STL file
     #  @return an instance of Mesh class
     def CreateMeshesFromSTL( self, theFileName ):
         aSmeshMesh = SMESH._objref_SMESH_Gen.CreateMeshesFromSTL(self,theFileName)
         aMesh = Mesh(self,self.geompyD,aSmeshMesh)
         return aMesh
-    
+
     ## From SMESH_Gen interface
     def GetSubShapesId( self, theMainObject, theListOfSubObjects ):
         return SMESH._objref_SMESH_Gen.GetSubShapesId(self,theMainObject, theListOfSubObjects)
@@ -248,12 +258,12 @@ class smeshDC(SMESH._objref_SMESH_Gen):
     ## From SMESH_Gen interface. Creates pattern
     def GetPattern(self):
         return SMESH._objref_SMESH_Gen.GetPattern(self)
-    
-    
-    
+
+
+
     # Filtering. Auxiliary functions:
     # ------------------------------
-    
+
     ## Creates an empty criterion
     #  @return SMESH.Filter.Criterion
     def GetEmptyCriterion(self):
@@ -269,7 +279,7 @@ class smeshDC(SMESH._objref_SMESH_Gen):
         Precision = -1 ##@1e-07
         return Filter.Criterion(Type, Compare, Threshold, ThresholdStr, ThresholdID,
                                 UnaryOp, BinaryOp, Tolerance, TypeOfElement, Precision)
-      
+
     ## Creates a criterion by given parameters
     #  @param elementType is the type of elements(NODE, EDGE, FACE, VOLUME)
     #  @param CritType is type of criterion( FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc. )
@@ -288,9 +298,9 @@ class smeshDC(SMESH._objref_SMESH_Gen):
         aCriterion = self.GetEmptyCriterion()
         aCriterion.TypeOfElement = elementType
         aCriterion.Type = self.EnumToLong(CritType)
-        
+
         aTreshold = Treshold
-        
+
         if Compare in [FT_LessThan, FT_MoreThan, FT_EqualTo]:
             aCriterion.Compare = self.EnumToLong(Compare)
         elif Compare == "=" or Compare == "==":
@@ -302,8 +312,8 @@ class smeshDC(SMESH._objref_SMESH_Gen):
         else:
             aCriterion.Compare = self.EnumToLong(FT_EqualTo)
             aTreshold = Compare
-            
-        if CritType in [FT_BelongToGeom,     FT_BelongToPlane, FT_BelongToGenSurface, 
+
+        if CritType in [FT_BelongToGeom,     FT_BelongToPlane, FT_BelongToGenSurface,
                         FT_BelongToCylinder, FT_LyingOnGeom]:
             # Check treshold
             if isinstance(aTreshold, geompyDC.GEOM._objref_GEOM_Object):
@@ -320,7 +330,7 @@ class smeshDC(SMESH._objref_SMESH_Gen):
                 print "Error: Treshold should be a string."
                 return None
         elif CritType in [FT_FreeBorders, FT_FreeEdges, FT_BadOrientedVolume]:
-            # Here we don't need treshold
+            # Here we do not need treshold
             if aTreshold ==  FT_LogicalNOT:
                 aCriterion.UnaryOp = self.EnumToLong(FT_LogicalNOT)
             elif aTreshold in [FT_LogicalAND, FT_LogicalOR]:
@@ -333,13 +343,13 @@ class smeshDC(SMESH._objref_SMESH_Gen):
             except:
                 print "Error: Treshold should be a number."
                 return None
-            
+
         if Treshold ==  FT_LogicalNOT or UnaryOp ==  FT_LogicalNOT:
             aCriterion.UnaryOp = self.EnumToLong(FT_LogicalNOT)
-            
+
         if Treshold in [FT_LogicalAND, FT_LogicalOR]:
             aCriterion.BinaryOp = self.EnumToLong(Treshold)
-            
+
         if UnaryOp in [FT_LogicalAND, FT_LogicalOR]:
             aCriterion.BinaryOp = self.EnumToLong(UnaryOp)
 
@@ -347,7 +357,7 @@ class smeshDC(SMESH._objref_SMESH_Gen):
             aCriterion.BinaryOp = self.EnumToLong(BinaryOp)
 
         return aCriterion
-    
+
     ## Creates filter by given parameters of criterion
     #  @param elementType is the type of elements in the group
     #  @param CritType is type of criterion( FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc. )
@@ -367,7 +377,7 @@ class smeshDC(SMESH._objref_SMESH_Gen):
         aCriteria.append(aCriterion)
         aFilter.SetCriteria(aCriteria)
         return aFilter
-    
+
     ## Creates numerical functor by its type
     #  @param theCrierion is FT_...; functor type
     #  @return SMESH_NumericalFunctor
@@ -403,16 +413,16 @@ class smeshDC(SMESH._objref_SMESH_Gen):
 import omniORB
 #Register the new proxy for SMESH_Gen
 omniORB.registerObjref(SMESH._objref_SMESH_Gen._NP_RepositoryId, smeshDC)
+
     
-    
-## Mother class to define algorithm, recommended to don't use directly.
+## Mother class to define algorithm, recommended to do not use directly.
 #
 #  More details.
 class Mesh_Algorithm:
     #  @class Mesh_Algorithm
     #  @brief Class Mesh_Algorithm
 
-    hypos = {}
+    #17908#hypos = {}
 
     #def __init__(self,smesh):
     #    self.smesh=smesh
@@ -422,11 +432,11 @@ class Mesh_Algorithm:
         self.subm = None
         self.algo = None
 
-    def FindHypothesis(self,hypname, args):
-        key = "%s %s %s" % (self.__class__.__name__, hypname, args)
-        if Mesh_Algorithm.hypos.has_key( key ):
-            return Mesh_Algorithm.hypos[ key ]
-        return None
+    #17908#def FindHypothesis(self,hypname, args):
+    #17908#    key = "%s %s %s" % (self.__class__.__name__, hypname, args)
+    #17908#    if Mesh_Algorithm.hypos.has_key( key ):
+    #17908#        return Mesh_Algorithm.hypos[ key ]
+    #17908#    return None
 
     ## If the algorithm is global, return 0; \n
     #  else return the submesh associated to this algorithm.
@@ -455,7 +465,7 @@ class Mesh_Algorithm:
     ## Get id of algo
     def GetId(self):
         return self.algo.GetId()
-    
+
     ## Private method.
     def Create(self, mesh, geom, hypo, so="libStdMeshersEngine.so"):
         if geom is None:
@@ -487,14 +497,14 @@ class Mesh_Algorithm:
     ## Private method
     def Hypothesis(self, hyp, args=[], so="libStdMeshersEngine.so", UseExisting=0):
         CreateNew = 1
-        if UseExisting:
-            hypo = self.FindHypothesis(hyp, args)
-            if hypo!=None: CreateNew = 0
-            pass
+        #17908#if UseExisting:
+        #17908#    hypo = self.FindHypothesis(hyp, args)
+        #17908#    if hypo: CreateNew = 0
+        #17908#    pass
         if CreateNew:
             hypo = self.mesh.smeshpyD.CreateHypothesis(hyp, so)
             key = "%s %s %s" % (self.__class__.__name__, hyp, args)
-            Mesh_Algorithm.hypos[key] = hypo
+            #17908#Mesh_Algorithm.hypos[key] = hypo
             a = ""
             s = "="
             i = 0
@@ -520,17 +530,18 @@ class Mesh_Algorithm:
 #  More details.
 class Mesh_Segment(Mesh_Algorithm):
 
-    algo = 0 # algorithm object common for all Mesh_Segment's
+    #17908#algo = 0 # algorithm object common for all Mesh_Segments
 
     ## Private constructor.
     def __init__(self, mesh, geom=0):
         Mesh_Algorithm.__init__(self)
 
-        if not Mesh_Segment.algo:
-            Mesh_Segment.algo = self.Create(mesh, geom, "Regular_1D")
-        else:
-            self.Assign( Mesh_Segment.algo, mesh, geom)
-            pass
+        #17908#if not Mesh_Segment.algo:
+        #17908#    Mesh_Segment.algo = self.Create(mesh, geom, "Regular_1D")
+        #17908#else:
+        #17908#    self.Assign( Mesh_Segment.algo, mesh, geom)
+        #17908#    pass
+        self.Create(mesh, geom, "Regular_1D")
 
     ## Define "LocalLength" hypothesis to cut an edge in several segments with the same length
     #  @param l for the length of segments that cut an edge
@@ -540,7 +551,7 @@ class Mesh_Segment(Mesh_Algorithm):
         hyp = self.Hypothesis("LocalLength", [l], UseExisting=UseExisting)
         hyp.SetLength(l)
         return hyp
-        
+
     ## Define "NumberOfSegments" hypothesis to cut an edge in several fixed number of segments
     #  @param n for the number of segments that cut an edge
     #  @param s for the scale factor (optional)
@@ -555,7 +566,7 @@ class Mesh_Segment(Mesh_Algorithm):
             hyp.SetScaleFactor(s)
         hyp.SetNumberOfSegments(n)
         return hyp
-        
+
     ## Define "Arithmetic1D" hypothesis to cut an edge in several segments with arithmetic length increasing
     #  @param start for the length of the first segment
     #  @param end   for the length of the last  segment
@@ -639,15 +650,16 @@ class Mesh_Segment(Mesh_Algorithm):
 #  More details.
 class Mesh_CompositeSegment(Mesh_Segment):
 
-    algo = 0 # algorithm object common for all Mesh_CompositeSegment's
+    #17908#algo = 0 # algorithm object common for all Mesh_CompositeSegments
 
     ## Private constructor.
     def __init__(self, mesh, geom=0):
-        if not Mesh_CompositeSegment.algo:
-            Mesh_CompositeSegment.algo = self.Create(mesh, geom, "CompositeSegment_1D")
-        else:
-            self.Assign( Mesh_CompositeSegment.algo, mesh, geom)
-            pass
+        #17908#if not Mesh_CompositeSegment.algo:
+        #17908#    Mesh_CompositeSegment.algo = self.Create(mesh, geom, "CompositeSegment_1D")
+        #17908#else:
+        #17908#    self.Assign( Mesh_CompositeSegment.algo, mesh, geom)
+        #17908#    pass
+        self.Create(mesh, geom, "CompositeSegment_1D")
 
 
 # Public class: Mesh_Segment_Python
@@ -658,16 +670,17 @@ class Mesh_CompositeSegment(Mesh_Segment):
 #  More details.
 class Mesh_Segment_Python(Mesh_Segment):
 
-    algo = 0 # algorithm object common for all Mesh_Segment_Python's
+    #17908#algo = 0 # algorithm object common for all Mesh_Segment_Pythons
 
     ## Private constructor.
     def __init__(self, mesh, geom=0):
         import Python1dPlugin
-        if not Mesh_Segment_Python.algo:
-            Mesh_Segment_Python.algo = self.Create(mesh, geom, "Python_1D", "libPython1dEngine.so")
-        else:
-            self.Assign( Mesh_Segment_Python.algo, mesh, geom)
-            pass
+        #17908#if not Mesh_Segment_Python.algo:
+        #17908#    Mesh_Segment_Python.algo = self.Create(mesh, geom, "Python_1D", "libPython1dEngine.so")
+        #17908#else:
+        #17908#    self.Assign( Mesh_Segment_Python.algo, mesh, geom)
+        #17908#    pass
+        self.Create(mesh, geom, "Python_1D", "libPython1dEngine.so")
     
     ## Define "PythonSplit1D" hypothesis based on the Erwan Adam patch, awaiting equivalent SALOME functionality
     #  @param n for the number of segments that cut an edge
@@ -692,42 +705,51 @@ class Mesh_Triangle(Mesh_Algorithm):
     algoType = 0
     params = 0
 
+    _angleMeshS = 8
+    _gradation  = 1.1
+
     # algorithm objects common for all instances of Mesh_Triangle
-    algoMEF = 0    
-    algoNET = 0
-    algoNET_2D = 0
+    #17908#algoMEF = 0
+    #17908#algoNET = 0
+    #17908#algoNET_2D = 0
 
     ## Private constructor.
     def __init__(self, mesh, algoType, geom=0):
         Mesh_Algorithm.__init__(self)
 
         if algoType == MEFISTO:
-            if not Mesh_Triangle.algoMEF:
-                Mesh_Triangle.algoMEF = self.Create(mesh, geom, "MEFISTO_2D")
-            else:
-                self.Assign( Mesh_Triangle.algoMEF, mesh, geom)
-                pass
+            #17908#if not Mesh_Triangle.algoMEF:
+            #17908#    Mesh_Triangle.algoMEF = self.Create(mesh, geom, "MEFISTO_2D")
+            #17908#else:
+            #17908#    self.Assign( Mesh_Triangle.algoMEF, mesh, geom)
+            #17908#    pass
+            self.Create(mesh, geom, "MEFISTO_2D")
             pass
+        elif algoType == BLSURF:
+            import BLSURFPlugin
+            self.Create(mesh, geom, "BLSURF", "libBLSURFEngine.so")
         elif algoType == NETGEN:
             if noNETGENPlugin:
                 print "Warning: NETGENPlugin module unavailable"
                 pass
-            if not Mesh_Triangle.algoNET:
-                Mesh_Triangle.algoNET = self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
-            else:
-                self.Assign( Mesh_Triangle.algoNET, mesh, geom)
-                pass
+            #17908#if not Mesh_Triangle.algoNET:
+            #17908#    Mesh_Triangle.algoNET = self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
+            #17908#else:
+            #17908#    self.Assign( Mesh_Triangle.algoNET, mesh, geom)
+            #17908#    pass
+            self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
             pass
         elif algoType == NETGEN_2D:
             if noNETGENPlugin:
                 print "Warning: NETGENPlugin module unavailable"
                 pass
-            if not Mesh_Triangle.algoNET_2D:
-                Mesh_Triangle.algoNET_2D = self.Create(mesh, geom,
-                                                      "NETGEN_2D_ONLY", "libNETGENEngine.so")
-            else:
-                self.Assign( Mesh_Triangle.algoNET_2D, mesh, geom)
-                pass
+            #17908#if not Mesh_Triangle.algoNET_2D:
+            #17908#    Mesh_Triangle.algoNET_2D = self.Create(mesh, geom,
+            #17908#                                          "NETGEN_2D_ONLY", "libNETGENEngine.so")
+            #17908#else:
+            #17908#    self.Assign( Mesh_Triangle.algoNET_2D, mesh, geom)
+            #17908#    pass
+            self.Create(mesh, geom, "NETGEN_2D_ONLY", "libNETGENEngine.so")
             pass
 
         self.algoType = algoType
@@ -758,6 +780,43 @@ class Mesh_Triangle(Mesh_Algorithm):
             print "Netgen 1D-2D algo doesn't support this hypothesis"
             return None
 
+    ## Set PhysicalMesh
+    #  @param thePhysicalMesh is:
+    #  DefaultSize or Custom
+    def SetPhysicalMesh(self, thePhysicalMesh=1):
+        if self.params == 0:
+            self.Parameters()
+        self.params.SetPhysicalMesh(thePhysicalMesh)
+
+    ## Set PhySize flag
+    def SetPhySize(self, theVal):
+        if self.params == 0:
+            self.Parameters()
+        self.params.SetPhySize(theVal)
+
+    ## Set GeometricMesh
+    #  @param theGeometricMesh is:
+    #  DefaultGeom or Custom
+    def SetGeometricMesh(self, theGeometricMesh=0):
+        if self.params == 0:
+            self.Parameters()
+        if self.params.GetPhysicalMesh() == 0: theGeometricMesh = 1
+        self.params.SetGeometricMesh(theGeometricMesh)
+
+    ## Set AngleMeshS flag
+    def SetAngleMeshS(self, theVal=_angleMeshS):
+        if self.params == 0:
+            self.Parameters()
+        if self.params.GetGeometricMesh() == 0: theVal = self._angleMeshS
+        self.params.SetAngleMeshS(theVal)
+
+    ## Set Gradation flag
+    def SetGradation(self, theVal=_gradation):
+        if self.params == 0:
+            self.Parameters()
+        if self.params.GetGeometricMesh() == 0: theVal = self._gradation
+        self.params.SetGradation(theVal)
+
     ## Set QuadAllowed flag
     #
     #  Only for algoType == NETGEN || NETGEN_2D
@@ -792,28 +851,36 @@ class Mesh_Triangle(Mesh_Algorithm):
             print "NETGEN_2D_ONLY algo doesn't support 'NETGEN_Parameters_2D' hypothesis"
             print "NETGEN_2D_ONLY uses 'MaxElementArea' and 'LengthFromEdges' ones"
             return None
+        elif self.algoType == BLSURF:
+            self.params = self.Hypothesis("BLSURF_Parameters", [], "libBLSURFEngine.so")
+            return self.params
         return None
 
     ## Set MaxSize
     #
     #  Only for algoType == NETGEN
     def SetMaxSize(self, theSize):
-        if self.params == 0 and self.Parameters():
+        if self.params == 0:
+            self.Parameters()
+        if self.params is not None:
             self.params.SetMaxSize(theSize)
-        
+
     ## Set SecondOrder flag
     #
     #  Only for algoType == NETGEN
     def SetSecondOrder(self, theVal):
-        if self.params == 0 and self.Parameters():
+        if self.params == 0:
+            self.Parameters()
+        if self.params is not None:
             self.params.SetSecondOrder(theVal)
-            return
 
     ## Set Optimize flag
     #
     #  Only for algoType == NETGEN
     def SetOptimize(self, theVal):
-        if self.params == 0 and self.Parameters():
+        if self.params == 0:
+            self.Parameters()
+        if self.params is not None:
             self.params.SetOptimize(theVal)
 
     ## Set Fineness
@@ -822,33 +889,47 @@ class Mesh_Triangle(Mesh_Algorithm):
     #
     #  Only for algoType == NETGEN
     def SetFineness(self, theFineness):
-        if self.params == 0 and self.Parameters():
+        if self.params == 0:
+            self.Parameters()
+        if self.params is not None:
             self.params.SetFineness(theFineness)
-        
-    ## Set GrowthRate  
+
+    ## Set GrowthRate
     #
     #  Only for algoType == NETGEN
     def SetGrowthRate(self, theRate):
-        if self.params == 0 and self.Parameters():
+        if self.params == 0:
+            self.Parameters()
+        if self.params is not None:
             self.params.SetGrowthRate(theRate)
 
     ## Set NbSegPerEdge
     #
     #  Only for algoType == NETGEN
     def SetNbSegPerEdge(self, theVal):
-        if self.params == 0 and self.Parameters():
+        if self.params == 0:
+            self.Parameters()
+        if self.params is not None:
             self.params.SetNbSegPerEdge(theVal)
 
     ## Set NbSegPerRadius
     #
     #  Only for algoType == NETGEN
     def SetNbSegPerRadius(self, theVal):
-        if self.params == 0 and self.Parameters():
+        if self.params == 0:
+            self.Parameters()
+        if self.params is not None:
             self.params.SetNbSegPerRadius(theVal)
 
+    ## Set Decimesh flag
+    def SetDecimesh(self, toAllow=False):
+        if self.params == 0:
+            self.Parameters()
+        self.params.SetDecimesh(toAllow)
+
     pass
-        
-    
+
+
 # Public class: Mesh_Quadrangle
 # -----------------------------
 
@@ -857,17 +938,18 @@ class Mesh_Triangle(Mesh_Algorithm):
 #  More details.
 class Mesh_Quadrangle(Mesh_Algorithm):
 
-    algo = 0 # algorithm object common for all Mesh_Quadrangle's
+    #17908#algo = 0 # algorithm object common for all Mesh_Quadrangles
 
     ## Private constructor.
     def __init__(self, mesh, geom=0):
         Mesh_Algorithm.__init__(self)
 
-        if not Mesh_Quadrangle.algo:
-            Mesh_Quadrangle.algo = self.Create(mesh, geom, "Quadrangle_2D")
-        else:
-            self.Assign( Mesh_Quadrangle.algo, mesh, geom)
-            pass
+        #17908#if not Mesh_Quadrangle.algo:
+        #17908#    Mesh_Quadrangle.algo = self.Create(mesh, geom, "Quadrangle_2D")
+        #17908#else:
+        #17908#    self.Assign( Mesh_Quadrangle.algo, mesh, geom)
+        #17908#    pass
+        self.Create(mesh, geom, "Quadrangle_2D")
     
     ## Define "QuadranglePreference" hypothesis, forcing construction
     #  of quadrangles if the number of nodes on opposite edges is not the same
@@ -887,39 +969,43 @@ class Mesh_Tetrahedron(Mesh_Algorithm):
     params = 0
     algoType = 0
 
-    algoNET = 0 # algorithm object common for all Mesh_Tetrahedron's
-    algoGHS = 0 # algorithm object common for all Mesh_Tetrahedron's
-    algoFNET = 0 # algorithm object common for all Mesh_Tetrahedron's
+    #17908#algoNET = 0 # algorithm object common for all Mesh_Tetrahedrons
+    #17908#algoGHS = 0 # algorithm object common for all Mesh_Tetrahedrons
+    #17908#algoFNET = 0 # algorithm object common for all Mesh_Tetrahedrons
 
     ## Private constructor.
     def __init__(self, mesh, algoType, geom=0):
         Mesh_Algorithm.__init__(self)
 
         if algoType == NETGEN:
-            if not Mesh_Tetrahedron.algoNET:
-                Mesh_Tetrahedron.algoNET = self.Create(mesh, geom, "NETGEN_3D", "libNETGENEngine.so")
-            else:
-                self.Assign( Mesh_Tetrahedron.algoNET, mesh, geom)
-                pass
+            #17908#if not Mesh_Tetrahedron.algoNET:
+            #17908#    Mesh_Tetrahedron.algoNET = self.Create(mesh, geom, "NETGEN_3D", "libNETGENEngine.so")
+            #17908#else:
+            #17908#    self.Assign( Mesh_Tetrahedron.algoNET, mesh, geom)
+            #17908#    pass
+            self.Create(mesh, geom, "NETGEN_3D", "libNETGENEngine.so")
             pass
 
         elif algoType == GHS3D:
-            if not Mesh_Tetrahedron.algoGHS:
-                import GHS3DPlugin
-                Mesh_Tetrahedron.algoGHS = self.Create(mesh, geom, "GHS3D_3D" , "libGHS3DEngine.so")
-            else:
-                self.Assign( Mesh_Tetrahedron.algoGHS, mesh, geom)
-                pass
+            #17908#if not Mesh_Tetrahedron.algoGHS:
+            #17908#    import GHS3DPlugin
+            #17908#    Mesh_Tetrahedron.algoGHS = self.Create(mesh, geom, "GHS3D_3D" , "libGHS3DEngine.so")
+            #17908#else:
+            #17908#    self.Assign( Mesh_Tetrahedron.algoGHS, mesh, geom)
+            #17908#    pass
+            import GHS3DPlugin
+            self.Create(mesh, geom, "GHS3D_3D" , "libGHS3DEngine.so")
             pass
 
         elif algoType == FULL_NETGEN:
             if noNETGENPlugin:
                 print "Warning: NETGENPlugin module has not been imported."
-            if not Mesh_Tetrahedron.algoFNET:
-                Mesh_Tetrahedron.algoFNET = self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so")
-            else:
-                self.Assign( Mesh_Tetrahedron.algoFNET, mesh, geom)
-                pass
+            #17908#if not Mesh_Tetrahedron.algoFNET:
+            #17908#    Mesh_Tetrahedron.algoFNET = self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so")
+            #17908#else:
+            #17908#    self.Assign( Mesh_Tetrahedron.algoFNET, mesh, geom)
+            #17908#    pass
+            self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so")
             pass
 
         self.algoType = algoType
@@ -941,8 +1027,8 @@ class Mesh_Tetrahedron(Mesh_Algorithm):
             return self.params
         else:
             print "Algo doesn't support this hypothesis"
-            return None 
-            
+            return None
+
     ## Set MaxSize
     def SetMaxSize(self, theSize):
         if self.params == 0:
@@ -968,8 +1054,8 @@ class Mesh_Tetrahedron(Mesh_Algorithm):
         if self.params == 0:
             self.Parameters()
         self.params.SetFineness(theFineness)
-        
-    ## Set GrowthRate  
+
+    ## Set GrowthRate
     def SetGrowthRate(self, theRate):
         if self.params == 0:
             self.Parameters()
@@ -995,18 +1081,62 @@ class Mesh_Tetrahedron(Mesh_Algorithm):
 #  More details.
 class Mesh_Hexahedron(Mesh_Algorithm):
 
-    algo = 0 # algorithm object common for all Mesh_Hexahedron's
+#     #17908#algo = 0 # algorithm object common for all Mesh_Hexahedrons
+# 
+#     ## Private constructor.
+#     def __init__(self, mesh, geom=0):
+#         Mesh_Algorithm.__init__(self)
+# 
+#         #17908#if not Mesh_Hexahedron.algo:
+#         #17908#    Mesh_Hexahedron.algo = self.Create(mesh, geom, "Hexa_3D")
+#         #17908#else:
+#         #17908#    self.Assign( Mesh_Hexahedron.algo, mesh, geom)
+#         #17908#    pass
+#         self.Create(mesh, geom, "Hexa_3D")
+
+    #17908#params = 0
+    #17908#algoType = 0
+
+    #17908#algoHEXA = 0 # algorithm object common for all Mesh_Hexahedron's
+    #17908#algoHEXO = 0 # algorithm object common for all Mesh_Hexahedron's
 
     ## Private constructor.
-    def __init__(self, mesh, geom=0):
+    def __init__(self, mesh, algoType=Hexa, geom=0):
         Mesh_Algorithm.__init__(self)
 
-        if not Mesh_Hexahedron.algo:
-            Mesh_Hexahedron.algo = self.Create(mesh, geom, "Hexa_3D")
-        else:
-            self.Assign( Mesh_Hexahedron.algo, mesh, geom)
+        if algoType == Hexa:
+            #17908#if not Mesh_Hexahedron.algoHEXA:
+            #17908#    Mesh_Hexahedron.algoHEXA = self.Create(mesh, geom, "Hexa_3D")
+            #17908#else:
+            #17908#    self.Assign(Mesh_Hexahedron.algoHEXA, mesh, geom)
+            #17908#    pass
+            self.Create(mesh, geom, "Hexa_3D")
             pass
 
+        elif algoType == Hexotic:
+            #17908#if not Mesh_Hexahedron.algoHEXO:
+            #17908#    import HexoticPlugin
+            #17908#    Mesh_Hexahedron.algoHEXO = self.Create(mesh, geom, "Hexotic_3D", "libHexoticEngine.so")
+            #17908#else:
+            #17908#    self.Assign(Mesh_Hexahedron.algoHEXO, mesh, geom)
+            #17908#    pass
+            import HexoticPlugin
+            self.Create(mesh, geom, "Hexotic_3D", "libHexoticEngine.so")
+            pass
+
+    ## Define "MinMaxQuad" hypothesis to give the three hexotic parameters
+    def MinMaxQuad(self, min=3, max=8, quad=True):
+        #17908#self.params = self.Hypothesis("Hexotic_Parameters", [], "libHexoticEngine.so")
+        #17908#self.params.SetHexesMinLevel(min)
+        #17908#self.params.SetHexesMaxLevel(max)
+        #17908#self.params.SetHexoticQuadrangles(quad)
+        #17908#return self.params
+        params = self.Hypothesis("Hexotic_Parameters", [], "libHexoticEngine.so")
+        params.SetHexesMinLevel(min)
+        params.SetHexesMaxLevel(max)
+        params.SetHexoticQuadrangles(quad)
+        return params
+
 # Deprecated, only for compatibility!
 # Public class: Mesh_Netgen
 # ------------------------------
@@ -1021,8 +1151,8 @@ class Mesh_Netgen(Mesh_Algorithm):
 
     is3D = 0
 
-    algoNET23 = 0 # algorithm object common for all Mesh_Netgen's
-    algoNET2 = 0 # algorithm object common for all Mesh_Netgen's
+    #17908#algoNET23 = 0 # algorithm object common for all Mesh_Netgens
+    #17908#algoNET2 = 0 # algorithm object common for all Mesh_Netgens
 
     ## Private constructor.
     def __init__(self, mesh, is3D, geom=0):
@@ -1033,19 +1163,21 @@ class Mesh_Netgen(Mesh_Algorithm):
             
         self.is3D = is3D
         if is3D:
-            if not Mesh_Netgen.algoNET23:
-                Mesh_Netgen.algoNET23 = self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so")
-            else:
-                self.Assign( Mesh_Netgen.algoNET23, mesh, geom)
-                pass
+            #17908#if not Mesh_Netgen.algoNET23:
+            #17908#    Mesh_Netgen.algoNET23 = self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so")
+            #17908#else:
+            #17908#    self.Assign( Mesh_Netgen.algoNET23, mesh, geom)
+            #17908#    pass
+            self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so")
             pass
 
         else:
-            if not Mesh_Netgen.algoNET2:
-                Mesh_Netgen.algoNET2 = self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
-            else:
-                self.Assign( Mesh_Netgen.algoNET2, mesh, geom)
-                pass
+            #17908#if not Mesh_Netgen.algoNET2:
+            #17908#    Mesh_Netgen.algoNET2 = self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
+            #17908#else:
+            #17908#    self.Assign( Mesh_Netgen.algoNET2, mesh, geom)
+            #17908#    pass
+            self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
             pass
 
     ## Define hypothesis containing parameters of the algorithm
@@ -1066,17 +1198,18 @@ class Mesh_Netgen(Mesh_Algorithm):
 #  More details.
 class Mesh_Projection1D(Mesh_Algorithm):
 
-    algo = 0 # algorithm object common for all Mesh_Projection1D's
+    #17908#algo = 0 # algorithm object common for all Mesh_Projection1Ds
 
     ## Private constructor.
     def __init__(self, mesh, geom=0):
         Mesh_Algorithm.__init__(self)
 
-        if not Mesh_Projection1D.algo:
-            Mesh_Projection1D.algo = self.Create(mesh, geom, "Projection_1D")
-        else:
-            self.Assign( Mesh_Projection1D.algo, mesh, geom)
-            pass
+        #17908#if not Mesh_Projection1D.algo:
+        #17908#    Mesh_Projection1D.algo = self.Create(mesh, geom, "Projection_1D")
+        #17908#else:
+        #17908#    self.Assign( Mesh_Projection1D.algo, mesh, geom)
+        #17908#    pass
+        self.Create(mesh, geom, "Projection_1D")
 
     ## Define "Source Edge" hypothesis, specifying a meshed edge to
     #  take a mesh pattern from, and optionally association of vertices
@@ -1106,17 +1239,18 @@ class Mesh_Projection1D(Mesh_Algorithm):
 #  More details.
 class Mesh_Projection2D(Mesh_Algorithm):
 
-    algo = 0 # algorithm object common for all Mesh_Projection2D's
+    #17908#algo = 0 # algorithm object common for all Mesh_Projection2Ds
 
     ## Private constructor.
     def __init__(self, mesh, geom=0):
         Mesh_Algorithm.__init__(self)
 
-        if not Mesh_Projection2D.algo:
-            Mesh_Projection2D.algo = self.Create(mesh, geom, "Projection_2D")
-        else:
-            self.Assign( Mesh_Projection2D.algo, mesh, geom)
-            pass
+        #17908#if not Mesh_Projection2D.algo:
+        #17908#    Mesh_Projection2D.algo = self.Create(mesh, geom, "Projection_2D")
+        #17908#else:
+        #17908#    self.Assign( Mesh_Projection2D.algo, mesh, geom)
+        #17908#    pass
+        self.Create(mesh, geom, "Projection_2D")
 
     ## Define "Source Face" hypothesis, specifying a meshed face to
     #  take a mesh pattern from, and optionally association of vertices
@@ -1152,17 +1286,18 @@ class Mesh_Projection2D(Mesh_Algorithm):
 #  More details.
 class Mesh_Projection3D(Mesh_Algorithm):
 
-    algo = 0 # algorithm object common for all Mesh_Projection3D's
+    #17908#algo = 0 # algorithm object common for all Mesh_Projection3Ds
 
     ## Private constructor.
     def __init__(self, mesh, geom=0):
         Mesh_Algorithm.__init__(self)
 
-        if not Mesh_Projection3D.algo:
-            Mesh_Projection3D.algo = self.Create(mesh, geom, "Projection_3D")
-        else:
-            self.Assign( Mesh_Projection3D.algo, mesh, geom)
-            pass
+        #17908#if not Mesh_Projection3D.algo:
+        #17908#    Mesh_Projection3D.algo = self.Create(mesh, geom, "Projection_3D")
+        #17908#else:
+        #17908#    self.Assign( Mesh_Projection3D.algo, mesh, geom)
+        #17908#    pass
+        self.Create(mesh, geom, "Projection_3D")
 
     ## Define "Source Shape 3D" hypothesis, specifying a meshed solid to
     #  take a mesh pattern from, and optionally association of vertices
@@ -1200,17 +1335,18 @@ class Mesh_Projection3D(Mesh_Algorithm):
 #  More details.
 class Mesh_Prism3D(Mesh_Algorithm):
 
-    algo = 0 # algorithm object common for all Mesh_Prism3D's
+    #17908#algo = 0 # algorithm object common for all Mesh_Prism3Ds
 
     ## Private constructor.
     def __init__(self, mesh, geom=0):
         Mesh_Algorithm.__init__(self)
 
-        if not Mesh_Prism3D.algo:
-            Mesh_Prism3D.algo = self.Create(mesh, geom, "Prism_3D")
-        else:
-            self.Assign( Mesh_Prism3D.algo, mesh, geom)
-            pass
+        #17908#if not Mesh_Prism3D.algo:
+        #17908#    Mesh_Prism3D.algo = self.Create(mesh, geom, "Prism_3D")
+        #17908#else:
+        #17908#    self.Assign( Mesh_Prism3D.algo, mesh, geom)
+        #17908#    pass
+        self.Create(mesh, geom, "Prism_3D")
 
 # Public class: Mesh_RadialPrism
 # -------------------------------
@@ -1220,17 +1356,19 @@ class Mesh_Prism3D(Mesh_Algorithm):
 #  More details.
 class Mesh_RadialPrism3D(Mesh_Algorithm):
 
-    algo = 0 # algorithm object common for all Mesh_RadialPrism3D's
+    #17908#algo = 0 # algorithm object common for all Mesh_RadialPrism3Ds
 
     ## Private constructor.
     def __init__(self, mesh, geom=0):
         Mesh_Algorithm.__init__(self)
 
-        if not Mesh_RadialPrism3D.algo:
-            Mesh_RadialPrism3D.algo = self.Create(mesh, geom, "RadialPrism_3D")
-        else:
-            self.Assign( Mesh_RadialPrism3D.algo, mesh, geom)
-            pass
+        #17908#if not Mesh_RadialPrism3D.algo:
+        #17908#    Mesh_RadialPrism3D.algo = self.Create(mesh, geom, "RadialPrism_3D")
+        #17908#else:
+        #17908#    self.Assign( Mesh_RadialPrism3D.algo, mesh, geom)
+        #17908#    pass
+        self.Create(mesh, geom, "RadialPrism_3D")
+
         self.distribHyp = self.Hypothesis( "LayerDistribution", UseExisting=0)
         self.nbLayers = None
 
@@ -1311,6 +1449,28 @@ class Mesh_RadialPrism3D(Mesh_Algorithm):
         hyp.SetFineness( fineness )
         return hyp
 
+# Private class: Mesh_UseExisting
+# -------------------------------
+class Mesh_UseExisting(Mesh_Algorithm):
+
+    #17908#algo1D = 0 # StdMeshers_UseExisting_1D object common for all Mesh_UseExisting
+    #17908#algo2D = 0 # StdMeshers_UseExisting_2D object common for all Mesh_UseExisting
+
+    def __init__(self, dim, mesh, geom=0):
+        if dim == 1:
+            #17908#if not Mesh_UseExisting.algo1D:
+            #17908#    Mesh_UseExisting.algo1D= self.Create(mesh, geom, "UseExisting_1D")
+            #17908#else:
+            #17908#    self.Assign( Mesh_UseExisting.algo1D, mesh, geom)
+            #17908#    pass
+            self.Create(mesh, geom, "UseExisting_1D")
+        else:
+            #17908#if not Mesh_UseExisting.algo2D:
+            #17908#    Mesh_UseExisting.algo2D= self.Create(mesh, geom, "UseExisting_2D")
+            #17908#else:
+            #17908#    self.Assign( Mesh_UseExisting.algo2D, mesh, geom)
+            #17908#    pass
+            self.Create(mesh, geom, "UseExisting_2D")
 
 # Public class: Mesh
 # ==================
@@ -1387,8 +1547,8 @@ class Mesh:
     ## Method that associates given shape to the mesh(entails the mesh recreation)
     #  @param geom shape to be meshed(GEOM_Object)
     def SetShape(self, geom):
-        self.mesh = self.smeshpyD.CreateMesh(geom)  
-                
+        self.mesh = self.smeshpyD.CreateMesh(geom)
+
     ## Return true if hypotheses are defined well
     #  @param theMesh is an instance of Mesh class
     #  @param theSubObject subshape of a mesh shape
@@ -1404,7 +1564,7 @@ class Mesh:
         return self.smeshpyD.GetAlgoState(self.mesh, theSubObject)
     
     ## Return geometrical object the given element is built on.
-    #  The returned geometrical object, if not nil, is either found in the 
+    #  The returned geometrical object, if not nil, is either found in the
     #  study or is published by this method with the given name
     #  @param theMesh is an instance of Mesh class
     #  @param theElementID an id of the mesh element
@@ -1447,6 +1607,28 @@ class Mesh:
         else:
             return Mesh_Segment(self, geom)
         
+    ## Enable creation of nodes and segments usable by 2D algoritms.
+    #  Added nodes and segments must be bound to edges and vertices by
+    #  SetNodeOnVertex(), SetNodeOnEdge() and SetMeshElementOnShape()
+    #  If the optional \a geom parameter is not sets, this algorithm is global.
+    #  \n Otherwise, this algorithm define a submesh based on \a geom subshape.
+    #  @param geom subshape to be manually meshed
+    #  @return StdMeshers_UseExisting_1D algorithm that generates nothing
+    def UseExistingSegments(self, geom=0):
+        algo = Mesh_UseExisting(1,self,geom)
+        return algo.GetAlgorithm()
+
+    ## Enable creation of nodes and faces usable by 3D algoritms.
+    #  Added nodes and faces must be bound to geom faces by SetNodeOnFace()
+    #  and SetMeshElementOnShape()
+    #  If the optional \a geom parameter is not sets, this algorithm is global.
+    #  \n Otherwise, this algorithm define a submesh based on \a geom subshape.
+    #  @param geom subshape to be manually meshed
+    #  @return StdMeshers_UseExisting_2D algorithm that generates nothing
+    def UseExistingFaces(self, geom=0):
+        algo = Mesh_UseExisting(2,self,geom)
+        return algo.GetAlgorithm()
+
     ## Creates a triangle 2D algorithm for faces.
     #  If the optional \a geom parameter is not sets, this algorithm is global.
     #  \n Otherwise, this algorithm define a submesh based on \a geom subshape.
@@ -1485,8 +1667,14 @@ class Mesh:
     #  If the optional \a geom parameter is not sets, this algorithm is global.
     #  \n Otherwise, this algorithm define a submesh based on \a geom subshape.
     #  @param geom If defined, subshape to be meshed
-    def Hexahedron(self, geom=0):
-        return Mesh_Hexahedron(self,  geom)
+    ## def Hexahedron(self, geom=0):
+    ##     return Mesh_Hexahedron(self,  geom)
+    def Hexahedron(self, algo=Hexa, geom=0):
+        ## if Hexahedron(geom, algo) or Hexahedron(geom) is called by mistake
+        if ( isinstance(algo, geompyDC.GEOM._objref_GEOM_Object) ):
+            if   geom in [Hexa, Hexotic]: algo, geom = geom, algo
+            elif geom == 0:               algo, geom = Hexa, algo
+        return Mesh_Hexahedron(self, algo, geom)
 
     ## Deprecated, only for compatibility!
     def Netgen(self, is3D, geom=0):
@@ -1619,7 +1807,7 @@ class Mesh:
             self.Quadrangle()
             pass
         if dim > 2 :
-            self.Hexahedron()            
+            self.Hexahedron()
             pass
         return self.Compute()
 
@@ -1655,7 +1843,7 @@ class Mesh:
     #  @param geom is subhape of mesh geometry
     def GetHypothesisList(self, geom):
         return self.mesh.GetHypothesisList( geom )
-                
+
     ## Removes all global hypotheses
     def RemoveGlobalHypotheses(self):
         current_hyps = self.mesh.GetHypothesisList( self.geom )
@@ -1667,7 +1855,7 @@ class Mesh:
     ## Create a mesh group based on geometric object \a grp
     #  and give a \a name, \n if this parameter is not defined
     #  the name is the same as the geometric group name \n
-    #  Note: Works like GroupOnGeom(). 
+    #  Note: Works like GroupOnGeom().
     #  @param grp  is a geometric group, a vertex, an edge, a face or a solid
     #  @param name is the name of the mesh group
     #  @return SMESH_GroupOnGeom
@@ -1705,8 +1893,8 @@ class Mesh:
     #  @param ascii defined the kind of file contents
     def ExportSTL(self, f, ascii=1):
         self.mesh.ExportSTL(f, ascii)
-   
-        
+
+
     # Operations with groups:
     # ----------------------
 
@@ -1837,7 +2025,7 @@ class Mesh:
         aPredicate.SetMesh(self.mesh)
         aBorders = aPredicate.GetBorders()
         return aBorders
-                
+
     ## Remove a group
     def RemoveGroup(self, group):
         self.mesh.RemoveGroup(group)
@@ -1850,6 +2038,10 @@ class Mesh:
     def GetGroups(self):
         return self.mesh.GetGroups()
 
+    ## Get number of groups existing in the mesh
+    def NbGroups(self):
+        return self.mesh.NbGroups()
+
     ## Get the list of names of groups existing in the mesh
     def GetGroupNames(self):
         groups = self.GetGroups()
@@ -1875,8 +2067,8 @@ class Mesh:
     #  main group but do not present in tool group are added to the new one
     def CutGroups(self, mainGroup, toolGroup, name):
         return self.mesh.CutGroups(mainGroup, toolGroup, name)
-         
-    
+
+
     # Get some info about mesh:
     # ------------------------
 
@@ -2058,19 +2250,34 @@ class Mesh:
         return self.mesh.GetElementType(id, iselem)
 
     ## Returns list of submesh elements ids
-    #  @param shapeID is geom object(subshape) IOR
-    def GetSubMeshElementsId(self, shapeID):
-        return self.mesh.GetSubMeshElementsId(shapeID)
+    #  @param Shape is geom object(subshape) IOR
+    #  Shape must be subshape of a ShapeToMesh()
+    def GetSubMeshElementsId(self, Shape):
+        if ( isinstance( Shape, geompyDC.GEOM._objref_GEOM_Object)):
+            ShapeID = Shape.GetSubShapeIndices()[0]
+        else:
+            ShapeID = Shape
+        return self.mesh.GetSubMeshElementsId(ShapeID)
 
     ## Returns list of submesh nodes ids
-    #  @param shapeID is geom object(subshape) IOR
-    def GetSubMeshNodesId(self, shapeID, all):
-        return self.mesh.GetSubMeshNodesId(shapeID, all)
+    #  @param Shape is geom object(subshape) IOR
+    #  Shape must be subshape of a ShapeToMesh()
+    def GetSubMeshNodesId(self, Shape, all):
+        if ( isinstance( Shape, geompyDC.GEOM._objref_GEOM_Object)):
+            ShapeID = Shape.GetSubShapeIndices()[0]
+        else:
+            ShapeID = Shape
+        return self.mesh.GetSubMeshNodesId(ShapeID, all)
     
     ## Returns list of ids of submesh elements with given type
-    #  @param shapeID is geom object(subshape) IOR
-    def GetSubMeshElementType(self, shapeID):
-        return self.mesh.GetSubMeshElementType(shapeID)
+    #  @param Shape is geom object(subshape) IOR
+    #  Shape must be subshape of a ShapeToMesh()
+    def GetSubMeshElementType(self, Shape):
+        if ( isinstance( Shape, geompyDC.GEOM._objref_GEOM_Object)):
+            ShapeID = Shape.GetSubShapeIndices()[0]
+        else:
+            ShapeID = Shape
+        return self.mesh.GetSubMeshElementType(ShapeID)
       
     ## Get mesh description
     def Dump(self):
@@ -2090,12 +2297,17 @@ class Mesh:
     def GetNodeInverseElements(self, id):
         return self.mesh.GetNodeInverseElements(id)
 
+    ## @brief Return position of a node on shape
+    #  @return SMESH::NodePosition
+    def GetNodePosition(self,NodeID):
+        return self.mesh.GetNodePosition(NodeID)
+
     ## If given element is node returns IDs of shape from position
     #  \n If there is not node for given ID - returns -1
     def GetShapeID(self, id):
         return self.mesh.GetShapeID(id)
 
-    ## For given element returns ID of result shape after 
+    ## For given element returns ID of result shape after
     #  FindShape() from SMESH_MeshEditor
     #  \n If there is not element for given ID - returns -1
     def GetShapeIDForElem(self,id):
@@ -2213,6 +2425,87 @@ class Mesh:
     def AddPolyhedralVolumeByFaces (self, IdsOfFaces):
         return self.editor.AddPolyhedralVolumeByFaces(IdsOfFaces)
     
+
+    ## @brief Bind a node to a vertex
+    # @param NodeID - node ID
+    # @param Vertex - vertex or vertex ID
+    # @return True if succeed else raise an exception
+    def SetNodeOnVertex(self, NodeID, Vertex):
+        if ( isinstance( Vertex, geompyDC.GEOM._objref_GEOM_Object)):
+            VertexID = Vertex.GetSubShapeIndices()[0]
+        else:
+            VertexID = Vertex
+        try:
+            self.editor.SetNodeOnVertex(NodeID, VertexID)
+        except SALOME.SALOME_Exception, inst:
+            raise ValueError, inst.details.text
+        return True
+
+
+    ## @brief Store node position on an edge
+    # @param NodeID - node ID
+    # @param Edge - edge or edge ID
+    # @param paramOnEdge - parameter on edge where the node is located
+    # @return True if succeed else raise an exception
+    def SetNodeOnEdge(self, NodeID, Edge, paramOnEdge):
+        if ( isinstance( Edge, geompyDC.GEOM._objref_GEOM_Object)):
+            EdgeID = Edge.GetSubShapeIndices()[0]
+        else:
+            EdgeID = Edge
+        try:
+            self.editor.SetNodeOnEdge(NodeID, EdgeID, paramOnEdge)
+        except SALOME.SALOME_Exception, inst:
+            raise ValueError, inst.details.text
+        return True
+
+    ## @brief Store node position on a face
+    # @param NodeID - node ID
+    # @param Face - face or face ID
+    # @param u - U parameter on face where the node is located
+    # @param v - V parameter on face where the node is located
+    # @return True if succeed else raise an exception
+    def SetNodeOnFace(self, NodeID, Face, u, v):
+        if ( isinstance( Face, geompyDC.GEOM._objref_GEOM_Object)):
+            FaceID = Face.GetSubShapeIndices()[0]
+        else:
+            FaceID = Face
+        try:
+            self.editor.SetNodeOnFace(NodeID, FaceID, u, v)
+        except SALOME.SALOME_Exception, inst:
+            raise ValueError, inst.details.text
+        return True
+
+    ## @brief Bind a node to a solid
+    # @param NodeID - node ID
+    # @param Solid - solid or solid ID
+    # @return True if succeed else raise an exception
+    def SetNodeInVolume(self, NodeID, Solid):
+        if ( isinstance( Solid, geompyDC.GEOM._objref_GEOM_Object)):
+            SolidID = Solid.GetSubShapeIndices()[0]
+        else:
+            SolidID = Solid
+        try:
+            self.editor.SetNodeInVolume(NodeID, SolidID)
+        except SALOME.SALOME_Exception, inst:
+            raise ValueError, inst.details.text
+        return True
+
+    ## @brief Bind an element to a shape
+    # @param ElementID - element ID
+    # @param Shape - shape or shape ID
+    # @return True if succeed else raise an exception
+    def SetMeshElementOnShape(self, ElementID, Shape):
+        if ( isinstance( Shape, geompyDC.GEOM._objref_GEOM_Object)):
+            ShapeID = Shape.GetSubShapeIndices()[0]
+        else:
+            ShapeID = Shape
+        try:
+            self.editor.SetMeshElementOnShape(ElementID, ShapeID)
+        except SALOME.SALOME_Exception, inst:
+            raise ValueError, inst.details.text
+        return True
+
+
     ## Move node with given id
     #  @param NodeID id of the node
     #  @param x new X coordinate
@@ -2289,7 +2582,7 @@ class Mesh:
     ## Split quadrangles into triangles.
     #  @param IDsOfElements the faces to be splitted.
     #  @param theCriterion  is FT_...; used to choose a diagonal for splitting.
-    #  @param @return TRUE in case of success, FALSE otherwise.
+    #  @return TRUE in case of success, FALSE otherwise.
     def QuadToTri (self, IDsOfElements, theCriterion):
         if IDsOfElements == []:
             IDsOfElements = self.GetElementsId()
@@ -2483,9 +2776,9 @@ class Mesh:
     #  @param MaxNbOfIterations maximum number of iterations
     #  @param MaxAspectRatio varies in range [1.0, inf]
     #  @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH)
-    def SmoothObject(self, theObject, IDsOfFixedNodes, 
+    def SmoothObject(self, theObject, IDsOfFixedNodes,
                      MaxNbOfIterations, MaxxAspectRatio, Method):
-        return self.editor.SmoothObject(theObject, IDsOfFixedNodes, 
+        return self.editor.SmoothObject(theObject, IDsOfFixedNodes,
                                         MaxNbOfIterations, MaxxAspectRatio, Method)
 
     ## Parametric smooth the given elements
@@ -2514,13 +2807,13 @@ class Mesh:
         return self.editor.SmoothParametricObject(theObject, IDsOfFixedNodes,
                                                   MaxNbOfIterations, MaxAspectRatio, Method)
 
-    ## Converts all mesh to quadratic one, deletes old elements, replacing 
+    ## Converts all mesh to quadratic one, deletes old elements, replacing
     #  them with quadratic ones with the same id.
     def ConvertToQuadratic(self, theForce3d):
         self.editor.ConvertToQuadratic(theForce3d)
 
     ## Converts all mesh from quadratic to ordinary ones,
-    #  deletes old quadratic elements, \n replacing 
+    #  deletes old quadratic elements, \n replacing
     #  them with ordinary mesh elements with the same id.
     def ConvertFromQuadratic(self):
         return self.editor.ConvertFromQuadratic()
@@ -2539,12 +2832,17 @@ class Mesh:
     #  @param AngleInRadians angle of Rotation
     #  @param NbOfSteps number of steps
     #  @param Tolerance tolerance
-    def RotationSweep(self, IDsOfElements, Axix, AngleInRadians, NbOfSteps, Tolerance):
+    #  @param MakeGroups to generate new groups from existing ones
+    def RotationSweep(self, IDsOfElements, Axix, AngleInRadians, NbOfSteps, Tolerance, MakeGroups=False):
         if IDsOfElements == []:
             IDsOfElements = self.GetElementsId()
         if ( isinstance( Axix, geompyDC.GEOM._objref_GEOM_Object)):
             Axix = self.smeshpyD.GetAxisStruct(Axix)
+        if MakeGroups:
+            return self.editor.RotationSweepMakeGroups(IDsOfElements, Axix,
+                                                       AngleInRadians, NbOfSteps, Tolerance)
         self.editor.RotationSweep(IDsOfElements, Axix, AngleInRadians, NbOfSteps, Tolerance)
+        return []
 
     ## Generate new elements by rotation of the elements of object around the axis
     #  @param theObject object wich elements should be sweeped
@@ -2552,60 +2850,87 @@ class Mesh:
     #  @param AngleInRadians angle of Rotation
     #  @param NbOfSteps number of steps
     #  @param Tolerance tolerance
-    def RotationSweepObject(self, theObject, Axix, AngleInRadians, NbOfSteps, Tolerance):
+    #  @param MakeGroups to generate new groups from existing ones
+    def RotationSweepObject(self, theObject, Axix, AngleInRadians, NbOfSteps, Tolerance, MakeGroups=False):
         if ( isinstance( Axix, geompyDC.GEOM._objref_GEOM_Object)):
             Axix = self.smeshpyD.GetAxisStruct(Axix)
+        if MakeGroups:
+            return self.editor.RotationSweepObjectMakeGroups(theObject, Axix, AngleInRadians,
+                                                             NbOfSteps, Tolerance)
         self.editor.RotationSweepObject(theObject, Axix, AngleInRadians, NbOfSteps, Tolerance)
+        return []
 
     ## Generate new elements by extrusion of the elements with given ids
     #  @param IDsOfElements list of elements ids for extrusion
-    #  @param StepVector vector, defining the direction and value of extrusion 
+    #  @param StepVector vector, defining the direction and value of extrusion
     #  @param NbOfSteps the number of steps
-    def ExtrusionSweep(self, IDsOfElements, StepVector, NbOfSteps):
+    #  @param MakeGroups to generate new groups from existing ones
+    def ExtrusionSweep(self, IDsOfElements, StepVector, NbOfSteps, MakeGroups=False):
         if IDsOfElements == []:
             IDsOfElements = self.GetElementsId()
         if ( isinstance( StepVector, geompyDC.GEOM._objref_GEOM_Object)):
             StepVector = self.smeshpyD.GetDirStruct(StepVector)
+        if MakeGroups:
+            return self.editor.ExtrusionSweepMakeGroups(IDsOfElements, StepVector, NbOfSteps)
         self.editor.ExtrusionSweep(IDsOfElements, StepVector, NbOfSteps)
+        return []
 
     ## Generate new elements by extrusion of the elements with given ids
     #  @param IDsOfElements is ids of elements
-    #  @param StepVector vector, defining the direction and value of extrusion 
+    #  @param StepVector vector, defining the direction and value of extrusion
     #  @param NbOfSteps the number of steps
     #  @param ExtrFlags set flags for performing extrusion
     #  @param SewTolerance uses for comparing locations of nodes if flag
     #         EXTRUSION_FLAG_SEW is set
-    def AdvancedExtrusion(self, IDsOfElements, StepVector, NbOfSteps, ExtrFlags, SewTolerance):
+    #  @param MakeGroups to generate new groups from existing ones
+    def AdvancedExtrusion(self, IDsOfElements, StepVector, NbOfSteps, ExtrFlags, SewTolerance, MakeGroups=False):
         if ( isinstance( StepVector, geompyDC.GEOM._objref_GEOM_Object)):
             StepVector = self.smeshpyD.GetDirStruct(StepVector)
-        self.editor.AdvancedExtrusion(IDsOfElements, StepVector, NbOfSteps, ExtrFlags, SewTolerance)
+        if MakeGroups:
+            return self.editor.AdvancedExtrusionMakeGroups(IDsOfElements, StepVector, NbOfSteps,
+                                                           ExtrFlags, SewTolerance)
+        self.editor.AdvancedExtrusion(IDsOfElements, StepVector, NbOfSteps,
+                                      ExtrFlags, SewTolerance)
+        return []
 
     ## Generate new elements by extrusion of the elements belong to object
     #  @param theObject object wich elements should be processed
-    #  @param StepVector vector, defining the direction and value of extrusion 
+    #  @param StepVector vector, defining the direction and value of extrusion
     #  @param NbOfSteps the number of steps
-    def ExtrusionSweepObject(self, theObject, StepVector, NbOfSteps):
+    #  @param MakeGroups to generate new groups from existing ones
+    def ExtrusionSweepObject(self, theObject, StepVector, NbOfSteps, MakeGroups=False):
         if ( isinstance( StepVector, geompyDC.GEOM._objref_GEOM_Object)):
             StepVector = self.smeshpyD.GetDirStruct(StepVector)
+        if MakeGroups:
+            return self.editor.ExtrusionSweepObjectMakeGroups(theObject, StepVector, NbOfSteps)
         self.editor.ExtrusionSweepObject(theObject, StepVector, NbOfSteps)
+        return []
 
     ## Generate new elements by extrusion of the elements belong to object
     #  @param theObject object wich elements should be processed
-    #  @param StepVector vector, defining the direction and value of extrusion 
+    #  @param StepVector vector, defining the direction and value of extrusion
     #  @param NbOfSteps the number of steps
-    def ExtrusionSweepObject1D(self, theObject, StepVector, NbOfSteps):
+    #  @param MakeGroups to generate new groups from existing ones
+    def ExtrusionSweepObject1D(self, theObject, StepVector, NbOfSteps, MakeGroups=False):
         if ( isinstance( StepVector, geompyDC.GEOM._objref_GEOM_Object)):
             StepVector = self.smeshpyD.GetDirStruct(StepVector)
+        if MakeGroups:
+            return self.editor.ExtrusionSweepObject1DMakeGroups(theObject, StepVector, NbOfSteps)
         self.editor.ExtrusionSweepObject1D(theObject, StepVector, NbOfSteps)
+        return []
     
     ## Generate new elements by extrusion of the elements belong to object
     #  @param theObject object wich elements should be processed
-    #  @param StepVector vector, defining the direction and value of extrusion 
-    #  @param NbOfSteps the number of steps    
-    def ExtrusionSweepObject2D(self, theObject, StepVector, NbOfSteps):
+    #  @param StepVector vector, defining the direction and value of extrusion
+    #  @param NbOfSteps the number of steps
+    #  @param MakeGroups to generate new groups from existing ones
+    def ExtrusionSweepObject2D(self, theObject, StepVector, NbOfSteps, MakeGroups=False):
         if ( isinstance( StepVector, geompyDC.GEOM._objref_GEOM_Object)):
             StepVector = self.smeshpyD.GetDirStruct(StepVector)
+        if MakeGroups:
+            return self.editor.ExtrusionSweepObject2DMakeGroups(theObject, StepVector, NbOfSteps)
         self.editor.ExtrusionSweepObject2D(theObject, StepVector, NbOfSteps)
+        return []
 
     ## Generate new elements by extrusion of the given elements
     #  A path of extrusion must be a meshed edge.
@@ -2615,19 +2940,25 @@ class Mesh:
     #  @param NodeStart the first or the last node on the edge. It is used to define the direction of extrusion
     #  @param HasAngles allows the shape to be rotated around the path to get the resulting mesh in a helical fashion
     #  @param Angles list of angles
-    #  @param HasRefPoint allows to use base point 
+    #  @param HasRefPoint allows to use base point
     #  @param RefPoint point around which the shape is rotated(the mass center of the shape by default).
     #         User can specify any point as the Base Point and the shape will be rotated with respect to this point.
+    #  @param MakeGroups to generate new groups from existing ones
     #  @param LinearVariation makes compute rotation angles as linear variation of given Angles along path steps
     def ExtrusionAlongPath(self, IDsOfElements, PathMesh, PathShape, NodeStart,
-                           HasAngles, Angles, HasRefPoint, RefPoint, LinearVariation=False):
+                           HasAngles, Angles, HasRefPoint, RefPoint,
+                           MakeGroups=False, LinearVariation=False):
         if IDsOfElements == []:
             IDsOfElements = self.GetElementsId()
         if ( isinstance( RefPoint, geompyDC.GEOM._objref_GEOM_Object)):
             RefPoint = self.smeshpyD.GetPointStruct(RefPoint)
             pass
-        return self.editor.ExtrusionAlongPath(IDsOfElements, PathMesh.GetMesh(), PathShape, NodeStart,
-                                              HasAngles, Angles, HasRefPoint, RefPoint)
+        if MakeGroups:
+            return self.editor.ExtrusionAlongPathMakeGroups(IDsOfElements, PathMesh.GetMesh(),
+                                                            PathShape, NodeStart, HasAngles,
+                                                            Angles, HasRefPoint, RefPoint)
+        return self.editor.ExtrusionAlongPath(IDsOfElements, PathMesh.GetMesh(), PathShape,
+                                              NodeStart, HasAngles, Angles, HasRefPoint, RefPoint)
 
     ## Generate new elements by extrusion of the elements belong to object
     #  A path of extrusion must be a meshed edge.
@@ -2637,16 +2968,23 @@ class Mesh:
     #  @param NodeStart the first or the last node on the edge. It is used to define the direction of extrusion
     #  @param HasAngles allows the shape to be rotated around the path to get the resulting mesh in a helical fashion
     #  @param Angles list of angles
-    #  @param HasRefPoint allows to use base point 
+    #  @param HasRefPoint allows to use base point
     #  @param RefPoint point around which the shape is rotated(the mass center of the shape by default).
     #         User can specify any point as the Base Point and the shape will be rotated with respect to this point.
+    #  @param MakeGroups to generate new groups from existing ones
     #  @param LinearVariation makes compute rotation angles as linear variation of given Angles along path steps
     def ExtrusionAlongPathObject(self, theObject, PathMesh, PathShape, NodeStart,
-                                 HasAngles, Angles, HasRefPoint, RefPoint, LinearVariation=False):
+                                 HasAngles, Angles, HasRefPoint, RefPoint,
+                                 MakeGroups=False, LinearVariation=False):
         if ( isinstance( RefPoint, geompyDC.GEOM._objref_GEOM_Object)):
-            RefPoint = self.smeshpyD.GetPointStruct(RefPoint) 
-        return self.editor.ExtrusionAlongPathObject(theObject, PathMesh.GetMesh(), PathShape, NodeStart,
-                                                    HasAngles, Angles, HasRefPoint, RefPoint, LinearVariation)
+            RefPoint = self.smeshpyD.GetPointStruct(RefPoint)
+        if MakeGroups:
+            return self.editor.ExtrusionAlongPathObjectMakeGroups(theObject, PathMesh.GetMesh(),
+                                                                  PathShape, NodeStart, HasAngles,
+                                                                  Angles, HasRefPoint, RefPoint)
+        return self.editor.ExtrusionAlongPathObject(theObject, PathMesh.GetMesh(), PathShape,
+                                                    NodeStart, HasAngles, Angles, HasRefPoint,
+                                                    RefPoint)
     
     ## Symmetrical copy of mesh elements
     #  @param IDsOfElements list of elements ids
@@ -2654,12 +2992,16 @@ class Mesh:
     #  @param theMirrorType is  POINT, AXIS or PLANE
     #  If the Mirror is geom object this parameter is unnecessary
     #  @param Copy allows to copy element(Copy is 1) or to replace with its mirroring(Copy is 0)
-    def Mirror(self, IDsOfElements, Mirror, theMirrorType, Copy=0):
+    #  @param MakeGroups to generate new groups from existing ones (if Copy)
+    def Mirror(self, IDsOfElements, Mirror, theMirrorType, Copy=0, MakeGroups=False):
         if IDsOfElements == []:
             IDsOfElements = self.GetElementsId()
         if ( isinstance( Mirror, geompyDC.GEOM._objref_GEOM_Object)):
             Mirror = self.smeshpyD.GetAxisStruct(Mirror)
+        if Copy and MakeGroups:
+            return self.editor.MirrorMakeGroups(IDsOfElements, Mirror, theMirrorType)
         self.editor.Mirror(IDsOfElements, Mirror, theMirrorType, Copy)
+        return []
 
     ## Symmetrical copy of object
     #  @param theObject mesh, submesh or group
@@ -2667,50 +3009,72 @@ class Mesh:
     #  @param theMirrorType is  POINT, AXIS or PLANE
     #  If the Mirror is geom object this parameter is unnecessary
     #  @param Copy allows to copy element(Copy is 1) or to replace with its mirroring(Copy is 0)
-    def MirrorObject (self, theObject, Mirror, theMirrorType, Copy=0):
+    #  @param MakeGroups to generate new groups from existing ones (if Copy)
+    def MirrorObject (self, theObject, Mirror, theMirrorType, Copy=0, MakeGroups=False):
         if ( isinstance( Mirror, geompyDC.GEOM._objref_GEOM_Object)):
             Mirror = self.smeshpyD.GetAxisStruct(Mirror)
+        if Copy and MakeGroups:
+            return self.editor.MirrorObjectMakeGroups(theObject, Mirror, theMirrorType)
         self.editor.MirrorObject(theObject, Mirror, theMirrorType, Copy)
+        return []
 
     ## Translates the elements
     #  @param IDsOfElements list of elements ids
     #  @param Vector direction of translation(DirStruct or vector)
     #  @param Copy allows to copy the translated elements
-    def Translate(self, IDsOfElements, Vector, Copy):
+    #  @param MakeGroups to generate new groups from existing ones (if Copy)
+    def Translate(self, IDsOfElements, Vector, Copy, MakeGroups=False):
         if IDsOfElements == []:
             IDsOfElements = self.GetElementsId()
         if ( isinstance( Vector, geompyDC.GEOM._objref_GEOM_Object)):
             Vector = self.smeshpyD.GetDirStruct(Vector)
+        if Copy and MakeGroups:
+            return self.editor.TranslateMakeGroups(IDsOfElements, Vector)
         self.editor.Translate(IDsOfElements, Vector, Copy)
+        return []
 
     ## Translates the object
     #  @param theObject object to translate(mesh, submesh, or group)
     #  @param Vector direction of translation(DirStruct or geom vector)
     #  @param Copy allows to copy the translated elements
-    def TranslateObject(self, theObject, Vector, Copy):
+    #  @param MakeGroups to generate new groups from existing ones (if Copy)
+    def TranslateObject(self, theObject, Vector, Copy, MakeGroups=False):
         if ( isinstance( Vector, geompyDC.GEOM._objref_GEOM_Object)):
             Vector = self.smeshpyD.GetDirStruct(Vector)
+        if Copy and MakeGroups:
+            return self.editor.TranslateObjectMakeGroups(theObject, Vector)
         self.editor.TranslateObject(theObject, Vector, Copy)
+        return []
 
     ## Rotates the elements
     #  @param IDsOfElements list of elements ids
     #  @param Axis axis of rotation(AxisStruct or geom line)
     #  @param AngleInRadians angle of rotation(in radians)
-    #  @param Copy allows to copy the rotated elements   
-    def Rotate (self, IDsOfElements, Axis, AngleInRadians, Copy):
+    #  @param Copy allows to copy the rotated elements
+    #  @param MakeGroups to generate new groups from existing ones (if Copy)
+    def Rotate (self, IDsOfElements, Axis, AngleInRadians, Copy, MakeGroups=False):
         if IDsOfElements == []:
             IDsOfElements = self.GetElementsId()
         if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)):
             Axis = self.smeshpyD.GetAxisStruct(Axis)
+        if Copy and MakeGroups:
+            return self.editor.RotateMakeGroups(IDsOfElements, Axis, AngleInRadians)
         self.editor.Rotate(IDsOfElements, Axis, AngleInRadians, Copy)
+        return []
 
     ## Rotates the object
     #  @param theObject object to rotate(mesh, submesh, or group)
     #  @param Axis axis of rotation(AxisStruct or geom line)
     #  @param AngleInRadians angle of rotation(in radians)
     #  @param Copy allows to copy the rotated elements
-    def RotateObject (self, theObject, Axis, AngleInRadians, Copy):
+    #  @param MakeGroups to generate new groups from existing ones (if Copy)
+    def RotateObject (self, theObject, Axis, AngleInRadians, Copy, MakeGroups=False):
+        if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)):
+            Axis = self.smeshpyD.GetAxisStruct(Axis)
+        if Copy and MakeGroups:
+            return self.editor.RotateObjectMakeGroups(theObject, Axis, AngleInRadians)
         self.editor.RotateObject(theObject, Axis, AngleInRadians, Copy)
+        return []
 
     ## Find group of nodes close to each other within Tolerance.
     #  @param Tolerance tolerance value
@@ -2786,13 +3150,13 @@ class Mesh:
         return self.editor.ChangeElemNodes(ide, newIDs)
     
     ## If during last operation of MeshEditor some nodes were
-    #  created this method returns list of it's IDs, \n
+    #  created this method returns list of its IDs, \n
     #  if new nodes not created - returns empty list
     def GetLastCreatedNodes(self):
         return self.editor.GetLastCreatedNodes()
 
     ## If during last operation of MeshEditor some elements were
-    #  created this method returns list of it's IDs, \n
+    #  created this method returns list of its IDs, \n
     #  if new elements not creared - returns empty list
     def GetLastCreatedElems(self):
         return self.editor.GetLastCreatedElems()