]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
PAL7426: geompy.py updated in accordance with GEOM_Gen.idl
authorjfa <jfa@opencascade.com>
Tue, 11 Jan 2005 11:05:11 +0000 (11:05 +0000)
committerjfa <jfa@opencascade.com>
Tue, 11 Jan 2005 11:05:11 +0000 (11:05 +0000)
src/GEOM_SWIG/GEOM_Spanner.py
src/GEOM_SWIG/GEOM_TestAll.py
src/GEOM_SWIG/GEOM_TestOthers.py
src/GEOM_SWIG/batchmode_geompy.py
src/GEOM_SWIG/geompy.py

index fd08520ac6796633d64371a1b4c052a0f16e2f61..cc336a7b441d64181c71b84f83641700a1934530 100644 (file)
 #  Module : GEOM
 #  $Header$
 
-def GetFaceNearPoint (geompy, block, pnt):
-  anObj = geompy.BlocksOp.GetFaceNearPoint(block, pnt)
-  if anObj is None:
-    print "GetFaceNearPoint : ", geompy.BlocksOp.GetErrorCode()
-  return anObj
-
-def GetOppositeFace (geompy, block, face):
-  anObj = geompy.BlocksOp.GetOppositeFace(block, face)
-  if anObj is None:
-    print "GetOppositeFace : ", geompy.BlocksOp.GetErrorCode()
-  return anObj
-
-def GetFaceByNormale (geompy, block, vec):
-  anObj = geompy.BlocksOp.GetFaceByNormale(block, vec)
-  if anObj is None:
-    print "GetFaceByNormale : ", geompy.BlocksOp.GetErrorCode()
-  return anObj
-
-def GetBlockNearPoint (geompy, comp, pnt):
-  anObj = geompy.BlocksOp.GetBlockNearPoint(comp, pnt)
-  if anObj is None:
-    print "GetBlockNearPoint : ", geompy.BlocksOp.GetErrorCode()
-  return anObj
-
 ############# MakeSpanner #############
 
 def MakeSpanner (salome, geompy, math, isBlocksTest = 0, isMeshTest = 0, smesh = None, hasGUI = 0):
