Salome HOME
0022353: EDF GEOM: Projection on a edge or a wire
[modules/geom.git] / src / GEOM_SWIG / geomBuilder.py
index 249379505cc5a1a824527a6fc11f07990dbb2f84..d26f3c6652bf9eaa12b59a88f24cc58b5eb5ac42 100644 (file)
 ## - Sub-shapes are automatically published as child items of the parent main shape in the study if main
 ##   shape was also published before. Otherwise, sub-shapes are published as top-level objects.
 ## - Not that some functions of \ref geomBuilder.geomBuilder "geomBuilder" class do not have
-##   @theName parameter (and, thus, do not support automatic publication).
+##   \a theName parameter (and, thus, do not support automatic publication).
 ##   For example, some transformation operations like
 ##   \ref geomBuilder.geomBuilder.TranslateDXDYDZ() "TranslateDXDYDZ()".
 ##   Refer to the documentation to check if some function has such possibility.
 
 ##   @}
 ##   @defgroup l2_measure       Using measurement tools
+##   @defgroup l2_field         Field on Geometry
 
 ## @}
 
@@ -210,7 +211,7 @@ import GEOM
 import math
 import os
 
-from salome.geom.gsketcher import Sketcher3D
+from salome.geom.gsketcher import Sketcher3D, Sketcher2D
 
 # service function
 def _toListOfNames(_names, _size=-1):
@@ -228,7 +229,11 @@ def _toListOfNames(_names, _size=-1):
 ## @ingroup l1_geomBuilder_auxiliary
 def RaiseIfFailed (Method_name, Operation):
     if Operation.IsDone() == 0 and Operation.GetErrorCode() != "NOT_FOUND_ANY":
+        Operation.AbortOperation()
         raise RuntimeError, Method_name + " : " + Operation.GetErrorCode()
+    else:
+        Operation.FinishOperation()
+        pass
 
 ## Return list of variables value from salome notebook
 ## @ingroup l1_geomBuilder_auxiliary
@@ -459,6 +464,18 @@ class info:
     CLOSED   = 1
     UNCLOSED = 2
 
+##! Private class used to bind calls of plugin operations to geomBuilder
+class PluginOperation:
+  def __init__(self, operation, function):
+    self.operation = operation
+    self.function = function
+    pass
+
+  def __call__(self, *args):
+    res = self.function(self.operation, *args)
+    RaiseIfFailed(self.function.__name__, self.operation)
+    return res
+
 # Warning: geom is a singleton
 geom = None
 engine = None
@@ -577,6 +594,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
               self.BlocksOp = None
               self.GroupOp  = None
               self.AdvOp    = None
+              self.FieldOp  = None
             pass
 
         ## Process object publication in the study, as follows:
@@ -620,6 +638,22 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
                     pass
                 return _name
             # ---
+            def _publish( _name, _obj ):
+                fatherObj = None
+                if isinstance( _obj, GEOM._objref_GEOM_Field ):
+                    fatherObj = _obj.GetShape()
+                elif isinstance( _obj, GEOM._objref_GEOM_FieldStep ):
+                    fatherObj = _obj.GetField()
+                elif not _obj.IsMainShape():
+                    fatherObj = _obj.GetMainShape()
+                    pass
+                if fatherObj and fatherObj.GetStudyEntry():
+                    self.addToStudyInFather(fatherObj, _obj, _name)
+                else:
+                    self.addToStudy(_obj, _name)
+                    pass
+                return
+            # ---
             if not theObj:
                 return # null object
             if not theName and not self.myMaxNbSubShapesAllowed:
@@ -632,27 +666,16 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
                 idx = 0
                 for obj in theObj:
                     if not obj: continue # bad object
-                    ###if obj.GetStudyEntry(): continue # already published
                     name = _item_name(theName, theDefaultName, idx)
-                    if obj.IsMainShape() or not obj.GetMainShape().GetStudyEntry():
-                        self.addToStudy(obj, name) # "%s_%d"%(aName, idx)
-                    else:
-                        self.addToStudyInFather(obj.GetMainShape(), obj, name) # "%s_%d"%(aName, idx)
-                        pass
+                    _publish( name, obj )
                     idx = idx+1
                     if not theName and idx == self.myMaxNbSubShapesAllowed: break
                     pass
                 pass
             else:
                 # single object is published
-                ###if theObj.GetStudyEntry(): return # already published
                 name = _item_name(theName, theDefaultName)
-                if theObj.IsMainShape():
-                    self.addToStudy(theObj, name)
-                else:
-                    self.addToStudyInFather(theObj.GetMainShape(), theObj, name)
-                    pass
-                pass
+                _publish( name, theObj )
             pass
 
         ## @addtogroup l1_geomBuilder_auxiliary
