Salome HOME
29470 - Point cloud on a face
[modules/geom.git] / src / GEOM_SWIG / geomBuilder.py
index afb8509e1e4dc93de6f04f3a905b7c501006dd63..9c8ad7f7c7e50b3f3a0d3da4d4ade1aed12e3989 100644 (file)
@@ -1,5 +1,5 @@
 #  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2022  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
 ##
 ##   @}
 ##   @defgroup l2_measure       Using measurement tools
 ##   @defgroup l2_field         Field on Geometry
+##   @defgroup l2_testing       Testing
 
 ## @}
 
@@ -378,6 +379,12 @@ def RaiseIfFailed (Method_name, Operation):
     if not Operation.IsDone() and Operation.GetErrorCode() != "NOT_FOUND_ANY":
         raise RuntimeError(Method_name + " : " + Operation.GetErrorCode())
 
+def PrintOrRaise(message, raiseException=False):
+    if raiseException:
+        raise RuntimeError(message)
+    else:
+        print(message)
+
 ## Return list of variables value from salome notebook
 ## @ingroup l1_geomBuilder_auxiliary
 def ParseParameters(*parameters):
@@ -732,8 +739,6 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
               GEOM._objref_GEOM_Gen.__init__(self, *args)
               self.myMaxNbSubShapesAllowed = 0 # auto-publishing is disabled by default
               self.myBuilder = None
-              self.father    = None
-
               self.BasicOp  = None
               self.CurvesOp = None
               self.PrimOp   = None
@@ -747,6 +752,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
               self.BlocksOp = None
               self.GroupOp  = None
               self.FieldOp  = None
+              self.TestOp   = None
             pass
 
         ## Process object publication in the study, as follows:
@@ -835,18 +841,12 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
         def init_geom(self):
             self.myStudy = salome.myStudy
             self.myBuilder = self.myStudy.NewBuilder()
-            self.father = self.myStudy.FindComponent("GEOM")
-            notebook.myStudy = salome.myStudy
-            if self.father is None:
-                self.father = self.myBuilder.NewComponent("GEOM")
-                A1 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributeName")
-                FName = A1._narrow(SALOMEDS.AttributeName)
-                FName.SetValue("Geometry")
-                A2 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributePixMap")
-                aPixmap = A2._narrow(SALOMEDS.AttributePixMap)
-                aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry")
-                self.myBuilder.DefineComponentInstance(self.father,self)
-                pass
+
+            # load data from the study file, if necessary
+            component = self.myStudy.FindComponent("GEOM")
+            if component:
+                self.myBuilder.LoadWith(component, self)
+
             self.BasicOp  = self.GetIBasicOperations    ()
             self.CurvesOp = self.GetICurvesOperations   ()
             self.PrimOp   = self.GetI3DPrimOperations   ()
@@ -860,14 +860,9 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
             self.BlocksOp = self.GetIBlocksOperations   ()
             self.GroupOp  = self.GetIGroupOperations    ()
             self.FieldOp  = self.GetIFieldOperations    ()
+            self.TestOp   = self.GetITestOperations     ()
 
-            # set GEOM as root in the use case tree
-            self.myUseCaseBuilder = self.myStudy.GetUseCaseBuilder()
-            self.myUseCaseBuilder.SetRootCurrent()
-            self.myUseCaseBuilder.Append(self.father)
-
-            # load data from the study file, if necessary
-            self.myBuilder.LoadWith(self.father, self)
+            notebook.myStudy = self.myStudy
             pass
 
         def GetPluginOperations(self, libraryName):
