Salome HOME
bos #20215 Help panels into SALOME for new users
[modules/geom.git] / src / GEOM_SWIG / GEOM_TestOthers.py
index 4db5841a03f34dd6952e6f494f8c20dd6bdad194..c0766776395837922a584eb26e804b89a3656132 100644 (file)
@@ -1,5 +1,5 @@
 #  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2020  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -7,7 +7,7 @@
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 # License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# version 2.1 of the License, or (at your option) any later version.
 #
 # This library is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -23,7 +23,6 @@
 #  File   : GEOM_TestOthers.py
 #  Author : Julia DOROVSKIKH
 #  Module : GEOM
-#  $Header$
 #
 # ! Please, if you edit this example file, update also
 # ! GEOM_SRC/doc/salome/gui/GEOM/input/tui_test_others.doc
 # ! documentation generation to identify certain places of this file
 
 import os
+import GEOM
 
 def TestExportImport (geompy, shape):
 
-  print "Test Export/Import ...",
+  print("Test Export/Import ...", end=' ')
 
   tmpDir = os.getenv("TEMP")
   if tmpDir == None:
@@ -78,16 +78,25 @@ def TestExportImport (geompy, shape):
   # Import
   Import = geompy.ImportFile(fileExportImport, "BREP")
 
-  id_Import = geompy.addToStudy(Import, "Import")
+  geompy.addToStudy(Import, "Import")
 
   # ImportBREP, ImportIGES, ImportSTEP
   ImportBREP = geompy.ImportBREP(fileExportImportBREP)
   ImportIGES = geompy.ImportIGES(fileExportImportIGES)
   ImportSTEP = geompy.ImportSTEP(fileExportImportSTEP)
 
-  id_ImportBREP = geompy.addToStudy(ImportBREP, "ImportBREP")
-  id_ImportIGES = geompy.addToStudy(ImportIGES, "ImportIGES")
-  id_ImportSTEP = geompy.addToStudy(ImportSTEP, "ImportSTEP")
+  geompy.addToStudy(ImportBREP, "ImportBREP")
+  geompy.addToStudy(ImportIGES, "ImportIGES")
+  geompy.addToStudy(ImportSTEP, "ImportSTEP")
+
+  # GetIGESUnit and GetSTEPUnit
+  if geompy.GetIGESUnit(fileExportImportIGES) != "M":
+    ImportIGES_scaled = geompy.ImportIGES(fileExportImportIGES, True)
+    geompy.addToStudy(ImportIGES_scaled, "ImportIGES_scaled")
+
+  if geompy.GetSTEPUnit(fileExportImportSTEP) != "M":
+    ImportSTEP_scaled = geompy.ImportSTEP(fileExportImportSTEP, True)
+    geompy.addToStudy(ImportSTEP_scaled, "ImportSTEP_scaled")
 
   # Remove files for Export/Import testing
   os.remove(fileExportImport)
@@ -100,7 +109,7 @@ def TestExportImport (geompy, shape):
   aNewShape = geompy.RestoreShape(aStream)
   geompy.addToStudy(aNewShape, "aNewShape")
 
-  print "OK"
+  print("OK")
 
 
 def TestOtherOperations (geompy, math):
@@ -154,17 +163,29 @@ def TestOtherOperations (geompy, math):
   id_Orientation = geompy.addToStudy(Orientation, "OrientationChange")
 
   # MakeCommon, MakeCut, MakeFuse, MakeSection
+  p1 = geompy.MakeVertex(60, 120, 0)
+  p2 = geompy.MakeVertex( 0,  0, 0)
+  v = geompy.MakeVector(p1, p2)
+  height = 90
+  radius1 = 50
+  cylinder = geompy.MakeCylinder(p1, v, radius1, height)
   Sphere = geompy.MakeSphereR(100)
 
