Salome HOME
Update of CheckDone
[modules/smesh.git] / src / SMESH_SWIG / StdMeshersBuilder.py
index 180ba86be86b4ba9f09a50cbd21c213529235be5..280ae889ff0b620034c9a0e05a3fb09a423abcdd 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -25,6 +25,7 @@ LIBRARY = "libStdMeshersEngine.so"
 
 from salome.smesh.smesh_algorithm import Mesh_Algorithm
 import StdMeshers
+from salome.geom import geomBuilder
 
 #----------------------------
 # Mesh algo type identifiers
@@ -42,13 +43,8 @@ Algorithm type: Python 1D algorithm, see :class:`~StdMeshersBuilder.StdMeshersBu
 
 COMPOSITE   = "CompositeSegment_1D"
 """
-
 Algorithm type: Composite segment 1D algorithm, see :class:`~StdMeshersBuilder.StdMeshersBuilder_CompositeSegment`
 """
-MEFISTO     = "MEFISTO_2D"
-"""
-Algorithm type: Triangle MEFISTO 2D algorithm, see :class:`~StdMeshersBuilder.StdMeshersBuilder_Triangle_MEFISTO`
-"""
 
 Hexa        = "Hexa_3D"
 """
@@ -75,6 +71,11 @@ POLYGON     = "PolygonPerFace_2D"
 Algorithm type: Polygon Per Face 2D algorithm, see :class:`~StdMeshersBuilder.StdMeshersBuilder_PolygonPerFace`
 """
 
+POLYHEDRON = "PolyhedronPerSolid_3D"
+"""
+Algorithm type: Polyhedron Per Solid 3D algorithm, see :class:`~StdMeshersBuilder.StdMeshersBuilder_PolyhedronPerSolid`
+"""
+
 # import items of enums
 for e in StdMeshers.QuadType._items: exec('%s = StdMeshers.%s'%(e,e))
 for e in StdMeshers.VLExtrusionMethod._items: exec('%s = StdMeshers.%s'%(e,e))
@@ -107,7 +108,7 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
     of smeshBuilder.Mesh class    
     """
 
-    docHelper  = "Creates segment 1D algorithm for edges"
+    docHelper  = "Create segment 1D algorithm for edges"
     """
     doc string of the method
     """
@@ -131,7 +132,7 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
         Parameters:
             l : for the length of segments that cut an edge
             UseExisting : if == true - searches for an  existing hypothesis created with
-                the same parameters, else (default) - creates a new one
+                the same parameters, else (default) - Create a new one
             p : precision, used for calculation of the number of segments.
                 The precision should be a positive, meaningful value within the range [0,1].
                 In general, the number of segments is calculated with the formula:
@@ -161,7 +162,7 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
             length : is optional maximal allowed length of segment, if it is omitted
                 the preestimated length is used that depends on geometry size
             UseExisting : if ==true - searches for an existing hypothesis created with
-                the same parameters, else (default) - creates a new one
+                the same parameters, else (default) - Create a new one
         
         Returns:
             an instance of StdMeshers_MaxLength hypothesis
@@ -169,15 +170,16 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
     
 
         hyp = self.Hypothesis("MaxLength", [length], UseExisting=UseExisting)
-        if length > 0.0:
+        if isinstance(length,str) or length > 0:
             # set given length
             hyp.SetLength(length)
         if not UseExisting:
             # set preestimated length
+            import SMESH
             gen = self.mesh.smeshpyD
             initHyp = gen.GetHypothesisParameterValues("MaxLength", "libStdMeshersEngine.so",
                                                        self.mesh.GetMesh(), self.mesh.GetShape(),
-                                                       False) # <- byMesh
+                                                       SMESH.HypInitParams( 1, 1.0, False ))
             preHyp = initHyp._narrow(StdMeshers.StdMeshers_MaxLength)
             if preHyp:
                 hyp.SetPreestimatedLength( preHyp.GetPreestimatedLength() )
@@ -188,21 +190,21 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
 
     def NumberOfSegments(self, n, s=[], reversedEdges=[], UseExisting=0):
         """
-       Defines "NumberOfSegments" hypothesis to cut an edge in a fixed number of segments
+        Defines "NumberOfSegments" hypothesis to cut an edge in a fixed number of segments
 
         Parameters:
             n: for the number of segments that cut an edge
             s: for the scale factor (optional)
             reversedEdges: is a list of edges to mesh using reversed orientation.
-                   A list item can also be a tuple (edge, 1st_vertex_of_edge)
+                    A list item can also be a tuple (edge, 1st_vertex_of_edge)
             UseExisting: if ==true - searches for an existing hypothesis created with
-                   the same parameters, else (default) - create a new one
+                    the same parameters, else (default) - create a new one
     
         Returns: 
-           an instance of StdMeshers_NumberOfSegments hypothesis
+            an instance of StdMeshers_NumberOfSegments hypothesis
         """
     
-       
+        
         if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges
             reversedEdges, UseExisting = [], reversedEdges
         entry = self.MainShapeEntry()
@@ -223,8 +225,8 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
 
     def _compareNumberOfSegments(self, hyp, args):
         """
-       Private method
-       Checks if the given "NumberOfSegments" hypothesis has the same parameters as the given arguments
+        Private method
+        Checks if the given "NumberOfSegments" hypothesis has the same parameters as the given arguments
         """
         if hyp.GetNumberOfSegments() == args[0]:
             if len(args) == 3:
@@ -252,12 +254,12 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
             maxSize: defines the maximal allowed segment length
             deflection: defines the maximal allowed distance from a segment to an edge
             UseExisting: if ==true - searches for an existing hypothesis created with
-                the same parameters, else (default) - creates a new one
+                the same parameters, else (default) - Create a new one
 
         Returns:
             an instance of StdMeshers_Adaptive1D hypothesis
         """
-       
+        
         from salome.smesh.smeshBuilder import IsEqual
         compFun = lambda hyp, args: ( IsEqual(hyp.GetMinSize(), args[0]) and \
                                       IsEqual(hyp.GetMaxSize(), args[1]) and \
@@ -270,21 +272,21 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
         return hyp
 
     def Arithmetic1D(self, start, end, reversedEdges=[], UseExisting=0):
-       """
-       Defines "Arithmetic1D" hypothesis to cut an edge in several segments with a length
-               that changes in arithmetic progression
-
-       Parameters:
-           start: defines the length of the first segment
-           end:   defines the length of the last  segment
-           reversedEdges: is a list of edges to mesh using reversed orientation.
-               A list item can also be a tuple (edge, 1st_vertex_of_edge)
-           UseExisting: if ==true - searches for an existing hypothesis created with
-               the same parameters, else (default) - creates a new one
-
-       Returns:
-               an instance of StdMeshers_Arithmetic1D hypothesis
-       """
+        """
+        Defines "Arithmetic1D" hypothesis to cut an edge in several segments with a length
+                that changes in arithmetic progression
+
+        Parameters:
+            start: defines the length of the first segment
+            end:   defines the length of the last  segment
+            reversedEdges: is a list of edges to mesh using reversed orientation.
+                A list item can also be a tuple (edge, 1st_vertex_of_edge)
+            UseExisting: if ==true - searches for an existing hypothesis created with
+                the same parameters, else (default) - Create a new one
+
+        Returns:
+                an instance of StdMeshers_Arithmetic1D hypothesis
+        """
         
         if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges
             reversedEdges, UseExisting = [], reversedEdges
@@ -304,21 +306,21 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
         return hyp
 
     def GeometricProgression(self, start, ratio, reversedEdges=[], UseExisting=0):
-       """
-           Defines "GeometricProgression" hypothesis to cut an edge in several
-               segments with a length that changes in Geometric progression
-
-           Parameters:
-               start: defines the length of the first segment
-               ratio: defines the common ratio of the geometric progression
-               reversedEdges: is a list of edges to mesh using reversed orientation.
-                   A list item can also be a tuple (edge, 1st_vertex_of_edge)
-               UseExisting: if ==true - searches for an existing hypothesis created with
-                   the same parameters, else (default) - creates a new one
-
-           Returns:
-               an instance of StdMeshers_Geometric1D hypothesis
-       """
+        """
+            Defines "GeometricProgression" hypothesis to cut an edge in several
+                segments with a length that changes in Geometric progression
+
+            Parameters:
+                start: defines the length of the first segment
+                ratio: defines the common ratio of the geometric progression
+                reversedEdges: is a list of edges to mesh using reversed orientation.
+                    A list item can also be a tuple (edge, 1st_vertex_of_edge)
+                UseExisting: if ==true - searches for an existing hypothesis created with
+                    the same parameters, else (default) - Create a new one
+
+            Returns:
+                an instance of StdMeshers_Geometric1D hypothesis
+        """
         
         reversedEdgeInd = self.ReversedEdgeIndices(reversedEdges)
         entry = self.MainShapeEntry()
@@ -337,23 +339,23 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
 
     def FixedPoints1D(self, points, nbSegs=[1], reversedEdges=[], UseExisting=0):
         """
-       Defines "FixedPoints1D" hypothesis to cut an edge using parameter
-               on curve from 0 to 1 (additionally it is neecessary to check
-               orientation of edges and create list of reversed edges if it is
-               needed) and sets numbers of segments between given points (default
-               values are 1)
-
-       Parameters:
-           points: defines the list of parameters on curve
-           nbSegs: defines the list of numbers of segments
-           reversedEdges: is a list of edges to mesh using reversed orientation.
-               A list item can also be a tuple (edge, 1st_vertex_of_edge)
-           UseExisting: if ==true - searches for an existing hypothesis created with
-               the same parameters, else (default) - creates a new one
-
-       Returns:
-               an instance of StdMeshers_FixedPoints1D hypothesis
-       """
+        Defines "FixedPoints1D" hypothesis to cut an edge using parameter
+                on curve from 0 to 1 (additionally it is neecessary to check
+                orientation of edges and create list of reversed edges if it is
+                needed) and sets numbers of segments between given points (default
+                values are 1)
+
+        Parameters:
+            points: defines the list of parameters on curve
+            nbSegs: defines the list of numbers of segments
+            reversedEdges: is a list of edges to mesh using reversed orientation.
+                A list item can also be a tuple (edge, 1st_vertex_of_edge)
+            UseExisting: if ==true - searches for an existing hypothesis created with
+                the same parameters, else (default) - Create a new one
+
+        Returns:
+                an instance of StdMeshers_FixedPoints1D hypothesis
+        """
         
         if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges
             reversedEdges, UseExisting = [], reversedEdges
@@ -381,12 +383,12 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
             reversedEdges: is a list of edges to mesh using reversed orientation.
                 A list item can also be a tuple (edge, 1st_vertex_of_edge)
             UseExisting: if ==true - searches for an existing hypothesis created with
-                the same parameters, else (default) - creates a new one
+                the same parameters, else (default) - Create a new one
 
         Returns:
             an instance of StdMeshers_StartEndLength hypothesis
         """
-       
+        
         if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges
             reversedEdges, UseExisting = [], reversedEdges
         reversedEdgeInd = self.ReversedEdgeIndices(reversedEdges)
@@ -405,14 +407,14 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
         return hyp
 
     def Deflection1D(self, d, UseExisting=0):
-       """
-       Defines "Deflection1D" hypothesis
+        """
+        Defines "Deflection1D" hypothesis
 
-       Parameters:
+        Parameters:
             d: for the deflection
             UseExisting: if ==true - searches for an existing hypothesis created with
                 the same parameters, else (default) - create a new one
-       """
+        """
         
         from salome.smesh.smeshBuilder import IsEqual
         compFun = lambda hyp, args: IsEqual(hyp.GetDeflection(), args[0])
@@ -421,35 +423,35 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
         return hyp
 
     def Propagation(self):
-       """
-       Defines "Propagation" hypothesis that propagates 1D hypotheses
-               from an edge where this hypothesis is assigned to
-               on all other edges that are at the opposite side in case of quadrangular faces
-               This hypothesis should be assigned to an edge to propagate a hypothesis from.
-       """
+        """
+        Defines "Propagation" hypothesis that propagates 1D hypotheses
+                from an edge where this hypothesis is assigned to
+                on all other edges that are at the opposite side in case of quadrangular faces
+                This hypothesis should be assigned to an edge to propagate a hypothesis from.
+        """
         
         return self.Hypothesis("Propagation", UseExisting=1, CompareMethod=self.CompareEqualHyp)
 
     def PropagationOfDistribution(self):
-       """
-       Defines "Propagation of Node Distribution" hypothesis that propagates
-               distribution of nodes from an edge where this hypothesis is assigned to,
-               to opposite edges of quadrangular faces, so that number of segments on all these
-               edges will be the same, as well as relations between segment lengths. 
-       """
+        """
+        Defines "Propagation of Node Distribution" hypothesis that propagates
+                distribution of nodes from an edge where this hypothesis is assigned to,
+                to opposite edges of quadrangular faces, so that number of segments on all these
+                edges will be the same, as well as relations between segment lengths. 
+        """
         
         return self.Hypothesis("PropagOfDistribution", UseExisting=1,
                                CompareMethod=self.CompareEqualHyp)
 
     def AutomaticLength(self, fineness=0, UseExisting=0):
-       """
-       Defines "AutomaticLength" hypothesis
-
-       Parameters:
-           fineness: for the fineness [0-1]
-           UseExisting: if ==true - searches for an existing hypothesis created with the
-               same parameters, else (default) - create a new one
-       """
+        """
+        Defines "AutomaticLength" hypothesis
+
+        Parameters:
+            fineness: for the fineness [0-1]
+            UseExisting: if ==true - searches for an existing hypothesis created with the
+                same parameters, else (default) - create a new one
+        """
         
         from salome.smesh.smeshBuilder import IsEqual
         compFun = lambda hyp, args: IsEqual(hyp.GetFineness(), args[0])
@@ -458,22 +460,22 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
         hyp.SetFineness( fineness )
         return hyp
 
-    def LengthNearVertex(self, length, vertex=0, UseExisting=0):
-       """
-       Defines "SegmentLengthAroundVertex" hypothesis
-
-       Parameters:
-           length: for the segment length
-           vertex: for the length localization: the vertex index [0,1] | vertex object.
-               Any other integer value means that the hypothesis will be set on the
-               whole 1D shape, where Mesh_Segment algorithm is assigned.
-           UseExisting: if ==true - searches for an  existing hypothesis created with
-               the same parameters, else (default) - creates a new one
-       """
+    def LengthNearVertex(self, length, vertex=-1, UseExisting=0):
+        """
+        Defines "SegmentLengthAroundVertex" hypothesis
+
+        Parameters:
+            length: for the segment length
+            vertex: for the length localization: the vertex index [0,1] | vertex object.
+                Any other integer value means that the hypothesis will be set on the
+                whole 1D shape, where Mesh_Segment algorithm is assigned.
+            UseExisting: if ==true - searches for an  existing hypothesis created with
+                the same parameters, else (default) - Create a new one
+        """
         
         import types
         store_geom = self.geom
-        if type(vertex) is types.IntType:
+        if isinstance(vertex, int):
             if vertex == 0 or vertex == 1:
                 from salome.geom import geomBuilder
                 vertex = self.mesh.geompyD.ExtractShapes(self.geom, geomBuilder.geomBuilder.ShapeType["VERTEX"],True)[vertex]
@@ -486,7 +488,7 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
         # 0D algorithm
         if self.geom is None:
             self.geom = store_geom
-            raise RuntimeError, "Attempt to create SegmentAroundVertex_0D algorithm on None shape"
+            raise RuntimeError("Attempt to create SegmentAroundVertex_0D algorithm on None shape")
         from salome.smesh.smeshBuilder import AssureGeomPublished, GetName, TreatHypoStatus
         AssureGeomPublished( self.mesh, self.geom )
         name = GetName(self.geom)
@@ -507,15 +509,15 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
         return hyp
 
     def QuadraticMesh(self):
-       """
-       Defines "QuadraticMesh" hypothesis, forcing construction of quadratic edges.
-       If the 2D mesher sees that all boundary edges are quadratic,
-       it generates quadratic faces, else it generates linear faces using
-       medium nodes as if they are vertices.
-       The 3D mesher generates quadratic volumes only if all boundary faces
-       are quadratic, else it fails.
-       """
-       
+        """
+        Defines "QuadraticMesh" hypothesis, forcing construction of quadratic edges.
+        If the 2D mesher sees that all boundary edges are quadratic,
+        it generates quadratic faces, else it generates linear faces using
+        medium nodes as if they are vertices.
+        The 3D mesher generates quadratic volumes only if all boundary faces
+        are quadratic, else it fails.
+        """
+        
         hyp = self.Hypothesis("QuadraticMesh", UseExisting=1, CompareMethod=self.CompareEqualHyp)
         return hyp
 
@@ -545,7 +547,7 @@ class StdMeshersBuilder_CompositeSegment(StdMeshersBuilder_Segment):
         of smeshBuilder.Mesh class
     """
 
-    docHelper  = "Creates segment 1D algorithm for edges"
+    docHelper  = "Create segment 1D algorithm for edges"
     """
     doc string of the method
     """
@@ -566,8 +568,8 @@ class StdMeshersBuilder_CompositeSegment(StdMeshersBuilder_Segment):
 
 class StdMeshersBuilder_Segment_Python(Mesh_Algorithm):
     """
-    Defines a segment 1D algorithm for discretization of edges with Python function
-       It is created by calling smeshBuilder.Mesh.Segment(smeshBuilder.PYTHON,geom=0)
+    Defines a segment 1D algorithm for discretization of edges with Python function.
+    It is created by calling smeshBuilder.Mesh.Segment(smeshBuilder.PYTHON,geom=0)
     """
     
 
@@ -579,7 +581,7 @@ class StdMeshersBuilder_Segment_Python(Mesh_Algorithm):
     """
     type of algorithm used with helper function in smeshBuilder.Mesh class
     """
-    docHelper  = "Creates segment 1D algorithm for edges"
+    docHelper  = "Create segment 1D algorithm for edges"
     """
     doc string of the method
     """
@@ -605,7 +607,7 @@ class StdMeshersBuilder_Segment_Python(Mesh_Algorithm):
             n: for the number of segments that cut an edge
             func: for the python function that calculates the length of all segments
             UseExisting: if ==true - searches for the existing hypothesis created with
-                the same parameters, else (default) - creates a new one
+                the same parameters, else (default) - Create a new one
         """
         
         compFun = lambda hyp, args: False
@@ -617,75 +619,9 @@ class StdMeshersBuilder_Segment_Python(Mesh_Algorithm):
 
     pass # end of StdMeshersBuilder_Segment_Python class
 
-class StdMeshersBuilder_Triangle_MEFISTO(Mesh_Algorithm):
-    """
-    Triangle MEFISTO 2D algorithm
-    It is created by calling smeshBuilder.Mesh.Triangle(smeshBuilder.MEFISTO,geom=0)
-    """
-    
-
-    meshMethod = "Triangle"
-    """
-    name of the dynamic method in smeshBuilder.Mesh class
-    """
-    algoType   = MEFISTO
-    """
-    type of algorithm used with helper function in smeshBuilder.Mesh class
-    """
-    isDefault  = True
-    """
-    flag pointing whether this algorithm should be used by default in dynamic method
-        of smeshBuilder.Mesh class
-    """
-    docHelper  = "Creates triangle 2D algorithm for faces"
-    """
-    doc string of the method
-    """
-
-    def __init__(self, mesh, geom=0):
-        """
-        Private constructor.
-
-        Parameters:
-            mesh: parent mesh object algorithm is assigned to
-            geom: geometry (shape/sub-shape) algorithm is assigned to;
-                if it is :code:`0` (default), the algorithm is assigned to the main shape
-        """
-        Mesh_Algorithm.__init__(self)
-        self.Create(mesh, geom, self.algoType)
-        pass
-
-    def MaxElementArea(self, area, UseExisting=0):
-        """
-        Defines "MaxElementArea" hypothesis basing on the definition of the maximum area of each triangle
-
-        Parameters:
-            area: for the maximum area of each triangle
-            UseExisting: if ==true - searches for an  existing hypothesis created with the
-                same parameters, else (default) - creates a new one
-        """
-        
-        from salome.smesh.smeshBuilder import IsEqual
-        comparator = lambda hyp, args: IsEqual(hyp.GetMaxElementArea(), args[0])
-        hyp = self.Hypothesis("MaxElementArea", [area], UseExisting=UseExisting,
-                              CompareMethod=comparator)
-        hyp.SetMaxElementArea(area)
-        return hyp
-
-    def LengthFromEdges(self):
-        """
-        Defines "LengthFromEdges" hypothesis to build triangles
-            based on the length of the edges taken from the wire
-        """
-        
-        hyp = self.Hypothesis("LengthFromEdges", UseExisting=1, CompareMethod=self.CompareEqualHyp)
-        return hyp
-
-    pass # end of StdMeshersBuilder_Triangle_MEFISTO class
-
 class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
     """
-    Defines a quadrangle 2D algorithm
+    Defines a quadrangle 2D algorithm.
     It is created by calling smeshBuilder.Mesh.Quadrangle(geom=0)
     """
     
@@ -703,7 +639,7 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
     flag pointing whether this algorithm should be used by default in dynamic method
         of smeshBuilder.Mesh class
     """
-    docHelper  = "Creates quadrangle 2D algorithm for faces"
+    docHelper  = "Create quadrangle 2D algorithm for faces"
     """
     doc string of the method
     """
@@ -726,7 +662,7 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
         pass
 
     def QuadrangleParameters(self, quadType=StdMeshers.QUAD_STANDARD, triangleVertex=0,
-                             enfVertices=[],enfPoints=[],UseExisting=0):
+                             enfVertices=[],enfPoints=[],corners=[],UseExisting=0):
         """
         Defines "QuadrangleParameters" hypothesis
             quadType defines the algorithm of transition between differently descretized
@@ -762,8 +698,15 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
                 or triples of values ([[x1,y1,z1], [x2,y2,z2], ...]).
                 In the case if the defined QuadrangleParameters() refer to a sole face,
                 all given points must lie on this face, else the mesher fails.
+            corners: list of vertices that should be used as quadrangle corners.
+                The parameter can be useful for faces with more than four vertices,
+                since in some cases Quadrangle Mapping algorithm chooses corner vertices
+                differently than it is desired.
+                A hypothesis can be global and define corners for all CAD faces that
+                require it, but be sure that each specified vertex is a corner in all
+                faces the hypothesis will be applied to.
             UseExisting: if *True* - searches for the existing hypothesis created with
-                the same parameters, else (default) - creates a new one
+                the same parameters, else (default) - Create a new one
         """
         
 
@@ -774,6 +717,7 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
         if isinstance( enfVertices, int ) and not enfPoints and not UseExisting:
             # a call of old syntax, before inserting enfVertices and enfPoints before UseExisting
             UseExisting, enfVertices = enfVertices, []
+
         pStructs, xyz = [], []
         for p in enfPoints:
             if isinstance( p, SMESH.PointStruct ):
@@ -791,14 +735,21 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
             self.params = self.Hypothesis("QuadrangleParams", [quadType,vertexID,entries,xyz],
                                           UseExisting = UseExisting, CompareMethod=compFun)
             pass
-        if self.params.GetQuadType() != quadType:
+
+        if corners and isinstance( corners[0], GEOM._objref_GEOM_Object ):
+            corners = [ self.mesh.geompyD.GetSubShapeID( self.mesh.geom, v ) for v in corners ]
+
+        #If quadType is None - will used default parameter ( StdMeshers.QUAD_STANDARD )
+        if quadType and self.params.GetQuadType() != quadType:
             self.params.SetQuadType(quadType)
-        if vertexID > 0:
+        #If triangleVertex is None - will used default parameter ( -1 ):
+        if triangleVertex and vertexID > 0:
             self.params.SetTriaVertex( vertexID )
         from salome.smesh.smeshBuilder import AssureGeomPublished
         for v in enfVertices:
             AssureGeomPublished( self.mesh, v )
         self.params.SetEnforcedNodes( enfVertices, pStructs )
+        self.params.SetCorners( corners )
         return self.params
 
     def QuadranglePreference(self, reversed=False, UseExisting=0):
@@ -807,12 +758,12 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
             quadrangles are built in the transition area along the finer meshed sides,
             if the total quantity of segments on all four sides of the face is even.
 
-       Parameters:
+        Parameters:
             reversed: if True, transition area is located along the coarser meshed sides.
         UseExisting: if ==true - searches for the existing hypothesis created with
-            the same parameters, else (default) - creates a new one
+            the same parameters, else (default) - Create a new one
         """
-       
+        
         if reversed:
             return self.QuadrangleParameters(QUAD_QUADRANGLE_PREF_REVERSED,UseExisting=UseExisting)
         return self.QuadrangleParameters(QUAD_QUADRANGLE_PREF,UseExisting=UseExisting)
@@ -824,7 +775,7 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
 
         Parameters:
             UseExisting: if ==true - searches for the existing hypothesis created with
-                the same parameters, else (default) - creates a new one
+                the same parameters, else (default) - Create a new one
         """
     
         return self.QuadrangleParameters(QUAD_TRIANGLE_PREF,UseExisting=UseExisting)
@@ -839,7 +790,7 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
 
         Parameters:
             UseExisting: if ==true - searches for the existing hypothesis created with
-                the same parameters, else (default) - creates a new one
+                the same parameters, else (default) - Create a new one
         """
         
         return self.QuadrangleParameters(QUAD_REDUCED,UseExisting=UseExisting)
@@ -854,7 +805,7 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
                 Vertex can be either a GEOM_Object or a vertex ID within the
                 shape to mesh
              UseExisting: if ==true - searches for the existing hypothesis created with
-                the same parameters, else (default) - creates a new one
+                the same parameters, else (default) - Create a new one
         """
         
         return self.QuadrangleParameters(QUAD_STANDARD,vertex,UseExisting)
@@ -863,7 +814,7 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
 
 class StdMeshersBuilder_Hexahedron(Mesh_Algorithm):
     """
-    Defines a hexahedron 3D algorithm
+    Defines a hexahedron 3D algorithm.
     It is created by calling smeshBuilder.Mesh.Hexahedron(geom=0)
     """
     
@@ -881,7 +832,7 @@ class StdMeshersBuilder_Hexahedron(Mesh_Algorithm):
     flag pointing whether this algorithm should be used by default in dynamic method
         of smeshBuilder.Mesh class
     """
-    docHelper  = "Creates hexahedron 3D algorithm for volumes"
+    docHelper  = "Create hexahedron 3D algorithm for volumes"
     """
     doc string of the method
     """
@@ -897,13 +848,22 @@ class StdMeshersBuilder_Hexahedron(Mesh_Algorithm):
         """
         Mesh_Algorithm.__init__(self)
         self.Create(mesh, geom, Hexa)
+        self.renumHypothesis = 0
         pass
 
+    def Renumber(self, blockCSList=[] ):
+        if isinstance( blockCSList, StdMeshers.BlockCS ):
+            blockCSList = [blockCSList]
+        if not self.renumHypothesis:
+            self.renumHypothesis = self.Hypothesis("BlockRenumber", blockCSList, UseExisting=0)
+        self.renumHypothesis.SetBlocksOrientation( blockCSList )
+        return self.renumHypothesis
+
     pass # end of StdMeshersBuilder_Hexahedron class
 
 class StdMeshersBuilder_Projection1D(Mesh_Algorithm):
     """
-    Defines a projection 1D algorithm
+    Defines a projection 1D algorithm.
     It is created by calling smeshBuilder.Mesh.Projection1D(geom=0)
     """
     
@@ -921,7 +881,7 @@ class StdMeshersBuilder_Projection1D(Mesh_Algorithm):
     flag pointing whether this algorithm should be used by default in dynamic method
         of smeshBuilder.Mesh class
     """
-    docHelper  = "Creates projection 1D algorithm for edges"
+    docHelper  = "Create projection 1D algorithm for edges"
     """
     doc string of the method
     """
@@ -950,7 +910,7 @@ class StdMeshersBuilder_Projection1D(Mesh_Algorithm):
             srcV: a vertex of *edge* to associate with *tgtV* (optional)
             tgtV: a vertex of *the edge* to which the algorithm is assigned, to associate with *srcV* (optional)
             UseExisting: if ==true - searches for the existing hypothesis created with
-                the same parameters, else (default) - creates a new one
+                the same parameters, else (default) - Create a new one
         """
         from salome.smesh.smeshBuilder import AssureGeomPublished, Mesh
         AssureGeomPublished( self.mesh, edge )
@@ -971,7 +931,7 @@ class StdMeshersBuilder_Projection1D(Mesh_Algorithm):
 
 class StdMeshersBuilder_Projection2D(Mesh_Algorithm):
     """
-    Defines a projection 2D algorithm
+    Defines a projection 2D algorithm.
     It is created by calling smeshBuilder.Mesh.Projection2D(geom=0)
     """
     
@@ -989,7 +949,7 @@ class StdMeshersBuilder_Projection2D(Mesh_Algorithm):
     flag pointing whether this algorithm should be used by default in dynamic method
         of smeshBuilder.Mesh class
     """
-    docHelper  = "Creates projection 2D algorithm for faces"
+    docHelper  = "Create projection 2D algorithm for faces"
     """
     doc string of the method
     """
@@ -1048,7 +1008,7 @@ class StdMeshersBuilder_Projection2D(Mesh_Algorithm):
 
 class StdMeshersBuilder_Projection1D2D(StdMeshersBuilder_Projection2D):
     """
-    Defines a projection 1D-2D algorithm
+    Defines a projection 1D-2D algorithm.
     It is created by calling smeshBuilder.Mesh.Projection1D2D(geom=0)
     """
     
@@ -1061,7 +1021,7 @@ class StdMeshersBuilder_Projection1D2D(StdMeshersBuilder_Projection2D):
     """
     type of algorithm used with helper function in smeshBuilder.Mesh class
     """
-    docHelper  = "Creates projection 1D-2D algorithm for faces"
+    docHelper  = "Create projection 1D-2D algorithm for faces"
     """
     doc string of the method
     """
@@ -1082,7 +1042,7 @@ class StdMeshersBuilder_Projection1D2D(StdMeshersBuilder_Projection2D):
 
 class StdMeshersBuilder_Projection3D(Mesh_Algorithm):
     """
-    Defines a projection 3D algorithm
+    Defines a projection 3D algorithm.
     It is created by calling smeshBuilder.Mesh.Projection3D(geom=0)
     """
     
@@ -1095,7 +1055,7 @@ class StdMeshersBuilder_Projection3D(Mesh_Algorithm):
     """
     type of algorithm used with helper function in smeshBuilder.Mesh class
     """
-    docHelper  = "Creates projection 3D algorithm for volumes"
+    docHelper  = "Create projection 3D algorithm for volumes"
     """
     doc string of the method
     """
@@ -1128,7 +1088,7 @@ class StdMeshersBuilder_Projection3D(Mesh_Algorithm):
             srcV2: a vertex of *solid* to associate with *tgtV1* (optional)
             tgtV2: a vertex of *the solid* to which the algorithm is assigned,to associate with *srcV2* (optional)
             UseExisting: if ==true - searches for the existing hypothesis created with
-                    the same parameters, else (default) - creates a new one
+                    the same parameters, else (default) - Create a new one
 
         Note: 
             association vertices must belong to one edge of a solid
@@ -1156,7 +1116,7 @@ class StdMeshersBuilder_Projection3D(Mesh_Algorithm):
 
 class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
     """
-    Defines a Prism 3D algorithm, which is either "Extrusion 3D" or "Radial Prism" depending on geometry
+    Defines a Prism 3D algorithm, which is either "Extrusion 3D" or "Radial Prism" depending on geometry.
     It is created by calling smeshBuilder.Mesh.Prism(geom=0)
     """
     
@@ -1169,7 +1129,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
     """
     type of algorithm used with helper function in smeshBuilder.Mesh class
     """
-    docHelper  = "Creates prism 3D algorithm for volumes"
+    docHelper  = "Create prism 3D algorithm for volumes"
     """
     doc string of the method
     """
@@ -1211,7 +1171,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
             3D hypothesis holding the 1D one
         """
         if self.algoType != "RadialPrism_3D":
-            print "Prism_3D algorithm doesn't support any hypothesis"
+            print("Prism_3D algorithm doesn't support any hypothesis")
             return None
         return self.distribHyp
 
@@ -1224,15 +1184,14 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
             the created hypothesis
         """
         if self.algoType != "RadialPrism_3D":
-            print "Prism_3D algorithm doesn't support any hypothesis"
+            print("Prism_3D algorithm doesn't support any hypothesis")
             return None
         if not self.nbLayers is None:
             self.mesh.GetMesh().RemoveHypothesis( self.geom, self.nbLayers )
             self.mesh.GetMesh().AddHypothesis( self.geom, self.distribHyp )
-        study = self.mesh.smeshpyD.GetCurrentStudy() # prevents publishing own 1D hypothesis
-        self.mesh.smeshpyD.SetCurrentStudy( None )
+        self.mesh.smeshpyD.SetEnablePublish( False ) # prevents publishing own 1D hypothesis
         hyp = self.mesh.smeshpyD.CreateHypothesis(hypType, so)
-        self.mesh.smeshpyD.SetCurrentStudy( study ) # enables publishing
+        self.mesh.smeshpyD.SetEnablePublish( True ) # enables publishing
         if not self.distribHyp:
             self.distribHyp = self.Hypothesis("LayerDistribution", UseExisting=0)
         self.distribHyp.SetLayerDistribution( hyp )
@@ -1246,10 +1205,10 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
         Parameters:
             n: number of layers
             UseExisting: if ==true - searches for the existing hypothesis created with
-                the same parameters, else (default) - creates a new one
+                the same parameters, else (default) - Create a new one
         """
         if self.algoType != "RadialPrism_3D":
-            print "Prism_3D algorithm doesn't support any hypothesis"
+            print("Prism_3D algorithm doesn't support any hypothesis")
             return None
         self.mesh.RemoveHypothesis( self.distribHyp, self.geom )
         from salome.smesh.smeshBuilder import IsEqual
@@ -1269,7 +1228,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
             p: the precision of rounding
         """
         if self.algoType != "RadialPrism_3D":
-            print "Prism_3D algorithm doesn't support any hypothesis"
+            print("Prism_3D algorithm doesn't support any hypothesis")
             return None
         hyp = self.OwnHypothesis("LocalLength", [l,p])
         hyp.SetLength(l)
@@ -1286,7 +1245,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
             s: the scale factor (optional)
         """
         if self.algoType != "RadialPrism_3D":
-            print "Prism_3D algorithm doesn't support any hypothesis"
+            print("Prism_3D algorithm doesn't support any hypothesis")
             return None
         if not s:
             hyp = self.OwnHypothesis("NumberOfSegments", [n])
@@ -1307,7 +1266,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
             end:    the length of the last  segment
         """
         if self.algoType != "RadialPrism_3D":
-            print "Prism_3D algorithm doesn't support any hypothesis"
+            print("Prism_3D algorithm doesn't support any hypothesis")
             return None
         hyp = self.OwnHypothesis("Arithmetic1D", [start, end])
         hyp.SetLength(start, 1)
@@ -1325,7 +1284,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
             ratio:  the common ratio of the geometric progression
         """
         if self.algoType != "RadialPrism_3D":
-            print "Prism_3D algorithm doesn't support any hypothesis"
+            print("Prism_3D algorithm doesn't support any hypothesis")
             return None
         hyp = self.OwnHypothesis("GeometricProgression", [start, ratio])
         hyp.SetStartLength( start )
@@ -1342,7 +1301,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
         end:   for the length of the last  segment
         """
         if self.algoType != "RadialPrism_3D":
-            print "Prism_3D algorithm doesn't support any hypothesis"
+            print("Prism_3D algorithm doesn't support any hypothesis")
             return None
         hyp = self.OwnHypothesis("StartEndLength", [start, end])
         hyp.SetLength(start, 1)
@@ -1358,7 +1317,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
             fineness: defines the quality of the mesh within the range [0-1]
         """
         if self.algoType != "RadialPrism_3D":
-            print "Prism_3D algorithm doesn't support any hypothesis"
+            print("Prism_3D algorithm doesn't support any hypothesis")
             return None
         hyp = self.OwnHypothesis("AutomaticLength")
         hyp.SetFineness( fineness )
@@ -1368,10 +1327,11 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
 
 class StdMeshersBuilder_RadialPrism3D(StdMeshersBuilder_Prism3D):
     """
-    Defines Radial Prism 3D algorithm
-    It is created by calling smeshBuilder.Mesh.Prism(geom=0)
+    Defines Radial Prism 3D algorithm.
+    It is created by calling smeshBuilder.Mesh.Prism(geom=0).
+    See :class:`StdMeshersBuilder_Prism3D` for methods defining distribution of mesh layers
+    build between the inner and outer shells.
     """
-    
 
     meshMethod = "Prism"
     """
@@ -1381,7 +1341,7 @@ class StdMeshersBuilder_RadialPrism3D(StdMeshersBuilder_Prism3D):
     """
     type of algorithm used with helper function in smeshBuilder.Mesh class
     """
-    docHelper  = "Creates Raial Prism 3D algorithm for volumes"
+    docHelper  = "Create Raial Prism 3D algorithm for volumes"
     """
     doc string of the method
     """
@@ -1440,10 +1400,9 @@ class StdMeshersBuilder_RadialAlgorithm(Mesh_Algorithm):
             self.distribHyp = self.Hypothesis("LayerDistribution2D", UseExisting=0)
         else:
             self.mesh.GetMesh().AddHypothesis( self.geom, self.distribHyp )
-        study = self.mesh.smeshpyD.GetCurrentStudy() # prevents publishing own 1D hypothesis
-        self.mesh.smeshpyD.SetCurrentStudy( None )
+        self.mesh.smeshpyD.SetEnablePublish( False )
         hyp = self.mesh.smeshpyD.CreateHypothesis(hypType, so)
-        self.mesh.smeshpyD.SetCurrentStudy( study ) # enables publishing
+        self.mesh.smeshpyD.SetEnablePublish( True )
         self.distribHyp.SetLayerDistribution( hyp )
         return hyp
 
@@ -1454,7 +1413,7 @@ class StdMeshersBuilder_RadialAlgorithm(Mesh_Algorithm):
         Parameters:
             n: number of layers
             UseExisting: if ==true - searches for the existing hypothesis created with
-                the same parameters, else (default) - creates a new one
+                the same parameters, else (default) - Create a new one
         """
         if self.distribHyp:
             self.mesh.GetMesh().RemoveHypothesis( self.geom, self.distribHyp )
@@ -1552,7 +1511,7 @@ class StdMeshersBuilder_RadialAlgorithm(Mesh_Algorithm):
 
 class StdMeshersBuilder_RadialQuadrangle1D2D(StdMeshersBuilder_RadialAlgorithm):
     """
-    Defines a Radial Quadrangle 1D-2D algorithm 
+    Defines a Radial Quadrangle 1D-2D algorithm.
     It is created by calling smeshBuilder.Mesh.Quadrangle(smeshBuilder.RADIAL_QUAD,geom=0)
     """
 
@@ -1564,7 +1523,7 @@ class StdMeshersBuilder_RadialQuadrangle1D2D(StdMeshersBuilder_RadialAlgorithm):
     """
     type of algorithm used with helper function in smeshBuilder.Mesh class
     """
-    docHelper  = "Creates quadrangle 1D-2D algorithm for faces having a shape of disk or a disk segment"
+    docHelper  = "Create quadrangle 1D-2D algorithm for faces having a shape of disk or a disk segment"
     """
     doc string of the method
     """
@@ -1588,7 +1547,7 @@ class StdMeshersBuilder_RadialQuadrangle1D2D(StdMeshersBuilder_RadialAlgorithm):
 
 class StdMeshersBuilder_QuadMA_1D2D(StdMeshersBuilder_RadialAlgorithm):
     """
-    Defines a Quadrangle (Medial Axis Projection) 1D-2D algorithm 
+    Defines a Quadrangle (Medial Axis Projection) 1D-2D algorithm .
     It is created by calling smeshBuilder.Mesh.Quadrangle(smeshBuilder.QUAD_MA_PROJ,geom=0)
     """
 
@@ -1600,7 +1559,7 @@ class StdMeshersBuilder_QuadMA_1D2D(StdMeshersBuilder_RadialAlgorithm):
     """
     type of algorithm used with helper function in smeshBuilder.Mesh class
     """
-    docHelper  = "Creates quadrangle 1D-2D algorithm for faces"
+    docHelper  = "Create quadrangle 1D-2D algorithm for faces"
     """
     doc string of the method
     """
@@ -1621,7 +1580,7 @@ class StdMeshersBuilder_QuadMA_1D2D(StdMeshersBuilder_RadialAlgorithm):
     pass
 
 class StdMeshersBuilder_PolygonPerFace(Mesh_Algorithm):
-    """ Defines a Polygon Per Face 2D algorithm 
+    """ Defines a Polygon Per Face 2D algorithm.
         It is created by calling smeshBuilder.Mesh.Polygon(geom=0)
     """
 
@@ -1638,7 +1597,45 @@ class StdMeshersBuilder_PolygonPerFace(Mesh_Algorithm):
     flag pointing whether this algorithm should be used by default in dynamic method
         of smeshBuilder.Mesh class
     """
-    docHelper  = "Creates polygon 2D algorithm for faces"
+    docHelper  = "Create polygon 2D algorithm for faces"
+    """
+    doc string of the method
+    """
+
+    def __init__(self, mesh, geom=0):
+        """
+        Private constructor.
+
+        Parameters:
+            mesh: parent mesh object algorithm is assigned to
+            geom: geometry (shape/sub-shape) algorithm is assigned to;
+                if it is :code:`0` (default), the algorithm is assigned to the main shape
+        """
+        Mesh_Algorithm.__init__(self)
+        self.Create(mesh, geom, self.algoType)
+        pass
+
+    pass
+
+class StdMeshersBuilder_PolyhedronPerSolid(Mesh_Algorithm):
+    """ Defines a Polyhedron Per Solid 3D algorithm.
+        It is created by calling smeshBuilder.Mesh.Polyhedron(geom=0)
+    """
+
+    meshMethod = "Polyhedron"
+    """
+    name of the dynamic method in smeshBuilder.Mesh class
+    """
+    algoType   = POLYHEDRON
+    """
+    type of algorithm used with helper function in smeshBuilder.Mesh class
+    """
+    isDefault  = True
+    """
+    flag pointing whether this algorithm should be used by default in dynamic method
+        of smeshBuilder.Mesh class
+    """
+    docHelper  = "Create polyhedron 3D algorithm for solids"
     """
     doc string of the method
     """
@@ -1659,7 +1656,7 @@ class StdMeshersBuilder_PolygonPerFace(Mesh_Algorithm):
     pass
 
 class StdMeshersBuilder_UseExistingElements_1D(Mesh_Algorithm):
-    """ Defines a Use Existing Elements 1D algorithm
+    """ Defines a Use Existing Elements 1D algorithm.
 
     It is created by calling smeshBuilder.Mesh.UseExisting1DElements(geom=0)
     """
@@ -1678,7 +1675,7 @@ class StdMeshersBuilder_UseExistingElements_1D(Mesh_Algorithm):
     flag pointing whether this algorithm should be used by default in dynamic method
         of smeshBuilder.Mesh class
     """
-    docHelper  = "Creates 1D algorithm for edges with reusing of existing mesh elements"
+    docHelper  = "Create 1D algorithm for edges with reusing of existing mesh elements"
     """
     doc string of the method
     """
@@ -1705,7 +1702,7 @@ class StdMeshersBuilder_UseExistingElements_1D(Mesh_Algorithm):
             toCopyMesh: if True, the whole mesh *groups* belong to is imported
             toCopyGroups: if True, all groups of the mesh *groups* belong to are imported
             UseExisting: if ==true - searches for the existing hypothesis created with
-                the same parameters, else (default) - creates a new one
+                the same parameters, else (default) - Create a new one
         """
         for group in groups:
             from salome.smesh.smeshBuilder import AssureGeomPublished
@@ -1721,7 +1718,7 @@ class StdMeshersBuilder_UseExistingElements_1D(Mesh_Algorithm):
     pass # end of StdMeshersBuilder_UseExistingElements_1D class
 
 class StdMeshersBuilder_UseExistingElements_1D2D(Mesh_Algorithm):
-    """ Defines a Use Existing Elements 1D-2D algorithm
+    """ Defines a Use Existing Elements 1D-2D algorithm.
 
     It is created by calling smeshBuilder.Mesh.UseExisting2DElements(geom=0)
     """
@@ -1740,7 +1737,7 @@ class StdMeshersBuilder_UseExistingElements_1D2D(Mesh_Algorithm):
     flag pointing whether this algorithm should be used by default in dynamic method
         of smeshBuilder.Mesh class
     """
-    docHelper  = "Creates 1D-2D algorithm for faces with reusing of existing mesh elements"
+    docHelper  = "Create 1D-2D algorithm for faces with reusing of existing mesh elements"
     """
     doc string of the method
     """
@@ -1767,7 +1764,7 @@ class StdMeshersBuilder_UseExistingElements_1D2D(Mesh_Algorithm):
             toCopyMesh: if True, the whole mesh *groups* belong to is imported
             toCopyGroups: if True, all groups of the mesh *groups* belong to are imported
             UseExisting: if ==true - searches for the existing hypothesis created with
-                the same parameters, else (default) - creates a new one
+                the same parameters, else (default) - Create a new one
         """
         import SMESH
         compFun = lambda hyp, args: ( hyp.GetSourceFaces() == args[0] and \
@@ -1784,7 +1781,7 @@ class StdMeshersBuilder_UseExistingElements_1D2D(Mesh_Algorithm):
     pass # end of StdMeshersBuilder_UseExistingElements_1D2D class
 
 class StdMeshersBuilder_Cartesian_3D(Mesh_Algorithm):
-    """ Defines a Body Fitting 3D algorithm
+    """ Defines a Body Fitting 3D algorithm.
 
     It is created by calling smeshBuilder.Mesh.BodyFitted(geom=0)
     """
@@ -1803,7 +1800,7 @@ class StdMeshersBuilder_Cartesian_3D(Mesh_Algorithm):
     flag pointing whether this algorithm should be used by default in dynamic method
         of smeshBuilder.Mesh class
     """
-    docHelper  = "Creates Body Fitting 3D algorithm for volumes"
+    docHelper  = "Create Body Fitting 3D algorithm for volumes"
     """
     doc string of the method
     """
@@ -1833,8 +1830,14 @@ class StdMeshersBuilder_Cartesian_3D(Mesh_Algorithm):
                     - Functions f(t) defining grid spacing at each point on grid axis. If there are
                         several functions, they must be accompanied by relative coordinates of
                         points dividing the whole shape into ranges where the functions apply; points
-                        coodrinates should vary within (0.0, 1.0) range. Parameter *t* of the spacing
+                        coordinates should vary within (0.0, 1.0) range. Parameter *t* of the spacing
                         function f(t) varies from 0.0 to 1.0 within a shape range. 
+        Note: 
+            The actual grid spacing can slightly differ from the defined one. This is done for the
+            best fitting of polyhedrons and for a better mesh quality on the interval boundaries.
+            For example, if a constant **Spacing** is defined along an axis, the actual grid will
+            fill the shape's dimension L along this axis with round number of equal cells:
+            Spacing_actual = L / round( L / Spacing_defined ).
 
         Examples:
             "10.5" - defines a grid with a constant spacing
@@ -1856,7 +1859,7 @@ class StdMeshersBuilder_Cartesian_3D(Mesh_Algorithm):
             self.mesh.AddHypothesis( self.hyp, self.geom )
 
         for axis, gridDef in enumerate( [xGridDef, yGridDef, zGridDef] ):
-            if not gridDef: raise ValueError, "Empty grid definition"
+            if not gridDef: raise ValueError("Empty grid definition")
             if isinstance( gridDef, str ):
                 self.hyp.SetGridSpacing( [gridDef], [], axis )
             elif isinstance( gridDef[0], str ):
@@ -1946,7 +1949,7 @@ class StdMeshersBuilder_Cartesian_3D(Mesh_Algorithm):
 
 class StdMeshersBuilder_UseExisting_1D(Mesh_Algorithm):
     """ Defines a stub 1D algorithm, which enables "manual" creation of nodes and
-        segments usable by 2D algorithms
+        segments usable by 2D algorithms.
 
     It is created by calling smeshBuilder.Mesh.UseExistingSegments(geom=0)
     """
@@ -1960,7 +1963,7 @@ class StdMeshersBuilder_UseExisting_1D(Mesh_Algorithm):
     """
     type of algorithm used with helper function in smeshBuilder.Mesh class
     """
-    docHelper  = "Creates 1D algorithm allowing batch meshing of edges"
+    docHelper  = "Create 1D algorithm allowing batch meshing of edges"
     """
     doc string of the method
     """
@@ -1981,7 +1984,7 @@ class StdMeshersBuilder_UseExisting_1D(Mesh_Algorithm):
 
 class StdMeshersBuilder_UseExisting_2D(Mesh_Algorithm):
     """ Defines a stub 2D algorithm, which enables "manual" creation of nodes and
-    faces usable by 3D algorithms
+    faces usable by 3D algorithms.
 
     It is created by calling smeshBuilder.Mesh.UseExistingFaces(geom=0)
     """
@@ -1995,7 +1998,7 @@ class StdMeshersBuilder_UseExisting_2D(Mesh_Algorithm):
     """
     type of algorithm used with helper function in smeshBuilder.Mesh class
     """
-    docHelper  = "Creates 2D algorithm allowing batch meshing of faces"
+    docHelper  = "Create 2D algorithm allowing batch meshing of faces"
     """
     doc string of the method
     """
@@ -2013,3 +2016,106 @@ class StdMeshersBuilder_UseExisting_2D(Mesh_Algorithm):
         pass
 
     pass # end of StdMeshersBuilder_UseExisting_2D class
+    
+class StdMeshersBuilder_ViscousLayer(Mesh_Algorithm):
+    """ Defines the prismatic layer builder.
+
+    It is created by calling smeshBuilder.Mesh.ViscousLayerBuilder(geom=TheGeometry)
+    """
+    
+    meshMethod = "ViscousLayerBuilder"
+    """
+    name of the dynamic method in smeshBuilder.Mesh class
+    """
+    algoType   = "ViscousLayerBuilder"
+    """
+    type of algorithm used with helper function in smeshBuilder.Mesh class
+    """
+    docHelper  = "Viscous layer builder for 2D and 3D geometries"
+    """
+    doc string of the method
+    """
+    
+    # On create method it will call create method from mesh python class
+    # 
+    def __init__(self, mesh, geom = 0 ):
+        """
+        Private constructor.
+
+        Parameters:
+            mesh: parent mesh object algorithm is assigned to
+            geom: geometry (shape/sub-shape) algorithm is assigned to;
+                if it is :code:`0` (default), the algorithm is assigned to the main shape
+        """        
+        self.thickness          = None
+        self.numberOfLayers     = None
+        self.stretchFactor      = None
+        self.elementsId         = []
+        self.isElementToIgnore  = True
+        self.extrMethod         = StdMeshers.SURF_OFFSET_SMOOTH
+        self.groupName          = ""
+        self.shrinkGeometry     = None
+        self.algo               = self.Create(mesh, geom, self.algoType)     
+        pass
+
+    def setBuilderParameters( self, thickness, numberOfLayers, stretchFactor, elementsId=[], 
+                                    isElementToIgnore=True, extrMethod=StdMeshers.SURF_OFFSET_SMOOTH, groupName="" ):            
+        self.thickness          = thickness
+        self.numberOfLayers     = numberOfLayers
+        self.stretchFactor      = stretchFactor
+        self.elementsId         = elementsId        # can be faces or edges
+        self.isElementToIgnore  = isElementToIgnore
+        self.extrMethod         = extrMethod
+        self.groupName          = groupName
+
+        self.algo.SetTotalThickness( thickness )
+        self.algo.SetNumberLayers( numberOfLayers )
+        self.algo.SetStretchFactor( stretchFactor )
+        
+        #Faces are set based on int ids so if a collection of face geom objects is recived cast it to int 
+        if elementsId and isinstance( elementsId, geomBuilder.GEOM._objref_GEOM_Object ):
+            elementsId = [ elementsId ]
+        if elementsId and isinstance( elementsId[0], geomBuilder.GEOM._objref_GEOM_Object ):
+            elementsIDs = []
+            for shape in elementsId:
+                try:
+                  ff = self.mesh.geompyD.SubShapeAll( shape, self.mesh.geompyD.ShapeType["FACE"] )
+                  if ( len( ff ) == 0 ):
+                    #try to get edges
+                    ff = self.mesh.geompyD.SubShapeAll( shape, self.mesh.geompyD.ShapeType["EDGE"] )
+
+                  for f in ff:
+                    elementsIDs.append( self.mesh.geompyD.GetSubShapeID(self.mesh.geom, f))
+                except:
+                  # try to get the SHAPERSTUDY engine directly, because GetGen does not work because of
+                  # simplification of access in geomBuilder: omniORB.registerObjref
+                  from SHAPERSTUDY_utils import getEngine
+                  gen = getEngine()
+                  if gen:
+                    aShapeOp = gen.GetIShapesOperations()
+                    ff = aShapeOp.ExtractSubShapes( shape, self.mesh.geompyD.ShapeType["FACE"], False)
+                    if (len(ff)==0):
+                        #try to get edges
+                        ff = aShapeOp.ExtractSubShapes( shape, self.mesh.geompyD.ShapeType["EDGE"], False)
+                    for f in ff:
+                      elementsIDs.append( aShapeOp.GetSubShapeIndex( self.mesh.geom, f ))
+            elementsId = elementsIDs
+
+        self.algo.SetFaces( elementsId, isElementToIgnore )    
+        self.algo.SetGroupName( groupName )   
+        self.algo.SetMethod( extrMethod )        
+        
+    def GetShrinkGeometry( self ):
+        if isinstance(self.geom, geomBuilder.GEOM._objref_GEOM_Object):
+            self.shrinkGeometry = self.algo.GetShrinkGeometry( self.mesh.GetMesh(), self.geom )
+        
+        return self.shrinkGeometry
+
+    def AddLayers( self, shrinkMesh ):
+        success = self.algo.AddLayers( shrinkMesh.GetMesh(), self.mesh.GetMesh(), self.geom )
+        if ( success ):
+            return self.mesh  #Return the original mesh of the builder
+        else:
+            return shrinkMesh
+
+    pass # end of StdMeshersBuilder_ViscousLayer class
\ No newline at end of file