PAL10015. Implement GetShapesOnQuadrangle()

This commit is contained in:
eap 2005-10-14 13:30:58 +00:00
parent 848e92b3ee
commit 8405ffc0f5
4 changed files with 104 additions and 0 deletions

View File

@ -962,6 +962,26 @@ module GEOM
in double theRadius, in double theRadius,
in shape_state theState); 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 * 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. * the specified plane by the certain way, defined through \a theState parameter.
@ -1010,6 +1030,26 @@ module GEOM
in double theRadius, in double theRadius,
in shape_state theState); 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 * Get sub-shape(s) of theShapeWhere, which are
* coincident with \a theShapeWhat or could be a part of it. * coincident with \a theShapeWhat or could be a part of it.

View File

@ -403,6 +403,30 @@ def TestOtherOperations (geompy, math):
p0, 100, geompy.GEOM.ST_ON) p0, 100, geompy.GEOM.ST_ON)
for vertex_i in vertices_on_sph: for vertex_i in vertices_on_sph:
geompy.addToStudy(vertex_i, "Vertex on Sphere (center = (0, 0, 0), r = 100)") 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) # GetInPlace(theShapeWhere, theShapeWhat)
box5 = geompy.MakeBoxDXDYDZ(100, 100, 100) box5 = geompy.MakeBoxDXDYDZ(100, 100, 100)

View File

@ -508,6 +508,18 @@ def GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState)
print "GetShapesOnSphereIDs : ", ShapesOp.GetErrorCode() print "GetShapesOnSphereIDs : ", ShapesOp.GetErrorCode()
return aList 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): def GetInPlace(theShapeWhere, theShapeWhat):
anObj = ShapesOp.GetInPlace(theShapeWhere, theShapeWhat) anObj = ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
if ShapesOp.IsDone() == 0: if ShapesOp.IsDone() == 0:

View File

@ -1017,6 +1017,34 @@ def GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState)
print "GetShapesOnSphereIDs : ", ShapesOp.GetErrorCode() print "GetShapesOnSphereIDs : ", ShapesOp.GetErrorCode()
return aList 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): def GetInPlace(theShapeWhere, theShapeWhat):
""" """
* Get sub-shape(s) of theShapeWhere, which are * Get sub-shape(s) of theShapeWhere, which are