-  Common  = geompy.MakeCommon (Box, Sphere)
-  Cut     = geompy.MakeCut    (Box, Sphere)
-  Fuse    = geompy.MakeFuse   (Box, Sphere)
-  Section = geompy.MakeSection(Box, Sphere)
-
-  id_Common  = geompy.addToStudy(Common,  "Common")
-  id_Cut     = geompy.addToStudy(Cut,     "Cut")
-  id_Fuse    = geompy.addToStudy(Fuse,    "Fuse")
+  Common1 = geompy.MakeCommon    (Box, Sphere)
+  Cut1    = geompy.MakeCut       (Box, Sphere)
+  Fuse1   = geompy.MakeFuse      (Box, Sphere)
+  Section = geompy.MakeSection   (Box, Sphere)
+  Common2 = geompy.MakeCommonList([Box, Sphere, cylinder])
+  Cut2    = geompy.MakeCutList   (Box, [Sphere, cylinder])
+  Fuse2   = geompy.MakeFuseList  ([Box, Sphere, cylinder])
+
+  id_Common1 = geompy.addToStudy(Common1,  "Common_1")
+  id_Cut1    = geompy.addToStudy(Cut1,     "Cut_1")
+  id_Fuse1   = geompy.addToStudy(Fuse1,    "Fuse_1")
   id_Section = geompy.addToStudy(Section, "Section")
+  id_Common2 = geompy.addToStudy(Common2,  "Common_2")
+  id_Cut2    = geompy.addToStudy(Cut2,     "Cut_2")
+  id_Fuse2   = geompy.addToStudy(Fuse2,    "Fuse_2")
 
   # Partition
   p100 = geompy.MakeVertex(100, 100, 100)
@@ -178,11 +199,16 @@ def TestOtherOperations (geompy, math):
   pz = geompy.MakeVertex(0, 0, 100)
   vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
 
-  MultiRot1D = geompy.MakeMultiRotation1D(f12, vy, pz, 6)
-  MultiRot2D = geompy.MakeMultiRotation2D(f12, vy, pz, 45, 6, 30, 3)
+  MultiRot1Dt = geompy.MakeMultiRotation1DNbTimes(f12, vy, pz, 6)
+  MultiRot1Ds = geompy.MakeMultiRotation1DByStep(f12, vy, pz, math.pi/5., 6)
+
+  MultiRot2Dt = geompy.MakeMultiRotation2DNbTimes(f12, vy, pz, 5, 30, 3)
+  MultiRot2Ds = geompy.MakeMultiRotation2DByStep(f12, vy, pz, math.pi/4., 6, 30, 3)
 
-  id_MultiRot1D = geompy.addToStudy(MultiRot1D, "MakeMultiRotation1D")
-  id_MultiRot2D = geompy.addToStudy(MultiRot2D, "MakeMultiRotation2D")
+  geompy.addToStudy(MultiRot1Dt, "MakeMultiRotation1DNbTimes")
+  geompy.addToStudy(MultiRot1Ds, "MakeMultiRotation1DByStep")
+  geompy.addToStudy(MultiRot2Dt, "MakeMultiRotation2DNbTimes")
+  id_MultiRot2D = geompy.addToStudy(MultiRot2Ds, "MakeMultiRotation2DByStep")
 
   # MakeFilletAll
   radius_fillet = 10.
@@ -213,19 +239,19 @@ def TestOtherOperations (geompy, math):
   # NumberOf
   NumberOfFaces = geompy.NumberOfFaces(Box)
   if NumberOfFaces != 6:
-    print "Bad number of faces in BOX!"
+    print("Bad number of faces in BOX!")
 
   NumberOfEdges = geompy.NumberOfEdges(Box)
   if NumberOfEdges != 12:
-    print "Bad number of edges in BOX!"
+    print("Bad number of edges in BOX!")
 
   NumberOfSolids = geompy.NumberOfSolids(Box)
   if NumberOfSolids != 1:
-    print "Bad number of solids in BOX!"
+    print("Bad number of solids in BOX!")
 
   NumberOfShapes = geompy.NumberOfSubShapes(Box, geompy.ShapeType["SHAPE"])
   if NumberOfShapes != 34:
-    print "Bad number of shapes in BOX!"
+    print("Bad number of shapes in BOX!")
 
   # MakeBlockExplode
   Compound = geompy.MakeCompound([Box, Sphere])
@@ -248,20 +274,20 @@ def TestOtherOperations (geompy, math):
 
   IsValid = geompy.CheckCompoundOfBlocks(Compound1)
   if IsValid == 0:
-    print "The Blocks Compound is NOT VALID"
+    print("The Blocks Compound is NOT VALID")
     (NonBlocks, NonQuads) = geompy.GetNonBlocks(Compound1)
     if NonBlocks is not None:
       geompy.addToStudyInFather(Compound1, NonBlocks, "Group of non-hexahedral solids")
     if NonQuads is not None:
       geompy.addToStudyInFather(Compound1, NonQuads, "Group of non-quadrangular faces")
   else:
