Salome HOME
GPUSPHGUI: add an option to Offset Surface opreation
[modules/geom.git] / src / GEOM_SWIG / geomBuilder.py
index 270c45b35a30841e3aed915bc6f742cb8a6a4a20..79dd09036de55ee8e4242e7684c947403e854273 100644 (file)
@@ -1,5 +1,5 @@
 #  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 ## vertices = geompy.SubShapeAll(box, geomBuilder.ShapeType['VERTEX'])
 ## # only 5 first vertices will be published, with default names
 ## print len(vertices)
-## # note, that result value still containes all 8 vertices
+## # note, that result value still contains all 8 vertices
 ## geompy.addToStudyAuto(-1) # disable automatic publication
 ## @endcode
 ##
@@ -295,7 +295,7 @@ def ManageTransactions(theOpeName):
 ## Raise an Error, containing the Method_name, if Operation is Failed
 ## @ingroup l1_geomBuilder_auxiliary
 def RaiseIfFailed (Method_name, Operation):
-    if Operation.IsDone() == 0 and Operation.GetErrorCode() != "NOT_FOUND_ANY":
+    if not Operation.IsDone() and Operation.GetErrorCode() != "NOT_FOUND_ANY":
         raise RuntimeError, Method_name + " : " + Operation.GetErrorCode()
 
 ## Return list of variables value from salome notebook
@@ -600,6 +600,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #  - EDGE:                                                 [nb_vertices]
         #
         #  - VERTEX:       [x  y  z]
+        #
+        #  - LCS:          [x y z  xx xy xz  yx yy yz  zx zy zz]
         #  @ingroup l1_geomBuilder_auxiliary
         kind = GEOM.GEOM_IKindOfShape
 
@@ -974,7 +976,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #                            in place of sub-shapes of the first argument,
         #                            because the whole shape corresponds to the first argument.
         #                            Mainly to be used after transformations, but it also can be
-        #                            usefull after partition with one object shape, and some other
+        #                            useful after partition with one object shape, and some other
         #                            operations, where only the first argument has to be considered.
         #                            If theObject has only one argument shape, this flag is automatically
         #                            considered as True, not regarding really passed value.
@@ -1000,7 +1002,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
                                    in place of sub-shapes of the first argument,
                                    because the whole shape corresponds to the first argument.
                                    Mainly to be used after transformations, but it also can be
-                                   usefull after partition with one object shape, and some other
+                                   useful after partition with one object shape, and some other
                                    operations, where only the first argument has to be considered.
                                    If theObject has only one argument shape, this flag is automatically
                                    considered as True, not regarding really passed value.
@@ -1025,7 +1027,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #                            in place of sub-shapes of the first argument,
         #                            because the whole shape corresponds to the first argument.
         #                            Mainly to be used after transformations, but it also can be
-        #                            usefull after partition with one object shape, and some other
+        #                            useful after partition with one object shape, and some other
         #                            operations, where only the first argument has to be considered.
         #                            If theObject has only one argument shape, this flag is automatically
         #                            considered as True, not regarding really passed value.
@@ -1051,7 +1053,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
                                    in place of sub-shapes of the first argument,
                                    because the whole shape corresponds to the first argument.
                                    Mainly to be used after transformations, but it also can be
-                                   usefull after partition with one object shape, and some other
+                                   useful after partition with one object shape, and some other
                                    operations, where only the first argument has to be considered.
                                    If theObject has only one argument shape, this flag is automatically
                                    considered as True, not regarding really passed value.
@@ -1148,6 +1150,11 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         ## Create a point, corresponding to the given parameter on the given curve.
         #  @param theRefCurve The referenced curve.
         #  @param theParameter Value of parameter on the referenced curve.
+        #  @param takeOrientationIntoAccount flag that tells if it is necessary
+        #         to take the curve's orientation into account for the
+        #         operation. I.e. if this flag is set, the results for the same
+        #         parameters (except the value 0.5) is different for forward
+        #         and reversed curves. If it is not set the result is the same.
         #  @param theName Object name; when specified, this parameter is used
         #         for result publication in the study. Otherwise, if automatic
         #         publication is switched on, default value is used for result name.
@@ -1156,13 +1163,20 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #
         #  @ref tui_creation_point "Example"
         @ManageTransactions("BasicOp")
-        def MakeVertexOnCurve(self, theRefCurve, theParameter, theName=None):
+        def MakeVertexOnCurve(self, theRefCurve, theParameter,
+                              takeOrientationIntoAccount=False, theName=None):
             """
             Create a point, corresponding to the given parameter on the given curve.
 
             Parameters:
                 theRefCurve The referenced curve.
                 theParameter Value of parameter on the referenced curve.
+                takeOrientationIntoAccount flag that tells if it is necessary
+                        to take the curve's orientation into account for the
+                        operation. I.e. if this flag is set, the results for
+                        the same parameters (except the value 0.5) is different
+                        for forward and reversed curves. If it is not set
+                        the result is the same.
                 theName Object name; when specified, this parameter is used
                         for result publication in the study. Otherwise, if automatic
                         publication is switched on, default value is used for result name.
@@ -1174,8 +1188,10 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
                 p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25)
             """
             # Example: see GEOM_TestAll.py