@@ -684,9 +707,36 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             self.MeasuOp  = self.GetIMeasureOperations  (self.myStudyId)
             self.BlocksOp = self.GetIBlocksOperations   (self.myStudyId)
             self.GroupOp  = self.GetIGroupOperations    (self.myStudyId)
-            self.AdvOp    = self.GetIAdvancedOperations (self.myStudyId)
+            self.FieldOp  = self.GetIFieldOperations    (self.myStudyId)
+
+            # The below line is a right way to map all plugin functions to geomBuilder,
+            # but AdvancedOperations are already mapped, that is why this line is commented
+            # and presents here only as an axample
+            #self.AdvOp    = self.GetPluginOperations (self.myStudyId, "AdvancedEngine")
+
+            # self.AdvOp is used by functions MakePipeTShape*, MakeDividedDisk, etc.
+            self.AdvOp = GEOM._objref_GEOM_Gen.GetPluginOperations (self, self.myStudyId, "AdvancedEngine")
+
+            # set GEOM as root in the use case tree
+            self.myUseCaseBuilder = self.myStudy.GetUseCaseBuilder()
+            self.myUseCaseBuilder.SetRootCurrent()
+            self.myUseCaseBuilder.Append(self.father)
             pass
 
+        def GetPluginOperations(self, studyID, libraryName):
+            op = GEOM._objref_GEOM_Gen.GetPluginOperations(self, studyID, libraryName)
+            if op:
+                # bind methods of operations to self
+                methods = op.__class__.__dict__['__methods__']
+                avoid_methods = self.BasicOp.__class__.__dict__['__methods__']
+                for meth_name in methods:
+                    if not meth_name in avoid_methods: # avoid basic methods
+                        function = getattr(op.__class__, meth_name)
+                        if callable(function):
+                            #self.__dict__[meth_name] = self.__PluginOperation(op, function)
+                            self.__dict__[meth_name] = PluginOperation(op, function)
+            return op
+
         ## Enable / disable results auto-publishing
         # 
         #  The automatic publishing is managed in the following way:
@@ -2207,7 +2257,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #  @param theParamMin the minimal value of the parameter.
         #  @param theParamMax the maximum value of the parameter.
         #  @param theParamStep the number of steps if theNewMethod = True, else step value of the parameter.
-        #  @param theCurveType the type of the curve.
+        #  @param theCurveType the type of the curve,
+        #         one of GEOM.Polyline, GEOM.Bezier, GEOM.Interpolation.
         #  @param theNewMethod flag for switching to the new method if the flag is set to false a deprecated method is used which can lead to a bug.
         #  @param theName Object name; when specified, this parameter is used
         #         for result publication in the study. Otherwise, if automatic
@@ -2228,7 +2279,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
                 theParamMin the minimal value of the parameter.
                 theParamMax the maximum value of the parameter.
                 theParamStep the number of steps if theNewMethod = True, else step value of the parameter.
-                theCurveType the type of the curve.
+                theCurveType the type of the curve,
+                             one of GEOM.Polyline, GEOM.Bezier, GEOM.Interpolation.
                 theNewMethod flag for switching to the new method if the flag is set to false a deprecated
                              method is used which can lead to a bug.
                 theName Object name; when specified, this parameter is used
@@ -2405,6 +2457,26 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             self._autoPublish(anObj, theName, "wire")
             return anObj
 
+        ## Obtain a 2D sketcher interface
+        #  @return An instance of @ref gsketcher.Sketcher2D "Sketcher2D" interface      
+        def Sketcher2D (self):
+            """
+            Obtain a 2D sketcher interface.
+
+            Example of usage:
+               sk = geompy.Sketcher2D()
+               sk.addPoint(20, 20)
+               sk.addSegmentRelative(15, 70)
+               sk.addSegmentPerpY(50)
+               sk.addArcRadiusRelative(25, 15, 14.5, 0)
+               sk.addArcCenterAbsolute(1, 1, 50, 50, 0, 0)
+               sk.addArcDirectionRadiusLength(20, 20, 101, 162.13)
+               sk.close()
+               Sketch_1 = sk.wire(geomObj_1)
+            """
+            sk = Sketcher2D (self)
+            return sk
+        
         ## Create a sketcher wire, following the numerical description,
         #  passed through <VAR>theCoordinates</VAR> argument. \n
         #  @param theCoordinates double values, defining points to create a wire,
@@ -4240,6 +4312,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
                 New GEOM.GEOM_Object, containing the created compound.
             """
             # Example: see GEOM_TestAll.py
+            self.ShapesOp.StartOperation()
             anObj = self.ShapesOp.MakeCompound(theShapes)
             RaiseIfFailed("MakeCompound", self.ShapesOp)
             self._autoPublish(anObj, theName, "compound")
@@ -5448,7 +5521,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             return ListObj
 
         ## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
-        #  selected by they indices in list of all sub-shapes of type <VAR>aType</VAR>.
+        #  selected by their indices in list of all sub-shapes of type <VAR>aType</VAR>.
         #  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.
@@ -5463,7 +5536,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         def SubShape(self, aShape, aType, ListOfInd, theName=None):
             """
             Obtain a compound of sub-shapes of aShape,
-            selected by they indices in list of all sub-shapes of type aType.
+            selected by their indices in list of all sub-shapes of type aType.
             Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
             
             Parameters:
@@ -5912,6 +5985,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         ## Sewing of some shapes into single shape.
         #  @param ListShape Shapes to be processed.
         #  @param theTolerance Required tolerance value.
+        #  @param AllowNonManifold Flag that allows non-manifold sewing.
         #  @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.
@@ -5919,13 +5993,14 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #  @return New GEOM.GEOM_Object, containing processed shape.
         #
         #  @ref tui_sewing "Example"
-        def MakeSewing(self, ListShape, theTolerance, theName=None):
+        def MakeSewing(self, ListShape, theTolerance, AllowNonManifold=False, theName=None):
             """
             Sewing of some shapes into single shape.
 
             Parameters:
                 ListShape Shapes to be processed.
                 theTolerance Required tolerance value.
+                AllowNonManifold Flag that allows non-manifold sewing.
                 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.
@@ -5936,24 +6011,26 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             # Example: see GEOM_TestHealing.py
             comp = self.MakeCompound(ListShape)
             # note: auto-publishing is done in self.Sew()
-            anObj = self.Sew(comp, theTolerance, theName)
+            anObj = self.Sew(comp, theTolerance, AllowNonManifold, theName)
             return anObj
 
         ## Sewing of the given object.
         #  @param theObject Shape to be processed.
         #  @param theTolerance Required tolerance value.
+        #  @param AllowNonManifold Flag that allows non-manifold sewing.
         #  @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 processed shape.
-        def Sew(self, theObject, theTolerance, theName=None):
+        def Sew(self, theObject, theTolerance, AllowNonManifold=False, theName=None):
             """
             Sewing of the given object.
 
             Parameters:
                 theObject Shape to be processed.
                 theTolerance Required tolerance value.
+                AllowNonManifold Flag that allows non-manifold sewing.
                 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.
@@ -5963,12 +6040,48 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             """
             # Example: see MakeSewing() above
             theTolerance,Parameters = ParseParameters(theTolerance)
-            anObj = self.HealOp.Sew(theObject, theTolerance)
+            if AllowNonManifold:
+                anObj = self.HealOp.SewAllowNonManifold(theObject, theTolerance)
+            else:
+                anObj = self.HealOp.Sew(theObject, theTolerance)
+            # To avoid script failure in case of good argument shape
+            if self.HealOp.GetErrorCode() == "ShHealOper_NotError_msg":
+                return theObject
             RaiseIfFailed("Sew", self.HealOp)
             anObj.SetParameters(Parameters)
             self._autoPublish(anObj, theName, "sewed")
             return anObj
 
+        ## Rebuild the topology of theCompound of solids by removing
+        #  of the faces that are shared by several solids.
+        #  @param theCompound Shape to be processed.
+        #  @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 processed shape.
+        #
+        #  @ref tui_remove_webs "Example"
+        def RemoveInternalFaces (self, theCompound, theName=None):
+            """
+            Rebuild the topology of theCompound of solids by removing
+            of the faces that are shared by several solids.
+
+            Parameters:
+                theCompound Shape to be processed.
+                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 processed shape.
+            """
+            # Example: see GEOM_TestHealing.py
+            anObj = self.HealOp.RemoveInternalFaces(theCompound)
+            RaiseIfFailed("RemoveInternalFaces", self.HealOp)
+            self._autoPublish(anObj, theName, "removeWebs")
+            return anObj
+
         ## Remove internal wires and edges from the given object (face).
         #  @param theObject Shape to be processed.
         #  @param theWires Indices of wires to be removed, if EMPTY then the method
@@ -6488,6 +6601,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #  @param theShape2 Second argument for boolean operation.
         #  @param theOperation Indicates the operation to be done:\n
         #                      1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
+        #  @param checkSelfInte The flag that tells if the arguments should
+        #         be checked for self-intersection prior to the operation.
         #  @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.
@@ -6495,7 +6610,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #  @return New GEOM.GEOM_Object, containing the result shape.
         #
         #  @ref tui_fuse "Example"
-        def MakeBoolean(self, theShape1, theShape2, theOperation, theName=None):
+        def MakeBoolean(self, theShape1, theShape2, theOperation, checkSelfInte=False, theName=None):
             """
             Perform one of boolean operations on two given shapes.
 
@@ -6504,6 +6619,9 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
                 theShape2 Second argument for boolean operation.
                 theOperation Indicates the operation to be done:
                              1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
+                checkSelfInte The flag that tells if the arguments should
+                              be checked for self-intersection prior to
+                              the operation.
                 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.
@@ -6512,7 +6630,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
                 New GEOM.GEOM_Object, containing the result shape.
             """
             # Example: see GEOM_TestAll.py
-            anObj = self.BoolOp.MakeBoolean(theShape1, theShape2, theOperation)
+            anObj = self.BoolOp.MakeBoolean(theShape1, theShape2, theOperation, checkSelfInte)
             RaiseIfFailed("MakeBoolean", self.BoolOp)
             def_names = { 1: "common", 2: "cut", 3: "fuse", 4: "section" }
             self._autoPublish(anObj, theName, def_names[theOperation])
@@ -6521,6 +6639,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         ## Perform Common boolean operation on two given shapes.
         #  @param theShape1 First argument for boolean operation.
         #  @param theShape2 Second argument for boolean operation.
+        #  @param checkSelfInte The flag that tells if the arguments should
+        #         be checked for self-intersection prior to the operation.
         #  @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.
@@ -6529,13 +6649,16 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #
         #  @ref tui_common "Example 1"
         #  \n @ref swig_MakeCommon "Example 2"
-        def MakeCommon(self, theShape1, theShape2, theName=None):
+        def MakeCommon(self, theShape1, theShape2, checkSelfInte=False, theName=None):
             """
             Perform Common boolean operation on two given shapes.
 
             Parameters: 
                 theShape1 First argument for boolean operation.
                 theShape2 Second argument for boolean operation.
+                checkSelfInte The flag that tells if the arguments should
+                              be checked for self-intersection prior to
+                              the operation.
                 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.
@@ -6545,11 +6668,13 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             """
             # Example: see GEOM_TestOthers.py
             # note: auto-publishing is done in self.MakeBoolean()
-            return self.MakeBoolean(theShape1, theShape2, 1, theName)
+            return self.MakeBoolean(theShape1, theShape2, 1, checkSelfInte, theName)
 
         ## Perform Cut boolean operation on two given shapes.
         #  @param theShape1 First argument for boolean operation.
         #  @param theShape2 Second argument for boolean operation.
+        #  @param checkSelfInte The flag that tells if the arguments should
+        #         be checked for self-intersection prior to the operation.
         #  @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.
@@ -6558,13 +6683,16 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #
         #  @ref tui_cut "Example 1"
         #  \n @ref swig_MakeCommon "Example 2"
-        def MakeCut(self, theShape1, theShape2, theName=None):
+        def MakeCut(self, theShape1, theShape2, checkSelfInte=False, theName=None):
             """
             Perform Cut boolean operation on two given shapes.
 
             Parameters: 
                 theShape1 First argument for boolean operation.
                 theShape2 Second argument for boolean operation.
+                checkSelfInte The flag that tells if the arguments should
+                              be checked for self-intersection prior to
+                              the operation.
                 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.
@@ -6575,11 +6703,13 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             """
             # Example: see GEOM_TestOthers.py
             # note: auto-publishing is done in self.MakeBoolean()
-            return self.MakeBoolean(theShape1, theShape2, 2, theName)
+            return self.MakeBoolean(theShape1, theShape2, 2, checkSelfInte, theName)
 
         ## Perform Fuse boolean operation on two given shapes.
         #  @param theShape1 First argument for boolean operation.
         #  @param theShape2 Second argument for boolean operation.
+        #  @param checkSelfInte The flag that tells if the arguments should
+        #         be checked for self-intersection prior to the operation.
         #  @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.
@@ -6588,13 +6718,16 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #
         #  @ref tui_fuse "Example 1"
         #  \n @ref swig_MakeCommon "Example 2"
-        def MakeFuse(self, theShape1, theShape2, theName=None):
+        def MakeFuse(self, theShape1, theShape2, checkSelfInte=False, theName=None):
             """
             Perform Fuse boolean operation on two given shapes.
 
             Parameters: 
                 theShape1 First argument for boolean operation.
                 theShape2 Second argument for boolean operation.
+                checkSelfInte The flag that tells if the arguments should
+                              be checked for self-intersection prior to
+                              the operation.
                 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.
@@ -6605,11 +6738,13 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             """
             # Example: see GEOM_TestOthers.py
             # note: auto-publishing is done in self.MakeBoolean()
-            return self.MakeBoolean(theShape1, theShape2, 3, theName)
+            return self.MakeBoolean(theShape1, theShape2, 3, checkSelfInte, theName)
 
         ## Perform Section boolean operation on two given shapes.
         #  @param theShape1 First argument for boolean operation.
         #  @param theShape2 Second argument for boolean operation.
+        #  @param checkSelfInte The flag that tells if the arguments should
+        #         be checked for self-intersection prior to the operation.
         #  @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.
@@ -6618,13 +6753,16 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #
         #  @ref tui_section "Example 1"
         #  \n @ref swig_MakeCommon "Example 2"
-        def MakeSection(self, theShape1, theShape2, theName=None):
+        def MakeSection(self, theShape1, theShape2, checkSelfInte=False, theName=None):
             """
             Perform Section boolean operation on two given shapes.
 
             Parameters: 
                 theShape1 First argument for boolean operation.
                 theShape2 Second argument for boolean operation.
+                checkSelfInte The flag that tells if the arguments should
+                              be checked for self-intersection prior to
+                              the operation.
                 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.
@@ -6635,10 +6773,12 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             """
             # Example: see GEOM_TestOthers.py
             # note: auto-publishing is done in self.MakeBoolean()
-            return self.MakeBoolean(theShape1, theShape2, 4, theName)
+            return self.MakeBoolean(theShape1, theShape2, 4, checkSelfInte, theName)
 
         ## Perform Fuse boolean operation on the list of shapes.
         #  @param theShapesList Shapes to be fused.
+        #  @param checkSelfInte The flag that tells if the arguments should
+        #         be checked for self-intersection prior to the operation.
         #  @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.
@@ -6647,12 +6787,15 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #
         #  @ref tui_fuse "Example 1"
         #  \n @ref swig_MakeCommon "Example 2"
-        def MakeFuseList(self, theShapesList, theName=None):
+        def MakeFuseList(self, theShapesList, checkSelfInte=False, theName=None):
             """
             Perform Fuse boolean operation on the list of shapes.
 
             Parameters: 
                 theShapesList Shapes to be fused.
+                checkSelfInte The flag that tells if the arguments should
+                              be checked for self-intersection prior to
+                              the operation.
                 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.
@@ -6662,13 +6805,15 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             
             """
             # Example: see GEOM_TestOthers.py
-            anObj = self.BoolOp.MakeFuseList(theShapesList)
+            anObj = self.BoolOp.MakeFuseList(theShapesList, checkSelfInte)
             RaiseIfFailed("MakeFuseList", self.BoolOp)
             self._autoPublish(anObj, theName, "fuse")
             return anObj
 
         ## Perform Common boolean operation on the list of shapes.
         #  @param theShapesList Shapes for Common operation.
+        #  @param checkSelfInte The flag that tells if the arguments should
+        #         be checked for self-intersection prior to the operation.
         #  @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.
@@ -6677,12 +6822,15 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #
         #  @ref tui_common "Example 1"
         #  \n @ref swig_MakeCommon "Example 2"
-        def MakeCommonList(self, theShapesList, theName=None):
+        def MakeCommonList(self, theShapesList, checkSelfInte=False, theName=None):
             """
             Perform Common boolean operation on the list of shapes.
 
             Parameters: 
                 theShapesList Shapes for Common operation.
+                checkSelfInte The flag that tells if the arguments should
+                              be checked for self-intersection prior to
+                              the operation.
                 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.
@@ -6692,7 +6840,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             
             """
             # Example: see GEOM_TestOthers.py
-            anObj = self.BoolOp.MakeCommonList(theShapesList)
+            anObj = self.BoolOp.MakeCommonList(theShapesList, checkSelfInte)
             RaiseIfFailed("MakeCommonList", self.BoolOp)
             self._autoPublish(anObj, theName, "common")
             return anObj
@@ -6700,6 +6848,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         ## Perform Cut boolean operation on one object and the list of tools.
         #  @param theMainShape The object of the operation.
         #  @param theShapesList The list of tools of the operation.
+        #  @param checkSelfInte The flag that tells if the arguments should
+        #         be checked for self-intersection prior to the operation.
         #  @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.
@@ -6708,13 +6858,16 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #
         #  @ref tui_cut "Example 1"
         #  \n @ref swig_MakeCommon "Example 2"
-        def MakeCutList(self, theMainShape, theShapesList, theName=None):
+        def MakeCutList(self, theMainShape, theShapesList, checkSelfInte=False, theName=None):
             """
             Perform Cut boolean operation on one object and the list of tools.
 
             Parameters: 
                 theMainShape The object of the operation.
                 theShapesList The list of tools of the operation.
+                checkSelfInte The flag that tells if the arguments should
+                              be checked for self-intersection prior to
+                              the operation.
                 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.
