+ }
+ gp_Pnt aLoc = BRep_Tool::Pnt(V3);
+ gp_Vec aVec(BRep_Tool::Pnt(V1),BRep_Tool::Pnt(V2));
+
+ if (aVec.Magnitude() < Precision::Confusion()) {
+ SetErrorCode("Vector with null magnitude given");
+ return NULL;
+ }
+ Handle(Geom_Surface) aPlane = new Geom_Plane(aLoc, aVec);
+
+ if ( aPlane.IsNull() )
+ return NULL;
+
+ // Find objects
+ TCollection_AsciiString anAsciiList;
+ Handle(TColStd_HSequenceOfTransient) aSeq;
+ aSeq = getShapesOnSurface( aPlane, theShape, aShapeType, theState, anAsciiList );
+ if ( aSeq.IsNull() || aSeq->Length() == 0 )
+ return NULL;
+
+ // Make a Python command
+
+ Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast( aSeq->Value( 1 ));
+ Handle(GEOM_Function) aFunction = anObj->GetLastFunction();
+
+ GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString()
+ << "] = geompy.GetShapesOnPlaneWithLocation(" << theShape << ", "
+ << aShapeType << ", " << theAx1 << ", "<< thePnt <<", " << theState << ")";
+
+ SetErrorCode(OK);
+ return aSeq;
+}
+
+//=============================================================================
+/*!
+ * GetShapesOnCylinder
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnCylinder
+ (const Handle(GEOM_Object)& theShape,
+ const Standard_Integer theShapeType,
+ const Handle(GEOM_Object)& theAxis,
+ const Standard_Real theRadius,
+ const GEOMAlgo_State theState)
+{
+ SetErrorCode(KO);
+
+ if (theShape.IsNull() || theAxis.IsNull()) return NULL;
+
+ TopoDS_Shape aShape = theShape->GetValue();
+ TopoDS_Shape anAxis = theAxis->GetValue();
+
+ if (aShape.IsNull() || anAxis.IsNull()) return NULL;
+
+ TopAbs_ShapeEnum aShapeType = TopAbs_ShapeEnum(theShapeType);
+ if ( !checkTypeShapesOn( aShapeType ))
+ return NULL;
+
+ // Create a cylinder surface
+ Handle(Geom_Surface) aCylinder = makeCylinder( anAxis, theRadius );
+ if ( aCylinder.IsNull() )
+ return NULL;
+
+ // Find objects
+ TCollection_AsciiString anAsciiList;
+ Handle(TColStd_HSequenceOfTransient) aSeq;
+ aSeq = getShapesOnSurface( aCylinder, theShape, aShapeType, theState, anAsciiList );
+ if ( aSeq.IsNull() || aSeq->Length() == 0 )
+ return NULL;
+
+ // Make a Python command
+
+ Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast( aSeq->Value( 1 ));
+ Handle(GEOM_Function) aFunction = anObj->GetLastFunction();
+
+ GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString()
+ << "] = geompy.GetShapesOnCylinder(" << theShape << ", " << aShapeType
+ << ", " << theAxis << ", " << theRadius << ", " << theState << ")";
+
+ SetErrorCode(OK);
+ return aSeq;
+}
+
+//=============================================================================
+/*!
+ * GetShapesOnSphere
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnSphere
+ (const Handle(GEOM_Object)& theShape,
+ const Standard_Integer theShapeType,
+ const Handle(GEOM_Object)& theCenter,
+ const Standard_Real theRadius,
+ const GEOMAlgo_State theState)
+{
+ SetErrorCode(KO);
+
+ if (theShape.IsNull() || theCenter.IsNull()) return NULL;
+
+ TopoDS_Shape aShape = theShape->GetValue();
+ TopoDS_Shape aCenter = theCenter->GetValue();
+
+ if (aShape.IsNull() || aCenter.IsNull()) return NULL;
+
+ TopAbs_ShapeEnum aShapeType = TopAbs_ShapeEnum(theShapeType);
+ if ( !checkTypeShapesOn( aShapeType ))
+ return NULL;
+
+ // Center of the sphere
+ if (aCenter.ShapeType() != TopAbs_VERTEX) return NULL;
+ gp_Pnt aLoc = BRep_Tool::Pnt(TopoDS::Vertex(aCenter));
+
+ gp_Ax3 anAx3 (aLoc, gp::DZ());
+ Handle(Geom_SphericalSurface) aSphere =
+ new Geom_SphericalSurface(anAx3, theRadius);
+
+ // Find objects
+ TCollection_AsciiString anAsciiList;
+ Handle(TColStd_HSequenceOfTransient) aSeq;
+ aSeq = getShapesOnSurface( aSphere, theShape, aShapeType, theState, anAsciiList );
+ if ( aSeq.IsNull() || aSeq->Length() == 0 )
+ return NULL;
+
+ // Make a Python command
+
+ Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast( aSeq->Value( 1 ));
+ Handle(GEOM_Function) aFunction = anObj->GetLastFunction();
+
+ GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString()
+ << "] = geompy.GetShapesOnSphere(" << theShape << ", " << aShapeType
+ << ", " << theCenter << ", " << theRadius << ", " << theState << ")";
+
+ SetErrorCode(OK);
+ return aSeq;
+}
+
+//=============================================================================
+/*!
+ * GetShapesOnPlaneIDs
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetShapesOnPlaneIDs
+ (const Handle(GEOM_Object)& theShape,
+ const Standard_Integer theShapeType,
+ const Handle(GEOM_Object)& theAx1,
+ const GEOMAlgo_State theState)
+{
+ SetErrorCode(KO);
+
+ if (theShape.IsNull() || theAx1.IsNull()) return NULL;
+
+ TopoDS_Shape aShape = theShape->GetValue();
+ TopoDS_Shape anAx1 = theAx1->GetValue();
+
+ if (aShape.IsNull() || anAx1.IsNull()) return NULL;
+
+ TopAbs_ShapeEnum aShapeType = TopAbs_ShapeEnum(theShapeType);
+ if ( !checkTypeShapesOn( aShapeType ))
+ return NULL;
+
+ // Create plane
+ Handle(Geom_Surface) aPlane = makePlane( anAx1 );
+ if ( aPlane.IsNull() )
+ return NULL;
+
+ // Find object IDs
+ Handle(TColStd_HSequenceOfInteger) aSeq;
+ aSeq = getShapesOnSurfaceIDs( aPlane, aShape, aShapeType, theState );
+
+ // The GetShapesOnPlaneIDs() doesn't change object so no new function is required.
+ Handle(GEOM_Function) aFunction = GEOM::GetCreatedLast(theShape,theAx1)->GetLastFunction();
+
+ // Make a Python command
+ GEOM::TPythonDump(aFunction, /*append=*/true)
+ << "listShapesOnPlane = geompy.GetShapesOnPlaneIDs"
+ << "(" << theShape << "," << aShapeType << "," << theAx1 << "," << theState << ")";
+
+ SetErrorCode(OK);
+ return aSeq;
+}
+
+//=============================================================================
+/*!
+ * GetShapesOnPlaneWithLocationIDs
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetShapesOnPlaneWithLocationIDs
+ (const Handle(GEOM_Object)& theShape,
+ const Standard_Integer theShapeType,
+ const Handle(GEOM_Object)& theAx1,
+ const Handle(GEOM_Object)& thePnt,
+ const GEOMAlgo_State theState)
+{
+ SetErrorCode(KO);
+
+ if (theShape.IsNull() || theAx1.IsNull() || thePnt.IsNull()) return NULL;
+
+ TopoDS_Shape aShape = theShape->GetValue();
+ TopoDS_Shape anAx1 = theAx1->GetValue();
+ TopoDS_Shape anPnt = thePnt->GetValue();
+
+ if (aShape.IsNull() || anAx1.IsNull() || anPnt.IsNull()) return NULL;
+
+ TopAbs_ShapeEnum aShapeType = TopAbs_ShapeEnum(theShapeType);
+ if ( !checkTypeShapesOn( aShapeType ))
+ return NULL;
+
+ // Create plane
+ if (anAx1.ShapeType() != TopAbs_EDGE || anPnt.ShapeType() != TopAbs_VERTEX) return NULL;
+ TopoDS_Edge anEdge = TopoDS::Edge(anAx1);
+ TopoDS_Vertex V1, V2, V3;
+ TopExp::Vertices(anEdge, V1, V2, Standard_True);
+ if (V1.IsNull() || V2.IsNull()) {
+ SetErrorCode("Bad edge given for the plane normal vector");
+ return NULL;
+ }
+ V3 = TopoDS::Vertex(anPnt);
+ if(V3.IsNull()) {
+ SetErrorCode("Bad vertex given for the plane location");
+ return NULL;
+ }
+ gp_Pnt aLoc = BRep_Tool::Pnt(V3);
+ gp_Vec aVec(BRep_Tool::Pnt(V1),BRep_Tool::Pnt(V2));
+ if (aVec.Magnitude() < Precision::Confusion()) {
+ SetErrorCode("Vector with null magnitude given");
+ return NULL;
+ }
+
+ Handle(Geom_Surface) aPlane = new Geom_Plane(aLoc, aVec);
+ if ( aPlane.IsNull() )
+ return NULL;
+
+ // Find object IDs
+ Handle(TColStd_HSequenceOfInteger) aSeq;
+ aSeq = getShapesOnSurfaceIDs( aPlane, aShape, aShapeType, theState );
+
+ // The GetShapesOnPlaneIDs() doesn't change object so no new function is required.
+ Handle(GEOM_Function) aFunction = GEOM::GetCreatedLast(theShape,theAx1)->GetLastFunction();
+
+ // Make a Python command
+ GEOM::TPythonDump(aFunction, /*append=*/true)
+ << "listShapesOnPlane = geompy.GetShapesOnPlaneWithLocationIDs"
+ << "(" << theShape << ", " << aShapeType << ", " << theAx1 << ", "<< thePnt << ", " << theState << ")";
+
+ SetErrorCode(OK);
+ return aSeq;
+}
+
+//=============================================================================
+/*!
+ * GetShapesOnCylinderIDs
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetShapesOnCylinderIDs
+ (const Handle(GEOM_Object)& theShape,
+ const Standard_Integer theShapeType,
+ const Handle(GEOM_Object)& theAxis,
+ const Standard_Real theRadius,
+ const GEOMAlgo_State theState)
+{
+ SetErrorCode(KO);
+
+ if (theShape.IsNull() || theAxis.IsNull()) return NULL;
+
+ TopoDS_Shape aShape = theShape->GetValue();
+ TopoDS_Shape anAxis = theAxis->GetValue();
+
+ if (aShape.IsNull() || anAxis.IsNull()) return NULL;
+
+ TopAbs_ShapeEnum aShapeType = TopAbs_ShapeEnum(theShapeType);
+ if ( !checkTypeShapesOn( aShapeType ))
+ return NULL;
+
+ // Create a cylinder surface
+ Handle(Geom_Surface) aCylinder = makeCylinder( anAxis, theRadius );
+ if ( aCylinder.IsNull() )
+ return NULL;
+
+ // Find object IDs
+ Handle(TColStd_HSequenceOfInteger) aSeq;
+ aSeq = getShapesOnSurfaceIDs( aCylinder, aShape, aShapeType, theState );
+
+ // The GetShapesOnCylinder() doesn't change object so no new function is required.
+ Handle(GEOM_Function) aFunction = GEOM::GetCreatedLast(theShape,theAxis)->GetLastFunction();
+
+ // Make a Python command
+ GEOM::TPythonDump(aFunction, /*append=*/true)
+ << "listShapesOnCylinder = geompy.GetShapesOnCylinderIDs"
+ << "(" << theShape << ", " << aShapeType << ", " << theAxis << ", "
+ << theRadius << ", " << theState << ")";
+
+ SetErrorCode(OK);
+ return aSeq;
+}
+
+//=============================================================================
+/*!
+ * GetShapesOnSphereIDs
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetShapesOnSphereIDs
+ (const Handle(GEOM_Object)& theShape,
+ const Standard_Integer theShapeType,
+ const Handle(GEOM_Object)& theCenter,
+ const Standard_Real theRadius,
+ const GEOMAlgo_State theState)
+{
+ SetErrorCode(KO);
+
+ if (theShape.IsNull() || theCenter.IsNull()) return NULL;
+
+ TopoDS_Shape aShape = theShape->GetValue();
+ TopoDS_Shape aCenter = theCenter->GetValue();
+
+ if (aShape.IsNull() || aCenter.IsNull()) return NULL;
+
+ TopAbs_ShapeEnum aShapeType = TopAbs_ShapeEnum(theShapeType);
+ if ( !checkTypeShapesOn( aShapeType ))
+ return NULL;
+
+ // Center of the sphere
+ if (aCenter.ShapeType() != TopAbs_VERTEX) return NULL;
+ gp_Pnt aLoc = BRep_Tool::Pnt(TopoDS::Vertex(aCenter));
+
+ gp_Ax3 anAx3 (aLoc, gp::DZ());
+ Handle(Geom_SphericalSurface) aSphere =
+ new Geom_SphericalSurface(anAx3, theRadius);
+
+ // Find object IDs
+ Handle(TColStd_HSequenceOfInteger) aSeq;
+ aSeq = getShapesOnSurfaceIDs( aSphere, aShape, aShapeType, theState );
+
+ // The GetShapesOnSphere() doesn't change object so no new function is required.
+ Handle(GEOM_Function) aFunction = GEOM::GetCreatedLast(theShape,theCenter)->GetLastFunction();
+
+ // Make a Python command
+ GEOM::TPythonDump(aFunction, /*append=*/true)
+ << "listShapesOnCylinder = geompy.GetShapesOnCylinderIDs"
+ << "(" << theShape << ", " << aShapeType << ", " << theCenter << ", "
+ << theRadius << ", " << theState << ")";
+
+ SetErrorCode(OK);
+ return aSeq;
+}
+
+//=======================================================================
+//function : getShapesOnQuadrangleIDs
+ /*!
+ * \brief Find IDs of subshapes complying with given status about quadrangle
+ * \param theShape - the shape to explore
+ * \param theShapeType - type of subshape of theShape
+ * \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 - required state
+ * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
+ */
+//=======================================================================
+Handle(TColStd_HSequenceOfInteger)
+ GEOMImpl_IShapesOperations::getShapesOnQuadrangleIDs (const Handle(GEOM_Object)& theShape,
+ const Standard_Integer theShapeType,
+ const Handle(GEOM_Object)& theTopLeftPoint,
+ const Handle(GEOM_Object)& theTopRigthPoint,
+ const Handle(GEOM_Object)& theBottomLeftPoint,
+ const Handle(GEOM_Object)& theBottomRigthPoint,
+ const GEOMAlgo_State theState)
+{
+ SetErrorCode(KO);
+
+ if ( theShape.IsNull() ||
+ theTopLeftPoint.IsNull() ||
+ theTopRigthPoint.IsNull() ||
+ theBottomLeftPoint.IsNull() ||
+ theBottomRigthPoint.IsNull() )
+ return NULL;
+
+ TopoDS_Shape aShape = theShape->GetValue();
+ TopoDS_Shape aTL = theTopLeftPoint->GetValue();
+ TopoDS_Shape aTR = theTopRigthPoint->GetValue();
+ TopoDS_Shape aBL = theBottomLeftPoint->GetValue();
+ TopoDS_Shape aBR = theBottomRigthPoint->GetValue();
+
+ if (aShape.IsNull() ||
+ aTL.IsNull() ||
+ aTR.IsNull() ||
+ aBL.IsNull() ||
+ aBR.IsNull() ||
+ aTL.ShapeType() != TopAbs_VERTEX ||
+ aTR.ShapeType() != TopAbs_VERTEX ||
+ aBL.ShapeType() != TopAbs_VERTEX ||
+ aBR.ShapeType() != TopAbs_VERTEX )
+ return NULL;
+
+ TopAbs_ShapeEnum aShapeType = TopAbs_ShapeEnum(theShapeType);
+ if ( !checkTypeShapesOn( aShapeType ))
+ return NULL;
+
+ Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
+
+ // Check presence of triangulation, build if need
+ if (!CheckTriangulation(aShape)) {
+ SetErrorCode("Cannot build triangulation on the shape");
+ return aSeqOfIDs;
+ }
+
+ // Call algo
+ gp_Pnt aPntTL = BRep_Tool::Pnt(TopoDS::Vertex(aTL));
+ gp_Pnt aPntTR = BRep_Tool::Pnt(TopoDS::Vertex(aTR));
+ gp_Pnt aPntBL = BRep_Tool::Pnt(TopoDS::Vertex(aBL));
+ gp_Pnt aPntBR = BRep_Tool::Pnt(TopoDS::Vertex(aBR));
+
+ GEOMAlgo_FinderShapeOnQuad aFinder( aPntTL, aPntTR, aPntBL, aPntBR );
+ Standard_Real aTol = 0.0001; // default value
+
+ aFinder.SetShape(aShape);
+ aFinder.SetTolerance(aTol);
+ //aFinder.SetSurface(theSurface);
+ aFinder.SetShapeType(aShapeType);
+ aFinder.SetState(theState);
+
+ // Sets the minimal number of inner points for the faces that do not have own
+ // inner points at all (for e.g. rectangular planar faces have just 2 triangles).
+ // Default value=3
+ aFinder.SetNbPntsMin(3);
+ // Sets the maximal number of inner points for edges or faces.
+ // It is usefull for the cases when this number is very big (e.g =2000) to improve
+ // the performance. If this value =0, all inner points will be taken into account.
+ // Default value=0
+ aFinder.SetNbPntsMax(100);
+
+ aFinder.Perform();
+
+ // Interprete results
+ Standard_Integer iErr = aFinder.ErrorStatus();
+ // the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx
+ if (iErr) {
+ MESSAGE(" iErr : " << iErr);
+ TCollection_AsciiString aMsg (" iErr : ");
+ aMsg += TCollection_AsciiString(iErr);
+ SetErrorCode(aMsg);
+ return aSeqOfIDs;
+ }
+ Standard_Integer iWrn = aFinder.WarningStatus();
+ // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn1.cxx
+ if (iWrn) {
+ MESSAGE(" *** iWrn : " << iWrn);
+ }
+
+ const TopTools_ListOfShape& listSS = aFinder.Shapes(); // the result
+
+ if (listSS.Extent() < 1) {
+ //SetErrorCode("Not a single sub-shape of the requested type found on the given surface");
+ SetErrorCode(NOT_FOUND_ANY); // NPAL18017
+ return aSeqOfIDs;
+ }
+
+ // Fill sequence of object IDs
+ aSeqOfIDs = new TColStd_HSequenceOfInteger;
+
+ TopTools_IndexedMapOfShape anIndices;
+ TopExp::MapShapes(aShape, anIndices);
+
+ TopTools_ListIteratorOfListOfShape itSub (listSS);
+ for (int index = 1; itSub.More(); itSub.Next(), ++index) {
+ int id = anIndices.FindIndex(itSub.Value());
+ aSeqOfIDs->Append(id);
+ }
+ return aSeqOfIDs;
+}
+
+//=======================================================================
+//function : GetShapesOnQuadrangle
+ /*!
+ * \brief Find subshapes complying with given status about quadrangle
+ * \param theShape - the shape to explore
+ * \param theShapeType - type of subshape of theShape
+ * \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 - required state
+ * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
+ */
+//=======================================================================
+Handle(TColStd_HSequenceOfTransient)
+ GEOMImpl_IShapesOperations::GetShapesOnQuadrangle (const Handle(GEOM_Object)& theShape,
+ const Standard_Integer theShapeType,
+ const Handle(GEOM_Object)& theTopLeftPoint,
+ const Handle(GEOM_Object)& theTopRigthPoint,
+ const Handle(GEOM_Object)& theBottomLeftPoint,
+ const Handle(GEOM_Object)& theBottomRigthPoint,
+ const GEOMAlgo_State theState)
+{
+ // Find indices
+ Handle(TColStd_HSequenceOfInteger) aSeqOfIDs =
+ getShapesOnQuadrangleIDs( theShape,
+ theShapeType,
+ theTopLeftPoint,
+ theTopRigthPoint,
+ theBottomLeftPoint,
+ theBottomRigthPoint,
+ theState);
+ if ( aSeqOfIDs.IsNull() || aSeqOfIDs->IsEmpty() )
+ return NULL;
+
+ // Find objects by indices
+ TCollection_AsciiString anAsciiList;
+ Handle(TColStd_HSequenceOfTransient) aSeq;
+ aSeq = getObjectsShapesOn( theShape, aSeqOfIDs, anAsciiList );
+ if ( aSeq.IsNull() || aSeq->IsEmpty() )
+ return NULL;
+
+ // Make a Python command
+
+ Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast( aSeq->Value( 1 ));
+ Handle(GEOM_Function) aFunction = anObj->GetLastFunction();
+
+ GEOM::TPythonDump(aFunction)
+ << "[" << anAsciiList.ToCString() << "] = geompy.GetShapesOnQuadrangle("
+ << theShape << ", "
+ << TopAbs_ShapeEnum(theShapeType) << ", "
+ << theTopLeftPoint << ", "
+ << theTopRigthPoint << ", "
+ << theBottomLeftPoint << ", "
+ << theBottomRigthPoint << ", "
+ << theState << ")";
+
+ SetErrorCode(OK);
+ return aSeq;
+}
+
+//=======================================================================
+//function : GetShapesOnQuadrangleIDs
+ /*!
+ * \brief Find IDs of subshapes complying with given status about quadrangle
+ * \param theShape - the shape to explore
+ * \param theShapeType - type of subshape of theShape
+ * \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 - required state
+ * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
+ */
+//=======================================================================
+Handle(TColStd_HSequenceOfInteger)
+ GEOMImpl_IShapesOperations::GetShapesOnQuadrangleIDs (const Handle(GEOM_Object)& theShape,
+ const Standard_Integer theShapeType,
+ const Handle(GEOM_Object)& theTopLeftPoint,
+ const Handle(GEOM_Object)& theTopRigthPoint,
+ const Handle(GEOM_Object)& theBottomLeftPoint,
+ const Handle(GEOM_Object)& theBottomRigthPoint,
+ const GEOMAlgo_State theState)
+{
+ // Find indices
+ Handle(TColStd_HSequenceOfInteger) aSeqOfIDs =
+ getShapesOnQuadrangleIDs( theShape,
+ theShapeType,
+ theTopLeftPoint,
+ theTopRigthPoint,
+ theBottomLeftPoint,
+ theBottomRigthPoint,
+ theState);
+ if ( aSeqOfIDs.IsNull() || aSeqOfIDs->IsEmpty() )
+ return NULL;
+
+ // Make a Python command
+
+ // The GetShapesOnCylinder() doesn't change object so no new function is required.
+ Handle(GEOM_Object) lastObj = GEOM::GetCreatedLast(theShape,theTopLeftPoint);
+ lastObj = GEOM::GetCreatedLast(lastObj,theTopRigthPoint);
+ lastObj = GEOM::GetCreatedLast(lastObj,theBottomRigthPoint);
+ lastObj = GEOM::GetCreatedLast(lastObj,theBottomLeftPoint);
+ Handle(GEOM_Function) aFunction = lastObj->GetLastFunction();
+
+ GEOM::TPythonDump(aFunction, /*append=*/true)
+ << "listShapesOnQuadrangle = geompy.GetShapesOnQuadrangleIDs("
+ << theShape << ", "
+ << TopAbs_ShapeEnum(theShapeType) << ", "
+ << theTopLeftPoint << ", "
+ << theTopRigthPoint << ", "
+ << theBottomLeftPoint << ", "
+ << theBottomRigthPoint << ", "
+ << theState << ")";
+
+ SetErrorCode(OK);
+ return aSeqOfIDs;
+}
+
+//=============================================================================
+/*!
+ * GetInPlaceOfShape
+ */
+//=============================================================================
+static bool GetInPlaceOfShape (const Handle(GEOM_Function)& theWhereFunction,
+ const TopTools_IndexedMapOfShape& theWhereIndices,
+ const TopoDS_Shape& theWhat,
+ TColStd_ListOfInteger& theModifiedList)
+{
+ if (theWhereFunction.IsNull() || theWhat.IsNull()) return false;
+
+ if (theWhereIndices.Contains(theWhat)) {
+ // entity was not changed by the operation
+ Standard_Integer aWhatIndex = theWhereIndices.FindIndex(theWhat);
+ theModifiedList.Append(aWhatIndex);
+ return true;
+ }