-    print "The Blocks Compound is VALID"
+    print("The Blocks Compound is VALID")
 
   IsValid = geompy.CheckCompoundOfBlocks(Box)
   if IsValid == 0:
-    print "The Box is NOT VALID"
+    print("The Box is NOT VALID")
   else:
-    print "The Box is VALID"
+    print("The Box is VALID")
 
   # GetSame
   Cone_ss = geompy.GetSame(Compound1, Cone)
@@ -299,10 +325,10 @@ def TestOtherOperations (geompy, math):
   # GetObjectIDs
   GetObjectIDs = geompy.GetObjectIDs(CreateGroup)
 
-  print "Group of Box's faces includes the following IDs:"
-  print "(must be ", f_ind_6, ", ", f_ind_3, " and ", f_ind_5, ")"
+  print("Group of Box's faces includes the following IDs:")
+  print("(must be ", f_ind_6, ", ", f_ind_3, " and ", f_ind_5, ")")
   for ObjectID in GetObjectIDs:
-    print " ", ObjectID
+    print(" ", ObjectID)
 
   # GetMainShape
   BoxCopy = geompy.GetMainShape(CreateGroup)
@@ -317,10 +343,10 @@ def TestOtherOperations (geompy, math):
 
   # Check
   GetObjectIDs = geompy.GetObjectIDs(CreateGroup)
-  print "Group of Box's faces includes the following IDs:"
-  print "(must be ", f_ind_6, ", ", f_ind_1, " and ", f_ind_2, ")"
+  print("Group of Box's faces includes the following IDs:")
+  print("(must be ", f_ind_6, ", ", f_ind_1, " and ", f_ind_2, ")")
   for ObjectID in GetObjectIDs:
-    print " ", ObjectID
+    print(" ", ObjectID)
 
   # Boolean Operations on Groups (Union, Intersection, Cut)
   Group_1 = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
@@ -365,7 +391,7 @@ def TestOtherOperations (geompy, math):
                      '4':"FACE", '5':"WIRE", '6':"EDGE", '7':"VERTEX", '8':"SHAPE"}
 
   GroupType = geompy.GetType(CreateGroup)
-  print "Type of elements of the created group is ", ShapeTypeString[`GroupType`]
+  print("Type of elements of the created group is ", ShapeTypeString[repr(GroupType)])
 
   # Prepare data for the following operations
   p0 = geompy.MakeVertex(0, 0, 0)
@@ -514,12 +540,17 @@ def TestOtherOperations (geompy, math):
 
   geompy.addToStudy(freeFacesWithoutExtra, "freeFacesWithoutExtra")
 
+  # UnionFaces
+  unitedFaces = geompy.UnionFaces(freeFaces)
+
+  geompy.addToStudy(unitedFaces, "unitedFaces")
+
   # GetSharedShapes
   sharedFaces = geompy.GetSharedShapes(part, freeFaces,
                                        geompy.ShapeType["FACE"])
   ind = 1
   for shFace in sharedFaces:
-    geompy.addToStudy(shFace, "sharedFace_" + `ind`)
+    geompy.addToStudy(shFace, "sharedFace_" + repr(ind))
     ind = ind + 1
     pass
 
@@ -527,10 +558,22 @@ def TestOtherOperations (geompy, math):
                                              geompy.ShapeType["EDGE"])
   ind = 1
   for shEdge in sharedEdges:
-    geompy.addToStudy(shEdge, "sharedEdge_" + `ind`)
+    geompy.addToStudy(shEdge, "sharedEdge_" + repr(ind))
     ind = ind + 1
     pass
 
+  # TransferData
+  path = os.getenv("DATA_DIR")
+  fileName = path + "/Shapes/Step/black_and_white.step"
+  blackWhite = geompy.ImportSTEP(fileName)
+  blackWhiteCopy = geompy.MakeCopy(blackWhite[0])
+  subBlackWhite = geompy.SubShapeAll(blackWhiteCopy, GEOM.SOLID)
+  geompy.TransferData(blackWhite[0], blackWhiteCopy)
+  geompy.addToStudy(blackWhite[0], "blackWhite")
+  geompy.addToStudy(blackWhiteCopy, "blackWhiteCopy")
+  geompy.addToStudyInFather( blackWhiteCopy, subBlackWhite[0], "" )
+  geompy.addToStudyInFather( blackWhiteCopy, subBlackWhite[1], "" )
+
   # CheckAndImprove
   blocksComp = geompy.CheckAndImprove(part)
 
