Salome HOME
NPAL 16548, 16820, 16218, 16547
[modules/geom.git] / src / GEOM_SWIG / geompy.py
index 119e2d9764c2f50d0f1f152a40471adeb1f39ace..aa985f00aa51b2a1726175e0724f8ba2d59db19c 100644 (file)
@@ -137,6 +137,13 @@ 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
 # -----------------------------------------------------------------------------
@@ -167,8 +174,7 @@ class info:
 #  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
@@ -182,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.
@@ -194,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.
@@ -204,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.
@@ -217,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.
@@ -229,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
@@ -242,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
@@ -254,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
@@ -268,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
@@ -282,8 +301,7 @@ 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.
@@ -294,8 +312,7 @@ def MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize):
 #  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.
@@ -307,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.
@@ -329,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
 
 # -----------------------------------------------------------------------------
@@ -346,8 +361,7 @@ 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.
@@ -359,8 +373,7 @@ def MakeArc(thePnt1, thePnt2, thePnt3):
 #  Example: see GEOM_TestAll.py
 def MakeArcCenter(thePnt1, thePnt2, thePnt3,theSense):
     anObj = CurvesOp.MakeArcCenter(thePnt1, thePnt2, thePnt3,theSense)
-    if CurvesOp.IsDone() == 0:
-      print "MakeArcCenter : ", CurvesOp.GetErrorCode()
+    RaiseIfFailed("MakeArcCenter", CurvesOp)
     return anObj
 
 ## Create a circle with given center, normal vector and radius.
@@ -372,8 +385,7 @@ def MakeArcCenter(thePnt1, thePnt2, thePnt3,theSense):
 #  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
@@ -383,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.
@@ -397,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.
@@ -408,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.
@@ -419,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.
@@ -430,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,
@@ -470,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,
@@ -483,8 +501,7 @@ def MakeSketcher(theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0]):
 #  @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
 
 # -----------------------------------------------------------------------------
@@ -510,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,
@@ -523,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.
@@ -537,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
@@ -551,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.
@@ -563,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.
@@ -585,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.
@@ -602,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
@@ -619,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.
@@ -633,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.
@@ -645,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.
@@ -658,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,
@@ -673,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
@@ -686,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
@@ -701,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.
@@ -715,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
@@ -733,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
 # -----------------------------------------------------------------------------
@@ -752,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.
@@ -763,8 +855,7 @@ 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.
@@ -776,8 +867,7 @@ 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.
@@ -789,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()
@@ -807,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.
@@ -818,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.
@@ -829,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.
@@ -840,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.
@@ -851,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.
@@ -862,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()
@@ -881,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.
@@ -894,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
@@ -911,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
@@ -920,8 +1000,7 @@ 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
@@ -938,8 +1017,7 @@ def GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState):
 #  Example: see GEOM_TestOthers.py
 def GetShapesOnPlaneWithLocation(theShape, theShapeType, theAx1, thePnt, theState):
     aList = ShapesOp.GetShapesOnPlaneWithLocation(theShape, theShapeType, theAx1, thePnt, theState)
-    if ShapesOp.IsDone() == 0:
-      print "GetShapesOnPlaneWithLocation : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("GetShapesOnPlaneWithLocation", ShapesOp)
     return aList
 
 ## Works like the above method, but returns list of sub-shapes indices
