]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Fix for bug 10157: To add using of the functionalities from PAL9969 into one of testi...
authorjfa <jfa@opencascade.com>
Tue, 21 Feb 2006 07:47:16 +0000 (07:47 +0000)
committerjfa <jfa@opencascade.com>
Tue, 21 Feb 2006 07:47:16 +0000 (07:47 +0000)
src/GEOM_SWIG/GEOM_TestOthers.py
src/GEOM_SWIG/geompy.py

index 4389fbd1405ed1cfd2ec357f4d3da0827abce0ac..e84f953460785059f86cca87d676eed46b6ca614 100644 (file)
@@ -242,15 +242,19 @@ def TestOtherOperations (geompy, math):
   geompy.AddObject(CreateGroup, f_ind_6) # box_faces[5]
   geompy.AddObject(CreateGroup, f_ind_1) # box_faces[0]
   geompy.AddObject(CreateGroup, f_ind_4) # box_faces[3]
+  # Now contains f_ind_6, f_ind_1, f_ind_4
 
   # UnionList
   geompy.UnionList(CreateGroup, [box_faces[2], box_faces[4], box_faces[5]])
+  # Now contains f_ind_6, f_ind_1, f_ind_4, f_ind_3, f_ind_5
 
   # RemoveObject(theGroup, theSubShapeID)
   geompy.RemoveObject(CreateGroup, f_ind_1) # box_faces[0]
+  # Now contains f_ind_6, f_ind_4, f_ind_3, f_ind_5
 
   # DifferenceList
   geompy.DifferenceList(CreateGroup, [box_faces[1], box_faces[0], box_faces[3]])
+  # Now contains f_ind_6, f_ind_3, f_ind_5
 
   # GetObjectIDs
   GetObjectIDs = geompy.GetObjectIDs(CreateGroup)
@@ -262,6 +266,21 @@ def TestOtherOperations (geompy, math):
 
   BoxCopy = geompy.GetMainShape(CreateGroup)
 
+  # DifferenceIDs
+  geompy.DifferenceIDs(CreateGroup, [f_ind_3, f_ind_5])
+  # Now contains f_ind_6
+
+  # UnionIDs
+  geompy.UnionIDs(CreateGroup, [f_ind_1, f_ind_2, f_ind_6])
+  # Now contains f_ind_6, f_ind_1, f_ind_2
+
+  # 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, ")"
+  for ObjectID in GetObjectIDs:
+    print " ", ObjectID
+
   # -----------------------------------------------------------------------------
   # enumeration ShapeTypeString as a dictionary
   # -----------------------------------------------------------------------------
@@ -392,12 +411,26 @@ def TestOtherOperations (geompy, math):
   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)
+  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))")
+
   # GetShapesOnCylinder
-  edges_on_cyl = geompy.GetShapesOnCylinder(blocksComp, geompy.ShapeType["EDGE"],
-                                            vy, 55, geompy.GEOM.ST_OUT)
-  for edge_i in edges_on_cyl:
+  edges_out_cyl = geompy.GetShapesOnCylinder(blocksComp, geompy.ShapeType["EDGE"],
+                                             vy, 55, geompy.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, 55, geompy.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)")
+
   # GetShapesOnSphere
   vertices_on_sph = geompy.GetShapesOnSphere(blocksComp, geompy.ShapeType["VERTEX"],
                                              p0, 100, geompy.GEOM.ST_ON)
@@ -405,6 +438,13 @@ def TestOtherOperations (geompy, math):
     geompy.addToStudy(vertex_i, "Vertex on Sphere (center = (0, 0, 0), r = 100)")
     pass
 
+  # GetShapesOnSphereIDs
+  vertices_on_sph_ids = geompy.GetShapesOnSphereIDs(blocksComp, geompy.ShapeType["VERTEX"],
+                                                    p0, 100, geompy.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)")
+
   # GetShapesOnQuadrangle
 
   geompy.addToStudy(f12, "F12" )
@@ -428,6 +468,13 @@ def TestOtherOperations (geompy, math):
     print "Error in GetShapesOnQuadrangle()"
     pass
 
+  # GetShapesOnQuadrangleIDs
+  vertices_on_quad_ids = geompy.GetShapesOnQuadrangleIDs(f12, geompy.ShapeType["VERTEX"],
+                                                         tl, tr, bl, br, geompy.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")
+
   # GetInPlace(theShapeWhere, theShapeWhat)
   box5 = geompy.MakeBoxDXDYDZ(100, 100, 100)
   box6 = geompy.MakeTranslation(box5, 50, 50, 0)
index 6d47c038af51cf2c34beea0f479da9418e845548..fcd4a139bc4167f22579a042a6d0f57518f116b2 100644 (file)
@@ -954,6 +954,8 @@ def GetShapesOnPlane(theShape, theShapeType, theAx1, theState):
 def GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState):
     """
      *  Works like the above method, but returns list of sub-shapes indices
+
+     *  Example: see GEOM_TestOthers.py
     """
     aList = ShapesOp.GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState)
     if ShapesOp.IsDone() == 0:
@@ -983,6 +985,8 @@ def GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState):
 def GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState):
     """
      *  Works like the above method, but returns list of sub-shapes indices
+
+     *  Example: see GEOM_TestOthers.py
     """
     aList = ShapesOp.GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState)
     if ShapesOp.IsDone() == 0:
@@ -1011,6 +1015,8 @@ def GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState):
 def GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState):
     """
      *  Works like the above method, but returns list of sub-shapes indices
+
+     *  Example: see GEOM_TestOthers.py
     """
     aList = ShapesOp.GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState)
     if ShapesOp.IsDone() == 0:
@@ -1039,6 +1045,8 @@ def GetShapesOnQuadrangle(theShape, theShapeType, theTopLeftPoint, theTopRigthPo
 def GetShapesOnQuadrangleIDs(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState):
     """
      *  Works like the above method, but returns list of sub-shapes indices
+
+     *  Example: see GEOM_TestOthers.py
     """
     aList = ShapesOp.GetShapesOnQuadrangleIDs(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState)
     if ShapesOp.IsDone() == 0:
@@ -2473,6 +2481,8 @@ def UnionIDs(theGroup, theSubShapes):
     """
      *  Works like the above method, but argument
      *  theSubShapes here is a list of sub-shapes indices
+
+     *  Example: see GEOM_TestOthers.py
     """
     GroupOp.UnionIDs(theGroup, theSubShapes)
     if GroupOp.IsDone() == 0:
@@ -2494,6 +2504,8 @@ def DifferenceIDs(theGroup, theSubShapes):
     """
      *  Works like the above method, but argument
      *  theSubShapes here is a list of sub-shapes indices
+
+     *  Example: see GEOM_TestOthers.py
     """
     GroupOp.DifferenceIDs(theGroup, theSubShapes)
     if GroupOp.IsDone() == 0: