Salome HOME
NPAL 16548, 16820, 16218, 16547
[modules/geom.git] / src / GEOM_SWIG / geompy.py
index d1095f4fed93b267546b0658c850399803a112f5..aa985f00aa51b2a1726175e0724f8ba2d59db19c 100644 (file)
 #  Module : GEOM
 #  $Header$
 
+import salome
+salome.salome_init()
 from salome import *
+
 import GEOM
 
 """
@@ -134,12 +137,30 @@ def addToStudyInFather(aFather, aShape, aName):
         return ""
     return aShape.GetStudyEntry()
 
+# -----------------------------------------------------------------------------
+# Raise an Error if Operation is Failed
+# -----------------------------------------------------------------------------
+def RaiseIfFailed (method_name, operation):
+    if operation.IsDone() == 0:
+      raise RuntimeError, method_name + " : " + operation.GetErrorCode()
+
 # -----------------------------------------------------------------------------
 # enumeration ShapeType as a dictionary
 # -----------------------------------------------------------------------------
 
 ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8}
 
+# -----------------------------------------------------------------------------
+# enumeration shape_kind
+# -----------------------------------------------------------------------------
+
+kind = GEOM.GEOM_IKindOfShape
+
+class info:
+    UNKNOWN  = 0
+    CLOSED   = 1
+    UNCLOSED = 2
+
 # -----------------------------------------------------------------------------
 # Basic primitives
 # -----------------------------------------------------------------------------
@@ -153,8 +174,7 @@ ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE"
 #  Example: see GEOM_TestAll.py
 def MakeVertex(theX, theY, theZ):
     anObj = BasicOp.MakePointXYZ(theX, theY, theZ)
-    if BasicOp.IsDone() == 0:
-      print "MakePointXYZ : ", BasicOp.GetErrorCode()
+    RaiseIfFailed("MakePointXYZ", BasicOp)
     return anObj
 
 ## Create a point, distant from the referenced point
@@ -168,8 +188,7 @@ def MakeVertex(theX, theY, theZ):
 #  Example: see GEOM_TestAll.py
 def MakeVertexWithRef(theReference, theX, theY, theZ):
     anObj = BasicOp.MakePointWithReference(theReference, theX, theY, theZ)
-    if BasicOp.IsDone() == 0:
-      print "MakePointWithReference : ", BasicOp.GetErrorCode()
+    RaiseIfFailed("MakePointWithReference", BasicOp)
     return anObj
 
 ## Create a point, corresponding to the given parameter on the given curve.
@@ -180,8 +199,17 @@ def MakeVertexWithRef(theReference, theX, theY, theZ):
 #  Example: see GEOM_TestAll.py
 def MakeVertexOnCurve(theRefCurve, theParameter):
     anObj = BasicOp.MakePointOnCurve(theRefCurve, theParameter)
-    if BasicOp.IsDone() == 0:
-      print "MakePointOnCurve : ", BasicOp.GetErrorCode()
+    RaiseIfFailed("MakePointOnCurve", BasicOp)
+    return anObj
+
+## Create a point on intersection of two lines.
+#  @param theRefLine1, theRefLine2 The referenced lines.
+#  @return New GEOM_Object, containing the created point.
+#
+#  Example: see GEOM_TestAll.py
+def MakeVertexOnLinesIntersection(theRefLine1, theRefLine2):
+    anObj = BasicOp.MakePointOnCurve(theRefLine1, theRefLine2)
+    RaiseIfFailed("MakePointOnLinesIntersection", BasicOp)
     return anObj
 
 ## Create a tangent, corresponding to the given parameter on the given curve.
@@ -190,8 +218,7 @@ def MakeVertexOnCurve(theRefCurve, theParameter):
 #  @return New GEOM_Object, containing the created tangent.
 def MakeTangentOnCurve(theRefCurve, theParameter):
     anObj = BasicOp.MakeTangentOnCurve(theRefCurve, theParameter)
-    if BasicOp.IsDone() == 0:
-      print "MakeTangentOnCurve : ", BasicOp.GetErrorCode()
+    RaiseIfFailed("MakeTangentOnCurve", BasicOp)
     return anObj
 
 ## Create a vector with the given components.
@@ -203,8 +230,7 @@ def MakeTangentOnCurve(theRefCurve, theParameter):
 #  Example: see GEOM_TestAll.py
 def MakeVectorDXDYDZ(theDX, theDY, theDZ):
     anObj = BasicOp.MakeVectorDXDYDZ(theDX, theDY, theDZ)
-    if BasicOp.IsDone() == 0:
-      print "MakeVectorDXDYDZ : ", BasicOp.GetErrorCode()
+    RaiseIfFailed("MakeVectorDXDYDZ", BasicOp)
     return anObj
 
 ## Create a vector between two points.
@@ -215,8 +241,7 @@ def MakeVectorDXDYDZ(theDX, theDY, theDZ):
 #  Example: see GEOM_TestAll.py
 def MakeVector(thePnt1, thePnt2):
     anObj = BasicOp.MakeVectorTwoPnt(thePnt1, thePnt2)
-    if BasicOp.IsDone() == 0:
-      print "MakeVectorTwoPnt : ", BasicOp.GetErrorCode()
+    RaiseIfFailed("MakeVectorTwoPnt", BasicOp)
     return anObj
 
 ## Create a line, passing through the given point
@@ -228,8 +253,7 @@ def MakeVector(thePnt1, thePnt2):
 #  Example: see GEOM_TestAll.py
 def MakeLine(thePnt, theDir):
     anObj = BasicOp.MakeLine(thePnt, theDir)
-    if BasicOp.IsDone() == 0:
-      print "MakeLine : ", BasicOp.GetErrorCode()
+    RaiseIfFailed("MakeLine", BasicOp)
     return anObj
 
 ## Create a line, passing through the given points
@@ -240,8 +264,18 @@ def MakeLine(thePnt, theDir):
 #  Example: see GEOM_TestAll.py
 def MakeLineTwoPnt(thePnt1, thePnt2):
     anObj = BasicOp.MakeLineTwoPnt(thePnt1, thePnt2)
-    if BasicOp.IsDone() == 0:
-      print "MakeLineTwoPnt : ", BasicOp.GetErrorCode()
+    RaiseIfFailed("MakeLineTwoPnt", BasicOp)
+    return anObj
+
+## Create a line on two faces intersection. 
+#  @param theFace1 First of two faces, defining the line.
+#  @param theFace2 Second of two faces, defining the line.
+#  @return New GEOM_Object, containing the created line.
+#
+#  Example: see GEOM_TestAll.py
+def MakeLineTwoFaces(theFace1, theFace2):
+    anObj = BasicOp.MakeLineTwoFaces(theFace1, theFace2)
+    RaiseIfFailed("MakeLineTwoFaces", BasicOp)
     return anObj
 
 ## Create a plane, passing through the given point
@@ -254,8 +288,7 @@ def MakeLineTwoPnt(thePnt1, thePnt2):
 #  Example: see GEOM_TestAll.py
 def MakePlane(thePnt, theVec, theTrimSize):
     anObj = BasicOp.MakePlanePntVec(thePnt, theVec, theTrimSize)
-    if BasicOp.IsDone() == 0:
-      print "MakePlanePntVec : ", BasicOp.GetErrorCode()
+    RaiseIfFailed("MakePlanePntVec", BasicOp)
     return anObj
 
 ## Create a plane, passing through the three given points
@@ -268,20 +301,18 @@ def MakePlane(thePnt, theVec, theTrimSize):
 #  Example: see GEOM_TestAll.py
 def MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize):
     anObj = BasicOp.MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize)
-    if BasicOp.IsDone() == 0:
-      print "MakePlaneThreePnt : ", BasicOp.GetErrorCode()
+    RaiseIfFailed("MakePlaneThreePnt", BasicOp)
     return anObj
 
 ## Create a plane, similar to the existing one, but with another size of representing face.
-#  @param theFace Referenced plane.
+#  @param theFace Referenced plane or LCS(Marker).
 #  @param theTrimSize New half size of a side of quadrangle face, representing the plane.
 #  @return New GEOM_Object, containing the created plane.
 #
 #  Example: see GEOM_TestAll.py
 def MakePlaneFace(theFace, theTrimSize):
     anObj = BasicOp.MakePlaneFace(theFace, theTrimSize)
-    if BasicOp.IsDone() == 0:
-      print "MakePlaneFace : ", BasicOp.GetErrorCode()
+    RaiseIfFailed("MakePlaneFace", BasicOp)
     return anObj
 
 ## Create a local coordinate system.
@@ -293,8 +324,7 @@ def MakePlaneFace(theFace, theTrimSize):
 #  Example: see GEOM_TestAll.py
 def MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ):
     anObj = BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ)
-    if BasicOp.IsDone() == 0:
-      print "MakeMarker : ", BasicOp.GetErrorCode()
+    RaiseIfFailed("MakeMarker", BasicOp)
     return anObj
 
 ## Create a local coordinate system.
@@ -315,8 +345,7 @@ def MakeMarkerPntTwoVec(theOrigin, theXVec, theYVec):
     anObj = BasicOp.MakeMarker( O[0], O[1], O[2],
                                 OXOY[0], OXOY[1], OXOY[2],
                                 OXOY[3], OXOY[4], OXOY[5], )
-    if BasicOp.IsDone() == 0:
-      print "MakeMarker : ", BasicOp.GetErrorCode()
+    RaiseIfFailed("MakeMarker", BasicOp)
     return anObj
 
 # -----------------------------------------------------------------------------
@@ -332,8 +361,19 @@ def MakeMarkerPntTwoVec(theOrigin, theXVec, theYVec):
 #  Example: see GEOM_TestAll.py
 def MakeArc(thePnt1, thePnt2, thePnt3):
     anObj = CurvesOp.MakeArc(thePnt1, thePnt2, thePnt3)
-    if CurvesOp.IsDone() == 0:
-      print "MakeArc : ", CurvesOp.GetErrorCode()
+    RaiseIfFailed("MakeArc", CurvesOp)
+    return anObj
+
+##  Create an arc of circle from a center and 2 points.
+#  @param thePnt1 Center of the arc
+#  @param thePnt2 Start point of the arc. (Gives also the radius of the arc)
+#  @param thePnt3 End point of the arc (Gives also a direction)
+#  @return New GEOM_Object, containing the created arc.
+#
+#  Example: see GEOM_TestAll.py
+def MakeArcCenter(thePnt1, thePnt2, thePnt3,theSense):
+    anObj = CurvesOp.MakeArcCenter(thePnt1, thePnt2, thePnt3,theSense)
+    RaiseIfFailed("MakeArcCenter", CurvesOp)
     return anObj
 
 ## Create a circle with given center, normal vector and radius.
@@ -345,8 +385,7 @@ def MakeArc(thePnt1, thePnt2, thePnt3):
 #  Example: see GEOM_TestAll.py
 def MakeCircle(thePnt, theVec, theR):
     anObj = CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR)
-    if CurvesOp.IsDone() == 0:
-      print "MakeCirclePntVecR : ", CurvesOp.GetErrorCode()
+    RaiseIfFailed("MakeCirclePntVecR", CurvesOp)
     return anObj
 
 ## Create a circle, passing through three given points
@@ -356,8 +395,19 @@ def MakeCircle(thePnt, theVec, theR):
 #  Example: see GEOM_TestAll.py
 def MakeCircleThreePnt(thePnt1, thePnt2, thePnt3):
     anObj = CurvesOp.MakeCircleThreePnt(thePnt1, thePnt2, thePnt3)
-    if CurvesOp.IsDone() == 0:
-      print "MakeCircleThreePnt : ", CurvesOp.GetErrorCode()
+    RaiseIfFailed("MakeCircleThreePnt", CurvesOp)
+    return anObj
+
+## Create a circle, with given point1 as center,
+#  passing through the point2 as radius and laying in the plane,
+#  defined by all three given points.
+#  @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
+#  @return New GEOM_Object, containing the created circle.
+#
+#  Example: see GEOM_example6.py
+def MakeCircleCenter2Pnt(thePnt1, thePnt2, thePnt3):
+    anObj = CurvesOp.MakeCircleCenter2Pnt(thePnt1, thePnt2, thePnt3)
+    RaiseIfFailed("MakeCircleCenter2Pnt", CurvesOp)
     return anObj
 
 ## Create an ellipse with given center, normal vector and radiuses.
@@ -370,8 +420,7 @@ def MakeCircleThreePnt(thePnt1, thePnt2, thePnt3):
 #  Example: see GEOM_TestAll.py
 def MakeEllipse(thePnt, theVec, theRMajor, theRMinor):
     anObj = CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor)
-    if CurvesOp.IsDone() == 0:
-      print "MakeEllipse : ", CurvesOp.GetErrorCode()
+    RaiseIfFailed("MakeEllipse", CurvesOp)
     return anObj
 
 ## Create a polyline on the set of points.
@@ -381,8 +430,7 @@ def MakeEllipse(thePnt, theVec, theRMajor, theRMinor):
 #  Example: see GEOM_TestAll.py
 def MakePolyline(thePoints):
     anObj = CurvesOp.MakePolyline(thePoints)
-    if CurvesOp.IsDone() == 0:
-      print "MakePolyline : ", CurvesOp.GetErrorCode()
+    RaiseIfFailed("MakePolyline", CurvesOp)
     return anObj
 
 ## Create bezier curve on the set of points.
@@ -392,8 +440,7 @@ def MakePolyline(thePoints):
 #  Example: see GEOM_TestAll.py
 def MakeBezier(thePoints):
     anObj = CurvesOp.MakeSplineBezier(thePoints)
-    if CurvesOp.IsDone() == 0:
-      print "MakeSplineBezier : ", CurvesOp.GetErrorCode()
+    RaiseIfFailed("MakeSplineBezier", CurvesOp)
     return anObj
 
 ## Create B-Spline curve on the set of points.
@@ -403,8 +450,7 @@ def MakeBezier(thePoints):
 #  Example: see GEOM_TestAll.py
 def MakeInterpol(thePoints):
     anObj = CurvesOp.MakeSplineInterpolation(thePoints)
-    if CurvesOp.IsDone() == 0:
-      print "MakeSplineInterpolation : ", CurvesOp.GetErrorCode()
+    RaiseIfFailed("MakeSplineInterpolation", CurvesOp)
     return anObj
 
 ## Create a sketcher (wire or face), following the textual description,
@@ -443,8 +489,7 @@ def MakeInterpol(thePoints):
 #  Example: see GEOM_TestAll.py
 def MakeSketcher(theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0]):
     anObj = CurvesOp.MakeSketcher(theCommand, theWorkingPlane)
-    if CurvesOp.IsDone() == 0:
-      print "MakeSketcher : ", CurvesOp.GetErrorCode()
+    RaiseIfFailed("MakeSketcher", CurvesOp)
     return anObj
 
 ## Create a sketcher (wire or face), following the textual description,
@@ -452,12 +497,11 @@ def MakeSketcher(theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0]):
 #  For format of the description string see the previous method.\n
 #  @param theCommand String, defining the sketcher in local
 #                    coordinates of the working plane.
-#  @param theWorkingPlane Planar Face of the working plane.
+#  @param theWorkingPlane Planar Face or LCS(Marker) of the working plane.
 #  @return New GEOM_Object, containing the created wire.
 def MakeSketcherOnPlane(theCommand, theWorkingPlane):
     anObj = CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane)
-    if CurvesOp.IsDone() == 0:
-      print "MakeSketcher : ", CurvesOp.GetErrorCode()
+    RaiseIfFailed("MakeSketcherOnPlane", CurvesOp)
     return anObj
 
 # -----------------------------------------------------------------------------
@@ -483,8 +527,7 @@ def MakeBox(x1,y1,z1,x2,y2,z2):
 #  Example: see GEOM_TestAll.py
 def MakeBoxDXDYDZ(theDX, theDY, theDZ):
     anObj = PrimOp.MakeBoxDXDYDZ(theDX, theDY, theDZ)
-    if PrimOp.IsDone() == 0:
-      print "MakeBoxDXDYDZ : ", PrimOp.GetErrorCode()
+    RaiseIfFailed("MakeBoxDXDYDZ", PrimOp)
     return anObj
 
 ## Create a box with two specified opposite vertices,
@@ -496,8 +539,7 @@ def MakeBoxDXDYDZ(theDX, theDY, theDZ):
 #  Example: see GEOM_TestAll.py
 def MakeBoxTwoPnt(thePnt1, thePnt2):
     anObj = PrimOp.MakeBoxTwoPnt(thePnt1, thePnt2)
-    if PrimOp.IsDone() == 0:
-      print "MakeBoxTwoPnt : ", PrimOp.GetErrorCode()
+    RaiseIfFailed("MakeBoxTwoPnt", PrimOp)
     return anObj
 
 ## Create a cylinder with given base point, axis, radius and height.
@@ -510,8 +552,7 @@ def MakeBoxTwoPnt(thePnt1, thePnt2):
 #  Example: see GEOM_TestAll.py
 def MakeCylinder(thePnt, theAxis, theR, theH):
     anObj = PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH)
-    if PrimOp.IsDone() == 0:
-      print "MakeCylinderPntVecRH : ", PrimOp.GetErrorCode()
+    RaiseIfFailed("MakeCylinderPntVecRH", PrimOp)
     return anObj
 
 ## Create a cylinder with given radius and height at
@@ -524,8 +565,7 @@ def MakeCylinder(thePnt, theAxis, theR, theH):
 #  Example: see GEOM_TestAll.py
 def MakeCylinderRH(theR, theH):
     anObj = PrimOp.MakeCylinderRH(theR, theH)
-    if PrimOp.IsDone() == 0:
-      print "MakeCylinderRH : ", PrimOp.GetErrorCode()
+    RaiseIfFailed("MakeCylinderRH", PrimOp)
     return anObj
 
 ## Create a sphere with given center and radius.
@@ -536,8 +576,7 @@ def MakeCylinderRH(theR, theH):
 #  Example: see GEOM_TestAll.py
 def MakeSpherePntR(thePnt, theR):
     anObj = PrimOp.MakeSpherePntR(thePnt, theR)
-    if PrimOp.IsDone() == 0:
-      print "MakeSpherePntR : ", PrimOp.GetErrorCode()
+    RaiseIfFailed("MakeSpherePntR", PrimOp)
     return anObj
 
 ## Create a sphere with given center and radius.
@@ -558,8 +597,7 @@ def MakeSphere(x, y, z, theR):
 #  Example: see GEOM_TestAll.py
 def MakeSphereR(theR):
     anObj = PrimOp.MakeSphereR(theR)
-    if PrimOp.IsDone() == 0:
-      print "MakeSphereR : ", PrimOp.GetErrorCode()
+    RaiseIfFailed("MakeSphereR", PrimOp)
     return anObj
 
 ## Create a cone with given base point, axis, height and radiuses.
@@ -575,8 +613,7 @@ def MakeSphereR(theR):
 #  Example: see GEOM_TestAll.py
 def MakeCone(thePnt, theAxis, theR1, theR2, theH):
     anObj = PrimOp.MakeConePntVecR1R2H(thePnt, theAxis, theR1, theR2, theH)
-    if PrimOp.IsDone() == 0:
-      print "MakeConePntVecR1R2H : ", PrimOp.GetErrorCode()
+    RaiseIfFailed("MakeConePntVecR1R2H", PrimOp)
     return anObj
 
 ## Create a cone with given height and radiuses at
@@ -592,8 +629,7 @@ def MakeCone(thePnt, theAxis, theR1, theR2, theH):
 #  Example: see GEOM_TestAll.py
 def MakeConeR1R2H(theR1, theR2, theH):
     anObj = PrimOp.MakeConeR1R2H(theR1, theR2, theH)
-    if PrimOp.IsDone() == 0:
-      print "MakeConeR1R2H : ", PrimOp.GetErrorCode()
+    RaiseIfFailed("MakeConeR1R2H", PrimOp)
     return anObj
 
 ## Create a torus with given center, normal vector and radiuses.
@@ -606,8 +642,7 @@ def MakeConeR1R2H(theR1, theR2, theH):
 #  Example: see GEOM_TestAll.py
 def MakeTorus(thePnt, theVec, theRMajor, theRMinor):
     anObj = PrimOp.MakeTorusPntVecRR(thePnt, theVec, theRMajor, theRMinor)
-    if PrimOp.IsDone() == 0:
-      print "MakeTorusPntVecRR : ", PrimOp.GetErrorCode()
+    RaiseIfFailed("MakeTorusPntVecRR", PrimOp)
     return anObj
 
 ## Create a torus with given radiuses at the origin of coordinate system.
@@ -618,8 +653,7 @@ def MakeTorus(thePnt, theVec, theRMajor, theRMinor):
 #  Example: see GEOM_TestAll.py
 def MakeTorusRR(theRMajor, theRMinor):
     anObj = PrimOp.MakeTorusRR(theRMajor, theRMinor)
-    if PrimOp.IsDone() == 0:
-      print "MakeTorusRR : ", PrimOp.GetErrorCode()
+    RaiseIfFailed("MakeTorusRR", PrimOp)
     return anObj
 
 ## Create a shape by extrusion of the base shape along a vector, defined by two points.
@@ -631,8 +665,12 @@ def MakeTorusRR(theRMajor, theRMinor):
 #  Example: see GEOM_TestAll.py
 def MakePrism(theBase, thePoint1, thePoint2):
     anObj = PrimOp.MakePrismTwoPnt(theBase, thePoint1, thePoint2)
-    if PrimOp.IsDone() == 0:
-      print "MakePrismTwoPnt : ", PrimOp.GetErrorCode()
+    RaiseIfFailed("MakePrismTwoPnt", PrimOp)
+    return anObj
+## The same prism but in two directions forward&backward.
+def MakePrism2Ways(theBase, thePoint1, thePoint2):
+    anObj = PrimOp.MakePrismTwoPnt2Ways(theBase, thePoint1, thePoint2)
+    RaiseIfFailed("MakePrismTwoPnt2Ways", PrimOp)
     return anObj
 
 ## Create a shape by extrusion of the base shape along the vector,
@@ -646,8 +684,21 @@ def MakePrism(theBase, thePoint1, thePoint2):
 #  Example: see GEOM_TestAll.py
 def MakePrismVecH(theBase, theVec, theH):
     anObj = PrimOp.MakePrismVecH(theBase, theVec, theH)
-    if PrimOp.IsDone() == 0:
-      print "MakePrismVecH : ", PrimOp.GetErrorCode()
+    RaiseIfFailed("MakePrismVecH", PrimOp)
+    return anObj
+
+## Create a shape by extrusion of the base shape along the vector,
+#  i.e. all the space, transfixed by the base shape during its translation
+#  along the vector on the given distance in 2 Ways (forward/backward) .
+#  @param theBase Base shape to be extruded.
+#  @param theVec Direction of extrusion.
+#  @param theH Prism dimension along theVec in forward direction.
+#  @return New GEOM_Object, containing the created prism.
+#
+#  Example: see GEOM_TestAll.py
+def MakePrismVecH2Ways(theBase, theVec, theH):
+    anObj = PrimOp.MakePrismVecH2Ways(theBase, theVec, theH)
+    RaiseIfFailed("MakePrismVecH2Ways", PrimOp)
     return anObj
 
 ## Create a shape by extrusion of the base shape along
@@ -659,8 +710,7 @@ def MakePrismVecH(theBase, theVec, theH):
 #  Example: see GEOM_TestAll.py
 def MakePipe(theBase, thePath):
     anObj = PrimOp.MakePipe(theBase, thePath)
-    if PrimOp.IsDone() == 0:
-      print "MakePipe : ", PrimOp.GetErrorCode()
+    RaiseIfFailed("MakePipe", PrimOp)
     return anObj
 
 ## Create a shape by revolution of the base shape around the axis
@@ -674,8 +724,12 @@ def MakePipe(theBase, thePath):
 #  Example: see GEOM_TestAll.py
 def MakeRevolution(theBase, theAxis, theAngle):
     anObj = PrimOp.MakeRevolutionAxisAngle(theBase, theAxis, theAngle)
-    if PrimOp.IsDone() == 0:
-      print "MakeRevolutionAxisAngle : ", PrimOp.GetErrorCode()
+    RaiseIfFailed("MakeRevolutionAxisAngle", PrimOp)
+    return anObj
+## The Same Revolution but in both ways forward&backward.
+def MakeRevolution2Ways(theBase, theAxis, theAngle):
+    anObj = PrimOp.MakeRevolutionAxisAngle2Ways(theBase, theAxis, theAngle)
+    RaiseIfFailed("MakeRevolutionAxisAngle2Ways", PrimOp)
     return anObj
 
 ## Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
@@ -688,8 +742,7 @@ def MakeRevolution(theBase, theAxis, theAngle):
 #  Example: see GEOM_TestAll.py
 def MakeThruSections(theSeqSections,theModeSolid,thePreci,theRuled):
     anObj = PrimOp.MakeThruSections(theSeqSections,theModeSolid,thePreci,theRuled)
-    if PrimOp.IsDone() == 0:
-      print "MakeThruSections : ", PrimOp.GetErrorCode()
+    RaiseIfFailed("MakeThruSections", PrimOp)
     return anObj
 
 ## Create a shape by extrusion of the profile shape along
@@ -706,13 +759,80 @@ def MakeThruSections(theSeqSections,theModeSolid,thePreci,theRuled):
 #                            orthogonal to the spine tangent in the correspondent point
 #  @return New GEOM_Object, containing the created pipe.
 #
-#  Example: see GEOM_TestAll.py
 def MakePipeWithDifferentSections(theSeqBases, theLocations,thePath,theWithContact,theWithCorrection):
     anObj = PrimOp.MakePipeWithDifferentSections(theSeqBases, theLocations,thePath,theWithContact,theWithCorrection)
-    if PrimOp.IsDone() == 0:
-      print "MakePipeWithDifferentSections : ", PrimOp.GetErrorCode()
+    RaiseIfFailed("MakePipeWithDifferentSections", PrimOp)
+    return anObj
+
+## Create a shape by extrusion of the profile shape along
+#  the path shape. The path shape can be a shell or a face.
+#  the several profiles can be specified in the several locations of path.     
+#  @param theSeqBases - list of  Bases shape to be extruded.
+#  @param theSeqSubBases - list of corresponding subshapes of section shapes.
+#  @param theLocations - list of locations on the path corresponding
+#                        specified list of the Bases shapes. Number of locations
+#                        should be equal to number of bases. First and last
+#                        locations must be coincided with first and last vertexes
+#                        of path correspondingly.
+#  @param thePath - Path shape to extrude the base shape along it.
+#  @param theWithContact - the mode defining that the section is translated to be in
+#                          contact with the spine.
+#  @param - WithCorrection - defining that the section is rotated to be
+#                            orthogonal to the spine tangent in the correspondent point
+#  @return New GEOM_Object, containing the created solids.
+#
+def MakePipeWithShellSections(theSeqBases, theSeqSubBases,
+                              theLocations, thePath,
+                              theWithContact, theWithCorrection):
+    anObj = PrimOp.MakePipeWithShellSections(theSeqBases, theSeqSubBases,
+                                             theLocations, thePath,
+                                             theWithContact, theWithCorrection)
+    RaiseIfFailed("MakePipeWithShellSections", PrimOp)
+    return anObj
+
+def MakePipeWithShellSectionsBySteps(theSeqBases, theSeqSubBases,
+                                     theLocations, thePath,
+                                     theWithContact, theWithCorrection):
+    res = []
+    nbsect = len(theSeqBases)
+    nbsubsect = len(theSeqSubBases)
+    #print "nbsect = ",nbsect
+    for i in range(1,nbsect):
+        #print "  i = ",i
+        tmpSeqBases = [ theSeqBases[i-1], theSeqBases[i] ]
+        tmpLocations = [ theLocations[i-1], theLocations[i] ]
+        tmpSeqSubBases = []
+        if nbsubsect>0: tmpSeqSubBases = [ theSeqSubBases[i-1], theSeqSubBases[i] ]
+        anObj = PrimOp.MakePipeWithShellSections(tmpSeqBases, tmpSeqSubBases,
+                                                 tmpLocations, thePath,
+                                                 theWithContact, theWithCorrection)
+        if PrimOp.IsDone() == 0:
+            print "Problems with pipe creation between ",i," and ",i+1," sections"
+            RaiseIfFailed("MakePipeWithShellSections", PrimOp)
+            break
+        else:
+            print "Pipe between ",i," and ",i+1," sections is OK"
+            res.append(anObj)
+            pass
+        pass
+
+    resc = MakeCompound(res)
+    #resc = MakeSewing(res, 0.001)
+    #print "resc: ",resc
+    return resc
+
+
+## Create solids between given sections
+#  @param theSeqBases - list of sections (shell or face).
+#  @param theLocations - list of corresponding vertexes
+#  @return New GEOM_Object, containing the created solids.
+#
+def MakePipeShellsWithoutPath(theSeqBases, theLocations):
+    anObj = PrimOp.MakePipeShellsWithoutPath(theSeqBases, theLocations)
+    RaiseIfFailed("MakePipeShellsWithoutPath", PrimOp)
     return anObj
 
+
 # -----------------------------------------------------------------------------
 # Create base shapes
 # -----------------------------------------------------------------------------
@@ -725,8 +845,7 @@ def MakePipeWithDifferentSections(theSeqBases, theLocations,thePath,theWithConta
 #  Example: see GEOM_TestAll.py
 def MakeEdge(thePnt1, thePnt2):
     anObj = ShapesOp.MakeEdge(thePnt1, thePnt2)
-    if ShapesOp.IsDone() == 0:
-      print "MakeEdge : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("MakeEdge", ShapesOp)
     return anObj
 
 ## Create a wire from the set of edges and wires.
@@ -736,12 +855,11 @@ def MakeEdge(thePnt1, thePnt2):
 #  Example: see GEOM_TestAll.py
 def MakeWire(theEdgesAndWires):
     anObj = ShapesOp.MakeWire(theEdgesAndWires)
-    if ShapesOp.IsDone() == 0:
-      print "MakeWire : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("MakeWire", ShapesOp)
     return anObj
 
 ## Create a face on the given wire.
-#  @param theWire Wire to build the face on.
+#  @param theWire closed Wire or Edge to build the face on.
 #  @param isPlanarWanted If TRUE, only planar face will be built.
 #                        If impossible, NULL object will be returned.
 #  @return New GEOM_Object, containing the created face.
@@ -749,12 +867,11 @@ def MakeWire(theEdgesAndWires):
 #  Example: see GEOM_TestAll.py
 def MakeFace(theWire, isPlanarWanted):
     anObj = ShapesOp.MakeFace(theWire, isPlanarWanted)
-    if ShapesOp.IsDone() == 0:
-      print "MakeFace : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("MakeFace", ShapesOp)
     return anObj
 
 ## Create a face on the given wires set.
-#  @param theWires List of wires to build the face on.
+#  @param theWires List of closed wires or edges to build the face on.
 #  @param isPlanarWanted If TRUE, only planar face will be built.
 #                        If impossible, NULL object will be returned.
 #  @return New GEOM_Object, containing the created face.
@@ -762,8 +879,7 @@ def MakeFace(theWire, isPlanarWanted):
 #  Example: see GEOM_TestAll.py
 def MakeFaceWires(theWires, isPlanarWanted):
     anObj = ShapesOp.MakeFaceWires(theWires, isPlanarWanted)
-    if ShapesOp.IsDone() == 0:
-      print "MakeFaceWires : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("MakeFaceWires", ShapesOp)
     return anObj
 
 ## Shortcut to MakeFaceWires()
@@ -780,8 +896,7 @@ def MakeFaces(theWires, isPlanarWanted):
 #  Example: see GEOM_TestAll.py
 def MakeShell(theFacesAndShells):
     anObj = ShapesOp.MakeShell(theFacesAndShells)
-    if ShapesOp.IsDone() == 0:
-       print "MakeShell : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("MakeShell", ShapesOp)
     return anObj
 
 ## Create a solid, bounded by the given shells.
@@ -791,8 +906,7 @@ def MakeShell(theFacesAndShells):
 #  Example: see GEOM_TestAll.py
 def MakeSolid(theShells):
     anObj = ShapesOp.MakeSolidShells(theShells)
-    if ShapesOp.IsDone() == 0:
-       print "MakeSolid : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("MakeSolidShells", ShapesOp)
     return anObj
 
 ## Create a compound of the given shapes.
@@ -802,8 +916,7 @@ def MakeSolid(theShells):
 #  Example: see GEOM_TestAll.py
 def MakeCompound(theShapes):
     anObj = ShapesOp.MakeCompound(theShapes)
-    if ShapesOp.IsDone() == 0:
-      print "MakeCompound : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("MakeCompound", ShapesOp)
     return anObj
 
 ## Gives quantity of faces in the given shape.
@@ -813,8 +926,7 @@ def MakeCompound(theShapes):
 #  Example: see GEOM_TestOthers.py
 def NumberOfFaces(theShape):
     nb_faces = ShapesOp.NumberOfFaces(theShape)
-    if ShapesOp.IsDone() == 0:
-      print "NumberOfFaces : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("NumberOfFaces", ShapesOp)
     return nb_faces
 
 ## Gives quantity of edges in the given shape.
@@ -824,8 +936,7 @@ def NumberOfFaces(theShape):
 #  Example: see GEOM_TestOthers.py
 def NumberOfEdges(theShape):
     nb_edges = ShapesOp.NumberOfEdges(theShape)
-    if ShapesOp.IsDone() == 0:
-      print "NumberOfEdges : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("NumberOfEdges", ShapesOp)
     return nb_edges
 
 ## Reverses an orientation the given shape.
@@ -835,8 +946,7 @@ def NumberOfEdges(theShape):
 #  Example: see GEOM_TestAll.py
 def ChangeOrientation(theShape):
     anObj = ShapesOp.ChangeOrientation(theShape)
-    if ShapesOp.IsDone() == 0:
-      print "ChangeOrientation : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("ChangeOrientation", ShapesOp)
     return anObj
 
 ## Shortcut to ChangeOrientation()
@@ -854,8 +964,7 @@ def OrientationChange(theShape):
 #  Example: see GEOM_TestOthers.py
 def GetFreeFacesIDs(theShape):
     anIDs = ShapesOp.GetFreeFacesIDs(theShape)
-    if ShapesOp.IsDone() == 0:
-      print "GetFreeFacesIDs : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("GetFreeFacesIDs", ShapesOp)
     return anIDs
 
 ## Get all sub-shapes of theShape1 of the given type, shared with theShape2.
@@ -867,8 +976,7 @@ def GetFreeFacesIDs(theShape):
 #  Example: see GEOM_TestOthers.py
 def GetSharedShapes(theShape1, theShape2, theShapeType):
     aList = ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
-    if ShapesOp.IsDone() == 0:
-      print "GetSharedShapes : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("GetSharedShapes", ShapesOp)
     return aList
 
 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
@@ -884,8 +992,7 @@ def GetSharedShapes(theShape1, theShape2, theShapeType):
 #  Example: see GEOM_TestOthers.py
 def GetShapesOnPlane(theShape, theShapeType, theAx1, theState):
     aList = ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState)
-    if ShapesOp.IsDone() == 0:
-      print "GetShapesOnPlane : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("GetShapesOnPlane", ShapesOp)
     return aList
 
 ## Works like the above method, but returns list of sub-shapes indices
@@ -893,8 +1000,32 @@ def GetShapesOnPlane(theShape, theShapeType, theAx1, theState):
 #  Example: see GEOM_TestOthers.py
 def GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState):
     aList = ShapesOp.GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState)
-    if ShapesOp.IsDone() == 0:
-        print "GetShapesOnPlaneIDs : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("GetShapesOnPlaneIDs", ShapesOp)
+    return aList
+
+## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
+#  the specified plane by the certain way, defined through \a theState parameter.
+#  @param theShape Shape to find sub-shapes of.
+#  @param theShapeType Type of sub-shapes to be retrieved.
+#  @param theAx1 Vector (or line, or linear edge), specifying normal
+#                direction of the plane to find shapes on.
+#  @param thePnt Point specifying location of the plane to find shapes on.
+#  @param theState The state of the subshapes to find. It can be one of
+#   ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
+#  @return List of all found sub-shapes.
+#
+#  Example: see GEOM_TestOthers.py
+def GetShapesOnPlaneWithLocation(theShape, theShapeType, theAx1, thePnt, theState):
+    aList = ShapesOp.GetShapesOnPlaneWithLocation(theShape, theShapeType, theAx1, thePnt, theState)
+    RaiseIfFailed("GetShapesOnPlaneWithLocation", ShapesOp)
+    return aList
+
+## Works like the above method, but returns list of sub-shapes indices
+#
+#  Example: see GEOM_TestOthers.py
+def GetShapesOnPlaneWithLocationIDs(theShape, theShapeType, theAx1, thePnt, theState):
+    aList = ShapesOp.GetShapesOnPlaneWithLocationIDs(theShape, theShapeType, theAx1, thePnt, theState)
+    RaiseIfFailed("GetShapesOnPlaneWithLocationIDs", ShapesOp)
     return aList
 
 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
@@ -911,8 +1042,7 @@ def GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState):
 #  Example: see GEOM_TestOthers.py
 def GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState):
     aList = ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState)
-    if ShapesOp.IsDone() == 0:
-      print "GetShapesOnCylinder : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("GetShapesOnCylinder", ShapesOp)
     return aList
 
 ## Works like the above method, but returns list of sub-shapes indices
@@ -920,8 +1050,7 @@ def GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState):
 #  Example: see GEOM_TestOthers.py
 def GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState):
     aList = ShapesOp.GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState)
-    if ShapesOp.IsDone() == 0:
-        print "GetShapesOnCylinderIDs : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("GetShapesOnCylinderIDs", ShapesOp)
     return aList
 
 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
@@ -937,8 +1066,7 @@ def GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState)
 #  Example: see GEOM_TestOthers.py
 def GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState):
     aList = ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState)
-    if ShapesOp.IsDone() == 0:
-      print "GetShapesOnSphere : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("GetShapesOnSphere", ShapesOp)
     return aList
 
 ## Works like the above method, but returns list of sub-shapes indices
@@ -946,8 +1074,7 @@ def GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState):
 #  Example: see GEOM_TestOthers.py
 def GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState):
     aList = ShapesOp.GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState)
-    if ShapesOp.IsDone() == 0:
-        print "GetShapesOnSphereIDs : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("GetShapesOnSphereIDs", ShapesOp)
     return aList
 
 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
@@ -965,8 +1092,7 @@ def GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState)
 #  Example: see GEOM_TestOthers.py
 def GetShapesOnQuadrangle(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState):
     aList = ShapesOp.GetShapesOnQuadrangle(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState)
-    if ShapesOp.IsDone() == 0:
-      print "GetShapesOnQuadrangle : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("GetShapesOnQuadrangle", ShapesOp)
     return aList
 
 ## Works like the above method, but returns list of sub-shapes indices
@@ -974,21 +1100,73 @@ def GetShapesOnQuadrangle(theShape, theShapeType, theTopLeftPoint, theTopRigthPo
 #  Example: see GEOM_TestOthers.py
 def GetShapesOnQuadrangleIDs(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState):
     aList = ShapesOp.GetShapesOnQuadrangleIDs(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState)
-    if ShapesOp.IsDone() == 0:
-        print "GetShapesOnQuadrangleIDs : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("GetShapesOnQuadrangleIDs", ShapesOp)
+    return aList
+
+## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
+#  the specified \a theBox by the certain way, defined through \a theState parameter.
+#  @param theBox Shape for relative comparing.
+#  @param theShape Shape to find sub-shapes of.
+#  @param theShapeType Type of sub-shapes to be retrieved.
+#  @param theState The state of the subshapes to find. It can be one of
+#   ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
+#  @return List of all found sub-shapes.
+#
+def GetShapesOnBox(theBox, theShape, theShapeType, theState):
+    aList = ShapesOp.GetShapesOnBox(theBox, theShape, theShapeType, theState)
+    RaiseIfFailed("GetShapesOnBox", ShapesOp)
+    return aList
+
+## Works like the above method, but returns list of sub-shapes indices
+#
+def GetShapesOnBoxIDs(theBox, theShape, theShapeType, theState):
+    aList = ShapesOp.GetShapesOnBoxIDs(theBox, theShape, theShapeType, theState)
+    RaiseIfFailed("GetShapesOnBoxIDs", ShapesOp)
     return aList
 
 ## Get sub-shape(s) of theShapeWhere, which are
 #  coincident with \a theShapeWhat or could be a part of it.
 #  @param theShapeWhere Shape to find sub-shapes of.
-#  @param theShapeWhat Shape, specifying what to find.
+#  @param theShapeWhat Shape, specifying what to find (must be in the
+#                      building history of the ShapeWhere).
 #  @return Group of all found sub-shapes or a single found sub-shape.
 #
 #  Example: see GEOM_TestOthers.py
 def GetInPlace(theShapeWhere, theShapeWhat):
     anObj = ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
-    if ShapesOp.IsDone() == 0:
-      print "GetInPlace : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("GetInPlace", ShapesOp)
+    return anObj
+
+## Get sub-shape(s) of \a theShapeWhere, which are
+#  coincident with \a theShapeWhat or could be a part of it.
+#
+#  Implementation of this method is based on a saved history of an operation,
+#  produced \a theShapeWhere. The \a theShapeWhat must be among this operation's
+#  arguments (an argument shape or a sub-shape of an argument shape).
+#  The operation could be the Partition or one of boolean operations,
+#  performed on simple shapes (not on compounds).
+#
+#  @param theShapeWhere Shape to find sub-shapes of.
+#  @param theShapeWhat Shape, specifying what to find (must be in the
+#                      building history of the ShapeWhere).
+#  @return Group of all found sub-shapes or a single found sub-shape.
+#
+#  Example: see GEOM_TestOthers.py
+def GetInPlaceByHistory(theShapeWhere, theShapeWhat):
+    anObj = ShapesOp.GetInPlaceByHistory(theShapeWhere, theShapeWhat)
+    RaiseIfFailed("GetInPlaceByHistory", ShapesOp)
+    return anObj
+
+## Get sub-shape of theShapeWhere, which is
+#  equal to \a theShapeWhat.
+#  @param theShapeWhere Shape to find sub-shape of.
+#  @param theShapeWhat Shape, specifying what to find
+#                      (must be usual shape).
+#  @return New GEOM_Object for found sub-shape.
+#
+def GetSame(theShapeWhere, theShapeWhat):
+    anObj = ShapesOp.GetSame(theShapeWhere, theShapeWhat)
+    RaiseIfFailed("GetSame", ShapesOp)
     return anObj
 
 # -----------------------------------------------------------------------------
@@ -1008,8 +1186,7 @@ def GetSubShape(aShape, ListOfID):
 #  Example: see GEOM_TestAll.py
 def GetSubShapeID(aShape, aSubShape):
     anID = LocalOp.GetSubShapeIndex(aShape, aSubShape)
-    if LocalOp.IsDone() == 0:
-      print "GetSubShapeIndex : ", LocalOp.GetErrorCode()
+    RaiseIfFailed("GetSubShapeIndex", LocalOp)
     return anID
 
 # -----------------------------------------------------------------------------
@@ -1024,8 +1201,7 @@ def GetSubShapeID(aShape, aSubShape):
 #  Example: see GEOM_TestAll.py
 def SubShapeAll(aShape, aType):
     ListObj = ShapesOp.MakeExplode(aShape,aType,0)
-    if ShapesOp.IsDone() == 0:
-      print "MakeExplode : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("MakeExplode", ShapesOp)
     return ListObj
 
 ## Explode a shape on subshapes of a given type.
@@ -1034,8 +1210,7 @@ def SubShapeAll(aShape, aType):
 #  @return List of IDs of sub-shapes.
 def SubShapeAllIDs(aShape, aType):
     ListObj = ShapesOp.SubShapeAllIDs(aShape,aType,0)
-    if ShapesOp.IsDone() == 0:
-      print "SubShapeAllIDs : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("SubShapeAllIDs", ShapesOp)
     return ListObj
 
 ## Explode a shape on subshapes of a given type.
@@ -1047,8 +1222,7 @@ def SubShapeAllIDs(aShape, aType):
 #  Example: see GEOM_TestAll.py
 def SubShapeAllSorted(aShape, aType):
     ListObj = ShapesOp.MakeExplode(aShape,aType,1)
-    if ShapesOp.IsDone() == 0:
-      print "MakeExplode : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("MakeExplode", ShapesOp)
     return ListObj
 
 ## Explode a shape on subshapes of a given type.
@@ -1058,9 +1232,8 @@ def SubShapeAllSorted(aShape, aType):
 #  @return List of IDs of sub-shapes.
 def SubShapeAllSortedIDs(aShape, aType):
     ListIDs = ShapesOp.SubShapeAllIDs(aShape,aType,1)
-    if ShapesOp.IsDone() == 0:
-      print "SubShapeAllSortedIDs : ", ShapesOp.GetErrorCode()
-    return ListObj
+    RaiseIfFailed("SubShapeAllIDs", ShapesOp)
+    return ListIDs
 
 ## Obtain a compound of sub-shapes of <aShape>,
 #  selected by they indices in list of all sub-shapes of type <aType>.
@@ -1104,8 +1277,7 @@ def SubShapeSorted(aShape, aType, ListOfInd):
 #  Example: see GEOM_TestHealing.py
 def ProcessShape(theShape, theOperators, theParameters, theValues):
     anObj = HealOp.ProcessShape(theShape, theOperators, theParameters, theValues)
-    if HealOp.IsDone() == 0:
-       print "ProcessShape : ", HealOp.GetErrorCode()
+    RaiseIfFailed("ProcessShape", HealOp)
     return anObj
 
 ## Remove faces from the given object (shape).
@@ -1117,8 +1289,7 @@ def ProcessShape(theShape, theOperators, theParameters, theValues):
 #  Example: see GEOM_TestHealing.py
 def SuppressFaces(theObject, theFaces):
     anObj = HealOp.SuppressFaces(theObject, theFaces)
-    if HealOp.IsDone() == 0:
-      print "SuppressFaces : ", HealOp.GetErrorCode()
+    RaiseIfFailed("SuppressFaces", HealOp)
     return anObj
 
 ## Sewing of some shapes into single shape.
@@ -1137,8 +1308,7 @@ def MakeSewing(ListShape, theTolerance):
 #  Example: see MakeSewing() above
 def Sew(theObject, theTolerance):
     anObj = HealOp.Sew(theObject, theTolerance)
-    if HealOp.IsDone() == 0:
-      print "Sew : ", HealOp.GetErrorCode()
+    RaiseIfFailed("Sew", HealOp)
     return anObj
 
 ## Remove internal wires and edges from the given object (face).
@@ -1150,8 +1320,7 @@ def Sew(theObject, theTolerance):
 #  Example: see GEOM_TestHealing.py
 def SuppressInternalWires(theObject, theWires):
     anObj = HealOp.RemoveIntWires(theObject, theWires)
-    if HealOp.IsDone() == 0:
-      print "SuppressInternalWires : ", HealOp.GetErrorCode()
+    RaiseIfFailed("RemoveIntWires", HealOp)
     return anObj
 
 ## Remove internal closed contours (holes) from the given object.
@@ -1163,8 +1332,7 @@ def SuppressInternalWires(theObject, theWires):
 #  Example: see GEOM_TestHealing.py
 def SuppressHoles(theObject, theWires):
     anObj = HealOp.FillHoles(theObject, theWires)
-    if HealOp.IsDone() == 0:
-      print "SuppressHoles : ", HealOp.GetErrorCode()
+    RaiseIfFailed("FillHoles", HealOp)
     return anObj
 
 ## Close an open wire.
@@ -1178,8 +1346,7 @@ def SuppressHoles(theObject, theWires):
 #  Example: see GEOM_TestHealing.py
 def CloseContour(theObject, theWires, isCommonVertex):
     anObj = HealOp.CloseContour(theObject, theWires, isCommonVertex)
-    if HealOp.IsDone() == 0:
-      print "CloseContour : ", HealOp.GetErrorCode()
+    RaiseIfFailed("CloseContour", HealOp)
     return anObj
 
 ## Addition of a point to a given edge object.
@@ -1195,8 +1362,22 @@ def CloseContour(theObject, theWires, isCommonVertex):
 #  Example: see GEOM_TestHealing.py
 def DivideEdge(theObject, theEdgeIndex, theValue, isByParameter):
     anObj = HealOp.DivideEdge(theObject, theEdgeIndex, theValue, isByParameter)
-    if HealOp.IsDone() == 0:
-      print "DivideEdge : ", HealOp.GetErrorCode()
+    RaiseIfFailed("DivideEdge", HealOp)
+    return anObj
+
+## Change orientation of the given object.
+#  @param theObject Shape to be processed.
+#  @update given shape
+def ChangeOrientationShell(theObject):
+    theObject = HealOp.ChangeOrientation(theObject)
+    RaiseIfFailed("ChangeOrientation", HealOp)
+
+## Change orientation of the given object.
+#  @param theObject Shape to be processed.
+#  @return New GEOM_Object, containing processed shape.
+def ChangeOrientationShellCopy(theObject):
+    anObj = HealOp.ChangeOrientationCopy(theObject)
+    RaiseIfFailed("ChangeOrientationCopy", HealOp)
     return anObj
 
 ## Get a list of wires (wrapped in GEOM_Object-s),
@@ -1210,8 +1391,7 @@ def DivideEdge(theObject, theEdgeIndex, theValue, isByParameter):
 #  Example: see GEOM_TestHealing.py
 def GetFreeBoundary(theObject):
     anObj = HealOp.GetFreeBoundary(theObject)
-    if HealOp.IsDone() == 0:
-      print "GetFreeBoundaries : ", HealOp.GetErrorCode()
+    RaiseIfFailed("GetFreeBoundary", HealOp)
     return anObj
 
 # -----------------------------------------------------------------------------
@@ -1223,8 +1403,7 @@ def GetFreeBoundary(theObject):
 #  Example: see GEOM_TestAll.py
 def MakeCopy(theOriginal):
     anObj = InsertOp.MakeCopy(theOriginal)
-    if InsertOp.IsDone() == 0:
-      print "MakeCopy : ", InsertOp.GetErrorCode()
+    RaiseIfFailed("MakeCopy", InsertOp)
     return anObj
 
 ## Create a filling from the given compound of contours.
@@ -1239,22 +1418,54 @@ def MakeCopy(theOriginal):
 #  Example: see GEOM_TestAll.py
 def MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter):
     anObj = PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter)
-    if PrimOp.IsDone() == 0:
-      print "MakeFilling : ", PrimOp.GetErrorCode()
+    RaiseIfFailed("MakeFilling", PrimOp)
     return anObj
 
 ## Replace coincident faces in theShape by one face.
 #  @param theShape Initial shape.
 #  @param theTolerance Maximum distance between faces, which can be considered as coincident.
+#  @param doKeepNonSolids If FALSE, only solids will present in the result, otherwise all initial shapes.
 #  @return New GEOM_Object, containing a copy of theShape without coincident faces.
 #
 #  Example: see GEOM_Spanner.py
-def MakeGlueFaces(theShape, theTolerance):
-    anObj = ShapesOp.MakeGlueFaces(theShape, theTolerance)
-    if ShapesOp.IsDone() == 0:
-      print "MakeGlueFaces : ", ShapesOp.GetErrorCode()
+def MakeGlueFaces(theShape, theTolerance, doKeepNonSolids=True):
+    anObj = ShapesOp.MakeGlueFaces(theShape, theTolerance, doKeepNonSolids)
+    if anObj is None:
+      raise RuntimeError, "MakeGlueFaces : " + ShapesOp.GetErrorCode()
+    return anObj
+
+
+## Find coincident faces in theShape for possible gluing.
+#  @param theShape Initial shape.
+#  @param theTolerance Maximum distance between faces,
+#                      which can be considered as coincident.
+#  @return ListOfGO.
+#
+#  Example: see GEOM_Spanner.py
+def GetGlueFaces(theShape, theTolerance):
+    anObj = ShapesOp.GetGlueFaces(theShape, theTolerance)
+    RaiseIfFailed("GetGlueFaces", ShapesOp)
     return anObj
 
+
+## Replace coincident faces in theShape by one face
+#  in compliance with given list of faces
+#  @param theShape Initial shape.
+#  @param theTolerance Maximum distance between faces,
+#                      which can be considered as coincident.
+#  @param theFaces List of faces for gluing.
+#  @param doKeepNonSolids If FALSE, only solids will present in the result, otherwise all initial shapes.
+#  @return New GEOM_Object, containing a copy of theShape
+#          without some faces.
+#
+#  Example: see GEOM_Spanner.py
+def MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids=True):
+    anObj = ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids)
+    if anObj is None:
+      raise RuntimeError, "MakeGlueFacesByList : " + ShapesOp.GetErrorCode()
+    return anObj
+
+
 # -----------------------------------------------------------------------------
 # Boolean (Common, Cut, Fuse, Section)
 # -----------------------------------------------------------------------------
@@ -1269,8 +1480,7 @@ def MakeGlueFaces(theShape, theTolerance):
 #  Example: see GEOM_TestAll.py
 def MakeBoolean(theShape1, theShape2, theOperation):
     anObj = BoolOp.MakeBoolean(theShape1, theShape2, theOperation)
-    if BoolOp.IsDone() == 0:
-      print "MakeBoolean : ", BoolOp.GetErrorCode()
+    RaiseIfFailed("MakeBoolean", BoolOp)
     return anObj
 
 ## Shortcut to MakeBoolean(s1, s2, 1)
@@ -1300,33 +1510,73 @@ def MakeSection(s1, s2):
 ## Perform partition operation.
 #  @param ListShapes Shapes to be intersected.
 #  @param ListTools Shapes to intersect theShapes.
-#  @param ListKeepInside Shapes, outside which the results will be deleted.
+#  !!!NOTE: Each compound from ListShapes and ListTools will be exploded
+#           in order to avoid possible intersection between shapes from
+#           this compound.
+#  @param Limit Type of resulting shapes (corresponding to TopAbs_ShapeEnum).
+#  @param KeepNonlimitShapes: if this parameter == 0 - only shapes with
+#                             type <= Limit are kept in the result,
+#                             else - shapes with type > Limit are kept
+#                             also (if they exist)
+#
+#  After implementation new version of PartitionAlgo (October 2006)
+#  other parameters are ignored by current functionality. They are kept
+#  in this function only for support old versions.
+#  Ignored parameters:
+#      @param ListKeepInside Shapes, outside which the results will be deleted.
 #         Each shape from theKeepInside must belong to theShapes also.
-#  @param ListRemoveInside Shapes, inside which the results will be deleted.
+#      @param ListRemoveInside Shapes, inside which the results will be deleted.
 #         Each shape from theRemoveInside must belong to theShapes also.
-#  @param Limit Type of resulting shapes (corresponding to TopAbs_ShapeEnum).
-#  @param RemoveWebs If TRUE, perform Glue 3D algorithm.
-#  @param ListMaterials Material indices for each shape. Make sence, only if theRemoveWebs is TRUE.
+#      @param RemoveWebs If TRUE, perform Glue 3D algorithm.
+#      @param ListMaterials Material indices for each shape. Make sence,
+#         only if theRemoveWebs is TRUE.
+#
 #  @return New GEOM_Object, containing the result shapes.
 #
 #  Example: see GEOM_TestAll.py
 def MakePartition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
-                  Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]):
+                  Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[],
+                  KeepNonlimitShapes=0):
     anObj = BoolOp.MakePartition(ListShapes, ListTools,
                                  ListKeepInside, ListRemoveInside,
-                                 Limit, RemoveWebs, ListMaterials);
-    if BoolOp.IsDone() == 0:
-      print "MakePartition : ", BoolOp.GetErrorCode()
+                                 Limit, RemoveWebs, ListMaterials,
+                                 KeepNonlimitShapes);
+    RaiseIfFailed("MakePartition", BoolOp)
+    return anObj
+
+## Perform partition operation.
+#  This method may be useful if it is needed to make a partition for
+#  compound contains nonintersected shapes. Performance will be better
+#  since intersection between shapes from compound is not performed.
+#
+#  Description of all parameters as in previous method MakePartition()
+#
+#  !!!NOTE: Passed compounds (via ListShapes or via ListTools)
+#           have to consist of nonintersecting shapes.
+#
+#  @return New GEOM_Object, containing the result shapes.
+#
+def MakePartitionNonSelfIntersectedShape(ListShapes, ListTools=[],
+                                         ListKeepInside=[], ListRemoveInside=[],
+                                         Limit=ShapeType["SHAPE"], RemoveWebs=0,
+                                         ListMaterials=[], KeepNonlimitShapes=0):
+    anObj = BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
+                                                        ListKeepInside, ListRemoveInside,
+                                                        Limit, RemoveWebs, ListMaterials,
+                                                        KeepNonlimitShapes);
+    RaiseIfFailed("MakePartitionNonSelfIntersectedShape", BoolOp)
     return anObj
 
 ## Shortcut to MakePartition()
 #
 #  Example: see GEOM_TestOthers.py
 def Partition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
-              Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]):
+              Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[],
+              KeepNonlimitShapes=0):
     anObj = MakePartition(ListShapes, ListTools,
                           ListKeepInside, ListRemoveInside,
-                          Limit, RemoveWebs, ListMaterials);
+                          Limit, RemoveWebs, ListMaterials,
+                          KeepNonlimitShapes);
     return anObj
 
 ## Perform partition of the Shape with the Plane
@@ -1337,8 +1587,7 @@ def Partition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
 #  Example: see GEOM_TestAll.py
 def MakeHalfPartition(theShape, thePlane):
     anObj = BoolOp.MakeHalfPartition(theShape, thePlane)
-    if BoolOp.IsDone() == 0:
-      print "MakeHalfPartition : ", BoolOp.GetErrorCode()
+    RaiseIfFailed("MakeHalfPartition", BoolOp)
     return anObj
 
 # -----------------------------------------------------------------------------
@@ -1355,8 +1604,7 @@ def MakeHalfPartition(theShape, thePlane):
 #  Example: see GEOM_TestAll.py
 def MakeTranslationTwoPoints(theObject, thePoint1, thePoint2):
     anObj = TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2)
-    if TrsfOp.IsDone() == 0:
-      print "TranslateTwoPointsCopy : ", TrsfOp.GetErrorCode()
+    RaiseIfFailed("TranslateTwoPointsCopy", TrsfOp)
     return anObj
 
 ## Translate the given object along the vector, specified
@@ -1368,8 +1616,7 @@ def MakeTranslationTwoPoints(theObject, thePoint1, thePoint2):
 #  Example: see GEOM_TestAll.py
 def MakeTranslation(theObject, theDX, theDY, theDZ):
     anObj = TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ)
-    if TrsfOp.IsDone() == 0:
-      print "TranslateDXDYDZCopy : ", TrsfOp.GetErrorCode()
+    RaiseIfFailed("TranslateDXDYDZCopy", TrsfOp)
     return anObj
 
 ## Translate the given object along the given vector,
@@ -1381,8 +1628,7 @@ def MakeTranslation(theObject, theDX, theDY, theDZ):
 #  Example: see GEOM_TestAll.py
 def MakeTranslationVector(theObject, theVector):
     anObj = TrsfOp.TranslateVectorCopy(theObject, theVector)
-    if TrsfOp.IsDone() == 0:
-      print "TranslateVectorCopy : ", TrsfOp.GetErrorCode()
+    RaiseIfFailed("TranslateVectorCopy", TrsfOp)
     return anObj
 
 ## Rotate the given object around the given axis
@@ -1395,8 +1641,21 @@ def MakeTranslationVector(theObject, theVector):
 #  Example: see GEOM_TestAll.py
 def MakeRotation(theObject, theAxis, theAngle):
     anObj = TrsfOp.RotateCopy(theObject, theAxis, theAngle)
-    if TrsfOp.IsDone() == 0:
-      print "RotateCopy : ", TrsfOp.GetErrorCode()
+    RaiseIfFailed("RotateCopy", TrsfOp)
+    return anObj
+
+## Rotate given object around vector perpendicular to plane
+#  containing three points, creating its copy before the rotatation.
+#  @param theObject The object to be rotated.
+#  @param theCentPoint central point - the axis is the vector perpendicular to the plane
+#  containing the three points.
+#  @param thePoint1 and thePoint2 - in a perpendicular plan of the axis.
+#  @return New GEOM_Object, containing the rotated object.
+#
+#  Example: see GEOM_TestAll.py
+def MakeRotationThreePoints(theObject, theCentPoint, thePoint1, thePoint2):
+    anObj = TrsfOp.RotateThreePointsCopy(theObject, theCentPoint, thePoint1, thePoint2)
+    RaiseIfFailed("RotateThreePointsCopy", TrsfOp)
     return anObj
 
 ## Scale the given object by the factor, creating its copy before the scaling.
@@ -1408,8 +1667,7 @@ def MakeRotation(theObject, theAxis, theAngle):
 #  Example: see GEOM_TestAll.py
 def MakeScaleTransform(theObject, thePoint, theFactor):
     anObj = TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
-    if TrsfOp.IsDone() == 0:
-      print "ScaleShapeCopy : ", TrsfOp.GetErrorCode()
+    RaiseIfFailed("ScaleShapeCopy", TrsfOp)
     return anObj
 
 ## Create an object, symmetrical
@@ -1421,8 +1679,7 @@ def MakeScaleTransform(theObject, thePoint, theFactor):
 #  Example: see GEOM_TestAll.py
 def MakeMirrorByPlane(theObject, thePlane):
     anObj = TrsfOp.MirrorPlaneCopy(theObject, thePlane)
-    if TrsfOp.IsDone() == 0:
-      print "MirrorPlaneCopy : ", TrsfOp.GetErrorCode()
+    RaiseIfFailed("MirrorPlaneCopy", TrsfOp)
     return anObj
 
 ## Create an object, symmetrical
@@ -1434,8 +1691,7 @@ def MakeMirrorByPlane(theObject, thePlane):
 #  Example: see GEOM_TestAll.py
 def MakeMirrorByAxis(theObject, theAxis):
     anObj = TrsfOp.MirrorAxisCopy(theObject, theAxis)
-    if TrsfOp.IsDone() == 0:
-      print "MirrorAxisCopy : ", TrsfOp.GetErrorCode()
+    RaiseIfFailed("MirrorAxisCopy", TrsfOp)
     return anObj
 
 ## Create an object, symmetrical
@@ -1447,18 +1703,24 @@ def MakeMirrorByAxis(theObject, theAxis):
 #  Example: see GEOM_TestAll.py
 def MakeMirrorByPoint(theObject, thePoint):
     anObj = TrsfOp.MirrorPointCopy(theObject, thePoint)
-    if TrsfOp.IsDone() == 0:
-      print "MirrorPointCopy : ", TrsfOp.GetErrorCode()
+    RaiseIfFailed("MirrorPointCopy", TrsfOp)
     return anObj
 
-## Modify the Location of the given object by LCS
-#  creating its copy before the setting
+## Modify the Location of the given object by LCS,
+#  creating its copy before the setting.
+#  @param theObject The object to be displaced.
+#  @param theStartLCS Coordinate system to perform displacement from it.
+#                     If \a theStartLCS is NULL, displacement
+#                     will be performed from global CS.
+#                     If \a theObject itself is used as \a theStartLCS,
+#                     its location will be changed to \a theEndLCS.
+#  @param theEndLCS Coordinate system to perform displacement to it.
+#  @return New GEOM_Object, containing the displaced shape.
 #
 #  Example: see GEOM_TestAll.py
 def MakePosition(theObject, theStartLCS, theEndLCS):
     anObj = TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS)
-    if TrsfOp.IsDone() == 0:
-      print "PositionShapeCopy : ", TrsfOp.GetErrorCode()
+    RaiseIfFailed("PositionShapeCopy", TrsfOp)
     return anObj
 
 ## Create new object as offset of the given one.
@@ -1469,8 +1731,7 @@ def MakePosition(theObject, theStartLCS, theEndLCS):
 #  Example: see GEOM_TestAll.py
 def MakeOffset(theObject, theOffset):
     anObj = TrsfOp.OffsetShapeCopy(theObject, theOffset)
-    if TrsfOp.IsDone() == 0:
-      print "OffsetShapeCopy : ", TrsfOp.GetErrorCode()
+    RaiseIfFailed("OffsetShapeCopy", TrsfOp)
     return anObj
 
 # -----------------------------------------------------------------------------
@@ -1488,8 +1749,7 @@ def MakeOffset(theObject, theOffset):
 #  Example: see GEOM_TestAll.py
 def MakeMultiTranslation1D(theObject, theVector, theStep, theNbTimes):
     anObj = TrsfOp.MultiTranslate1D(theObject, theVector, theStep, theNbTimes)
-    if TrsfOp.IsDone() == 0:
-      print "MultiTranslate1D : ", TrsfOp.GetErrorCode()
+    RaiseIfFailed("MultiTranslate1D", TrsfOp)
     return anObj
 
 ## Conseqently apply two specified translations to theObject specified number of times.
@@ -1508,8 +1768,7 @@ def MakeMultiTranslation2D(theObject, theVector1, theStep1, theNbTimes1,
                                      theVector2, theStep2, theNbTimes2):
     anObj = TrsfOp.MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1,
                                               theVector2, theStep2, theNbTimes2)
-    if TrsfOp.IsDone() == 0:
-      print "MultiTranslate2D : ", TrsfOp.GetErrorCode()
+    RaiseIfFailed("MultiTranslate2D", TrsfOp)
     return anObj
 
 ## Rotate the given object around the given axis a given number times.
@@ -1523,8 +1782,7 @@ def MakeMultiTranslation2D(theObject, theVector1, theStep1, theNbTimes1,
 #  Example: see GEOM_TestAll.py
 def MultiRotate1D(theObject, theAxis, theNbTimes):
     anObj = TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes)
-    if TrsfOp.IsDone() == 0:
-      print "MultiRotate1D : ", TrsfOp.GetErrorCode()
+    RaiseIfFailed("MultiRotate1D", TrsfOp)
     return anObj
 
 ## Rotate the given object around the
@@ -1544,8 +1802,7 @@ def MultiRotate1D(theObject, theAxis, theNbTimes):
 #  Example: see GEOM_TestAll.py
 def MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2):
     anObj = TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2)
-    if TrsfOp.IsDone() == 0:
-      print "MultiRotate2D : ", TrsfOp.GetErrorCode()
+    RaiseIfFailed("MultiRotate2D", TrsfOp)
     return anObj
 
 ## The same, as MultiRotate1D(), but axis is given by direction and point
@@ -1576,8 +1833,7 @@ def MakeMultiRotation2D(aShape,aDir,aPoint,anAngle,nbtimes1,aStep,nbtimes2):
 #  Example: see GEOM_TestOthers.py
 def MakeFilletAll(theShape, theR):
     anObj = LocalOp.MakeFilletAll(theShape, theR)
-    if LocalOp.IsDone() == 0:
-      print "MakeFilletAll : ", LocalOp.GetErrorCode()
+    RaiseIfFailed("MakeFilletAll", LocalOp)
     return anObj
 
 ## Perform a fillet on the specified edges/faces of the given shape
@@ -1593,10 +1849,21 @@ def MakeFillet(theShape, theR, theShapeType, theListShapes):
     anObj = None
     if theShapeType == ShapeType["EDGE"]:
         anObj = LocalOp.MakeFilletEdges(theShape, theR, theListShapes)
+        RaiseIfFailed("MakeFilletEdges", LocalOp)
     else:
         anObj = LocalOp.MakeFilletFaces(theShape, theR, theListShapes)
-    if LocalOp.IsDone() == 0:
-      print "MakeFillet : ", LocalOp.GetErrorCode()
+        RaiseIfFailed("MakeFilletFaces", LocalOp)
+    return anObj
+
+## The same but with two Fillet Radius R1 and R2
+def MakeFilletR1R2(theShape, theR1, theR2, theShapeType, theListShapes):
+    anObj = None
+    if theShapeType == ShapeType["EDGE"]:
+        anObj = LocalOp.MakeFilletEdgesR1R2(theShape, theR1, theR2, theListShapes)
+        RaiseIfFailed("MakeFilletEdgesR1R2", LocalOp)
+    else:
+        anObj = LocalOp.MakeFilletFacesR1R2(theShape, theR1, theR2, theListShapes)
+        RaiseIfFailed("MakeFilletFacesR1R2", LocalOp)
     return anObj
 
 ## Perform a symmetric chamfer on all edges of the given shape.
@@ -1607,8 +1874,7 @@ def MakeFillet(theShape, theR, theShapeType, theListShapes):
 #  Example: see GEOM_TestOthers.py
 def MakeChamferAll(theShape, theD):
     anObj = LocalOp.MakeChamferAll(theShape, theD)
-    if LocalOp.IsDone() == 0:
-      print "MakeChamferAll : ", LocalOp.GetErrorCode()
+    RaiseIfFailed("MakeChamferAll", LocalOp)
     return anObj
 
 ## Perform a chamfer on edges, common to the specified faces,
@@ -1623,8 +1889,14 @@ def MakeChamferAll(theShape, theD):
 #  Example: see GEOM_TestAll.py
 def MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2):
     anObj = LocalOp.MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2)
-    if LocalOp.IsDone() == 0:
-      print "MakeChamferEdge : ", LocalOp.GetErrorCode()
+    RaiseIfFailed("MakeChamferEdge", LocalOp)
+    return anObj
+
+## The Same chamfer but with params theD is chamfer lenght and
+#  theAngle is Angle of chamfer (angle in radians)
+def MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2):
+    anObj = LocalOp.MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2)
+    RaiseIfFailed("MakeChamferEdgeAD", LocalOp)
     return anObj
 
 ## Perform a chamfer on all edges of the specified faces,
@@ -1641,8 +1913,34 @@ def MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2):
 #  Example: see GEOM_TestAll.py
 def MakeChamferFaces(theShape, theD1, theD2, theFaces):
     anObj = LocalOp.MakeChamferFaces(theShape, theD1, theD2, theFaces)
-    if LocalOp.IsDone() == 0:
-      print "MakeChamferFaces : ", LocalOp.GetErrorCode()
+    RaiseIfFailed("MakeChamferFaces", LocalOp)
+    return anObj
+
+## The Same chamfer but with params theD is chamfer lenght and
+#  theAngle is Angle of chamfer (angle in radians)
+def MakeChamferFacesAD(theShape, theD, theAngle, theFaces):
+    anObj = LocalOp.MakeChamferFacesAD(theShape, theD, theAngle, theFaces)
+    RaiseIfFailed("MakeChamferFacesAD", LocalOp)
+    return anObj
+
+## Perform a chamfer on edges,
+#  with distance D1 on the first specified face (if several for one edge)
+#  @param theShape Shape, to perform chamfer on.
+#  @param theD1 and theD2 Chamfer size 
+#  @param theEdges Sequence of edges of \a theShape.
+#  @return New GEOM_Object, containing the result shape.
+#
+#  Example:
+def MakeChamferEdges(theShape, theD1, theD2, theEdges):
+    anObj = LocalOp.MakeChamferEdges(theShape, theD1, theD2, theEdges)
+    RaiseIfFailed("MakeChamferEdges", LocalOp)
+    return anObj
+
+## The Same chamfer but with params theD is chamfer lenght and
+#  theAngle is Angle of chamfer (angle in radians)
+def MakeChamferEdgesAD(theShape, theD, theAngle, theEdges):
+    anObj = LocalOp.MakeChamferEdgesAD(theShape, theD, theAngle, theEdges)
+    RaiseIfFailed("MakeChamferEdgesAD", LocalOp)
     return anObj
 
 ## Shortcut to MakeChamferEdge() and MakeChamferFaces()
@@ -1668,8 +1966,7 @@ def MakeChamfer(aShape,d1,d2,aShapeType,ListShape):
 #  Example: see GEOM_TestAll.py
 def Archimede(theShape, theWeight, theWaterDensity, theMeshDeflection):
     anObj = LocalOp.MakeArchimede(theShape, theWeight, theWaterDensity, theMeshDeflection)
-    if LocalOp.IsDone() == 0:
-      print "MakeArchimede : ", LocalOp.GetErrorCode()
+    RaiseIfFailed("MakeArchimede", LocalOp)
     return anObj
 
 # -----------------------------------------------------------------------------
@@ -1682,8 +1979,7 @@ def Archimede(theShape, theWeight, theWaterDensity, theMeshDeflection):
 #  Example: see GEOM_TestMeasures.py
 def PointCoordinates(Point):
     aTuple = MeasuOp.PointCoordinates(Point)
-    if MeasuOp.IsDone() == 0:
-      print "PointCoordinates : ", MeasuOp.GetErrorCode()
+    RaiseIfFailed("PointCoordinates", MeasuOp)
     return aTuple
 
 ## Get summarized length of all wires,
@@ -1697,8 +1993,7 @@ def PointCoordinates(Point):
 #  Example: see GEOM_TestMeasures.py
 def BasicProperties(theShape):
     aTuple = MeasuOp.GetBasicProperties(theShape)
-    if MeasuOp.IsDone() == 0:
-      print "BasicProperties : ", MeasuOp.GetErrorCode()
+    RaiseIfFailed("GetBasicProperties", MeasuOp)
     return aTuple
 
 ## Get parameters of bounding box of the given shape
@@ -1711,8 +2006,7 @@ def BasicProperties(theShape):
 #  Example: see GEOM_TestMeasures.py
 def BoundingBox(theShape):
     aTuple = MeasuOp.GetBoundingBox(theShape)
-    if MeasuOp.IsDone() == 0:
-      print "BoundingBox : ", MeasuOp.GetErrorCode()
+    RaiseIfFailed("GetBoundingBox", MeasuOp)
     return aTuple
 
 ## Get inertia matrix and moments of inertia of theShape.
@@ -1724,8 +2018,7 @@ def BoundingBox(theShape):
 #  Example: see GEOM_TestMeasures.py
 def Inertia(theShape):
     aTuple = MeasuOp.GetInertia(theShape)
-    if MeasuOp.IsDone() == 0:
-      print "Inertia : ", MeasuOp.GetErrorCode()
+    RaiseIfFailed("GetInertia", MeasuOp)
     return aTuple
 
 ## Get minimal distance between the given shapes.
@@ -1735,10 +2028,30 @@ def Inertia(theShape):
 #  Example: see GEOM_TestMeasures.py
 def MinDistance(theShape1, theShape2):
     aTuple = MeasuOp.GetMinDistance(theShape1, theShape2)
-    if MeasuOp.IsDone() == 0:
-      print "MinDistance : ", MeasuOp.GetErrorCode()
+    RaiseIfFailed("GetMinDistance", MeasuOp)
     return aTuple[0]
 
+## Get minimal distance between the given shapes.
+#  @param theShape1,theShape2 Shapes to find minimal distance between.
+#  @return Value of the minimal distance between the given shapes.
+#
+#  Example: see GEOM_TestMeasures.py
+def MinDistanceComponents(theShape1, theShape2):
+    aTuple = MeasuOp.GetMinDistance(theShape1, theShape2)
+    RaiseIfFailed("GetMinDistance", MeasuOp)
+    aRes = [aTuple[0], aTuple[4] - aTuple[1], aTuple[5] - aTuple[2], aTuple[6] - aTuple[3]]
+    return aRes
+
+## Get angle between the given shapes.
+#  @param theShape1,theShape2 Lines or linear edges to find angle between.
+#  @return Value of the angle between the given shapes.
+#
+#  Example: see GEOM_TestMeasures.py
+def GetAngle(theShape1, theShape2):
+    anAngle = MeasuOp.GetAngle(theShape1, theShape2)
+    RaiseIfFailed("GetAngle", MeasuOp)
+    return anAngle
+
 ## Get min and max tolerances of sub-shapes of theShape
 #  @param theShape Shape, to get tolerances of.
 #  @return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]
@@ -1749,8 +2062,7 @@ def MinDistance(theShape1, theShape2):
 #  Example: see GEOM_TestMeasures.py
 def Tolerance(theShape):
     aTuple = MeasuOp.GetTolerance(theShape)
-    if MeasuOp.IsDone() == 0:
-      print "Tolerance : ", MeasuOp.GetErrorCode()
+    RaiseIfFailed("GetTolerance", MeasuOp)
     return aTuple
 
 ## Obtain description of the given shape (number of sub-shapes of each type)
@@ -1760,8 +2072,7 @@ def Tolerance(theShape):
 #  Example: see GEOM_TestMeasures.py
 def WhatIs(theShape):
     aDescr = MeasuOp.WhatIs(theShape)
-    if MeasuOp.IsDone() == 0:
-      print "WhatIs : ", MeasuOp.GetErrorCode()
+    RaiseIfFailed("WhatIs", MeasuOp)
     return aDescr
 
 ## Get a point, situated at the centre of mass of theShape.
@@ -1771,8 +2082,19 @@ def WhatIs(theShape):
 #  Example: see GEOM_TestMeasures.py
 def MakeCDG(theShape):
     anObj = MeasuOp.GetCentreOfMass(theShape)
-    if MeasuOp.IsDone() == 0:
-      print "GetCentreOfMass : ", MeasuOp.GetErrorCode()
+    RaiseIfFailed("GetCentreOfMass", MeasuOp)
+    return anObj
+
+## Get a normale to the given face. If the point is not given,
+#  the normale is calculated at the center of mass.
+#  @param theFace Face to define normale of.
+#  @param theOptionalPoint Point to compute the normale at.
+#  @return New GEOM_Object, containing the created vector.
+#
+#  Example: see GEOM_TestMeasures.py
+def GetNormal(theFace, theOptionalPoint = None):
+    anObj = MeasuOp.GetNormal(theFace, theOptionalPoint)
+    RaiseIfFailed("GetNormal", MeasuOp)
     return anObj
 
 ## Check a topology of the given shape.
@@ -1786,16 +2108,100 @@ def MakeCDG(theShape):
 def CheckShape(theShape, theIsCheckGeom = 0):
     if theIsCheckGeom:
         (IsValid, Status) = MeasuOp.CheckShapeWithGeometry(theShape)
+        RaiseIfFailed("CheckShapeWithGeometry", MeasuOp)
     else:
         (IsValid, Status) = MeasuOp.CheckShape(theShape)
-
-    if MeasuOp.IsDone() == 0:
-      print "CheckShape : ", MeasuOp.GetErrorCode()
-    else:
-      if IsValid == 0:
+        RaiseIfFailed("CheckShape", MeasuOp)
+    if IsValid == 0:
         print Status
     return IsValid
 
+## Get position (LCS) of theShape.
+#
+#  Origin of the LCS is situated at the shape's center of mass.
+#  Axes of the LCS are obtained from shape's location or,
+#  if the shape is a planar face, from position of its plane.
+#
+#  @param theShape Shape to calculate position of.
+#  @return [Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz].
+#          Ox,Oy,Oz: Coordinates of shape's LCS origin.
+#          Zx,Zy,Zz: Coordinates of shape's LCS normal(main) direction.
+#          Xx,Xy,Xz: Coordinates of shape's LCS X direction.
+#
+#  Example: see GEOM_TestMeasures.py
+def GetPosition(theShape):
+    aTuple = MeasuOp.GetPosition(theShape)
+    RaiseIfFailed("GetPosition", MeasuOp)
+    return aTuple
+
+## Get kind of theShape.
+#
+#  @param theShape Shape to get a kind of.
+#  @return Returns a kind of shape in terms of <VAR>GEOM_IKindOfShape.shape_kind</VAR> enumeration
+#          and a list of parameters, describing the shape.
+#  @note  Concrete meaning of each value, returned via \a theIntegers
+#         or \a theDoubles list depends on the kind of the shape.
+#         The full list of possible outputs is:
+#
+#  geompy.kind.COMPOUND              nb_solids  nb_faces  nb_edges  nb_vertices
+#  geompy.kind.COMPSOLID             nb_solids  nb_faces  nb_edges  nb_vertices
+#
+#  geompy.kind.SHELL       geompy.info.CLOSED   nb_faces  nb_edges  nb_vertices
+#  geompy.kind.SHELL       geompy.info.UNCLOSED nb_faces  nb_edges  nb_vertices
+#
+#  geompy.kind.WIRE        geompy.info.CLOSED             nb_edges  nb_vertices
+#  geompy.kind.WIRE        geompy.info.UNCLOSED           nb_edges  nb_vertices
+#
+#  geompy.kind.SPHERE       xc yc zc            R
+#  geompy.kind.CYLINDER     xb yb zb  dx dy dz  R         H
+#  geompy.kind.BOX          xc yc zc                      ax ay az
+#  geompy.kind.ROTATED_BOX  xc yc zc  zx zy zz  xx xy xz  ax ay az
+#  geompy.kind.TORUS        xc yc zc  dx dy dz  R_1  R_2
+#  geompy.kind.CONE         xb yb zb  dx dy dz  R_1  R_2  H
+#  geompy.kind.POLYHEDRON                       nb_faces  nb_edges  nb_vertices
+#  geompy.kind.SOLID                            nb_faces  nb_edges  nb_vertices
+#
+#  geompy.kind.SPHERE2D     xc yc zc            R
+#  geompy.kind.CYLINDER2D   xb yb zb  dx dy dz  R         H
+#  geompy.kind.TORUS2D      xc yc zc  dx dy dz  R_1  R_2
+#  geompy.kind.CONE2D       xc yc zc  dx dy dz  R_1  R_2  H
+#  geompy.kind.DISK_CIRCLE  xc yc zc  dx dy dz  R
+#  geompy.kind.DISK_ELLIPSE xc yc zc  dx dy dz  R_1  R_2
+#  geompy.kind.POLYGON      xo yo zo  dx dy dz            nb_edges  nb_vertices
+#  geompy.kind.PLANE        xo yo zo  dx dy dz
+#  geompy.kind.PLANAR       xo yo zo  dx dy dz            nb_edges  nb_vertices
+#  geompy.kind.FACE                                       nb_edges  nb_vertices
+#
+#  geompy.kind.CIRCLE       xc yc zc  dx dy dz  R
+#  geompy.kind.ARC_CIRCLE   xc yc zc  dx dy dz  R         x1 y1 z1  x2 y2 z2
+#  geompy.kind.ELLIPSE      xc yc zc  dx dy dz  R_1  R_2
+#  geompy.kind.ARC_ELLIPSE  xc yc zc  dx dy dz  R_1  R_2  x1 y1 z1  x2 y2 z2
+#  geompy.kind.LINE         xo yo zo  dx dy dz
+#  geompy.kind.SEGMENT      x1 y1 z1  x2 y2 z2
+#  geompy.kind.EDGE                                                 nb_vertices
+#
+#  geompy.kind.VERTEX       x  y  z
+#
+#  Example: see GEOM_TestMeasures.py
+def KindOfShape(theShape):
+    aRoughTuple = MeasuOp.KindOfShape(theShape)
+    RaiseIfFailed("KindOfShape", MeasuOp)
+
+    aKind  = aRoughTuple[0]
+    anInts = aRoughTuple[1]
+    aDbls  = aRoughTuple[2]
+
+    # Now there is no exception from this rule:
+    aKindTuple = [aKind] + aDbls + anInts
+
+    # If they are we will regroup parameters for such kind of shape.
+    # For example:
+    #if aKind == kind.SOME_KIND:
+    #    #  SOME_KIND     int int double int double double
+    #    aKindTuple = [aKind, anInts[0], anInts[1], aDbls[0], anInts[2], aDbls[1], aDbls[2]]
+
+    return aKindTuple
+
 # -----------------------------------------------------------------------------
 # Import/Export objects
 # -----------------------------------------------------------------------------
@@ -1810,8 +2216,7 @@ def CheckShape(theShape, theIsCheckGeom = 0):
 #  Example: see GEOM_TestOthers.py
 def Import(theFileName, theFormatName):
     anObj = InsertOp.Import(theFileName, theFormatName)
-    if InsertOp.IsDone() == 0:
-      print "Import : ", InsertOp.GetErrorCode()
+    RaiseIfFailed("Import", InsertOp)
     return anObj
 
 ## Shortcut to Import() for BREP format
@@ -1841,8 +2246,7 @@ def ImportSTEP(theFileName):
 #  Example: see GEOM_TestOthers.py
 def Export(theObject, theFileName, theFormatName):
     InsertOp.Export(theObject, theFileName, theFormatName)
-    if InsertOp.IsDone() == 0:
-      print "Export : ", InsertOp.GetErrorCode()
+    RaiseIfFailed("Export", InsertOp)
 
 ## Shortcut to Export() for BREP format
 #
@@ -1874,8 +2278,7 @@ def ExportSTEP(theObject, theFileName):
 #  Example: see GEOM_Spanner.py
 def MakeQuad(E1, E2, E3, E4):
     anObj = BlocksOp.MakeQuad(E1, E2, E3, E4)
-    if BlocksOp.IsDone() == 0:
-      print "MakeQuad : ", BlocksOp.GetErrorCode()
+    RaiseIfFailed("MakeQuad", BlocksOp)
     return anObj
 
 ## Create a quadrangle face on two edges.
@@ -1886,8 +2289,7 @@ def MakeQuad(E1, E2, E3, E4):
 #  Example: see GEOM_Spanner.py
 def MakeQuad2Edges(E1, E2):
     anObj = BlocksOp.MakeQuad2Edges(E1, E2)
-    if BlocksOp.IsDone() == 0:
-      print "MakeQuad2Edges : ", BlocksOp.GetErrorCode()
+    RaiseIfFailed("MakeQuad2Edges", BlocksOp)
     return anObj
 
 ## Create a quadrangle face with specified corners.
@@ -1898,8 +2300,7 @@ def MakeQuad2Edges(E1, E2):
 #  Example: see GEOM_Spanner.py
 def MakeQuad4Vertices(V1, V2, V3, V4):
     anObj = BlocksOp.MakeQuad4Vertices(V1, V2, V3, V4)
-    if BlocksOp.IsDone() == 0:
-      print "MakeQuad4Vertices : ", BlocksOp.GetErrorCode()
+    RaiseIfFailed("MakeQuad4Vertices", BlocksOp)
     return anObj
 
 ## Create a hexahedral solid, bounded by the six given faces. Order of
@@ -1910,8 +2311,7 @@ def MakeQuad4Vertices(V1, V2, V3, V4):
 #  Example: see GEOM_Spanner.py
 def MakeHexa(F1, F2, F3, F4, F5, F6):
     anObj = BlocksOp.MakeHexa(F1, F2, F3, F4, F5, F6)
-    if BlocksOp.IsDone() == 0:
-      print "MakeHexa : ", BlocksOp.GetErrorCode()
+    RaiseIfFailed("MakeHexa", BlocksOp)
     return anObj
 
 ## Create a hexahedral solid between two given faces.
@@ -1922,8 +2322,7 @@ def MakeHexa(F1, F2, F3, F4, F5, F6):
 #  Example: see GEOM_Spanner.py
 def MakeHexa2Faces(F1, F2):
     anObj = BlocksOp.MakeHexa2Faces(F1, F2)
-    if BlocksOp.IsDone() == 0:
-      print "MakeHexa2Faces : ", BlocksOp.GetErrorCode()
+    RaiseIfFailed("MakeHexa2Faces", BlocksOp)
     return anObj
 
 ## Get a vertex, found in the given shape by its coordinates.
@@ -1936,8 +2335,7 @@ def MakeHexa2Faces(F1, F2):
 #  Example: see GEOM_TestOthers.py
 def GetPoint(theShape, theX, theY, theZ, theEpsilon):
     anObj = BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
-    if BlocksOp.IsDone() == 0:
-      print "GetPoint : ", BlocksOp.GetErrorCode()
+    RaiseIfFailed("GetPoint", BlocksOp)
     return anObj
 
 ## Get an edge, found in the given shape by two given vertices.
@@ -1948,8 +2346,7 @@ def GetPoint(theShape, theX, theY, theZ, theEpsilon):
 #  Example: see GEOM_Spanner.py
 def GetEdge(theShape, thePoint1, thePoint2):
     anObj = BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
-    if BlocksOp.IsDone() == 0:
-      print "GetEdge : ", BlocksOp.GetErrorCode()
+    RaiseIfFailed("GetEdge", BlocksOp)
     return anObj
 
 ## Find an edge of the given shape, which has minimal distance to the given point.
@@ -1960,8 +2357,7 @@ def GetEdge(theShape, thePoint1, thePoint2):
 #  Example: see GEOM_TestOthers.py
 def GetEdgeNearPoint(theShape, thePoint):
     anObj = BlocksOp.GetEdgeNearPoint(theShape, thePoint)
-    if BlocksOp.IsDone() == 0:
-      print "GetEdgeNearPoint : ", BlocksOp.GetErrorCode()
+    RaiseIfFailed("GetEdgeNearPoint", BlocksOp)
     return anObj
 
 ## Returns a face, found in the given shape by four given corner vertices.
@@ -1972,8 +2368,7 @@ def GetEdgeNearPoint(theShape, thePoint):
 #  Example: see GEOM_Spanner.py
 def GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4):
     anObj = BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4)
-    if BlocksOp.IsDone() == 0:
-      print "GetFaceByPoints : ", BlocksOp.GetErrorCode()
+    RaiseIfFailed("GetFaceByPoints", BlocksOp)
     return anObj
 
 ## Get a face of block, found in the given shape by two given edges.
@@ -1984,8 +2379,7 @@ def GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4):
 #  Example: see GEOM_Spanner.py
 def GetFaceByEdges(theShape, theEdge1, theEdge2):
     anObj = BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2)
-    if BlocksOp.IsDone() == 0:
-      print "GetFaceByEdges : ", BlocksOp.GetErrorCode()
+    RaiseIfFailed("GetFaceByEdges", BlocksOp)
     return anObj
 
 ## Find a face, opposite to the given one in the given block.
@@ -1996,8 +2390,7 @@ def GetFaceByEdges(theShape, theEdge1, theEdge2):
 #  Example: see GEOM_Spanner.py
 def GetOppositeFace(theBlock, theFace):
     anObj = BlocksOp.GetOppositeFace(theBlock, theFace)
-    if BlocksOp.IsDone() == 0:
-      print "GetOppositeFace : ", BlocksOp.GetErrorCode()
+    RaiseIfFailed("GetOppositeFace", BlocksOp)
     return anObj
 
 ## Find a face of the given shape, which has minimal distance to the given point.
@@ -2008,8 +2401,7 @@ def GetOppositeFace(theBlock, theFace):
 #  Example: see GEOM_Spanner.py
 def GetFaceNearPoint(theShape, thePoint):
     anObj = BlocksOp.GetFaceNearPoint(theShape, thePoint)
-    if BlocksOp.IsDone() == 0:
-      print "GetFaceNearPoint : ", BlocksOp.GetErrorCode()
+    RaiseIfFailed("GetFaceNearPoint", BlocksOp)
     return anObj
 
 ## Find a face of block, whose outside normale has minimal angle with the given vector.
@@ -2020,8 +2412,7 @@ def GetFaceNearPoint(theShape, thePoint):
 #  Example: see GEOM_Spanner.py
 def GetFaceByNormale(theBlock, theVector):
     anObj = BlocksOp.GetFaceByNormale(theBlock, theVector)
-    if BlocksOp.IsDone() == 0:
-      print "GetFaceByNormale : ", BlocksOp.GetErrorCode()
+    RaiseIfFailed("GetFaceByNormale", BlocksOp)
     return anObj
 
 ## Check, if the compound of blocks is given.
@@ -2038,24 +2429,22 @@ def GetFaceByNormale(theBlock, theVector):
 #  Example: see GEOM_Spanner.py
 def CheckCompoundOfBlocks(theCompound):
     (IsValid, BCErrors) = BlocksOp.CheckCompoundOfBlocks(theCompound)
-    if BlocksOp.IsDone() == 0:
-      print "CheckCompoundOfBlocks : ", BlocksOp.GetErrorCode()
-    else:
-      if IsValid == 0:
+    RaiseIfFailed("CheckCompoundOfBlocks", BlocksOp)
+    if IsValid == 0:
         Descr = BlocksOp.PrintBCErrors(theCompound, BCErrors)
         print Descr
     return IsValid
 
 ## Remove all seam and degenerated edges from \a theShape.
-#  Unite faces and edges, sharing one surface.
+#  Unite faces and edges, sharing one surface. It means that
+#  this faces must have references to one C++ surface object (handle).
 #  @param theShape The compound or single solid to remove irregular edges from.
 #  @return Improved shape.
 #
 #  Example: see GEOM_TestOthers.py
 def RemoveExtraEdges(theShape):
     anObj = BlocksOp.RemoveExtraEdges(theShape)
-    if BlocksOp.IsDone() == 0:
-      print "RemoveExtraEdges : ", BlocksOp.GetErrorCode()
+    RaiseIfFailed("RemoveExtraEdges", BlocksOp)
     return anObj
 
 ## Check, if the given shape is a blocks compound.
@@ -2067,8 +2456,7 @@ def RemoveExtraEdges(theShape):
 #  Example: see GEOM_TestOthers.py
 def CheckAndImprove(theShape):
     anObj = BlocksOp.CheckAndImprove(theShape)
-    if BlocksOp.IsDone() == 0:
-      print "CheckAndImprove : ", BlocksOp.GetErrorCode()
+    RaiseIfFailed("CheckAndImprove", BlocksOp)
     return anObj
 
 ## Get all the blocks, contained in the given compound.
@@ -2081,8 +2469,7 @@ def CheckAndImprove(theShape):
 #  Example: see GEOM_TestOthers.py
 def MakeBlockExplode(theCompound, theMinNbFaces, theMaxNbFaces):
     aList = BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces)
-    if BlocksOp.IsDone() == 0:
-      print "MakeBlockExplode : ", BlocksOp.GetErrorCode()
+    RaiseIfFailed("ExplodeCompoundOfBlocks", BlocksOp)
     return aList
 
 ## Find block, containing the given point inside its volume or on boundary.
@@ -2094,8 +2481,7 @@ def MakeBlockExplode(theCompound, theMinNbFaces, theMaxNbFaces):
 #  Example: see GEOM_Spanner.py
 def GetBlockNearPoint(theCompound, thePoint):
     anObj = BlocksOp.GetBlockNearPoint(theCompound, thePoint)
-    if BlocksOp.IsDone() == 0:
-      print "GetBlockNearPoint : ", BlocksOp.GetErrorCode()
+    RaiseIfFailed("GetBlockNearPoint", BlocksOp)
     return anObj
 
 ## Find block, containing all the elements, passed as the parts, or maximum quantity of them.
@@ -2106,8 +2492,7 @@ def GetBlockNearPoint(theCompound, thePoint):
 #  Example: see GEOM_TestOthers.py
 def GetBlockByParts(theCompound, theParts):
     anObj = BlocksOp.GetBlockByParts(theCompound, theParts)
-    if BlocksOp.IsDone() == 0:
-      print "GetBlockByParts : ", BlocksOp.GetErrorCode()
+    RaiseIfFailed("GetBlockByParts", BlocksOp)
     return anObj
 
 ## Return all blocks, containing all the elements, passed as the parts.
@@ -2118,8 +2503,7 @@ def GetBlockByParts(theCompound, theParts):
 #  Example: see GEOM_Spanner.py
 def GetBlocksByParts(theCompound, theParts):
     aList = BlocksOp.GetBlocksByParts(theCompound, theParts)
-    if BlocksOp.IsDone() == 0:
-      print "GetBlocksByParts : ", BlocksOp.GetErrorCode()
+    RaiseIfFailed("GetBlocksByParts", BlocksOp)
     return aList
 
 ## Multi-transformate block and glue the result.
@@ -2134,8 +2518,7 @@ def GetBlocksByParts(theCompound, theParts):
 #  Example: see GEOM_Spanner.py
 def MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes):
     anObj = BlocksOp.MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes)
-    if BlocksOp.IsDone() == 0:
-      print "MakeMultiTransformation1D : ", BlocksOp.GetErrorCode()
+    RaiseIfFailed("MakeMultiTransformation1D", BlocksOp)
     return anObj
 
 ## Multi-transformate block and glue the result.
@@ -2150,8 +2533,7 @@ def MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
                                     DirFace1V, DirFace2V, NbTimesV):
     anObj = BlocksOp.MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
                                                      DirFace1V, DirFace2V, NbTimesV)
-    if BlocksOp.IsDone() == 0:
-      print "MakeMultiTransformation2D : ", BlocksOp.GetErrorCode()
+    RaiseIfFailed("MakeMultiTransformation2D", BlocksOp)
     return anObj
 
 ## Build all possible propagation groups.
@@ -2164,8 +2546,7 @@ def MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
 #  Example: see GEOM_TestOthers.py
 def Propagate(theShape):
     listChains = BlocksOp.Propagate(theShape)
-    if BlocksOp.IsDone() == 0:
-      print "Propagate : ", BlocksOp.GetErrorCode()
+    RaiseIfFailed("Propagate", BlocksOp)
     return listChains
 
 # -----------------------------------------------------------------------------
@@ -2180,8 +2561,7 @@ def Propagate(theShape):
 #  Example: see GEOM_TestOthers.py
 def CreateGroup(theMainShape, theShapeType):
     anObj = GroupOp.CreateGroup(theMainShape, theShapeType)
-    if GroupOp.IsDone() == 0:
-       print "CreateGroup : ", GroupOp.GetErrorCode()
+    RaiseIfFailed("CreateGroup", GroupOp)
     return anObj
 
 ## Adds a sub object with ID theSubShapeId to the group
@@ -2192,8 +2572,7 @@ def CreateGroup(theMainShape, theShapeType):
 #  Example: see GEOM_TestOthers.py
 def AddObject(theGroup, theSubShapeID):
     GroupOp.AddObject(theGroup, theSubShapeID)
-    if GroupOp.IsDone() == 0:
-      print "AddObject : ", GroupOp.GetErrorCode()
+    RaiseIfFailed("AddObject", GroupOp)
 
 ## Removes a sub object with ID \a theSubShapeId from the group
 #  @param theGroup is a GEOM group from which the new sub shape is removed
@@ -2203,8 +2582,7 @@ def AddObject(theGroup, theSubShapeID):
 #  Example: see GEOM_TestOthers.py
 def RemoveObject(theGroup, theSubShapeID):
     GroupOp.RemoveObject(theGroup, theSubShapeID)
-    if GroupOp.IsDone() == 0:
-      print "RemoveObject : ", GroupOp.GetErrorCode()
+    RaiseIfFailed("RemoveObject", GroupOp)
 
 ## Adds to the group all the given shapes. No errors, if some shapes are alredy included.
 #  @param theGroup is a GEOM group to which the new sub shapes are added.
@@ -2213,8 +2591,7 @@ def RemoveObject(theGroup, theSubShapeID):
 #  Example: see GEOM_TestOthers.py
 def UnionList (theGroup, theSubShapes):
     GroupOp.UnionList(theGroup, theSubShapes)
-    if GroupOp.IsDone() == 0:
-      print "UnionList : ", GroupOp.GetErrorCode()
+    RaiseIfFailed("UnionList", GroupOp)
 
 ## Works like the above method, but argument
 #  theSubShapes here is a list of sub-shapes indices
@@ -2222,8 +2599,7 @@ def UnionList (theGroup, theSubShapes):
 #  Example: see GEOM_TestOthers.py
 def UnionIDs(theGroup, theSubShapes):
     GroupOp.UnionIDs(theGroup, theSubShapes)
-    if GroupOp.IsDone() == 0:
-        print "UnionIDs : ", GroupOp.GetErrorCode()
+    RaiseIfFailed("UnionIDs", GroupOp)
 
 ## Removes from the group all the given shapes. No errors, if some shapes are not included.
 #  @param theGroup is a GEOM group from which the sub-shapes are removed.
@@ -2232,8 +2608,7 @@ def UnionIDs(theGroup, theSubShapes):
 #  Example: see GEOM_TestOthers.py
 def DifferenceList (theGroup, theSubShapes):
     GroupOp.DifferenceList(theGroup, theSubShapes)
-    if GroupOp.IsDone() == 0:
-      print "DifferenceList : ", GroupOp.GetErrorCode()
+    RaiseIfFailed("DifferenceList", GroupOp)
 
 ## Works like the above method, but argument
 #  theSubShapes here is a list of sub-shapes indices
@@ -2241,8 +2616,7 @@ def DifferenceList (theGroup, theSubShapes):
 #  Example: see GEOM_TestOthers.py
 def DifferenceIDs(theGroup, theSubShapes):
     GroupOp.DifferenceIDs(theGroup, theSubShapes)
-    if GroupOp.IsDone() == 0:
-        print "DifferenceIDs : ", GroupOp.GetErrorCode()
+    RaiseIfFailed("DifferenceIDs", GroupOp)
 
 ## Returns a list of sub objects ID stored in the group
 #  @param theGroup is a GEOM group for which a list of IDs is requested
@@ -2250,8 +2624,7 @@ def DifferenceIDs(theGroup, theSubShapes):
 #  Example: see GEOM_TestOthers.py
 def GetObjectIDs(theGroup):
     ListIDs = GroupOp.GetObjects(theGroup)
-    if GroupOp.IsDone() == 0:
-      print "GetObjectIDs : ", GroupOp.GetErrorCode()
+    RaiseIfFailed("GetObjects", GroupOp)
     return ListIDs
 
 ## Returns a type of sub objects stored in the group
@@ -2260,8 +2633,7 @@ def GetObjectIDs(theGroup):
 #  Example: see GEOM_TestOthers.py
 def GetType(theGroup):
     aType = GroupOp.GetType(theGroup)
-    if GroupOp.IsDone() == 0:
-      print "GetType : ", GroupOp.GetErrorCode()
+    RaiseIfFailed("GetType", GroupOp)
     return aType
 
 ## Returns a main shape associated with the group
@@ -2271,8 +2643,7 @@ def GetType(theGroup):
 #  Example: see GEOM_TestOthers.py
 def GetMainShape(theGroup):
     anObj = GroupOp.GetMainShape(theGroup)
-    if GroupOp.IsDone() == 0:
-      print "GetMainShape : ", GroupOp.GetErrorCode()
+    RaiseIfFailed("GetMainShape", GroupOp)
     return anObj
 
 ## Create group of edges of theShape, whose length is in range [min_length, max_length].