@@ -585,13 +628,13 @@ def TestOtherOperations (geompy, math):
 
   # GetShapesOnPlane
   faces_on_pln = geompy.GetShapesOnPlane(blocksComp, geompy.ShapeType["FACE"],
-                                         v_0pp, geompy.GEOM.ST_ONIN)
+                                         v_0pp, GEOM.ST_ONIN)
   for face_i in faces_on_pln:
     geompy.addToStudy(face_i, "Face on Plane (N = (0, 1, 1)) or below it")
 
   # GetShapesOnPlaneIDs
   faces_above_pln_ids = geompy.GetShapesOnPlaneIDs(blocksComp, geompy.ShapeType["FACE"],
-                                                   v_0pp, geompy.GEOM.ST_OUT)
+                                                   v_0pp, GEOM.ST_OUT)
   faces_above = geompy.CreateGroup(blocksComp, geompy.ShapeType["FACE"])
   geompy.UnionIDs(faces_above, faces_above_pln_ids)
   geompy.addToStudy(faces_above, "Group of faces above Plane (N = (0, 1, 1))")
@@ -599,13 +642,13 @@ def TestOtherOperations (geompy, math):
   # GetShapesOnPlaneWithLocation
   Loc = geompy.MakeVertex(0, -50, 0)
   edges_on_pln = geompy.GetShapesOnPlaneWithLocation(blocksComp, geompy.ShapeType["EDGE"],
-                                                     v_y, Loc, geompy.GEOM.ST_ON)
+                                                     v_y, Loc, GEOM.ST_ON)
   for edge_i in edges_on_pln:
     geompy.addToStudy(edge_i, "Edge on Plane (N = (0, -1, 0) & Location = (0, -50, 0)")
 
   # GetShapesOnPlaneWithLocationIDs
   edges_on_pln_ids = geompy.GetShapesOnPlaneWithLocationIDs(
-           blocksComp, geompy.ShapeType["EDGE"], v_y, Loc, geompy.GEOM.ST_ON)
+           blocksComp, geompy.ShapeType["EDGE"], v_y, Loc, GEOM.ST_ON)
   group_edges_on_pln = geompy.CreateGroup(blocksComp, geompy.ShapeType["EDGE"])
   geompy.UnionIDs(group_edges_on_pln, edges_on_pln_ids)
   grname = "Group of edges on Plane (N = (0, -1, 0) & Location = (0, -50, 0))"
@@ -613,39 +656,39 @@ def TestOtherOperations (geompy, math):
 
   # GetShapesOnCylinder
   edges_out_cyl = geompy.GetShapesOnCylinder(blocksComp, geompy.ShapeType["EDGE"],
-                                             vy, 55, geompy.GEOM.ST_OUT)
+                                             vy, 55, GEOM.ST_OUT)
   for edge_i in edges_out_cyl:
     geompy.addToStudy(edge_i, "Edge out of Cylinder (axis = (0, 1, 0), r = 55)")
 
   # GetShapesOnCylinderIDs
   edges_in_cyl_ids = geompy.GetShapesOnCylinderIDs(blocksComp, geompy.ShapeType["EDGE"],
-                                                   vy, 80, geompy.GEOM.ST_IN)
+                                                   vy, 80, GEOM.ST_IN)
   edges_in = geompy.CreateGroup(blocksComp, geompy.ShapeType["EDGE"])
   geompy.UnionIDs(edges_in, edges_in_cyl_ids)
   geompy.addToStudy(edges_in, "Group of edges inside Cylinder (axis = (0, 1, 0), r = 55)")
 
   # GetShapesOnCylinderWithLocation
   edges_out_cyl = geompy.GetShapesOnCylinderWithLocation(blocksComp, geompy.ShapeType["EDGE"],
-                                                         vy, p11, 55, geompy.GEOM.ST_OUT)
+                                                         vy, p11, 55, GEOM.ST_OUT)
   for edge_i in edges_out_cyl:
     geompy.addToStudy(edge_i, "Edge out of Cylinder (axis = (0, 1, 0),  loc = (0, 0, 0), r = 55)")
 
   # GetShapesOnCylinderWithLocationIDs
   edges_in_cyl_ids = geompy.GetShapesOnCylinderWithLocationIDs(blocksComp, geompy.ShapeType["EDGE"],
-                                                               vy, p11, 80, geompy.GEOM.ST_IN)
+                                                               vy, p11, 80, GEOM.ST_IN)
   edges_in = geompy.CreateGroup(blocksComp, geompy.ShapeType["EDGE"])
   geompy.UnionIDs(edges_in, edges_in_cyl_ids)
   geompy.addToStudy(edges_in, "Group of edges inside Cylinder (axis = (0, 1, 0), loc = (0, 0, 0), r = 80)")
 
   # GetShapesOnSphere
   vertices_on_sph = geompy.GetShapesOnSphere(blocksComp, geompy.ShapeType["VERTEX"],
-                                             p0, 100, geompy.GEOM.ST_ON)
+                                             p0, 100, GEOM.ST_ON)
   for vertex_i in vertices_on_sph:
     geompy.addToStudy(vertex_i, "Vertex on Sphere (center = (0, 0, 0), r = 100)")
 
   # GetShapesOnSphereIDs
   vertices_on_sph_ids = geompy.GetShapesOnSphereIDs(blocksComp, geompy.ShapeType["VERTEX"],
-                                                    p0, 100, geompy.GEOM.ST_ON)
+                                                    p0, 100, GEOM.ST_ON)
   vertices_on = geompy.CreateGroup(blocksComp, geompy.ShapeType["VERTEX"])
   geompy.UnionIDs(vertices_on, vertices_on_sph_ids)
   geompy.addToStudy(vertices_on, "Group of vertices on Sphere (center = (0, 0, 0), r = 100)")