@@ -1054,7 +1049,7 @@ class geomBuilder(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.
@@ -1080,7 +1075,7 @@ class geomBuilder(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.
@@ -1105,7 +1100,7 @@ class geomBuilder(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.
@@ -1131,7 +1126,7 @@ class geomBuilder(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.
@@ -1446,7 +1441,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
         #
         #  @ref swig_MakeVertexInsideFace "Example"
         @ManageTransactions("BasicOp")
-        def MakeVertexInsideFace (self, theFace, theName=None):
+        def MakeVertexInsideFace (self, theFace, theNumberOfPnts=1, theName=None):
             """
             Create a point, which lays on the given face.
             The point will lay in arbitrary place of the face.
@@ -1456,6 +1451,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
 
             Parameters:
                 theFace The referenced face.
+                theNumberOfPnts The number of points we want to get, 1 by default.
                 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.
@@ -1467,7 +1463,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
                 p_on_face = geompy.MakeVertexInsideFace(Face)
             """
             # Example: see GEOM_TestAll.py
-            anObj = self.BasicOp.MakePointOnFace(theFace)
+            anObj = self.BasicOp.MakePointOnFace(theFace, theNumberOfPnts)
             RaiseIfFailed("MakeVertexInsideFace", self.BasicOp)
             self._autoPublish(anObj, theName, "vertex")
             return anObj
@@ -1638,7 +1634,7 @@ class geomBuilder(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
@@ -1652,7 +1648,7 @@ class geomBuilder(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.
@@ -1772,7 +1768,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
         ## Create a plane, passing through the three given points
         #  @param thePnt1 First of three points, defining the plane.
         #  @param thePnt2 Second of three points, defining the plane.
-        #  @param thePnt3 Fird of three points, defining the plane.
+        #  @param thePnt3 Third of three points, defining the plane.
         #  @param theTrimSize Half size of a side of quadrangle face, representing the plane.
         #  @param theName Object name; when specified, this parameter is used
         #         for result publication in the study. Otherwise, if automatic
@@ -1789,7 +1785,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
             Parameters:
                 thePnt1 First of three points, defining the plane.
                 thePnt2 Second of three points, defining the plane.
-                thePnt3 Fird of three points, defining the plane.
+                thePnt3 Third of three points, defining the plane.
                 theTrimSize Half size of a side of quadrangle face, representing the plane.
                 theName Object name; when specified, this parameter is used
                         for result publication in the study. Otherwise, if automatic
@@ -3971,7 +3967,7 @@ class geomBuilder(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";
@@ -4011,7 +4007,7 @@ class geomBuilder(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";
@@ -4260,7 +4256,7 @@ class geomBuilder(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,
@@ -4272,7 +4268,7 @@ class geomBuilder(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 = []
@@ -4367,7 +4363,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
         #  @param theBase Base shape to be extruded.
         #  @param thePath Path shape to extrude the base shape along it.
         #  @param theVec Vector defines a constant binormal direction to keep the
-        #                same angle beetween the direction and the sections
+        #                same angle between the direction and the sections
         #                along the sweep surface.
         #  @param IsGenerateGroups flag that tells if it is necessary to
         #         create groups. It is equal to False by default.
@@ -4396,7 +4392,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
                 theBase Base shape to be extruded.
                 thePath Path shape to extrude the base shape along it.
                 theVec Vector defines a constant binormal direction to keep the
-                       same angle beetween the direction and the sections
+                       same angle between the direction and the sections
                        along the sweep surface.
                 IsGenerateGroups flag that tells if it is necessary to
                                  create groups. It is equal to False by default.
@@ -4761,7 +4757,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
         #
         #  @ref tui_creation_face "Example"
         @ManageTransactions("ShapesOp")
-        def MakeFace(self, theWire, isPlanarWanted, theName=None):
+        def MakeFace(self, theWire, isPlanarWanted, theName=None, raiseException=False):
             """
             Create a face on the given wire.
 
@@ -4782,7 +4778,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
             # Example: see GEOM_TestAll.py
             anObj = self.ShapesOp.MakeFace(theWire, isPlanarWanted)
             if isPlanarWanted and anObj is not None and self.ShapesOp.GetErrorCode() == "MAKE_FACE_TOLERANCE_TOO_BIG":
-                print("WARNING: Cannot build a planar face: required tolerance is too big. Non-planar face is built.")
+                PrintOrRaise("WARNING: Cannot build a planar face: required tolerance is too big. Non-planar face is built.",raiseException)
             else:
                 RaiseIfFailed("MakeFace", self.ShapesOp)
             self._autoPublish(anObj, theName, "face")
@@ -4803,7 +4799,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
         #
         #  @ref tui_creation_face "Example"
         @ManageTransactions("ShapesOp")
-        def MakeFaceWires(self, theWires, isPlanarWanted, theName=None):
+        def MakeFaceWires(self, theWires, isPlanarWanted, theName=None, raiseException=False):
             """
             Create a face on the given wires set.
 
@@ -4824,7 +4820,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
             # Example: see GEOM_TestAll.py
             anObj = self.ShapesOp.MakeFaceWires(ToList(theWires), isPlanarWanted)
             if isPlanarWanted and anObj is not None and self.ShapesOp.GetErrorCode() == "MAKE_FACE_TOLERANCE_TOO_BIG":
-                print("WARNING: Cannot build a planar face: required tolerance is too big. Non-planar face is built.")
+                PrintOrRaise("WARNING: Cannot build a planar face: required tolerance is too big. Non-planar face is built.",raiseException)
             else:
                 RaiseIfFailed("MakeFaceWires", self.ShapesOp)
             self._autoPublish(anObj, theName, "face")
@@ -5671,9 +5667,9 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
         #  @param theShape Shape to find sub-shapes of.
         #  @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
         #  @param theTopLeftPoint Point, specifying top left corner of a quadrangle
-        #  @param theTopRigthPoint Point, specifying top right corner of a quadrangle
+        #  @param theTopRightPoint Point, specifying top right corner of a quadrangle
         #  @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
-        #  @param theBottomRigthPoint Point, specifying bottom right corner of a quadrangle
+        #  @param theBottomRightPoint Point, specifying bottom right corner of a quadrangle
         #  @param theState The state of the sub-shapes to find (see GEOM::shape_state)
         #  @param theName Object name; when specified, this parameter is used
         #         for result publication in the study. Otherwise, if automatic
@@ -5684,8 +5680,8 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
         #  @ref swig_GetShapesOnQuadrangle "Example"
         @ManageTransactions("ShapesOp")
         def GetShapesOnQuadrangle(self, theShape, theShapeType,
-                                  theTopLeftPoint, theTopRigthPoint,
-                                  theBottomLeftPoint, theBottomRigthPoint, theState, theName=None):
+                                  theTopLeftPoint, theTopRightPoint,
+                                  theBottomLeftPoint, theBottomRightPoint, theState, theName=None):
             """
             Find in theShape all sub-shapes of type theShapeType, situated relatively
             the specified quadrangle by the certain way, defined through theState parameter.
@@ -5694,9 +5690,9 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
                 theShape Shape to find sub-shapes of.
                 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
                 theTopLeftPoint Point, specifying top left corner of a quadrangle
-                theTopRigthPoint Point, specifying top right corner of a quadrangle
+                theTopRightPoint Point, specifying top right corner of a quadrangle
                 theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
-                theBottomRigthPoint Point, specifying bottom right corner of a quadrangle
+                theBottomRightPoint Point, specifying bottom right corner of a quadrangle
                 theState The state of the sub-shapes to find (see GEOM::shape_state)
                 theName Object name; when specified, this parameter is used
                         for result publication in the study. Otherwise, if automatic
@@ -5707,8 +5703,8 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
             """
             # Example: see GEOM_TestOthers.py
             aList = self.ShapesOp.GetShapesOnQuadrangle(theShape, theShapeType,
-                                                        theTopLeftPoint, theTopRigthPoint,
-                                                        theBottomLeftPoint, theBottomRigthPoint, theState)
+                                                        theTopLeftPoint, theTopRightPoint,
+                                                        theBottomLeftPoint, theBottomRightPoint, theState)
             RaiseIfFailed("GetShapesOnQuadrangle", self.ShapesOp)
             self._autoPublish(aList, theName, "shapeOnQuadrangle")
             return aList
@@ -5718,9 +5714,9 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
         #  @param theShape Shape to find sub-shapes of.
         #  @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
         #  @param theTopLeftPoint Point, specifying top left corner of a quadrangle
-        #  @param theTopRigthPoint Point, specifying top right corner of a quadrangle
+        #  @param theTopRightPoint Point, specifying top right corner of a quadrangle
         #  @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
-        #  @param theBottomRigthPoint Point, specifying bottom right corner of a quadrangle
+        #  @param theBottomRightPoint Point, specifying bottom right corner of a quadrangle
         #  @param theState The state of the sub-shapes to find (see GEOM::shape_state)
         #
         #  @return List of all found sub-shapes indices.
@@ -5728,8 +5724,8 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
         #  @ref swig_GetShapesOnQuadrangleIDs "Example"
         @ManageTransactions("ShapesOp")
         def GetShapesOnQuadrangleIDs(self, theShape, theShapeType,
-                                     theTopLeftPoint, theTopRigthPoint,
-                                     theBottomLeftPoint, theBottomRigthPoint, theState):
+                                     theTopLeftPoint, theTopRightPoint,
+                                     theBottomLeftPoint, theBottomRightPoint, theState):
             """
             Find in theShape all sub-shapes of type theShapeType, situated relatively
             the specified quadrangle by the certain way, defined through theState parameter.
@@ -5738,9 +5734,9 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
                 theShape Shape to find sub-shapes of.
                 theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
                 theTopLeftPoint Point, specifying top left corner of a quadrangle
-                theTopRigthPoint Point, specifying top right corner of a quadrangle
+                theTopRightPoint Point, specifying top right corner of a quadrangle
                 theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
-                theBottomRigthPoint Point, specifying bottom right corner of a quadrangle
+                theBottomRightPoint Point, specifying bottom right corner of a quadrangle
                 theState The state of the sub-shapes to find (see GEOM::shape_state)
 
             Returns:
@@ -5749,8 +5745,8 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
 
             # Example: see GEOM_TestOthers.py
             aList = self.ShapesOp.GetShapesOnQuadrangleIDs(theShape, theShapeType,
-                                                           theTopLeftPoint, theTopRigthPoint,
-                                                           theBottomLeftPoint, theBottomRigthPoint, theState)
+                                                           theTopLeftPoint, theTopRightPoint,
+                                                           theBottomLeftPoint, theBottomRightPoint, theState)
             RaiseIfFailed("GetShapesOnQuadrangleIDs", self.ShapesOp)
             return aList
 
@@ -6038,6 +6034,38 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
             self._autoPublish(anObj, theName, "inplace")
             return anObj
 
+        ## A sort of GetInPlace functionality, returning IDs of sub-shapes.
+        #  For each sub-shape ID of @a theShapeWhat return a list of corresponding sub-shape
+        #  IDs of @a theShapeWhere.
+        #  For example, if theShapeWhat is a box and theShapeWhere is this box cut into 
+        #  two parts by a plane, then the result can be as this: 
+        #    len( result_list ) = 35,
+        #    result_list[ 1 ] = [ 2, 36 ], which means that the box  (ID 1) turned into two
+        #  solids with IDs 2 and 36 within theShapeWhere
+        #
+        #  @param theShapeWhere Shape to find sub-shapes of.
+        #  @param theShapeWhat Shape, specifying what to find.
+        #  @return List of lists of sub-shape IDS of theShapeWhere.
+        def GetInPlaceMap(self, theShapeWhere, theShapeWhat):
+            """
+            A sort of GetInPlace functionality, returning IDs of sub-shapes.
+            For each sub-shape ID of @a theShapeWhat return a list of corresponding sub-shape
+            IDs of @a theShapeWhere.
+            For example, if theShapeWhat is a box and theShapeWhere is this box cut into 
+            two parts by a plane, then the result can be as this: 
+              len( result_list ) = 35,
+              result_list[ 1 ] = [ 2, 36 ], which means that the box (ID 1) turned into two
+            solids with IDs 2 and 36 within theShapeWhere
+
+            Parameters:
+                theShapeWhere Shape to find sub-shapes of.
+                theShapeWhat Shape, specifying what to find.
+
+            Returns:
+                List of lists of sub-shape IDS of theShapeWhere.
+            """
+            return self.ShapesOp.GetInPlaceMap(theShapeWhere, theShapeWhat)
+
         ## Get sub-shape of theShapeWhere, which is
         #  equal to \a theShapeWhat.
         #  @param theShapeWhere Shape to find sub-shape of.
@@ -7456,7 +7484,7 @@ class geomBuilder(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.
         #
@@ -7475,7 +7503,7 @@ class geomBuilder(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.
             """
@@ -8172,7 +8200,7 @@ class geomBuilder(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.
@@ -8214,7 +8242,7 @@ class geomBuilder(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.
@@ -9306,14 +9334,15 @@ class geomBuilder(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
@@ -9322,11 +9351,13 @@ class geomBuilder(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.
@@ -9345,7 +9376,48 @@ class geomBuilder(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")
@@ -10355,14 +10427,14 @@ class geomBuilder(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
@@ -10413,12 +10485,12 @@ class geomBuilder(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
@@ -10471,7 +10543,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
             Parameters:
                 theInit Shape to remove material from. It must be a solid or a compound made of a single solid.
                 theBase Closed edge or wire defining the base shape to be extruded.
-                theH Prism dimension along the normal  to theBase
+                theH Prism dimension along the normal to theBase
                 theAngle Draft angle in degrees.
                 theInvert If true material changes the direction.
                 theName Object name; when specified, this parameter is used
@@ -10511,7 +10583,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
             Parameters:
                 theInit Shape to add material to. It must be a solid or a compound made of a single solid.
                 theBase Closed edge or wire defining the base shape to be extruded.
-                theH Prism dimension along the normal  to theBase
+                theH Prism dimension along the normal to theBase
                 theAngle Draft angle in degrees.
                 theInvert If true material changes the direction.
                 theName Object name; when specified, this parameter is used
@@ -11107,6 +11179,56 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
             return aSurf
         ## @}
 
+        ## Measure curvature radius of surface in the given point along the given direction.
+        #  @param theSurf the given face.
+        #  @param thePoint given point.
+        #  @param theDirection given direction.
+        #  @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 vector of curvature of theSurf.
+        #          The returned vector is codirectional with the normal to the face
+        #          in the given point in case of positive curvature value
+        #          and opposite to the normal in case of negative curvature.
+        #          The normal of the returned vector is equal to the
+        #          absolute value of the curvature radius.
+        #          Null shape is returned in case of infinite radius
+        #          (zero curvature), for example, in case of flat face.
+        #
+        ## @ref swig_CurvatureOnFace "Example"
+        @ManageTransactions("MeasuOp")
+        def CurvatureOnFace(self, theSurf, thePoint, theDirection, theName=None):
+            """
+            Measure curvature radius of surface in the given point along the given direction.
+
+            Parameters:
+                theSurf the given face.
+                thePoint given point.
+                theDirection given direction.
+                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 vector of curvature of theSurf.
+                The returned vector is codirectional with the normal to the face
+                in the given point in case of positive curvature value
+                and opposite to the normal in case of negative curvature.
+                The normal of the returned vector is equal to the
+                absolute value of the curvature radius.
+                Null shape is returned in case of infinite radius
+                (zero curvature), for example, in case of flat face.
+
+            Example of usage:
+                curvature_1 = geompy.CurvatureOnFace(Face_1, Vertex_1, OX)
+            """
+            aVec = self.MeasuOp.SurfaceCurvatureByPointAndDirection(theSurf,thePoint,theDirection)
+            if self.MeasuOp.GetErrorCode() != "ZERO_CURVATURE":
+                RaiseIfFailed("CurvatureOnFace", self.MeasuOp)
+                self._autoPublish(aVec, theName, "curvature")
+            return aVec
+
         ## Get min and max tolerances of sub-shapes of theShape
         #  @param theShape Shape, to get tolerances of.
         #  @return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]\n
@@ -11249,9 +11371,10 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
             self._autoPublish(anObj, theName, "centerOfMass")
             return anObj
 
-        ## Get a vertex sub-shape by index depended with orientation.
+        ## Get a vertex sub-shape by index.
         #  @param theShape Shape to find sub-shape.
         #  @param theIndex Index to find vertex by this index (starting from zero)
+        #  @param theUseOri To consider edge/wire orientation or not
         #  @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.
@@ -11260,13 +11383,14 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
         #
         #  @ref tui_measurement_tools_page "Example"
         @ManageTransactions("MeasuOp")
-        def GetVertexByIndex(self, theShape, theIndex, theName=None):
+        def GetVertexByIndex(self, theShape, theIndex, theUseOri=True, theName=None):
             """
-            Get a vertex sub-shape by index depended with orientation.
+            Get a vertex sub-shape by index.
 
             Parameters:
                 theShape Shape to find sub-shape.
                 theIndex Index to find vertex by this index (starting from zero)
+                theUseOri To consider edge/wire orientation or not
                 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.
@@ -11275,7 +11399,9 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
                 New GEOM.GEOM_Object, containing the created vertex.
             """
             # Example: see GEOM_TestMeasures.py
-            anObj = self.MeasuOp.GetVertexByIndex(theShape, theIndex)
+            if isinstance( theUseOri, str ): # theUseOri was inserted before theName
+                theUseOri, theName = True, theUseOri
+            anObj = self.MeasuOp.GetVertexByIndex(theShape, theIndex, theUseOri)
             RaiseIfFailed("GetVertexByIndex", self.MeasuOp)
             self._autoPublish(anObj, theName, "vertex")
             return anObj
@@ -11304,7 +11430,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
             """
             # Example: see GEOM_TestMeasures.py
             # note: auto-publishing is done in self.GetVertexByIndex()
-            return self.GetVertexByIndex(theShape, 0, theName)
+            return self.GetVertexByIndex(theShape, 0, True, theName)
 
         ## Get the last vertex of wire/edge depended orientation.
         #  @param theShape Shape to find last vertex.
@@ -11331,7 +11457,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
             # Example: see GEOM_TestMeasures.py
             nb_vert =  self.NumberOfSubShapes(theShape, self.ShapeType["VERTEX"])
             # note: auto-publishing is done in self.GetVertexByIndex()
-            return self.GetVertexByIndex(theShape, (nb_vert-1), theName)
+            return self.GetVertexByIndex(theShape, (nb_vert-1), True, theName)
 
         ## Get a normale to the given face. If the point is not given,
         #  the normale is calculated at the center of mass.
@@ -11496,7 +11622,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
 
         ## 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:
+        #  @param theDeflection Linear deflection coefficient that specifies quality of tessellation:
         #         - 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)
@@ -11511,7 +11637,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
 
             Parameters:
                 theShape Shape to check.
-                theDeflection Linear deflection coefficient that specifies quality of tesselation:
+                theDeflection Linear deflection coefficient that specifies quality of tessellation:
                     - 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)
@@ -11525,20 +11651,20 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
             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
+        ## Check boolean and partition operations arguments.
+        #  @param theShape the argument of an operation to be checked
+        #  @return TRUE if the argument is valid for a boolean or partition
         #          operation; FALSE otherwise.
         @ManageTransactions("MeasuOp")
         def CheckBOPArguments(self, theShape):
             """
-            Check boolean and partition operations agruments.
+            Check boolean and partition operations arguments.
 
             Parameters:
-                theShape the agrument of an operation to be checked
+                theShape the argument of an operation to be checked
 
             Returns:
-                TRUE if the agrument is valid for a boolean or partition
+                TRUE if the argument is valid for a boolean or partition
                 operation; FALSE otherwise.
             """
             return self.MeasuOp.CheckBOPArguments(theShape)
@@ -11549,7 +11675,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
         #  @param theTolerance Specifies a distance between shapes used for detecting gaps:
         #         - if \a theTolerance <= 0, algorithm detects intersections (default behavior)
         #         - if \a theTolerance > 0, algorithm detects gaps
-        #  @param theDeflection Linear deflection coefficient that specifies quality of tesselation:
+        #  @param theDeflection Linear deflection coefficient that specifies quality of tessellation:
         #         - if \a theDeflection <= 0, default deflection 0.001 is used
         #  @return TRUE, if there are intersections (gaps) between source shapes
         #  @return List of sub-shapes IDs from 1st shape that localize intersection.
@@ -11567,7 +11693,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
                 theTolerance Specifies a distance between shapes used for detecting gaps:
                     - if theTolerance <= 0, algorithm detects intersections (default behavior)
                     - if theTolerance > 0, algorithm detects gaps
-                theDeflection Linear deflection coefficient that specifies quality of tesselation:
+                theDeflection Linear deflection coefficient that specifies quality of tessellation:
                     - if theDeflection <= 0, default deflection 0.001 is used
  
             Returns:
@@ -11851,7 +11977,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
         ## @{
 
         ## Create a quadrangle face from four edges. Order of Edges is not
-        #  important. It is  not necessary that edges share the same vertex.
+        #  important. It is not necessary that edges share the same vertex.
         #  @param E1,E2,E3,E4 Edges for the face bound.
         #  @param theName Object name; when specified, this parameter is used
         #         for result publication in the study. Otherwise, if automatic
@@ -11864,7 +11990,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
         def MakeQuad(self, E1, E2, E3, E4, theName=None):
             """
             Create a quadrangle face from four edges. Order of Edges is not
-            important. It is  not necessary that edges share the same vertex.
+            important. It is not necessary that edges share the same vertex.
 
             Parameters:
                 E1,E2,E3,E4 Edges for the face bound.
@@ -11969,7 +12095,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
             return anObj
 
         ## Create a hexahedral solid, bounded by the six given faces. Order of
-        #  faces is not important. It is  not necessary that Faces share the same edge.
+        #  faces is not important. It is not necessary that Faces share the same edge.
         #  @param F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
         #  @param theName Object name; when specified, this parameter is used
         #         for result publication in the study. Otherwise, if automatic
@@ -11983,7 +12109,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
         def MakeHexa(self, F1, F2, F3, F4, F5, F6, theName=None):
             """
             Create a hexahedral solid, bounded by the six given faces. Order of
-            faces is not important. It is  not necessary that Faces share the same edge.
+            faces is not important. It is not necessary that Faces share the same edge.
 
             Parameters:
                 F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
@@ -12847,7 +12973,7 @@ class geomBuilder(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
@@ -12862,7 +12988,7 @@ class geomBuilder(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.
@@ -12970,7 +13096,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
             RaiseIfFailed("RemoveObject", self.GroupOp)
             pass
 
-        ## Adds to the group all the given shapes. No errors, if some shapes are alredy included.
+        ## Adds to the group all the given shapes. No errors, if some shapes are already included.
         #  @param theGroup is a GEOM group to which the new sub-shapes are added.
         #  @param theSubShapes is a list of sub-shapes to be added.
         #
@@ -12978,7 +13104,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
         @ManageTransactions("GroupOp")
         def UnionList (self,theGroup, theSubShapes):
             """
-            Adds to the group all the given shapes. No errors, if some shapes are alredy included.
+            Adds to the group all the given shapes. No errors, if some shapes are already included.
 
             Parameters:
                 theGroup is a GEOM group to which the new sub-shapes are added.
@@ -12989,7 +13115,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
             RaiseIfFailed("UnionList", self.GroupOp)
             pass
 
-        ## Adds to the group all the given shapes. No errors, if some shapes are alredy included.
+        ## Adds to the group all the given shapes. No errors, if some shapes are already included.
         #  @param theGroup is a GEOM group to which the new sub-shapes are added.
         #  @param theSubShapes is a list of indices of sub-shapes to be added.
         #
@@ -12997,7 +13123,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
         @ManageTransactions("GroupOp")
         def UnionIDs(self,theGroup, theSubShapes):
             """
-            Adds to the group all the given shapes. No errors, if some shapes are alredy included.
+            Adds to the group all the given shapes. No errors, if some shapes are already included.
 
             Parameters:
                 theGroup is a GEOM group to which the new sub-shapes are added.
@@ -13287,7 +13413,7 @@ class geomBuilder(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):
@@ -13295,7 +13421,7 @@ class geomBuilder(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, ... )
@@ -13722,7 +13848,6 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
             Returns:
                 a new created folder
             """
-            if not Father: Father = self.father
             return self.CreateFolder(Name, Father)
 
         ## Move object to the specified folder
@@ -13833,6 +13958,37 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
         # end of l2_field
         ## @}
 
+        ## @addtogroup l2_testing
+        ## @{
+
+        ## Build a mesh on the given shape.
+        # @param shape the source shape
+        # @param linear_deflection linear deflection coefficient
+        # @param is_relative says if given value of deflection is relative to shape's bounding box
+        # @param angular_deflection angular deflection for edges in degrees
+        # @return True in case of success; otherwise False.
+        @ManageTransactions("TestOp")
+        def Tesselate(self, shape, linear_deflection=0, is_relative=True, angular_deflection=0):
+            """Build a mesh on the given shape.
+
+            Parameters:
+                shape the source shape
+                linear_deflection linear deflection coefficient
+                is_relative says if given value of deflection is relative to shape's bounding box
+                angular_deflection angular deflection for edges in degrees
+
+            Returns:
+                True in case of success; otherwise False.
+            """
+            if angular_deflection > 0:
+                angular_deflection = angular_deflection * math.pi / 180.
+            r = self.TestOp.Tesselate(shape, linear_deflection, is_relative, angular_deflection)
+            RaiseIfFailed("Tesselate", self.TestOp)
+            return r
+
+        # end of l2_testing
+        ## @}
+
 
 # Register the new proxy for GEOM_Gen
 omniORB.registerObjref(GEOM._objref_GEOM_Gen._NP_RepositoryId, geomBuilder)
@@ -14004,6 +14160,10 @@ def New( instance=None):
     global engine
     global geom
     global doLcc
+    if instance and isinstance( instance, SALOMEDS._objref_Study ):
+        import sys
+        sys.stderr.write("Warning: 'study' argument is no more needed in geomBuilder.New(). Consider updating your script!!!\n\n")
+        instance = None
     engine = instance
     if engine is None:
       doLcc = True