-            theParameter, Parameters = ParseParameters(theParameter)
-            anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter)
+            theParameter, takeOrientationIntoAccount, Parameters = ParseParameters(
+                theParameter, takeOrientationIntoAccount)
+            anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter,
+                                                  takeOrientationIntoAccount)
             RaiseIfFailed("MakePointOnCurve", self.BasicOp)
             anObj.SetParameters(Parameters)
             self._autoPublish(anObj, theName, "vertex")
@@ -1544,7 +1560,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             return anObj
 
         ## Create a line, passing through the given point
-        #  and parrallel to the given direction
+        #  and parallel to the given direction
         #  @param thePnt Point. The resulting line will pass through it.
         #  @param theDir Direction. The resulting line will be parallel to it.
         #  @param theName Object name; when specified, this parameter is used
@@ -1558,7 +1574,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         def MakeLine(self, thePnt, theDir, theName=None):
             """
             Create a line, passing through the given point
-            and parrallel to the given direction
+            and parallel to the given direction
 
             Parameters:
                 thePnt Point. The resulting line will pass through it.
@@ -2398,7 +2414,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
               anObj = self.CurvesOp.MakeCurveParametricNew(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType)
             else:
               anObj = self.CurvesOp.MakeCurveParametric(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType)
-            RaiseIfFailed("MakeSplineInterpolation", self.CurvesOp)
+            RaiseIfFailed("MakeCurveParametric", self.CurvesOp)
             anObj.SetParameters(Parameters)
             self._autoPublish(anObj, theName, "curve")
             return anObj
@@ -3055,10 +3071,12 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             theR,theH,theA,Parameters = ParseParameters(theR, theH, theA)
            if flag:
                 theA = theA*math.pi/180.
-            anObj = self.PrimOp.MakeCylinderPntVecRHA(thePnt, theAxis, theR, theH, theA)
-            RaiseIfFailed("MakeCylinderPntVecRHA", self.PrimOp)
-            anObj.SetParameters(Parameters)
-            self._autoPublish(anObj, theName, "cylinder")
+           if theA<=0. or theA>=2*math.pi:
+             raise ValueError("The angle parameter should be strictly between 0 and 2*pi.")
+           anObj = self.PrimOp.MakeCylinderPntVecRHA(thePnt, theAxis, theR, theH, theA)
+           RaiseIfFailed("MakeCylinderPntVecRHA", self.PrimOp)
+           anObj.SetParameters(Parameters)
+           self._autoPublish(anObj, theName, "cylinder")
             return anObj
 
         ## Create a cylinder with given radius and height at
@@ -3136,6 +3154,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             theR,theH,theA,Parameters = ParseParameters(theR, theH, theA)
             if flag:
                 theA = theA*math.pi/180.
+            if theA<=0. or theA>=2*math.pi:
+             raise ValueError("The angle parameter should be strictly between 0 and 2*pi.")
             anObj = self.PrimOp.MakeCylinderRHA(theR, theH, theA)
             RaiseIfFailed("MakeCylinderRHA", self.PrimOp)
             anObj.SetParameters(Parameters)
@@ -3873,7 +3893,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #  possible to generate groups along with the result by means of
         #  setting the flag \a IsGenerateGroups.<BR>
         #  If \a thePath is a closed edge or wire and \a IsGenerateGroups is
-        #  set, an error is occured. If \a thePath is not closed edge/wire,
+        #  set, an error is occurred. If \a thePath is not closed edge/wire,
         #  the following groups are returned:
         #  - If \a theBase is unclosed edge or wire: "Down", "Up", "Side1",
         #    "Side2";
@@ -3899,8 +3919,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #         publication is switched on, default value is used for result name.
         #
         #  @return New GEOM.GEOM_Object, containing the created pipe if 
-        #          \a IsGenerateGroups is not set. Otherwise it returns new
-        #          GEOM.ListOfGO. Its first element is the created pipe, the
+        #          \a IsGenerateGroups is not set. Otherwise it returns a
+        #          list of GEOM.GEOM_Object. Its first element is the created pipe, the
         #          remaining ones are created groups.
         #
         #  @ref tui_creation_pipe "Example"
@@ -3913,7 +3933,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             possible to generate groups along with the result by means of
             setting the flag IsGenerateGroups.
             If thePath is a closed edge or wire and IsGenerateGroups is
-            set, an error is occured. If thePath is not closed edge/wire,
+            set, an error is occurred. If thePath is not closed edge/wire,
             the following groups are returned:
             - If theBase is unclosed edge or wire: "Down", "Up", "Side1",
               "Side2";
@@ -3939,8 +3959,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
 
             Returns:
                 New GEOM.GEOM_Object, containing the created pipe if 
-                IsGenerateGroups is not set. Otherwise it returns new
-                GEOM.ListOfGO. Its first element is the created pipe, the
+                IsGenerateGroups is not set. Otherwise it returns a
+                list of GEOM.GEOM_Object. Its first element is the created pipe, the
                 remaining ones are created groups.
             """
             # Example: see GEOM_TestAll.py
@@ -4019,7 +4039,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             aList = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
                                                               theLocations, thePath,
                                                               theWithContact, theWithCorrection,
