From: eap Date: Fri, 14 Oct 2005 13:30:58 +0000 (+0000) Subject: PAL10015. Implement GetShapesOnQuadrangle() X-Git-Tag: ForTest_3_1_0a2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8405ffc0f51a34a1e111c1b395ff07b4f18db4f9;p=modules%2Fgeom.git PAL10015. Implement GetShapesOnQuadrangle() --- diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 6bc1582c6..e102e01b1 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -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. diff --git a/src/GEOM_SWIG/GEOM_TestOthers.py b/src/GEOM_SWIG/GEOM_TestOthers.py index bb3d94f63..4389fbd14 100644 --- a/src/GEOM_SWIG/GEOM_TestOthers.py +++ b/src/GEOM_SWIG/GEOM_TestOthers.py @@ -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) diff --git a/src/GEOM_SWIG/batchmode_geompy.py b/src/GEOM_SWIG/batchmode_geompy.py index 2ef3c1d68..aa90a337f 100644 --- a/src/GEOM_SWIG/batchmode_geompy.py +++ b/src/GEOM_SWIG/batchmode_geompy.py @@ -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: diff --git a/src/GEOM_SWIG/geompy.py b/src/GEOM_SWIG/geompy.py index d788cc4fe..6d47c038a 100644 --- a/src/GEOM_SWIG/geompy.py +++ b/src/GEOM_SWIG/geompy.py @@ -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