@@ -6724,7 +6877,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             
             """
             # Example: see GEOM_TestOthers.py
-            anObj = self.BoolOp.MakeCutList(theMainShape, theShapesList)
+            anObj = self.BoolOp.MakeCutList(theMainShape, theShapesList, checkSelfInte)
             RaiseIfFailed("MakeCutList", self.BoolOp)
             self._autoPublish(anObj, theName, "cut")
             return anObj
@@ -7883,6 +8036,46 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             RaiseIfFailed("ProjectShapeCopy", self.TrsfOp)
             self._autoPublish(anObj, theName, "projection")
             return anObj
+            
+        ## Create a projection 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.
+        #  @param theWire the wire. The edge is accepted as well.
+        #  @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 [\a u, \a PointOnEdge, \a EdgeInWireIndex]
+        #  \n \a u: The parameter of projection point on edge.
+        #  \n \a PointOnEdge: The projection point.
+        #  \n \a EdgeInWireIndex: The index of an edge in a wire.
+        #
+        #  @ref tui_projection "Example"
+        def MakeProjectionOnWire(self, thePoint, theWire, theName=None):
+            """
+            Create a projection 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.
+            
+            Parameters:
+                thePoint the point to be projected.
+                theWire the wire. The edge is accepted as well.
+                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:
+                [u, PointOnEdge, EdgeInWireIndex]
+                 u: The parameter of projection point on edge.
+                 PointOnEdge: The projection point.
+                 EdgeInWireIndex: The index of an edge in a wire.
+            """
+            # Example: see GEOM_TestAll.py
+            anObj = self.TrsfOp.ProjectPointOnWire(thePoint, theWire)
+            RaiseIfFailed("ProjectPointOnWire", self.TrsfOp)
+            self._autoPublish(anObj[1], theName, "projection")
+            return anObj
 
         # -----------------------------------------------------------------------------
         # Patterns
@@ -9501,11 +9694,6 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             # Example: see GEOM_TestMeasures.py
             listSh = self.SubShapeAllIDs(theShape, theType)
             Nb = len(listSh)
-            t       = EnumToLong(theShape.GetShapeType())
-            theType = EnumToLong(theType)
-            if t == theType:
-                Nb = Nb + 1
-                pass
             return Nb
 
         ## Obtain quantity of shapes of each type in \a theShape.
@@ -9531,13 +9719,21 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
                 if typeSh in ( "AUTO", "SHAPE" ): continue
                 listSh = self.SubShapeAllIDs(theShape, self.ShapeType[typeSh])
                 Nb = len(listSh)
-                if EnumToLong(theShape.GetShapeType()) == self.ShapeType[typeSh]:
-                    Nb = Nb + 1
-                    pass
                 aDict[typeSh] = Nb
                 pass
             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 )
+            return res
+
         ## Get a point, situated at the centre of mass of theShape.
         #  @param theShape Shape to define centre of mass of.
         #  @param theName Object name; when specified, this parameter is used
@@ -11358,10 +11554,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
 
         ## Cut of lists of groups.
         #  New group is created. It will contain only entities
-        #  which are present in groups listed in theGList1 but 
-        #  are not present in groups from theGList2.
-        #  @param theGList1 is a list of GEOM groups to include elements of.
-        #  @param theGList2 is a list of GEOM groups to exclude elements of.
+        #  which are present in groups listed in theGList.
+        #  @param theGList is a list of GEOM groups to include elements of.
         #  @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.
@@ -11373,12 +11567,10 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             """
             Cut of lists of groups.
             New group is created. It will contain only entities
-            which are present in groups listed in theGList1 but 
-            are not present in groups from theGList2.
+            which are present in groups listed in theGList.
 
             Parameters:
-                theGList1 is a list of GEOM groups to include elements of.
-                theGList2 is a list of GEOM groups to exclude elements of.
+                theGList is a list of GEOM groups to include elements of.
                 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.
@@ -12163,6 +12355,46 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             self._autoPublish(anObj, theName, "dividedCylinder")
             return anObj
 
+        ## Create a surface from a cloud of points
+        #  @param thelPoints list of points
+        #  @return New GEOM_Object, containing the created shape.
+        #
+        #  @ref tui_creation_smoothingsurface "Example"
+        def MakeSmoothingSurface(self, thelPoints):
+            anObj = self.AdvOp.MakeSmoothingSurface(thelPoints)
+            RaiseIfFailed("MakeSmoothingSurface", self.AdvOp)
+            return anObj
+
+        ## Export a shape to XAO format
+        #  @param shape The shape to export
+        #  @param groups The list of groups to export
+        #  @param fields The list of fields to export
+        #  @param author The author of the export
+        #  @param fileName The name of the file to export
+        #  @return boolean
+        #
+        #  @ref tui_exportxao "Example"
+        def ExportXAO(self, shape, groups, fields, author, fileName):
+            res = self.InsertOp.ExportXAO(shape, groups, fields, author, fileName)
+            RaiseIfFailed("ExportXAO", self.InsertOp)
+            return res
+
+        ## Import a shape from XAO format
+        #  @param shape Shape to export
+        #  @param fileName The name of the file to import
+        #  @return tuple (res, shape, subShapes, groups, fields)
+        #       res Flag indicating if the import was successful
+        #       shape The imported shape
+        #       subShapes The list of imported subShapes
+        #       groups The list of imported groups
+        #       fields The list of imported fields
+        #
+        #  @ref tui_importxao "Example"
+        def ImportXAO(self, fileName):
+            res = self.InsertOp.ImportXAO(fileName)
+            RaiseIfFailed("ImportXAO", self.InsertOp)
+            return res
+
         #@@ insert new functions before this line @@ do not remove this line @@#
 
         # end of l4_advanced