-                                                              IsGenerateGroups)
+                                                              False, IsGenerateGroups)
             RaiseIfFailed("MakePipeWithDifferentSections", self.PrimOp)
 
             if IsGenerateGroups:
@@ -4029,6 +4049,43 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             self._autoPublish(aList[0], theName, "pipe")
             return aList[0]
 
+        ## Create a shape by extrusion of the profile shape along
+        #  the path shape. This function is a version of
+        #  MakePipeWithDifferentSections() with the same parameters, except
+        #  eliminated theWithContact and theWithCorrection. So it is
+        #  possible to find the description of all parameters is in this
+        #  method. The difference is that this method performs the operation
+        #  step by step, i.e. it creates pipes between each pair of neighbor
+        #  sections and fuses them into a single shape.
+        #
+        #  @ref tui_creation_pipe_with_diff_sec "Example"
+        @ManageTransactions("PrimOp")
+        def MakePipeWithDifferentSectionsBySteps(self, theSeqBases,
+                                                 theLocations, thePath,
+                                                 IsGenerateGroups=False, theName=None):
+            """
+            Create a shape by extrusion of the profile shape along
+            the path shape. This function is a version of
+            MakePipeWithDifferentSections() with the same parameters, except
+            eliminated theWithContact and theWithCorrection. So it is
+            possible to find the description of all parameters is in this
+            method. The difference is that this method performs the operation
+            step by step, i.e. it creates pipes between each pair of neighbor
+            sections and fuses them into a single shape.
+            """
+            aList = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
+                                                              theLocations, thePath,
+                                                              False, False,
+                                                              True, IsGenerateGroups)
+            RaiseIfFailed("MakePipeWithDifferentSectionsBySteps", self.PrimOp)
+
+            if IsGenerateGroups:
+              self._autoPublish(aList, theName, "pipe")
+              return aList
+
+            self._autoPublish(aList[0], theName, "pipe")
+            return aList[0]
+
         ## Create a shape by extrusion of the profile shape along
         #  the path shape. The path shape can be a wire or an edge.
         #  the several profiles can be specified in the several locations of path.
@@ -4125,7 +4182,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         ## Create a shape by extrusion of the profile shape along
         #  the path shape. This function is used only for debug pipe
         #  functionality - it is a version of function MakePipeWithShellSections()