@@ -947,8 +1025,7 @@ def GetShapesOnPlaneWithLocation(theShape, theShapeType, theAx1, thePnt, theStat
 #  Example: see GEOM_TestOthers.py
 def GetShapesOnPlaneWithLocationIDs(theShape, theShapeType, theAx1, thePnt, theState):
     aList = ShapesOp.GetShapesOnPlaneWithLocationIDs(theShape, theShapeType, theAx1, thePnt, theState)
-    if ShapesOp.IsDone() == 0:
-        print "GetShapesOnPlaneWithLocationIDs : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("GetShapesOnPlaneWithLocationIDs", ShapesOp)
     return aList
 
 ## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
@@ -965,8 +1042,7 @@ def GetShapesOnPlaneWithLocationIDs(theShape, theShapeType, theAx1, thePnt, theS
 #  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
@@ -974,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
@@ -991,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
@@ -1000,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
@@ -1019,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
@@ -1028,8 +1100,7 @@ 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
@@ -1043,41 +1114,59 @@ def GetShapesOnQuadrangleIDs(theShape, theShapeType, theTopLeftPoint, theTopRigt
 #
 def GetShapesOnBox(theBox, theShape, theShapeType, theState):
     aList = ShapesOp.GetShapesOnBox(theBox, theShape, theShapeType, theState)
-    if ShapesOp.IsDone() == 0:
-      print "GetShapesOnBox : ", ShapesOp.GetErrorCode()
+    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)
-    if ShapesOp.IsDone() == 0:
-        print "GetShapesOnBoxIDs : ", ShapesOp.GetErrorCode()
+    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.
+#  @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)
-    if ShapesOp.IsDone() == 0:
-      print "GetSame : ", ShapesOp.GetErrorCode()
+    RaiseIfFailed("GetSame", ShapesOp)
     return anObj
 
 # -----------------------------------------------------------------------------
@@ -1097,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
 
 # -----------------------------------------------------------------------------
@@ -1113,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.
@@ -1123,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.
@@ -1136,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.
@@ -1147,8 +1232,7 @@ 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()
+    RaiseIfFailed("SubShapeAllIDs", ShapesOp)
     return ListIDs
 
 ## Obtain a compound of sub-shapes of <aShape>,
@@ -1193,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).
@@ -1206,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.
@@ -1226,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).
@@ -1239,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.
@@ -1252,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.
@@ -1267,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.
@@ -1284,8 +1362,7 @@ 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.
@@ -1293,16 +1370,14 @@ def DivideEdge(theObject, theEdgeIndex, theValue, isByParameter):
 #  @update given shape
 def ChangeOrientationShell(theObject):
     theObject = HealOp.ChangeOrientation(theObject)
-    if HealOp.IsDone() == 0:
-      print "ChangeOrientation : ", HealOp.GetErrorCode()
+    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)
-    if HealOp.IsDone() == 0:
-      print "ChangeOrientation : ", HealOp.GetErrorCode()
+    RaiseIfFailed("ChangeOrientationCopy", HealOp)
     return anObj
 
 ## Get a list of wires (wrapped in GEOM_Object-s),
@@ -1316,8 +1391,7 @@ def ChangeOrientationShellCopy(theObject):
 #  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
 
 # -----------------------------------------------------------------------------
@@ -1329,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.
@@ -1345,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)
 # -----------------------------------------------------------------------------
@@ -1375,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)
@@ -1410,6 +1514,10 @@ def MakeSection(s1, s2):
 #           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
@@ -1427,12 +1535,13 @@ def MakeSection(s1, s2):
 #
 #  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.
@@ -1447,23 +1556,27 @@ def MakePartition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=
 #
 #  @return New GEOM_Object, containing the result shapes.
 #
-def MakePartitionNonSelfIntersectedShape(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
-                  Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]):
+def MakePartitionNonSelfIntersectedShape(ListShapes, ListTools=[],
+                                         ListKeepInside=[], ListRemoveInside=[],
+                                         Limit=ShapeType["SHAPE"], RemoveWebs=0,
+                                         ListMaterials=[], KeepNonlimitShapes=0):
     anObj = BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
                                                         ListKeepInside, ListRemoveInside,
-                                                        Limit, RemoveWebs, ListMaterials);
-    if BoolOp.IsDone() == 0:
-      print "MakePartitionNonSelfIntersectedShape : ", BoolOp.GetErrorCode()
+                                                        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
@@ -1474,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
 
 # -----------------------------------------------------------------------------