@@ -12301,10 +12533,269 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             RaiseIfFailed("AddTexture", self.InsertOp)
             return ID
 
+        ## Creates a new folder object. It is a container for any GEOM objects.
+        #  @param Name name of the container
+        #  @param Father parent object. If None, 
+        #         folder under 'Geometry' root object will be created.
+        #  @return a new created folder
+        def NewFolder(self, Name, Father=None):
+            """
+            Create a new folder object. It is an auxiliary container for any GEOM objects.
+            
+            Parameters:
+                Name name of the container
+                Father parent object. If None, 
+                folder under 'Geometry' root object will be created.
+            
+            Returns:
+                a new created folder
+            """
+            if not Father: Father = self.father
+            return self.CreateFolder(Name, Father)
+
+        ## Move object to the specified folder
+        #  @param Object object to move
+        #  @param Folder target folder
+        def PutToFolder(self, Object, Folder):
+            """
+            Move object to the specified folder
+            
+            Parameters:
+                Object object to move
+                Folder target folder
+            """
+            self.MoveToFolder(Object, Folder)
+            pass
+
+        ## Move list of objects to the specified folder
+        #  @param ListOfSO list of objects to move
+        #  @param Folder target folder
+        def PutListToFolder(self, ListOfSO, Folder):
+            """
+            Move list of objects to the specified folder
+            
+            Parameters:
+                ListOfSO list of objects to move
+                Folder target folder
+            """
+            self.MoveListToFolder(ListOfSO, Folder)
+            pass
+
+        ## @addtogroup l2_field
+        ## @{
+
+        ## Creates a field
+        #  @param shape the shape the field lies on
+        #  @param name the field name
+        #  @param type type of field data: 0 - bool, 1 - int, 2 - double, 3 - string
+        #  @param dimension dimension of the shape the field lies on
+        #         0 - VERTEX, 1 - EDGE, 2 - FACE, 3 - SOLID, -1 - whole shape
+        #  @param componentNames names of components
+        #  @return a created field
+        def CreateField(self, shape, name, type, dimension, componentNames):
+            """
+            Creates a field
+
+            Parameters:
+                shape the shape the field lies on
+                name  the field name
+                type  type of field data
+                dimension dimension of the shape the field lies on
+                          0 - VERTEX, 1 - EDGE, 2 - FACE, 3 - SOLID, -1 - whole shape
+                componentNames names of components
+            
+            Returns:
+                a created field
+            """
+            if isinstance( type, int ):
+                if type < 0 or type > 3:
+                    raise RuntimeError, "CreateField : Error: data type must be within [0-3] range"
+                type = [GEOM.FDT_Bool,GEOM.FDT_Int,GEOM.FDT_Double,GEOM.FDT_String][type]
+
+            f = self.FieldOp.CreateField( shape, name, type, dimension, componentNames)
+            RaiseIfFailed("CreateField", self.FieldOp)
+            global geom
+            geom._autoPublish( f, "", name)
+            return f
+
+        ## Removes a field from the GEOM component
+        #  @param field the field to remove
+        def RemoveField(self, field):
+            "Removes a field from the GEOM component"
+            global geom
+            if isinstance( field, GEOM._objref_GEOM_Field ):
+                geom.RemoveObject( field )
+            elif isinstance( field, geomField ):
+                geom.RemoveObject( field.field )
+            else:
+                raise RuntimeError, "RemoveField() : the object is not a field"
+            return
+
+        ## Returns number of fields on a shape
+        def CountFields(self, shape):
+            "Returns number of fields on a shape"
+            nb = self.FieldOp.CountFields( shape )
+            RaiseIfFailed("CountFields", self.FieldOp)
+            return nb
+
+        ## Returns all fields on a shape
+        def GetFields(self, shape):
+            "Returns all fields on a shape"
+            ff = self.FieldOp.GetFields( shape )
+            RaiseIfFailed("GetFields", self.FieldOp)
+            return ff
+
+        ## Returns a field on a shape by its name
+        def GetField(self, shape, name):
+            "Returns a field on a shape by its name"
+            f = self.FieldOp.GetField( shape, name )
+            RaiseIfFailed("GetField", self.FieldOp)
+            return f
+
+        # end of l2_field
+        ## @}
+
+
 import omniORB
 # Register the new proxy for GEOM_Gen
 omniORB.registerObjref(GEOM._objref_GEOM_Gen._NP_RepositoryId, geomBuilder)
 