-        #  which give a possibility to recieve information about
+        #  which give a possibility to receive information about
         #  creating pipe between each pair of sections step by step.
         @ManageTransactions("PrimOp")
         def MakePipeWithShellSectionsBySteps(self, theSeqBases, theSeqSubBases,
@@ -4137,7 +4194,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             the path shape. This function is used only for debug pipe
             functionality - it is a version of previous function
             geompy.MakePipeWithShellSections() which give a possibility to
-            recieve information about creating pipe between each pair of
+            receive information about creating pipe between each pair of
             sections step by step.
             """
             res = []
@@ -4622,7 +4679,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #         for result publication in the study. Otherwise, if automatic
         #         publication is switched on, default value is used for result name.
         #
-        #  @return New GEOM.GEOM_Object, containing the created face.
+        #  @return New GEOM.GEOM_Object, containing the created face (compound of faces).
         #
         #  @ref tui_creation_face "Example"
         @ManageTransactions("ShapesOp")
@@ -4642,7 +4699,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
                         publication is switched on, default value is used for result name.
 
             Returns:
-                New GEOM.GEOM_Object, containing the created face.
+                New GEOM.GEOM_Object, containing the created face (compound of faces).
             """
             # Example: see GEOM_TestAll.py
             anObj = self.ShapesOp.MakeFace(theWire, isPlanarWanted)
@@ -4664,7 +4721,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #         for result publication in the study. Otherwise, if automatic
         #         publication is switched on, default value is used for result name.
         #
-        #  @return New GEOM.GEOM_Object, containing the created face.
+        #  @return New GEOM.GEOM_Object, containing the created face (compound of faces).
         #
         #  @ref tui_creation_face "Example"
         @ManageTransactions("ShapesOp")
@@ -4684,7 +4741,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
                         publication is switched on, default value is used for result name.
 
             Returns:
-                New GEOM.GEOM_Object, containing the created face.
+                New GEOM.GEOM_Object, containing the created face (compound of faces).
             """
             # Example: see GEOM_TestAll.py
             anObj = self.ShapesOp.MakeFaceWires(ToList(theWires), isPlanarWanted)
@@ -4777,13 +4834,13 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             self._autoPublish(anObj, theName, "face")
             return anObj
 
-        ## Create a shell from the set of faces and shells.
-        #  @param theFacesAndShells List of faces and/or shells.
+        ## Create a shell from the set of faces, shells and/or compounds of faces.
+        #  @param theFacesAndShells List of faces, shells and/or compounds of faces.
         #  @param theName Object name; when specified, this parameter is used
         #         for result publication in the study. Otherwise, if automatic
         #         publication is switched on, default value is used for result name.
         #
-        #  @return New GEOM.GEOM_Object, containing the created shell.
+        #  @return New GEOM.GEOM_Object, containing the created shell (compound of shells).
         #
         #  @ref tui_creation_shell "Example"
         @ManageTransactions("ShapesOp")
@@ -4798,7 +4855,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
                         publication is switched on, default value is used for result name.
 
             Returns:
-                New GEOM.GEOM_Object, containing the created shell.
+                New GEOM.GEOM_Object, containing the created shell (compound of shells).
             """
             # Example: see GEOM_TestAll.py
             anObj = self.ShapesOp.MakeShell( ToList( theFacesAndShells ))
@@ -5809,7 +5866,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #         for result publication in the study. Otherwise, if automatic
         #         publication is switched on, default value is used for result name.
         #
-        #  @return Group of all found sub-shapes or a single found sub-shape.
+        #  @return Compound which includes all found sub-shapes if they have different types; 
+        #          or group of all found shapes of the equal type; or a single found sub-shape.
         #
         #  @note This function has a restriction on argument shapes.
         #        If \a theShapeWhere has curved parts with significantly
@@ -5834,7 +5892,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
                         publication is switched on, default value is used for result name.
 
             Returns:
-                Group of all found sub-shapes or a single found sub-shape.
+                Compound which includes all found sub-shapes if they have different types; 
+                or group of all found shapes of the equal type; or a single found sub-shape.
 
 
             Note:
@@ -5870,7 +5929,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #         for result publication in the study. Otherwise, if automatic
         #         publication is switched on, default value is used for result name.
         #
-        #  @return Group of all found sub-shapes or a single found sub-shape.
+        #  @return Compound which includes all found sub-shapes if they have different types; 
+        #          or group of all found shapes of the equal type; or a single found sub-shape.
         #
         #  @ref swig_GetInPlace "Example"
         @ManageTransactions("ShapesOp")
@@ -5891,7 +5951,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
                         publication is switched on, default value is used for result name.
 
             Returns:
-                Group of all found sub-shapes or a single found sub-shape.
+                Compound which includes all found sub-shapes if they have different types; 
+                or group of all found shapes of the equal type; or a single found sub-shape.
             """
             # Example: see GEOM_TestOthers.py
             anObj = self.ShapesOp.GetInPlaceByHistory(theShapeWhere, theShapeWhat)
@@ -6322,7 +6383,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
 
         ## Explode a shape on sub-shapes of a given type.
         #  Sub-shapes will be sorted taking into account their gravity centers,
-        #  to provide stable order of sub-shapes.
+        #  to provide stable order of sub-shapes. Please see
+        #  @ref sorting_shapes_page "Description of Sorting Shapes Algorithm".
         #  If the shape itself matches the type, it is also returned.
         #  @param aShape Shape to be exploded.
         #  @param aType Type of sub-shapes to be retrieved (see ShapeType())
@@ -6359,7 +6421,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
 
         ## Explode a shape on sub-shapes of a given type.
         #  Sub-shapes will be sorted taking into account their gravity centers,
-        #  to provide stable order of sub-shapes.
+        #  to provide stable order of sub-shapes. Please see
+        #  @ref sorting_shapes_page "Description of Sorting Shapes Algorithm".
         #  @param aShape Shape to be exploded.
         #  @param aType Type of sub-shapes to be retrieved (see ShapeType())
         #  @return List of IDs of sub-shapes.
@@ -6385,6 +6448,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
 
         ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
         #  selected by they indices in sorted list of all sub-shapes of type <VAR>aType</VAR>.
+        #  Please see @ref sorting_shapes_page "Description of Sorting Shapes Algorithm".
         #  Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
         #  @param aShape Shape to get sub-shape of.
         #  @param ListOfInd List of sub-shapes indices.
@@ -6425,7 +6489,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         ## Extract shapes (excluding the main shape) of given type.
         #  @param aShape The shape.
         #  @param aType  The shape type (see ShapeType())
-        #  @param isSorted Boolean flag to switch sorting on/off.
+        #  @param isSorted Boolean flag to switch sorting on/off. Please see
+        #         @ref sorting_shapes_page "Description of Sorting Shapes Algorithm".
         #  @param theName Object name; when specified, this parameter is used
         #         for result publication in the study. Otherwise, if automatic
         #         publication is switched on, default value is used for result name.
@@ -6517,6 +6582,57 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             self._autoPublish(ListObj, theName, "SortedEdges")
             return ListObj
 
+        ##
+        # Return the list of subshapes that satisfies a certain tolerance
+        # criterion. The user defines the type of shapes to be returned, the
+        # condition and the tolerance value. The operation is defined for
+        # faces, edges and vertices only. E.g. for theShapeType FACE,
+        # theCondition GEOM::CC_GT and theTolerance 1.e-7 this method returns
+        # all faces of theShape that have tolerances greater then 1.e7.
+        #
+        #  @param theShape the shape to be exploded
+        #  @param theShapeType the type of sub-shapes to be returned (see
+        #         ShapeType()). Can have the values FACE, EDGE and VERTEX only.
+        #  @param theCondition the condition type (see GEOM::comparison_condition).
+        #  @param theTolerance the tolerance filter.
+        #  @param theName Object name; when specified, this parameter is used
+        #         for result publication in the study. Otherwise, if automatic
+        #         publication is switched on, default value is used for result name.
+        #  @return the list of shapes that satisfy the conditions.
+        #
+        #  @ref swig_GetSubShapesWithTolerance "Example"
+        @ManageTransactions("ShapesOp")
+        def GetSubShapesWithTolerance(self, theShape, theShapeType,
+                                      theCondition, theTolerance, theName=None):
+            """
+            Return the list of subshapes that satisfies a certain tolerance
+            criterion. The user defines the type of shapes to be returned, the
+            condition and the tolerance value. The operation is defined for
+            faces, edges and vertices only. E.g. for theShapeType FACE,
+            theCondition GEOM::CC_GT and theTolerance 1.e-7 this method returns
+            all faces of theShape that have tolerances greater then 1.e7.
+            
+            Parameters:
+                theShape the shape to be exploded
+                theShapeType the type of sub-shapes to be returned (see
+                             ShapeType()). Can have the values FACE,
+                             EDGE and VERTEX only.
+                theCondition the condition type (see GEOM::comparison_condition).
+                theTolerance the tolerance filter.
+                theName Object name; when specified, this parameter is used
+                        for result publication in the study. Otherwise, if automatic
+                        publication is switched on, default value is used for result name.
+
+            Returns:
+                The list of shapes that satisfy the conditions.
+            """
+            # Example: see GEOM_TestAll.py
+            ListObj = self.ShapesOp.GetSubShapesWithTolerance(theShape, EnumToLong(theShapeType),
+                                                              theCondition, theTolerance)
+            RaiseIfFailed("GetSubShapesWithTolerance", self.ShapesOp)
+            self._autoPublish(ListObj, theName, "SubShapeWithTolerance")
+            return ListObj
+
         ## Check if the object is a sub-object of another GEOM object.
         #  @param aSubObject Checked sub-object (or its parent object, in case if
         #         \a theSubObjectIndex is non-zero).
@@ -6549,6 +6665,35 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             RaiseIfFailed("IsSubShapeBelongsTo", self.ShapesOp)
             return IsOk
 
+        ## Perform extraction of sub-shapes from the main shape.
+        #
+        #  @param theShape the main shape
+        #  @param theListOfID the list of sub-shape IDs to be extracted from
+        #         the main shape.
+        #  @return New GEOM.GEOM_Object, containing the shape without
+        #          extracted sub-shapes.
+        #
+        #  @ref swig_MakeExtraction "Example"
+        @ManageTransactions("ShapesOp")
+        def MakeExtraction(self, theShape, theListOfID, theName=None):
+            """
+            Perform extraction of sub-shapes from the main shape.
+
+            Parameters:
+                theShape the main shape
+                theListOfID the list of sub-shape IDs to be extracted from
+                            the main shape.
+
+            Returns
+                New GEOM.GEOM_Object, containing the shape without
+                extracted sub-shapes.
+            """
+            # Example: see GEOM_TestAll.py
+            (anObj, aStat) = self.ShapesOp.MakeExtraction(theShape, theListOfID)
+            RaiseIfFailed("MakeExtraction", self.ShapesOp)
+            self._autoPublish(anObj, theName, "Extraction")
+            return anObj
+
         # end of l4_decompose
         ## @}
 
@@ -7233,7 +7378,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #         publication is switched on, default value is used for result name.
         #
         #  @return [\a status, \a theClosedWires, \a theOpenWires]
-        #  \n \a status: FALSE, if an error(s) occured during the method execution.
+        #  \n \a status: FALSE, if an error(s) occurred during the method execution.
         #  \n \a theClosedWires: Closed wires on the free boundary of the given shape.
         #  \n \a theOpenWires: Open wires on the free boundary of the given shape.
         #
@@ -7252,7 +7397,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
 
             Returns:
                 [status, theClosedWires, theOpenWires]
-                 status: FALSE, if an error(s) occured during the method execution.
+                 status: FALSE, if an error(s) occurred during the method execution.
                  theClosedWires: Closed wires on the free boundary of the given shape.
                  theOpenWires: Open wires on the free boundary of the given shape.
             """
@@ -7949,7 +8094,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #      @param ListRemoveInside Shapes, inside which the results will be deleted.
         #         Each shape from theRemoveInside must belong to theShapes also.
         #      @param RemoveWebs If TRUE, perform Glue 3D algorithm.
-        #      @param ListMaterials Material indices for each shape. Make sence,
+        #      @param ListMaterials Material indices for each shape. Make sense,
         #         only if theRemoveWebs is TRUE.
         #
         #  @return New GEOM.GEOM_Object, containing the result shapes.
@@ -7991,7 +8136,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
                 ListRemoveInside Shapes, inside which the results will be deleted.
                                  Each shape from theRemoveInside must belong to theShapes also.
                 RemoveWebs If TRUE, perform Glue 3D algorithm.
-                ListMaterials Material indices for each shape. Make sence, only if theRemoveWebs is TRUE.
+                ListMaterials Material indices for each shape. Make sense, only if theRemoveWebs is TRUE.
 
             Returns:
                 New GEOM.GEOM_Object, containing the result shapes.
@@ -9083,14 +9228,15 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             """
             theOffset, Parameters = ParseParameters(theOffset)
             if theCopy:
-                anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset)
+                anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset, True)
             else:
-                anObj = self.TrsfOp.OffsetShape(theObject, theOffset)
+                anObj = self.TrsfOp.OffsetShape(theObject, theOffset, True)
             RaiseIfFailed("Offset", self.TrsfOp)
             anObj.SetParameters(Parameters)
             return anObj
 
-        ## Create new object as offset of the given one.
+        ## Create new object as offset of the given one. Gap between two adjacent
+        #  offset surfaces is filled by a pipe.
         #  @param theObject The base object for the offset.
         #  @param theOffset Offset value.
         #  @param theName Object name; when specified, this parameter is used
@@ -9099,11 +9245,13 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #
         #  @return New GEOM.GEOM_Object, containing the offset object.
         #
+        #  @sa MakeOffsetIntersectionJoin
         #  @ref tui_offset "Example"
         @ManageTransactions("TrsfOp")
         def MakeOffset(self, theObject, theOffset, theName=None):
             """
-            Create new object as offset of the given one.
+            Create new object as offset of the given one. Gap between adjacent
+            offset surfaces is filled by a pipe.
 
             Parameters:
                 theObject The base object for the offset.
@@ -9122,7 +9270,48 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             """
             # Example: see GEOM_TestAll.py
             theOffset, Parameters = ParseParameters(theOffset)
-            anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset)
+            anObj = self.TrsfOp.OffsetShapeCopy( theObject, theOffset, True )
+            RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
+            anObj.SetParameters(Parameters)
+            self._autoPublish(anObj, theName, "offset")
+            return anObj
+
+        ## Create new object as offset of the given one. Gap between adjacent
+        #  offset surfaces is filled by extending and intersecting them.
+        #  @param theObject The base object for the offset.
+        #  @param theOffset Offset value.
+        #  @param theName Object name; when specified, this parameter is used
+        #         for result publication in the study. Otherwise, if automatic
+        #         publication is switched on, default value is used for result name.
+        #
+        #  @return New GEOM.GEOM_Object, containing the offset object.
+        #
+        #  @sa MakeOffset
+        #  @ref tui_offset "Example"
+        @ManageTransactions("TrsfOp")
+        def MakeOffsetIntersectionJoin(self, theObject, theOffset, theName=None):
+            """
+            Create new object as offset of the given one. Gap between adjacent
+            offset surfaces is filled by extending and intersecting them.
+
+            Parameters:
+                theObject The base object for the offset.
+                theOffset Offset value.
+                theName Object name; when specified, this parameter is used
+                        for result publication in the study. Otherwise, if automatic
+                        publication is switched on, default value is used for result name.
+
+            Returns:
+                New GEOM.GEOM_Object, containing the offset object.
+
+            Example of usage:
+                 box = geompy.MakeBox(20, 20, 20, 200, 200, 200)
+                 # create a new box extended by 70
+                 offset = geompy.MakeOffsetIntersectionJoin(box, 70.)
+            """
+            # Example: see GEOM_TestAll.py
+            theOffset, Parameters = ParseParameters( theOffset )
+            anObj = self.TrsfOp.OffsetShapeCopy( theObject, theOffset, False )
             RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
             anObj.SetParameters(Parameters)
             self._autoPublish(anObj, theName, "offset")
@@ -9161,7 +9350,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             self._autoPublish(anObj, theName, "projection")
             return anObj
 
-        ## Create a projection projection of the given point on a wire or an edge.
+        ## Create a projection of the given point on a wire or an edge.
         #  If there are no solutions or there are 2 or more solutions It throws an
         #  exception.
         #  @param thePoint the point to be projected.
@@ -9179,7 +9368,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         @ManageTransactions("TrsfOp")
         def MakeProjectionOnWire(self, thePoint, theWire, theName=None):
             """
-            Create a projection projection of the given point on a wire or an edge.
+            Create a projection of the given point on a wire or an edge.
             If there are no solutions or there are 2 or more solutions It throws an
             exception.
 
@@ -9577,6 +9766,10 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #         The angle in which to project the total length of the wire.
         #         If it is negative the projection is not scaled and natural
         #         wire length is kept for the projection.
+        #  @param theAngleRotation The desired angle in radians between
+        #         the tangent vector to the first curve at the first point of
+        #         the theObject's projection in 2D space and U-direction of
+        #         cylinder's 2D space.
         #  @param theName Object name; when specified, this parameter is used
         #         for result publication in the study. Otherwise, if automatic
         #         publication is switched on, default value is used for result name.
@@ -9588,6 +9781,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #  @ref tui_projection "Example"
         def MakeProjectionOnCylinder (self, theObject, theRadius,
                                       theStartAngle=0.0, theAngleLength=-1.0,
+                                      theAngleRotation=0.0,
                                       theName=None):
             """
             Compute a wire or a face that represents a projection of the source
@@ -9604,6 +9798,10 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
                         to project the total length of the wire. If it is negative the
                         projection is not scaled and natural wire length is kept for
                         the projection.
+                theAngleRotation The desired angle in radians between
+                        the tangent vector to the first curve at the first
+                        point of the theObject's projection in 2D space and
+                        U-direction of cylinder's 2D space.
                 theName Object name; when specified, this parameter is used
                         for result publication in the study. Otherwise, if automatic
                         publication is switched on, default value is used for result name.
@@ -9620,14 +9818,19 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             flagAngleLength = False
             if isinstance(theAngleLength,str):
                 flagAngleLength = True
-            theRadius, theStartAngle, theAngleLength, Parameters = ParseParameters(
-              theRadius, theStartAngle, theAngleLength)
+            flagAngleRotation = False
+            if isinstance(theAngleRotation,str):
+                flagAngleRotation = True
+            theRadius, theStartAngle, theAngleLength, theAngleRotation, Parameters = ParseParameters(
+              theRadius, theStartAngle, theAngleLength, theAngleRotation)
             if flagStartAngle:
                 theStartAngle = theStartAngle*math.pi/180.
             if flagAngleLength:
                 theAngleLength = theAngleLength*math.pi/180.
+            if flagAngleRotation:
+                theAngleRotation = theAngleRotation*math.pi/180.
             anObj = self.TrsfOp.MakeProjectionOnCylinder(theObject, theRadius,
-                theStartAngle, theAngleLength)
+                theStartAngle, theAngleLength, theAngleRotation)
             RaiseIfFailed("MakeProjectionOnCylinder", self.TrsfOp)
             anObj.SetParameters(Parameters)
             self._autoPublish(anObj, theName, "projection")
@@ -10118,14 +10321,14 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             self._autoPublish(anObj, theName, "chamfer")
             return anObj
 
-        ## The Same that MakeChamferFaces() but with params theD is chamfer lenght and
+        ## The Same that MakeChamferFaces() but with params theD is chamfer length and
         #  theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
         #
         #  @ref swig_FilletChamfer "Example"
         @ManageTransactions("LocalOp")
         def MakeChamferFacesAD(self, theShape, theD, theAngle, theFaces, theName=None):
             """
-            The Same that geompy.MakeChamferFaces but with params theD is chamfer lenght and
+            The Same that geompy.MakeChamferFaces but with params theD is chamfer length and
             theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
             """
             flag = False
@@ -10176,12 +10379,12 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             self._autoPublish(anObj, theName, "chamfer")
             return anObj
 
-        ## The Same that MakeChamferEdges() but with params theD is chamfer lenght and
+        ## The Same that MakeChamferEdges() but with params theD is chamfer length and
         #  theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
         @ManageTransactions("LocalOp")
         def MakeChamferEdgesAD(self, theShape, theD, theAngle, theEdges, theName=None):
             """
-            The Same that geompy.MakeChamferEdges but with params theD is chamfer lenght and
+            The Same that geompy.MakeChamferEdges but with params theD is chamfer length and
             theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
             """
             flag = False
@@ -10420,6 +10623,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         ## Get summarized length of all wires,
         #  area of surface and volume of the given shape.
         #  @param theShape Shape to define properties of.
+        #  @param theTolerance maximal relative error of area
+        #         and volume computation.
         #  @return [theLength, theSurfArea, theVolume]\n
         #  theLength:   Summarized length of all wires of the given shape.\n
         #  theSurfArea: Area of surface of the given shape.\n
@@ -10427,13 +10632,15 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #
         #  @ref tui_basic_properties_page "Example"
         @ManageTransactions("MeasuOp")
-        def BasicProperties(self,theShape):
+        def BasicProperties(self,theShape, theTolerance=1.e-6):
             """
             Get summarized length of all wires,
             area of surface and volume of the given shape.
 
             Parameters:
                 theShape Shape to define properties of.
+                theTolerance maximal relative error of area
+                             and volume computation.
 
             Returns:
                 [theLength, theSurfArea, theVolume]
@@ -10442,7 +10649,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
                  theVolume:   Volume of the given shape.
             """
             # Example: see GEOM_TestMeasures.py
-            aTuple = self.MeasuOp.GetBasicProperties(theShape)
+            aTuple = self.MeasuOp.GetBasicProperties(theShape, theTolerance)
             RaiseIfFailed("GetBasicProperties", self.MeasuOp)
             return aTuple
 
@@ -10966,14 +11173,17 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             return aDict
 
         def GetCreationInformation(self, theShape):
-            info = theShape.GetCreationInformation()
-            # operationName
-            opName = info.operationName
-            if not opName: opName = "no info available"
-            res = "Operation: " + opName
-            # parameters
-            for parVal in info.params:
-                res += " \n %s = %s" % ( parVal.name, parVal.value )
+            res = ''
+            infos = theShape.GetCreationInformation()
+            for info in infos:
+                # operationName
+                opName = info.operationName
+                if not opName: opName = "no info available"
+                if res: res += "\n"
+                res += "Operation: " + opName
+                # parameters
+                for parVal in info.params:
+                    res += "\n \t%s = %s" % ( parVal.name, parVal.value )
             return res
 
         ## Get a point, situated at the centre of mass of theShape.
@@ -11250,6 +11460,55 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             RaiseIfFailed("CheckSelfIntersections", self.MeasuOp)
             return IsValid
 
+        ## Detect self-intersections of the given shape with algorithm based on mesh intersections.
+        #  @param theShape Shape to check.
+        #  @param theDeflection Linear deflection coefficient that specifies quality of tesselation:
+        #         - if \a theDeflection <= 0, default deflection 0.001 is used
+        #  @param theTolerance Specifies a distance between sub-shapes used for detecting gaps:
+        #         - if \a theTolerance <= 0, algorithm detects intersections (default behavior)
+        #         - if \a theTolerance > 0, algorithm detects gaps
+        #  @return TRUE, if the shape contains no self-intersections.
+        #
+        #  @ref tui_check_self_intersections_fast_page "Example"
+        @ManageTransactions("MeasuOp")
+        def CheckSelfIntersectionsFast(self, theShape, theDeflection = 0.001, theTolerance = 0.0):
+            """
+            Detect self-intersections of the given shape with algorithm based on mesh intersections.
+
+            Parameters:
+                theShape Shape to check.
+                theDeflection Linear deflection coefficient that specifies quality of tesselation:
+                    - if theDeflection <= 0, default deflection 0.001 is used
+                theTolerance Specifies a distance between shapes used for detecting gaps:
+                    - if theTolerance <= 0, algorithm detects intersections (default behavior)
+                    - if theTolerance > 0, algorithm detects gaps
+            Returns:
+                TRUE, if the shape contains no self-intersections.
+            """
+            # Example: see GEOM_TestMeasures.py
+            (IsValid, Pairs) = self.MeasuOp.CheckSelfIntersectionsFast(theShape, theDeflection, theTolerance)
+            RaiseIfFailed("CheckSelfIntersectionsFast", self.MeasuOp)
+            return IsValid
+
+        ## Check boolean and partition operations agruments.
+        #  @param theShape the agrument of an operation to be checked
+        #  @return TRUE if the agrument is valid for a boolean or partition
+        #          operation; FALSE otherwise.
+        @ManageTransactions("MeasuOp")
+        def CheckBOPArguments(self, theShape):
+            """
+            Check boolean and partition operations agruments.
+
+            Parameters:
+                theShape the agrument of an operation to be checked
+
+            Returns:
+                TRUE if the agrument is valid for a boolean or partition
+                operation; FALSE otherwise.
+            """
+            return self.MeasuOp.CheckBOPArguments(theShape)
+
         ## Detect intersections of the given shapes with algorithm based on mesh intersections.
         #  @param theShape1 First source object
         #  @param theShape2 Second source object
@@ -11469,8 +11728,14 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             return self.ImportFile(theFileName, theFormatName, theName)
 
         ## Read a shape from the binary stream, containing its bounding representation (BRep).
-        #  @note This method will not be dumped to the python script by DumpStudy functionality.
-        #  @note GEOM.GEOM_Object.GetShapeStream() method can be used to obtain the shape's BRep stream.
+        #
+        #  @note As the byte-stream representing the shape data can be quite large, this method
+        #  is not automatically dumped to the Python script with the DumpStudy functionality;
+        #  so please use this method carefully, only for strong reasons.
+        #  
+        #  @note GEOM.GEOM_Object.GetShapeStream() method can be used to obtain the shape's
+        #  data stream.
+        #
         #  @param theStream The BRep binary stream.
         #  @param theName Object name; when specified, this parameter is used
         #         for result publication in the study. Otherwise, if automatic
@@ -11497,6 +11762,11 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
                 New GEOM_Object, containing the shape, read from theStream.
             """
             # Example: see GEOM_TestOthers.py
+            if not theStream:
+                # this is the workaround to ignore invalid case when data stream is empty
+                if int(os.getenv("GEOM_IGNORE_RESTORE_SHAPE", "0")) > 0:
+                    print "WARNING: Result of RestoreShape is a NULL shape!"
+                    return None
             anObj = self.InsertOp.RestoreShape(theStream)
             RaiseIfFailed("RestoreShape", self.InsertOp)
             self._autoPublish(anObj, theName, "restored")
@@ -12543,7 +12813,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         ## Build all possible propagation groups.
         #  Propagation group is a set of all edges, opposite to one (main)
         #  edge of this group directly or through other opposite edges.
-        #  Notion of Opposite Edge make sence only on quadrangle face.
+        #  Notion of Opposite Edge make sense only on quadrangle face.
         #  @param theShape Shape to build propagation groups on.
         #  @param theName Object name; when specified, this parameter is used
         #         for result publication in the study. Otherwise, if automatic
@@ -12558,7 +12828,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             Build all possible propagation groups.
             Propagation group is a set of all edges, opposite to one (main)
             edge of this group directly or through other opposite edges.
-            Notion of Opposite Edge make sence only on quadrangle face.
+            Notion of Opposite Edge make sense only on quadrangle face.
 
             Parameters:
                 theShape Shape to build propagation groups on.
@@ -12983,7 +13253,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             return aType
 
         ## Convert a type of geom object from id to string value
-        #  @param theId is a GEOM obect type id.
+        #  @param theId is a GEOM object type id.
         #  @return type of geom object (POINT, VECTOR, PLANE, LINE, TORUS, ... )
         #  @ref swig_GetType "Example"
         def ShapeIdToType(self, theId):
@@ -12991,7 +13261,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             Convert a type of geom object from id to string value
 
             Parameters:
-                theId is a GEOM obect type id.
+                theId is a GEOM object type id.
 
             Returns:
                 type of geom object (POINT, VECTOR, PLANE, LINE, TORUS, ... )
@@ -13215,7 +13485,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             self.addToStudyInFather(shape, group_edges, "Group of edges with " + `min_length`
                                     + left_str + "length" + right_str + `max_length`)
 
-            sg.updateObjBrowser(1)
+            sg.updateObjBrowser(True)
 
             return group_edges