@@ -96,9 +72,7 @@ def MakeSpanner (salome, geompy, math, isBlocksTest = 0, isMeshTest = 0, smesh =
   Edge21 = geompy.MakeEdge(p_15_0, p_15_20)
   id_edge21 = geompy.addToStudy(Edge21, "1 Edge for Block 2")
 
-  Edge22 = BlocksOp.GetEdge(Block1, p_10_0, p_10_25)
-  if Edge22 is None:
-    print "BlocksOp.GetEdge(Block1, p_10_0, p_10_25) : ", BlocksOp.GetErrorCode()
+  Edge22 = geompy.GetEdge(Block1, p_10_0, p_10_25)
   id_edge22 = geompy.addToStudy(Edge22, "2 Edge for Block 2")
 
   Face21 = geompy.MakeQuad2Edges(Edge21, Edge22);
@@ -114,7 +88,7 @@ def MakeSpanner (salome, geompy, math, isBlocksTest = 0, isMeshTest = 0, smesh =
 
   p_15_10_1 = geompy.MakeVertex(15., 10., 1.)
 
-  Face31 = GetFaceNearPoint(geompy, Block2, p_15_10_1)
+  Face31 = geompy.GetFaceNearPoint(Block2, p_15_10_1)
   id_face31 = geompy.addToStudy(Face31, "1 Face for Block 3")
 
   Prism1 = geompy.MakePrismVecH(Face31, vx, 5);
@@ -140,7 +114,7 @@ def MakeSpanner (salome, geompy, math, isBlocksTest = 0, isMeshTest = 0, smesh =
 
   ### Block 4 ###
 
-  Face41 = GetOppositeFace(geompy, Block3, Face31)
+  Face41 = geompy.GetOppositeFace(Block3, Face31)
   id_face41 = geompy.addToStudy(Face41, "1 Face for Block 4")
 
   p_25_5  = geompy.MakeVertex(25.,  5., 0.)
@@ -222,7 +196,7 @@ def MakeSpanner (salome, geompy, math, isBlocksTest = 0, isMeshTest = 0, smesh =
 
   p_30_0_1 = geompy.MakeVertex(30., 0., 1.)
 
-  Face2s = GetFaceNearPoint(geompy, Block1s, p_30_0_1)
+  Face2s = geompy.GetFaceNearPoint(Block1s, p_30_0_1)
   id_face2s = geompy.addToStudy(Face2s, "2 Face of Block 1s")
 
   f2s_ind = geompy.LocalOp.GetSubShapeIndex(Block1s, Face2s)
@@ -241,10 +215,10 @@ def MakeSpanner (salome, geompy, math, isBlocksTest = 0, isMeshTest = 0, smesh =
   p_55_0_1 = geompy.MakeVertex(55., 0., 1.)
   p_55_110_1 = geompy.MakeVertex(55., -110., 1.)
 
-  Face11l = GetFaceNearPoint(geompy, Block5, p_55_0_1)
+  Face11l = geompy.GetFaceNearPoint(Block5, p_55_0_1)
   id_face11l = geompy.addToStudy(Face11l, "1 Face for Linking Block 1")
 
-  Face12l = GetFaceNearPoint(geompy, Gear, p_55_110_1)
+  Face12l = geompy.GetFaceNearPoint(Gear, p_55_110_1)
   id_face12l = geompy.addToStudy(Face12l, "2 Face for Linking Block 1")
 
   Block1l = geompy.MakeHexa2Faces(Face11l, Face12l)
@@ -255,10 +229,10 @@ def MakeSpanner (salome, geompy, math, isBlocksTest = 0, isMeshTest = 0, smesh =
   p_25_0_1 = geompy.MakeVertex(25., 0., 1.)
   p_45_110_1 = geompy.MakeVertex(45., -110., 1.)
 
-  Face21l = GetFaceNearPoint(geompy, Block4, p_25_0_1)
+  Face21l = geompy.GetFaceNearPoint(Block4, p_25_0_1)
   id_face21l = geompy.addToStudy(Face21l, "1 Face for Linking Block 2")
 
-  Face22l = GetFaceNearPoint(geompy, Gear, p_45_110_1)
+  Face22l = geompy.GetFaceNearPoint(Gear, p_45_110_1)
   id_face22l = geompy.addToStudy(Face22l, "2 Face for Linking Block 2")
 
   Block2l = geompy.MakeHexa2Faces(Face21l, Face22l)
@@ -269,10 +243,10 @@ def MakeSpanner (salome, geompy, math, isBlocksTest = 0, isMeshTest = 0, smesh =
   p_55_30_1 = geompy.MakeVertex(55., 30., 1.)
   p_65_110_1 = geompy.MakeVertex(65., -110., 1.)
 
-  Face31l = GetFaceNearPoint(geompy, Mirror1, p_55_30_1)
+  Face31l = geompy.GetFaceNearPoint(Mirror1, p_55_30_1)
   id_face31l = geompy.addToStudy(Face31l, "1 Face for Linking Block 3")
 
-  Face32l = GetFaceNearPoint(geompy, Gear, p_65_110_1)
+  Face32l = geompy.GetFaceNearPoint(Gear, p_65_110_1)
   id_face32l = geompy.addToStudy(Face32l, "2 Face for Linking Block 3")
 
   Block3l = geompy.MakeHexa2Faces(Face31l, Face32l)
@@ -284,22 +258,22 @@ def MakeSpanner (salome, geompy, math, isBlocksTest = 0, isMeshTest = 0, smesh =
   Handle = geompy.MakeGlueFaces(CompLB, 1e-5)
   id_handle = geompy.addToStudy(Handle, "Handle")
 
-  Block1h = GetBlockNearPoint(geompy, Handle, p_45_110_1)
+  Block1h = geompy.GetBlockNearPoint(Handle, p_45_110_1)
   id_block1h = geompy.addToStudyInFather(Handle, Block1h, "Block 1 of Handle")
 
-  Block2h = GetBlockNearPoint(geompy, Handle, p_65_110_1)
+  Block2h = geompy.GetBlockNearPoint(Handle, p_65_110_1)
   id_block2h = geompy.addToStudyInFather(Handle, Block2h, "Block 2 of Handle")
 
-  Face11h = GetFaceByNormale(geompy, Block1h, vx)
+  Face11h = geompy.GetFaceByNormale(Block1h, vx)
   id_face11h = geompy.addToStudyInFather(Block1h, Face11h, "Face 1")
 
-  Face12h = GetOppositeFace(geompy, Block1h, Face11h)
+  Face12h = geompy.GetOppositeFace(Block1h, Face11h)
   id_face12h = geompy.addToStudyInFather(Block1h, Face12h, "Face 2")
 
-  Face21h = GetFaceByNormale(geompy, Block2h, vx)
+  Face21h = geompy.GetFaceByNormale(Block2h, vx)
   id_face21h = geompy.addToStudyInFather(Block2h, Face21h, "Face 1")
 
-  Face22h = GetOppositeFace(geompy, Block2h, Face21h)
+  Face22h = geompy.GetOppositeFace(Block2h, Face21h)
   id_face22h = geompy.addToStudyInFather(Block2h, Face22h, "Face 2")
 
   Block3h = BlocksOp.GetBlockByParts(Handle, [Face11h, Face21h])
@@ -322,7 +296,7 @@ def MakeSpanner (salome, geompy, math, isBlocksTest = 0, isMeshTest = 0, smesh =
 
   ### Check the Spanner ###
 
-  isCompOfBlocks6 = BlocksOp.IsCompoundOfBlocks(Spanner, 6, 6)
+  isCompOfBlocks6 = BlocksOp.CheckCompoundOfBlocks(Spanner)
   if isCompOfBlocks6 == 0:
     print "Spanner is not a compound of hexahedral solids"
   else:
@@ -334,14 +308,12 @@ def MakeSpanner (salome, geompy, math, isBlocksTest = 0, isMeshTest = 0, smesh =
 
     ### Get Blocks 4 and 5 from the spanner ###
 
-    Face42_sp = BlocksOp.GetFaceByEdges(Spanner, Edge41, Edge42)
-    if Face42_sp is None:
-      print "BlocksOp.GetFaceByEdges(Spanner, Edge41, Edge42) : ", BlocksOp.GetErrorCode()
+    Face42_sp = geompy.GetFaceByEdges(Spanner, Edge41, Edge42)
     id_face42_sp = geompy.addToStudyInFather(Spanner, Face42_sp, "Face 4_2")
 
-    Blocks_f4_sp = BlocksOp.GetBlocksByParts(Spanner, [Face42_sp])
-    if Blocks_f4_sp is None:
-      print "BlocksOp.GetBlocksByParts() : ", BlocksOp.GetErrorCode()
+    Blocks_f4_sp = geompy.GetBlocksByParts(Spanner, [Face42_sp])
+
+    isMRot2D = 0
 
     for aBlock in Blocks_f4_sp:
       name = geompy.SubShapeName(aBlock, Spanner)
@@ -349,17 +321,18 @@ def MakeSpanner (salome, geompy, math, isBlocksTest = 0, isMeshTest = 0, smesh =
 
       f42_sp_ind = geompy.LocalOp.GetSubShapeIndex(aBlock, Face42_sp)
 
-      Face_5_horiz = GetFaceByNormale(geompy, aBlock, vz)
+      Face_5_horiz = geompy.GetFaceByNormale(aBlock, vz)
       f_5_horiz_ind = geompy.LocalOp.GetSubShapeIndex(aBlock, Face_5_horiz)
 
       MRot = geompy.MakeMultiTransformation2D(aBlock, f42_sp_ind, 0, 3, f_5_horiz_ind, 0, 5)
       if MRot is not None:
+        isMRot2D = 1
         p_z100 = geompy.MakeVertex(0., 0., 100.)
         MRot_tr = geompy.MakeTranslationTwoPoints(MRot, p0, p_z100)
         id_MRot_tr = geompy.addToStudy(MRot_tr, "Multi-rotated block 5")
 
-    if BlocksOp.IsDone() == 0:
-      print "Operation failed"
+    if isMRot2D == 0:
+      print "2D Multi Transformation failed"
 
     ### Get one face of the Gear ###
 
@@ -368,9 +341,7 @@ def MakeSpanner (salome, geompy, math, isBlocksTest = 0, isMeshTest = 0, smesh =
     p_40_0_tr   = geompy.MakeTranslationTwoPoints(p_40_0  , p0, p_60_150_0)
     p_40_0_r_tr = geompy.MakeTranslationTwoPoints(p_40_0_r, p0, p_60_150_0)
 
-    Face_g_1 = BlocksOp.GetFaceByPoints(Gear, p_20_0_tr, p_20_0_r_tr, p_40_0_tr, p_40_0_r_tr)
-    if Face_g_1 is None:
-      print "BlocksOp.GetFaceByPoints(Gear, ...) : ", BlocksOp.GetErrorCode()
+    Face_g_1 = geompy.GetFaceByPoints(Gear, p_20_0_tr, p_20_0_r_tr, p_40_0_tr, p_40_0_r_tr)
     id_face_g_1 = geompy.addToStudyInFather(Gear, Face_g_1, "Face of Gear by four points")
 
     edgesNb = geompy.ShapesOp.NumberOfEdges(Face_g_1)
@@ -393,12 +364,12 @@ def MakeSpanner (salome, geompy, math, isBlocksTest = 0, isMeshTest = 0, smesh =
     # ---- add a middle block of spanner handle in study
 
     p_45_0_1 = geompy.MakeVertex(45., 0., 1.)
-    BlockMh = GetBlockNearPoint(geompy, Spanner, p_45_0_1)
+    BlockMh = geompy.GetBlockNearPoint(Spanner, p_45_0_1)
     id_blockMh = geompy.addToStudyInFather(Spanner, BlockMh, "Middle Block of Spanner Handle")
 
     # ---- add the top face of the middle block in study
 
-    FaceTop = GetFaceByNormale(geompy, BlockMh, vz)
+    FaceTop = geompy.GetFaceByNormale(BlockMh, vz)
     id_facetop = geompy.addToStudyInFather(BlockMh, FaceTop, "Top Face")
 
     # ---- add long edges of the top face in study
index 4d24d80098064e9314efe60ba4eec9b16a1e49af..67e626578c07cce7a440936141abb8740b3fd606 100644 (file)
@@ -157,9 +157,12 @@ def TestAll (geompy, math):
 
   #Transform objects
   Translation = geompy.MakeTranslationTwoPoints(Box, px, pz)  #(3 GEOM_Object_ptr)->GEOM_Object_ptr
+  TranslVect  = geompy.MakeTranslationVector(Box, vxyz)       #(2 GEOM_Object_ptr)->GEOM_Object_ptr
   Rotation    = geompy.MakeRotation(Box, vz, angle1)          #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr
   Scale       = geompy.MakeScaleTransform(Box, p0, factor)    #
   Mirror      = geompy.MakeMirrorByPlane(Box, Plane)          #(2 GEOM_Object_ptr)->GEOM_Object_ptr
+  MirrorAxis  = geompy.MakeMirrorByAxis(Box, Line1)           #
+  MirrorPnt   = geompy.MakeMirrorByPoint(Box, p200)           #
   Position    = geompy.MakePosition(Box, cs1, cs2)            #(3 GEOM_Object_ptr)->GEOM_Object_ptr
   Offset      = geompy.MakeOffset(Box, 10.)                   #(GEOM_Object_ptr, Double)->GEOM_Object_ptr
   Orientation = geompy.ChangeOrientation(Box)
@@ -210,7 +213,8 @@ def TestAll (geompy, math):
   print "CheckShape(Prism) = ", CheckShape
 
   #Partition objects
-  Partition = geompy.MakePartition([Box], [Plane]) #(2 Lists Of GEOM_Object_ptr)->GEOM_Object_ptr
+  Partition  = geompy.MakePartition([Box], [Plane]) #(2 Lists Of GEOM_Object_ptr)->GEOM_Object_ptr
+  Partition1 = geompy.MakeHalfPartition(Box, Plane) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
 
   #Add In Study
 
@@ -286,9 +290,12 @@ def TestAll (geompy, math):
   id_Sewing     = geompy.addToStudy(Sewing,     "Sewing")
 
   id_Translation = geompy.addToStudy(Translation, "Translation")
+  id_TranslVect  = geompy.addToStudy(TranslVect , "Translation along vector")
   id_Rotation    = geompy.addToStudy(Rotation,    "Rotation")
   id_Scale       = geompy.addToStudy(Scale,       "Scale")
-  id_Mirror      = geompy.addToStudy(Mirror,      "Mirror")
+  id_Mirror      = geompy.addToStudy(Mirror,      "Mirror by Plane")
+  id_MirrorAxis  = geompy.addToStudy(MirrorAxis,  "Mirror by Axis")
+  id_MirrorPnt   = geompy.addToStudy(MirrorPnt,   "Mirror by Point")
   id_Position    = geompy.addToStudy(Position,    "Positioned box")
   id_Offset      = geompy.addToStudy(Offset,      "Offset")
   id_Orientation = geompy.addToStudy(Orientation, "Orientation")
@@ -305,7 +312,8 @@ def TestAll (geompy, math):
   id_CDG       = geompy.addToStudy(CDG,       "CDG")
   id_Archimede = geompy.addToStudy(Archimede, "Archimede")
 
-  id_Partition = geompy.addToStudy(Partition, "Partition")
+  id_Partition  = geompy.addToStudy(Partition, "Partition")
+  id_Partition1 = geompy.addToStudy(Partition1, "Half Partition")
 
   #Decompose objects
   SubFace    = geompy.SubShape(Box, geompy.ShapeType["FACE"], [2])
index b2524c07a7c39fe909e2075d3b8b248d47696e8f..356e23fc5d3bdb4e289e78cec933c68adf03e5c8 100644 (file)
@@ -141,6 +141,16 @@ def TestOtherOperations (geompy, math):
   id_ImportIGES = geompy.addToStudy(ImportIGES, "ImportIGES")
   id_ImportSTEP = geompy.addToStudy(ImportSTEP, "ImportSTEP")
 
+  # NumberOfFaces
+  NumberOfFaces = geompy.NumberOfFaces(Box)
+  if NumberOfFaces != 6:
+    print "Bad number of faces in BOX!"
+
+  # NumberOfEdges
+  NumberOfEdges = geompy.NumberOfEdges(Box)
+  if NumberOfEdges != 12:
+    print "Bad number of edges in BOX!"
+
   # MakeBlockExplode
   Compound = geompy.MakeCompound([Box, Sphere])
   MakeBlockExplode = geompy.MakeBlockExplode(Compound, 6, 6)
@@ -197,3 +207,103 @@ def TestOtherOperations (geompy, math):
   print "Group of Box's faces includes the following IDs:"
   for ObjectID in GetObjectIDs:
     print " ", ObjectID
+
+  BoxCopy = geompy.GetMainShape(CreateGroup)
+
+  # -----------------------------------------------------------------------------
+  # enumeration ShapeTypeString as a dictionary
+  # -----------------------------------------------------------------------------
+  ShapeTypeString = {'0':"COMPOUND", '1':"COMPSOLID", '2':"SOLID", '3':"SHELL", '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`]
+
+  # Prepare data for the following operations
+  p0 = geompy.MakeVertex(0, 0, 0)
+  b0 = geompy.MakeBox(-50, -50, -50, 50, 50, 50)
+  s0 = geompy.MakeSphereR(100)
+
+  id_b0 = geompy.addToStudy(b0, "b0")
+  id_s0 = geompy.addToStudy(s0, "s0")
+
+  v_0pp = geompy.MakeVectorDXDYDZ( 0,  1,  1)
+  v_0np = geompy.MakeVectorDXDYDZ( 0, -1,  1)
+  v_p0p = geompy.MakeVectorDXDYDZ( 1,  0,  1)
+  v_n0p = geompy.MakeVectorDXDYDZ(-1,  0,  1)
+  v_pp0 = geompy.MakeVectorDXDYDZ( 1,  1,  0)
+  v_np0 = geompy.MakeVectorDXDYDZ(-1,  1,  0)
+
+  pln_0pp = geompy.MakePlane(p0, v_0pp, 200)
+  pln_0np = geompy.MakePlane(p0, v_0np, 200)
+  pln_p0p = geompy.MakePlane(p0, v_p0p, 200)
+  pln_n0p = geompy.MakePlane(p0, v_n0p, 200)
+  pln_pp0 = geompy.MakePlane(p0, v_pp0, 200)
+  pln_np0 = geompy.MakePlane(p0, v_np0, 200)
+
+  part_tool = geompy.MakePartition([b0, pln_0pp, pln_0np, pln_p0p, pln_n0p, pln_pp0, pln_np0],
+                                   [],
+                                   [],
+                                   [b0])
+  id_part_tool = geompy.addToStudy(part_tool, "part_tool")
+
+  part = geompy.MakePartition([s0], [part_tool])
+  geompy.addToStudy(part, "part")
+
+  # GetFreeFacesIDs
+  anIDs = geompy.GetFreeFacesIDs(part)
+  freeFaces = geompy.GetSubShape(part, anIDs)
+
+  geompy.addToStudy(freeFaces, "freeFaces")
+
+  # RemoveExtraEdges
+  freeFacesWithoutExtra = geompy.RemoveExtraEdges(freeFaces)
+
+  geompy.addToStudy(freeFacesWithoutExtra, "freeFacesWithoutExtra")
+
+  # GetSharedShapes
+  sharedFaces = geompy.GetSharedShapes(part, freeFacesWithoutExtra, geompy.ShapeType["FACE"])
+
+  for shFace in sharedFaces:
+    geompy.addToStudy(shFace, "sharedFace")
+
+  # CheckAndImprove
+  blocksComp = geompy.CheckAndImprove(part)
+
+  geompy.addToStudy(blocksComp, "blocksComp")
+
+  # Propagate
+  listChains = geompy.Propagate(blocksComp)
+
+  for chain in listChains:
+    geompy.addToStudyInFather(blocksComp, chain, "propagation chain")
+
+  # GetPoint(theShape, theX, theY, theZ, theEpsilon)
+  # 
+  # (-50,  50, 50) .-----. (50,  50, 50)
+  #      pb0_top_1 |     | 
+  #                |     . pmidle
+  #                |     | 
+  # (-50, -50, 50) '-----' (50, -50, 50)
+  #
+  pb0_top_1 = geompy.GetPoint(blocksComp, -50,  50,  50, 0.01)
+  pb0_bot_1 = geompy.GetPoint(blocksComp, -50, -50, -50, 0.01)
+
+  geompy.addToStudyInFather(blocksComp, pb0_top_1, "point from blocksComp (-50,  50,  50)")
+  geompy.addToStudyInFather(blocksComp, pb0_bot_1, "point from blocksComp (-50, -50, -50)")
+
+  # GetEdgeNearPoint(theShape, thePoint)
+  pmidle = geompy.MakeVertex(50, 0, 50)
+  edge1 = geompy.GetEdgeNearPoint(blocksComp, pmidle)
+
+  geompy.addToStudyInFather(blocksComp, edge1, "edge near point (50, 0, 50)")
+
+  # GetBlockByParts(theCompound, theParts)
+  b0_image = geompy.GetBlockByParts(blocksComp, [pb0_top_1, pb0_bot_1, edge1])
+
+  geompy.addToStudyInFather(blocksComp, b0_image, "b0 image")
+
+  # GetShapesOnPlane(theShape, theShapeType, thePlane)
+  # GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius)
+  # GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius)
+
+  # GetInPlace(theShapeWhere, theShapeWhat)
index 9a2d1a4f864ebceed9a31816e9fd4441ce558b4b..b6008af41e647c34d86ec6ce44ce3b53b1c25de7 100644 (file)
@@ -103,8 +103,8 @@ GroupOp  = geom.GetIGroupOperations   (myStudyId)
 # Basic primitives
 # -----------------------------------------------------------------------------
 
-def MakeVertex(x,y,z):
-    anObj = BasicOp.MakePointXYZ(x,y,z)
+def MakeVertex(theX, theY, theZ):
+    anObj = BasicOp.MakePointXYZ(theX, theY, theZ)
     if BasicOp.IsDone() == 0:
       print "MakePointXYZ : ", BasicOp.GetErrorCode()
     return anObj
@@ -400,10 +400,10 @@ def GetFreeFacesIDs(theShape):
     return anIDs
 
 def GetSharedShapes(theShape1, theShape2, theShapeType):
-    anObj = ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
+    aList = ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
     if ShapesOp.IsDone() == 0:
       print "GetSharedShapes : ", ShapesOp.GetErrorCode()
-    return anObj
+    return aList
 
 #def GetShapesOnPlane(theShape, theShapeType, thePlane):
 #    anObj = ShapesOp.GetShapesOnPlane(theShape, theShapeType, thePlane)
@@ -462,7 +462,7 @@ def SubShapeAllIDs(aShape, aType):
       print "SubShapeAllIDs : ", ShapesOp.GetErrorCode()
     return ListObj
 
-def SubShapeAllSorted(aShape,aType):
+def SubShapeAllSorted(aShape, aType):
     ListObj = ShapesOp.MakeExplode(aShape,aType,1)
     if ShapesOp.IsDone() == 0:
       print "MakeExplode : ", ShapesOp.GetErrorCode()
@@ -611,8 +611,8 @@ def Partition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
                           Limit, RemoveWebs, ListMaterials);
     return anObj
 
-def MakeHalfPartition(theShape):
-    anObj = BoolOp.MakeHalfPartition(theShape)
+def MakeHalfPartition(theShape, thePlane):
+    anObj = BoolOp.MakeHalfPartition(theShape, thePlane)
     if BoolOp.IsDone() == 0:
       print "MakeHalfPartition : ", BoolOp.GetErrorCode()
     return anObj
@@ -975,6 +975,12 @@ def MakeBlockExplode(theCompound, theMinNbFaces, theMaxNbFaces):
       print "MakeBlockExplode : ", BlocksOp.GetErrorCode()
     return aList
 
+def GetBlockNearPoint(theCompound, thePoint):
+    anObj = BlocksOp.GetBlockNearPoint(theCompound, thePoint)
+    if BlocksOp.IsDone() == 0:
+      print "GetBlockNearPoint : ", BlocksOp.GetErrorCode()
+    return anObj
+
 def GetBlockByParts(theCompound, theParts):
     anObj = BlocksOp.GetBlockByParts(theCompound, theParts)
     if BlocksOp.IsDone() == 0:
@@ -982,10 +988,10 @@ def GetBlockByParts(theCompound, theParts):
     return anObj
 
 def GetBlocksByParts(theCompound, theParts):
-    anObj = BlocksOp.GetBlocksByParts(theCompound, theParts)
+    aList = BlocksOp.GetBlocksByParts(theCompound, theParts)
     if BlocksOp.IsDone() == 0:
       print "GetBlocksByParts : ", BlocksOp.GetErrorCode()
-    return anObj
+    return aList
 
 def MakeMultiTransformation1D(Block, DirFaceID1, DirFaceID2, NbTimes):
     anObj = BlocksOp.MakeMultiTransformation1D(Block, DirFaceID1, DirFaceID2, NbTimes)
@@ -1002,10 +1008,10 @@ def MakeMultiTransformation2D(Block, DirFaceID1U, DirFaceID2U, NbTimesU,
     return anObj
 
 def Propagate(theShape):
-    anObj = BlocksOp.Propagate(theShape)
+    listChains = BlocksOp.Propagate(theShape)
     if BlocksOp.IsDone() == 0:
       print "Propagate : ", BlocksOp.GetErrorCode()
-    return anObj
+    return listChains
 
 # -----------------------------------------------------------------------------
 # Group operations
@@ -1045,6 +1051,8 @@ def GetMainShape(theGroup):
       print "GetMainShape : ", GroupOp.GetErrorCode()
     return anObj
 
+# Add Path to the system path
+#
 def addPath(Path):
     if (sys.path.count(Path) < 1):
        sys.path.append(Path)
index 61e13457bed88ca7093d4ccae6a862ae67432bfa..66154fa1ed684b57ed1025d868245028850d05f4 100644 (file)
@@ -737,7 +737,7 @@ def MakeCompound(theShapes):
 #     *  \param theShape Shape to count faces of.
 #     *  \return Quantity of faces.
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_TestOthers.py
 #
 def NumberOfFaces(theShape):
     nb_faces = ShapesOp.NumberOfFaces(theShape)
@@ -749,7 +749,7 @@ def NumberOfFaces(theShape):
 #     *  \param theShape Shape to count edges of.
 #     *  \return Quantity of edges.
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_TestOthers.py
 #
 def NumberOfEdges(theShape):
     nb_edges = ShapesOp.NumberOfEdges(theShape)
@@ -782,7 +782,7 @@ def OrientationChange(theShape):
 #     *  \param theShape Shape to find free faces in.
 #     *  \return List of IDs of all free faces, contained in theShape.
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_TestOthers.py
 #
 def GetFreeFacesIDs(theShape):
     anIDs = ShapesOp.GetFreeFacesIDs(theShape)
@@ -796,13 +796,13 @@ def GetFreeFacesIDs(theShape):
 #     *  \param theShapeType Type of sub-shapes to be retrieved.
 #     *  \return List of sub-shapes of theShape1, shared with theShape2.
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_TestOthers.py
 #
 def GetSharedShapes(theShape1, theShape2, theShapeType):
-    anObj = ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
+    aList = ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
     if ShapesOp.IsDone() == 0:
       print "GetSharedShapes : ", ShapesOp.GetErrorCode()
-    return anObj
+    return aList
 
 #     *  Get sub-shapes of theShape of the given type,
 #     *  laying on the specified plane.
@@ -811,7 +811,7 @@ def GetSharedShapes(theShape1, theShape2, theShapeType):
 #     *  \param thePlane Face, specifying the plane to find shapes on.
 #     *  \return Group of all found sub-shapes.
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_TestOthers.py
 #
 #def GetShapesOnPlane(theShape, theShapeType, thePlane):
 #    anObj = ShapesOp.GetShapesOnPlane(theShape, theShapeType, thePlane)
@@ -828,7 +828,7 @@ def GetSharedShapes(theShape1, theShape2, theShapeType):
 #     *  \param theRadius Radius of the cylinder to find shapes on.
 #     *  \return Group of all found sub-shapes.
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_TestOthers.py
 #
 #def GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius):
 #    anObj = ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius)
@@ -844,7 +844,7 @@ def GetSharedShapes(theShape1, theShape2, theShapeType):
 #     *  \param theRadius Radius of the sphere to find shapes on.
 #     *  \return Group of all found sub-shapes.
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_TestOthers.py
 #
 #def GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius):
 #    anObj = ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius)
@@ -858,7 +858,7 @@ def GetSharedShapes(theShape1, theShape2, theShapeType):
 #     *  \param theShapeWhat Shape, specifying what to find.
 #     *  \return Group of all found sub-shapes or a single found sub-shape.
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_TestOthers.py
 #
 #def GetInPlace(theShapeWhere, theShapeWhat):
 #    anObj = ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
@@ -1224,10 +1224,10 @@ def Partition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
 #     *  \param thePlane Tool shape, to intersect theShape.
 #     *  \return New GEOM_Object, containing the result shape.
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_TestAll.py
 #
-def MakeHalfPartition(theShape):
-    anObj = BoolOp.MakeHalfPartition(theShape)
+def MakeHalfPartition(theShape, thePlane):
+    anObj = BoolOp.MakeHalfPartition(theShape, thePlane)
     if BoolOp.IsDone() == 0:
       print "MakeHalfPartition : ", BoolOp.GetErrorCode()
     return anObj
@@ -1271,7 +1271,7 @@ def MakeTranslation(theObject, theDX, theDY, theDZ):
 #     *  \param theVector The translation vector.
 #     *  \return New GEOM_Object, containing the translated object.
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_TestAll.py
 #
 def MakeTranslationVector(theObject, theVector):
     anObj = TrsfOp.TranslateVectorCopy(theObject, theVector)
@@ -1328,7 +1328,7 @@ def MakeMirrorByPlane(theObject, thePlane):
 #     *  \param theAxis Axis of symmetry.
 #     *  \return New GEOM_Object, containing the mirrored shape.
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_TestAll.py
 #
 def MakeMirrorByAxis(theObject, theAxis):
     anObj = TrsfOp.MirrorAxisCopy(theObject, theAxis)
@@ -1342,7 +1342,7 @@ def MakeMirrorByAxis(theObject, theAxis):
 #     *  \param thePoint Point of symmetry.
 #     *  \return New GEOM_Object, containing the mirrored shape.
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_TestAll.py
 #
 def MakeMirrorByPoint(theObject, thePoint):
     anObj = TrsfOp.MirrorPointCopy(theObject, thePoint)
@@ -1847,7 +1847,7 @@ def MakeHexa2Faces(F1, F2):
 #     *                    vertex and point with the given coordinates.
 #     *  \return New GEOM_Object, containing the found vertex.
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_TestOthers.py
 #
 def GetPoint(theShape, theX, theY, theZ, theEpsilon):
     anObj = BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
@@ -1860,7 +1860,7 @@ def GetPoint(theShape, theX, theY, theZ, theEpsilon):
 #     *  \param thePoint1,thePoint2 Points, close to the ends of the desired edge.
 #     *  \return New GEOM_Object, containing the found edge.
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_Spanner.py
 #
 def GetEdge(theShape, thePoint1, thePoint2):
     anObj = BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
@@ -1873,7 +1873,7 @@ def GetEdge(theShape, thePoint1, thePoint2):
 #     *  \param thePoint Point, close to the desired edge.
 #     *  \return New GEOM_Object, containing the found edge.
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_TestOthers.py
 #
 def GetEdgeNearPoint(theShape, thePoint):
     anObj = BlocksOp.GetEdgeNearPoint(theShape, thePoint)
@@ -1886,7 +1886,7 @@ def GetEdgeNearPoint(theShape, thePoint):
 #     *  \param thePoint1-thePoint4 Points, close to the corners of the desired face.
 #     *  \return New GEOM_Object, containing the found face.
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_Spanner.py
 #
 def GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4):
     anObj = BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4)
@@ -1899,7 +1899,7 @@ def GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4):
 #     *  \param theEdge1,theEdge2 Edges, close to the edges of the desired face.
 #     *  \return New GEOM_Object, containing the found face.
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_Spanner.py
 #
 def GetFaceByEdges(theShape, theEdge1, theEdge2):
     anObj = BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2)
@@ -1912,7 +1912,7 @@ def GetFaceByEdges(theShape, theEdge1, theEdge2):
 #     *  \param theFace Face of \a theBlock, opposite to the desired face.
 #     *  \return New GEOM_Object, containing the found face.
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_Spanner.py
 #
 def GetOppositeFace(theBlock, theFace):
     anObj = BlocksOp.GetOppositeFace(theBlock, theFace)
@@ -1925,7 +1925,7 @@ def GetOppositeFace(theBlock, theFace):
 #     *  \param thePoint Point, close to the desired face.
 #     *  \return New GEOM_Object, containing the found face.
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_Spanner.py
 #
 def GetFaceNearPoint(theShape, thePoint):
     anObj = BlocksOp.GetFaceNearPoint(theShape, thePoint)
@@ -1938,7 +1938,7 @@ def GetFaceNearPoint(theShape, thePoint):
 #     *  \param theVector Vector, close to the normale of the desired face.
 #     *  \return New GEOM_Object, containing the found face.
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_Spanner.py
 #
 def GetFaceByNormale(theBlock, theVector):
     anObj = BlocksOp.GetFaceByNormale(theBlock, theVector)
@@ -1957,7 +1957,7 @@ def GetFaceByNormale(theBlock, theVector):
 #     *  \return TRUE, if the given shape is a compound of blocks.
 #     *  If theCompound is not valid, prints all discovered errors.
 #
-#     *  Example: see GEOM_TestOthers.py
+#     *  Example: see GEOM_Spanner.py
 #
 def CheckCompoundOfBlocks(theCompound):
     (IsValid, BCErrors) = BlocksOp.CheckCompoundOfBlocks(theCompound)
@@ -1974,7 +1974,7 @@ def CheckCompoundOfBlocks(theCompound):
 #     *  \param theShape The compound or single solid to remove irregular edges from.
 #     *  \return Improved shape.
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_TestOthers.py
 #
 def RemoveExtraEdges(theShape):
     anObj = BlocksOp.RemoveExtraEdges(theShape)
@@ -1988,7 +1988,7 @@ def RemoveExtraEdges(theShape):
 #     *  \param theCompound The compound to check and improve.
 #     *  \return Improved compound.
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_TestOthers.py
 #
 def CheckAndImprove(theShape):
     anObj = BlocksOp.CheckAndImprove(theShape)
@@ -2011,12 +2011,26 @@ def MakeBlockExplode(theCompound, theMinNbFaces, theMaxNbFaces):
       print "MakeBlockExplode : ", BlocksOp.GetErrorCode()
     return aList
 
+#     *  Find block, containing the given point inside its volume or on boundary.
+#     *  \param theCompound Compound, to find block in.
+#     *  \param thePoint Point, close to the desired block. If the point lays on
+#     *         boundary between some blocks, we return block with nearest center.
+#     *  \return New GEOM_Object, containing the found block.
+#
+#     *  Example: see GEOM_Spanner.py
+#
+def GetBlockNearPoint(theCompound, thePoint):
+    anObj = BlocksOp.GetBlockNearPoint(theCompound, thePoint)
+    if BlocksOp.IsDone() == 0:
+      print "GetBlockNearPoint : ", BlocksOp.GetErrorCode()
+    return anObj
+
 #     *  Find block, containing all the elements, passed as the parts, or maximum quantity of them.
 #     *  \param theCompound Compound, to find block in.
 #     *  \param theParts List of faces and/or edges and/or vertices to be parts of the found block.
 #     *  \return New GEOM_Object, containing the found block.
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_TestOthers.py
 #
 def GetBlockByParts(theCompound, theParts):
     anObj = BlocksOp.GetBlockByParts(theCompound, theParts)
@@ -2029,13 +2043,13 @@ def GetBlockByParts(theCompound, theParts):
 #     *  \param theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
 #     *  \return List of GEOM_Objects, containing the found blocks.
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_Spanner.py
 #
 def GetBlocksByParts(theCompound, theParts):
-    anObj = BlocksOp.GetBlocksByParts(theCompound, theParts)
+    aList = BlocksOp.GetBlocksByParts(theCompound, theParts)
     if BlocksOp.IsDone() == 0:
       print "GetBlocksByParts : ", BlocksOp.GetErrorCode()
-    return anObj
+    return aList
 
 #     *  Multi-transformate block and glue the result.
 #     *  Transformation is defined so, as to superpose direction faces.
@@ -2078,13 +2092,13 @@ def MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
 #     *  \param theShape Shape to build propagation groups on.
 #     *  \return List of GEOM_Objects, each of them is a propagation group.
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_TestOthers.py
 #
 def Propagate(theShape):
-    anObj = BlocksOp.Propagate(theShape)
+    listChains = BlocksOp.Propagate(theShape)
     if BlocksOp.IsDone() == 0:
       print "Propagate : ", BlocksOp.GetErrorCode()
-    return anObj
+    return listChains
 
 # -----------------------------------------------------------------------------
 # Group operations
@@ -2141,7 +2155,7 @@ def GetObjectIDs(theGroup):
 #     *  Returns a type of sub objects stored in the group
 #     *  \param theGroup is a GEOM group which type is returned.
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_TestOthers.py
 #
 def GetType(theGroup):
     aType = GroupOp.GetType(theGroup)
@@ -2153,7 +2167,7 @@ def GetType(theGroup):
 #     *  \param theGroup is a GEOM group for which a main shape object is requested
 #     *  \return a GEOM object which is a main shape for theGroup
 #
-#     *  Example: see ???
+#     *  Example: see GEOM_TestOthers.py
 #
 def GetMainShape(theGroup):
     anObj = GroupOp.GetMainShape(theGroup)