+
+## Field on Geometry
+#  @ingroup l2_field
+class geomField( GEOM._objref_GEOM_Field ):
+
+    def __init__(self):
+        GEOM._objref_GEOM_Field.__init__(self)
+        self.field = GEOM._objref_GEOM_Field
+        return
+
+    ## Returns the shape the field lies on
+    def getShape(self):
+        "Returns the shape the field lies on"
+        return self.field.GetShape(self)
+
+    ## Returns the field name
+    def getName(self):
+        "Returns the field name"
+        return self.field.GetName(self)
+
+    ## Returns type of field data as integer [0-3]
+    def getType(self):
+        "Returns type of field data"
+        return self.field.GetDataType(self)._v
+
+    ## Returns type of field data:
+    #  one of GEOM.FDT_Bool, GEOM.FDT_Int, GEOM.FDT_Double, GEOM.FDT_String
+    def getTypeEnum(self):
+        "Returns type of field data"
+        return self.field.GetDataType(self)
+
+    ## Returns dimension of the shape the field lies on:
+    #  0 - VERTEX, 1 - EDGE, 2 - FACE, 3 - SOLID, -1 - whole shape
+    def getDimension(self):
+        """Returns dimension of the shape the field lies on:
+        0 - VERTEX, 1 - EDGE, 2 - FACE, 3 - SOLID, -1 - whole shape"""
+        return self.field.GetDimension(self)
+
+    ## Returns names of components
+    def getComponents(self):
+        "Returns names of components"
+        return self.field.GetComponents(self)
+
+    ## Adds a time step to the field
+    #  @param step the time step number futher used as the step identifier
+    #  @param stamp the time step time
+    #  @param values the values of the time step
+    def addStep(self, step, stamp, values):
+        "Adds a time step to the field"
+        stp = self.field.AddStep( self, step, stamp )
+        if not stp:
+            raise RuntimeError, \
+                  "Field.addStep() : Error: step %s already exists in this field"%step
+        global geom
+        geom._autoPublish( stp, "", "Step %s, %s"%(step,stamp))
+        self.setValues( step, values )
+        return stp
+
+    ## Remove a time step from the field
+    def removeStep(self,step):
+        "Remove a time step from the field"
+        stepSO = None
+        try:
+            stepObj = self.field.GetStep( self, step )
+            if stepObj:
+                stepSO = geom.myStudy.FindObjectID( stepObj.GetStudyEntry() )
+        except:
+            #import traceback
+            #traceback.print_exc()
+            pass
+        self.field.RemoveStep( self, step )
+        if stepSO:
+            geom.myBuilder.RemoveObjectWithChildren( stepSO )
+        return
+
+    ## Returns number of time steps in the field
+    def countSteps(self):
+        "Returns number of time steps in the field"
+        return self.field.CountSteps(self)
+
+    ## Returns a list of time step IDs in the field
+    def getSteps(self):
+        "Returns a list of time step IDs in the field"
+        return self.field.GetSteps(self)
+
+    ## Returns a time step by its ID
+    def getStep(self,step):
+        "Returns a time step by its ID"
+        stp = self.field.GetStep(self, step)
+        if not stp:
+            raise RuntimeError, "Step %s is missing from this field"%step
+        return stp
+
+    ## Returns the time of the field step
+    def getStamp(self,step):
+        "Returns the time of the field step"
+        return self.getStep(step).GetStamp()
+
+    ## Changes the time of the field step
+    def setStamp(self, step, stamp):
+        "Changes the time of the field step"
+        return self.getStep(step).SetStamp(stamp)
+
+    ## Returns values of the field step
+    def getValues(self, step):
+        "Returns values of the field step"
+        return self.getStep(step).GetValues()
+
+    ## Changes values of the field step
+    def setValues(self, step, values):
+        "Changes values of the field step"
+        stp = self.getStep(step)
+        errBeg = "Field.setValues(values) : Error: "
+        try:
+            ok = stp.SetValues( values )
+        except Exception, e:
+            excStr = str(e)
+            if excStr.find("WrongPythonType") > 0:
+                raise RuntimeError, errBeg +\
+                      "wrong type of values, %s values are expected"%str(self.getTypeEnum())[4:]
+            raise RuntimeError, errBeg + str(e)
+        if not ok:
+            nbOK = self.field.GetArraySize(self)
+            nbKO = len(values)
+            if nbOK != nbKO:
+                raise RuntimeError, errBeg + "len(values) must be %s but not %s"%(nbOK,nbKO)
+            else:
+                raise RuntimeError, errBeg + "failed"
+        return
+
+    pass # end of class geomField
+
+# Register the new proxy for GEOM_Field
+omniORB.registerObjref(GEOM._objref_GEOM_Field._NP_RepositoryId, geomField)
+
+
 ## Create a new geomBuilder instance.The geomBuilder class provides the Python
 #  interface to GEOM operations.
 #