Salome HOME
PAL10015. Implement GetShapesOnQuadrangle()
authoreap <eap@opencascade.com>
Fri, 14 Oct 2005 13:30:58 +0000 (13:30 +0000)
committereap <eap@opencascade.com>
Fri, 14 Oct 2005 13:30:58 +0000 (13:30 +0000)
idl/GEOM_Gen.idl
src/GEOM_SWIG/GEOM_TestOthers.py
src/GEOM_SWIG/batchmode_geompy.py
src/GEOM_SWIG/geompy.py

index 6bc1582c6a1fae15830282617ba4e0d5dd5c7d01..e102e01b1cc13e82403ae2c73fda92af64338c61 100644 (file)
@@ -962,6 +962,26 @@ module GEOM
                                in double      theRadius,
                                in shape_state theState);
 
+    /*!
+     *  Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
+     *  the specified quadrangle by the certain way, defined through \a theState parameter.
+     *  \param theShape Shape to find sub-shapes of.
+     *  \param theShapeType Type of sub-shapes to be retrieved.
+     *  \param theTopLeftPoint Top left quadrangle corner
+     *  \param theTopRigthPoint Top right quadrangle corner
+     *  \param theBottomLeftPoint Bottom left quadrangle corner
+     *  \param theBottomRigthPoint Bottom right quadrangle corner
+     *  \param theState The state of the subshapes to find.
+     *  \return List of all found sub-shapes.
+     */
+    ListOfGO GetShapesOnQuadrangle (in GEOM_Object theShape,
+                                    in long        theShapeType,
+                                    in GEOM_Object theTopLeftPoint,
+                                    in GEOM_Object theTopRigthPoint,
+                                    in GEOM_Object theBottomLeftPoint,
+                                    in GEOM_Object theBottomRigthPoint,
+                                    in shape_state theState);
+
     /*!
      *  Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
      *  the specified plane by the certain way, defined through \a theState parameter.
@@ -1010,6 +1030,26 @@ module GEOM
                                     in double      theRadius,
                                     in shape_state theState);
 
+    /*!
+     *  Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
+     *  the specified quadrangle by the certain way, defined through \a theState parameter.
+     *  \param theShape Shape to find sub-shapes of.
+     *  \param theShapeType Type of sub-shapes to be retrieved.
+     *  \param theTopLeftPoint Top left quadrangle corner
+     *  \param theTopRigthPoint Top right quadrangle corner
+     *  \param theBottomLeftPoint Bottom left quadrangle corner
+     *  \param theBottomRigthPoint Bottom right quadrangle corner
+     *  \param theState The state of the subshapes to find.
+     *  \return List of IDs of all found sub-shapes.
+     */
+    ListOfLong GetShapesOnQuadrangleIDs (in GEOM_Object theShape,
+                                         in long        theShapeType,
+                                         in GEOM_Object theTopLeftPoint,
+                                         in GEOM_Object theTopRigthPoint,
+                                         in GEOM_Object theBottomLeftPoint,
+                                         in GEOM_Object theBottomRigthPoint,
+                                         in shape_state theState);
+
     /*!
      *  Get sub-shape(s) of theShapeWhere, which are
      *  coincident with \a theShapeWhat or could be a part of it.
index bb3d94f637f91a28c95edbd1e0433edcc65da59a..4389fbd1405ed1cfd2ec357f4d3da0827abce0ac 100644 (file)
@@ -403,6 +403,30 @@ def TestOtherOperations (geompy, math):
                                              p0, 100, geompy.GEOM.ST_ON)
   for vertex_i in vertices_on_sph:
     geompy.addToStudy(vertex_i, "Vertex on Sphere (center = (0, 0, 0), r = 100)")
+    pass
+
+  # GetShapesOnQuadrangle
+
+  geompy.addToStudy(f12, "F12" )
+
+  bl = geompy.MakeVertex(10,-10, 0)
+  br = geompy.MakeVertex(40,-10, 0)
+  tr = geompy.MakeVertex(40, 20, 0)
+  tl = geompy.MakeVertex(10, 20, 0)
+  qe1 = geompy.MakeEdge(bl, br)
+  qe2 = geompy.MakeEdge(br, tr)
+  qe3 = geompy.MakeEdge(tr, tl)
+  qe4 = geompy.MakeEdge(tl, bl)
+  quadrangle = geompy.MakeWire([qe1, qe2, qe3, qe4])
+  geompy.addToStudy(quadrangle, "Quadrangle")
+
+  edges_onin_quad = geompy.GetShapesOnQuadrangle( f12, geompy.ShapeType["EDGE"],
+                                                  tl, tr, bl, br, geompy.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()"
+    pass
 
   # GetInPlace(theShapeWhere, theShapeWhat)
   box5 = geompy.MakeBoxDXDYDZ(100, 100, 100)
index 2ef3c1d680dc42e62fb5e1030b239a42fa93a7b4..aa90a337f21fa3ed3cf055dda20c5f93bf5a56b5 100644 (file)
@@ -508,6 +508,18 @@ def GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState)
         print "GetShapesOnSphereIDs : ", ShapesOp.GetErrorCode()
     return aList
 
+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()
+    return aList
+
+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()
+    return aList
+
 def GetInPlace(theShapeWhere, theShapeWhat):
     anObj = ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
     if ShapesOp.IsDone() == 0:
index d788cc4fedb20d819a94185022ca935591d57b0a..6d47c038af51cf2c34beea0f479da9418e845548 100644 (file)
@@ -1017,6 +1017,34 @@ def GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState)
         print "GetShapesOnSphereIDs : ", ShapesOp.GetErrorCode()
     return aList
 
+def GetShapesOnQuadrangle(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState):
+    """
+     *  Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
+     *  the specified quadrangle by the certain way, defined through \a theState parameter.
+     *  \param theShape Shape to find sub-shapes of.
+     *  \param theShapeType Type of sub-shapes to be retrieved.
+     *  \param theCenter Point, specifying center of the sphere to find shapes on.
+     *  \param theRadius Radius of the sphere to find shapes on.
+     *  \param theState The state of the subshapes to find. It can be one of
+     *   ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
+     *  \return List of all found sub-shapes.
+
+     *  Example: see GEOM_TestOthers.py
+    """
+    aList = ShapesOp.GetShapesOnQuadrangle(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState)
+    if ShapesOp.IsDone() == 0:
+      print "GetShapesOnQuadrangle : ", ShapesOp.GetErrorCode()
+    return aList
+
+def GetShapesOnQuadrangleIDs(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState):
+    """
+     *  Works like the above method, but returns list of sub-shapes indices
+    """
+    aList = ShapesOp.GetShapesOnQuadrangleIDs(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState)
+    if ShapesOp.IsDone() == 0:
+        print "GetShapesOnQuadrangleIDs : ", ShapesOp.GetErrorCode()
+    return aList
+
 def GetInPlace(theShapeWhere, theShapeWhat):
     """
      *  Get sub-shape(s) of theShapeWhere, which are