@@ -666,30 +709,30 @@ def TestOtherOperations (geompy, math):
   geompy.addToStudy(quadrangle, "Quadrangle")
 
   edges_onin_quad = geompy.GetShapesOnQuadrangle(f12, geompy.ShapeType["EDGE"],
-                                                 tl, tr, bl, br, geompy.GEOM.ST_ONIN)
+                                                 tl, tr, bl, br, GEOM.ST_ONIN)
   comp = geompy.MakeCompound(edges_onin_quad)
   geompy.addToStudy(comp, "Edges of F12 ONIN Quadrangle")
   if len( edges_onin_quad ) != 4:
-    print "Error in GetShapesOnQuadrangle()"
+    print("Error in GetShapesOnQuadrangle()")
 
   # GetShapesOnQuadrangleIDs
   vertices_on_quad_ids = geompy.GetShapesOnQuadrangleIDs(f12, geompy.ShapeType["VERTEX"],
-                                                         tl, tr, bl, br, geompy.GEOM.ST_ON)
+                                                         tl, tr, bl, br, GEOM.ST_ON)
   vertices_on_quad = geompy.CreateGroup(f12, geompy.ShapeType["VERTEX"])
   geompy.UnionIDs(vertices_on_quad, vertices_on_quad_ids)
   geompy.addToStudy(vertices_on_quad, "Group of vertices on Quadrangle F12")
 
   # GetShapesOnBox
   edges_on_box = geompy.GetShapesOnBox(b0, part, geompy.ShapeType["EDGE"],
-                                       geompy.GEOM.ST_ON)
+                                       GEOM.ST_ON)
   comp = geompy.MakeCompound(edges_on_box)
   geompy.addToStudy(comp, "Edges of part ON box b0")
   if len( edges_on_box ) != 12:
-    print "Error in GetShapesOnBox()"
+    print("Error in GetShapesOnBox()")
 
   # GetShapesOnBoxIDs
   faces_on_box_ids = geompy.GetShapesOnBoxIDs(b0, part, geompy.ShapeType["FACE"],
-                                              geompy.GEOM.ST_ON)
+                                              GEOM.ST_ON)
   faces_on_box = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
   geompy.UnionIDs(faces_on_box, faces_on_box_ids)
   geompy.addToStudyInFather(part, faces_on_box, "Group of faces on box b0")
@@ -699,34 +742,33 @@ def TestOtherOperations (geompy, math):
   sph2 = geompy.MakeSphere(50, 50, -50, 40)
   pcyl = geompy.MakeVertex(50, 50, -50)
   cyli = geompy.MakeCylinder(pcyl, vz, 40, 100)
-  fuse = geompy.MakeFuse(sph1, cyli)
-  sh_1 = geompy.MakeFuse(fuse, sph2)
+  sh_1 = geompy.MakeFuseList([sph1, cyli, sph2])
   # As after Fuse we have a compound, we need to obtain a solid from it
-  #shsh = geompy.SubShapeAll(fuse, geompy.ShapeType["SOLID"])
+  #shsh = geompy.SubShapeAll(sh_1, geompy.ShapeType["SOLID"])
   #sh_1 = shsh[0]
   geompy.addToStudy(sh_1, "sh_1")
 
   # GetShapesOnShape
   faces_in_sh = geompy.GetShapesOnShape(sh_1, part, geompy.ShapeType["FACE"],
-                                        geompy.GEOM.ST_IN)
+                                        GEOM.ST_IN)
   comp = geompy.MakeCompound(faces_in_sh)
   geompy.addToStudy(comp, "Faces of part IN shape sh_1")
   if len(faces_in_sh) != 11:
-    print "Error in GetShapesOnShape()"
+    print("Error in GetShapesOnShape()")
 
   # GetShapesOnShapeAsCompound
   faces_in_sh_c = geompy.GetShapesOnShapeAsCompound(sh_1, part, geompy.ShapeType["FACE"],
-                                                    geompy.GEOM.ST_IN)
+                                                    GEOM.ST_IN)
   geompy.addToStudy(faces_in_sh_c, "Faces of part IN shape sh_1 (as compound)")
 
   # GetShapesOnShapeIDs
   edges_in_sh_ids = geompy.GetShapesOnShapeIDs(sh_1, part, geompy.ShapeType["EDGE"],
-                                               geompy.GEOM.ST_IN)
+                                               GEOM.ST_IN)
   edges_in_sh = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
   geompy.UnionIDs(edges_in_sh, edges_in_sh_ids)
   geompy.addToStudyInFather(part, edges_in_sh, "Group of edges in shape sh_1")
   if len(edges_in_sh_ids) != 15:
-    print "Error in GetShapesOnShapeIDs()"
+    print("Error in GetShapesOnShapeIDs()")
 
   # Prepare arguments for GetInPlace and GetInPlaceByHistory
   box5 = geompy.MakeBoxDXDYDZ(100, 100, 100)
@@ -742,8 +784,8 @@ def TestOtherOperations (geompy, math):
   box6_faces = geompy.SubShapeAll(box6, geompy.ShapeType["FACE"])
 
   for ifa in range(6):
-    geompy.addToStudyInFather(box5, box5_faces[ifa], "Face" + `ifa + 1`)
-    geompy.addToStudyInFather(box6, box6_faces[ifa], "Face" + `ifa + 1`)
+    geompy.addToStudyInFather(box5, box5_faces[ifa], "Face" + repr(ifa + 1))
+    geompy.addToStudyInFather(box6, box6_faces[ifa], "Face" + repr(ifa + 1))
 
   # GetInPlace(theShapeWhere, theShapeWhat)
   ibb = 5
@@ -757,10 +799,10 @@ def TestOtherOperations (geompy, math):
         # there is no reflection in the result.
         if refl_box_face is not None:
           error = "Result of GetInPlace must be NULL for face "
-          error += `ifa` + " of box " + `ibb`
-          raise RuntimeError, error
+          error += repr(ifa) + " of box " + repr(ibb)
+          raise RuntimeError(error)
       else:
-        ssname = "Reflection of face " + `ifa` + " of box " + `ibb`
+        ssname = "Reflection of face " + repr(ifa) + " of box " + repr(ibb)
         geompy.addToStudyInFather(part, refl_box_face, ssname)
       ifa = ifa + 1
     ibb = ibb + 1
@@ -774,15 +816,15 @@ def TestOtherOperations (geompy, math):
   for afaces in faces_list:
     ifa = 1
     for aface in afaces:
-      ssname = "Reflection of face " + `ifa` + " of box " + `ibb` + " (by history)"
+      ssname = "Reflection of face " + repr(ifa) + " of box " + repr(ibb) + " (by history)"
       if ibb == 6 and (ifa == 2 or ifa == 4):
-        # use IDL interface directly to avoid error message appearence in Python console
+        # use IDL interface directly to avoid error message appearance in Python console
         refl_box_face = geompy.ShapesOp.GetInPlaceByHistory(part, aface)
         if refl_box_face is not None:
           geompy.addToStudyInFather(part, refl_box_face, ssname)
           error = "Result of GetInPlaceByHistory must be NULL for face "
-          error += `ifa` + " of box " + `ibb`
-          raise RuntimeError, error
+          error += repr(ifa) + " of box " + repr(ibb)
+          raise RuntimeError(error)
       else:
         # use geompy interface
         refl_box_face = geompy.GetInPlaceByHistory(part, aface)