@@ -1492,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
@@ -1505,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,
@@ -1518,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
@@ -1532,8 +1641,7 @@ 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
@@ -1547,8 +1655,7 @@ def MakeRotation(theObject, theAxis, theAngle):
 #  Example: see GEOM_TestAll.py
 def MakeRotationThreePoints(theObject, theCentPoint, thePoint1, thePoint2):
     anObj = TrsfOp.RotateThreePointsCopy(theObject, theCentPoint, thePoint1, thePoint2)
-    if TrsfOp.IsDone() == 0:
-      print "RotateThreePointsCopy : ", TrsfOp.GetErrorCode()
+    RaiseIfFailed("RotateThreePointsCopy", TrsfOp)
     return anObj
 
 ## Scale the given object by the factor, creating its copy before the scaling.
@@ -1560,8 +1667,7 @@ def MakeRotationThreePoints(theObject, theCentPoint, thePoint1, thePoint2):
 #  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
@@ -1573,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
@@ -1586,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
@@ -1599,8 +1703,7 @@ 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,
@@ -1617,8 +1720,7 @@ def MakeMirrorByPoint(theObject, thePoint):
 #  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.
@@ -1629,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
 
 # -----------------------------------------------------------------------------
@@ -1648,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.
@@ -1668,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.
@@ -1683,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
@@ -1704,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
@@ -1736,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
@@ -1753,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.
@@ -1767,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,
@@ -1783,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,
@@ -1801,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()
@@ -1828,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
 
 # -----------------------------------------------------------------------------
@@ -1842,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,
@@ -1857,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
@@ -1871,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.
@@ -1884,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.
@@ -1895,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]
@@ -1909,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)
@@ -1920,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.
@@ -1931,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.
@@ -1946,13 +2108,11 @@ 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
 
@@ -1971,8 +2131,7 @@ def CheckShape(theShape, theIsCheckGeom = 0):
 #  Example: see GEOM_TestMeasures.py
 def GetPosition(theShape):
     aTuple = MeasuOp.GetPosition(theShape)
-    if MeasuOp.IsDone() == 0:
-      print "GetPosition : ", MeasuOp.GetErrorCode()
+    RaiseIfFailed("GetPosition", MeasuOp)
     return aTuple
 
 ## Get kind of theShape.
@@ -2026,9 +2185,7 @@ def GetPosition(theShape):
 #  Example: see GEOM_TestMeasures.py
 def KindOfShape(theShape):
     aRoughTuple = MeasuOp.KindOfShape(theShape)
-    if MeasuOp.IsDone() == 0:
-        print "KindOfShape : ", MeasuOp.GetErrorCode()
-        return []
+    RaiseIfFailed("KindOfShape", MeasuOp)
 
     aKind  = aRoughTuple[0]
     anInts = aRoughTuple[1]
@@ -2059,8 +2216,7 @@ def KindOfShape(theShape):
 #  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
@@ -2090,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
 #
@@ -2123,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.
@@ -2135,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.
@@ -2147,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
@@ -2159,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.
@@ -2171,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.
@@ -2185,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.
@@ -2197,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.
@@ -2209,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.
@@ -2221,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.
@@ -2233,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.
@@ -2245,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.
@@ -2257,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.
@@ -2269,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.
@@ -2287,10 +2429,8 @@ 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
@@ -2304,8 +2444,7 @@ def CheckCompoundOfBlocks(theCompound):
 #  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.
@@ -2317,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.
@@ -2331,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.
@@ -2344,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.
@@ -2356,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.
@@ -2368,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.
@@ -2384,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.
@@ -2400,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.
@@ -2414,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
 
 # -----------------------------------------------------------------------------
@@ -2430,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
@@ -2442,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
@@ -2453,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.
@@ -2463,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
@@ -2472,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.
@@ -2482,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
@@ -2491,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
@@ -2500,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
@@ -2510,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
@@ -2521,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].