]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
PAL7508. Update implementation of GetShapesOn<xxx>() functions.
authorjfa <jfa@opencascade.com>
Fri, 21 Jan 2005 09:16:41 +0000 (09:16 +0000)
committerjfa <jfa@opencascade.com>
Fri, 21 Jan 2005 09:16:41 +0000 (09:16 +0000)
idl/GEOM_Gen.idl
src/GEOMImpl/GEOMImpl_IShapesOperations.cxx
src/GEOMImpl/GEOMImpl_IShapesOperations.hxx
src/GEOM_I/GEOM_IShapesOperations_i.cc
src/GEOM_I/GEOM_IShapesOperations_i.hh
src/GEOM_SWIG/GEOM_TestOthers.py
src/GEOM_SWIG/batchmode_geompy.py
src/GEOM_SWIG/geompy.py

index 2c40235b5f26efe8445d79d5f78094c6dd4b1126..35bcfaa4c703bf5ebbe69b830abaf8c89954a036 100644 (file)
@@ -18,6 +18,44 @@ module GEOM
   enum shape_type { COMPOUND, COMPSOLID, SOLID, SHELL,
                    FACE, WIRE, EDGE, VERTEX, SHAPE };
 
+
+  /*!
+   *  State of shape relatively geometrical surface like plane, sphere or cylinder.
+   *  Is used in functions GEOM_IShapesOperations.GetShapesOn<xxx>()
+   */
+  enum shape_state
+  {
+    /*! Shape is on surface */
+    ST_ON,
+
+    /*!
+     *  Shape is in the direction defined by the normal and not on surface.
+     *  For plane it means above the plane,
+     *  For sphere and cylinder it means outside of volume, bounded by the surface.
+     */
+    ST_OUT,
+
+    /*!
+     *  Shape is in the direction defined by the normal and on surface.
+     *  ONOUT = ON || OUT
+     */
+    ST_ONOUT,
+
+    /*!
+     *  Complementary to ONOUT.
+     *  For plane it means below the plane,
+     *  For sphere and cylinder it means inside the volume, bounded by the surface
+     *  (beyond axis and surface for cylinder and beyond cented and surface for sphere).
+     */
+    ST_IN,
+
+    /*!
+     *  Complementary to OUT.
+     *  ONIN = ON || IN
+     */
+    ST_ONIN
+  };
+
   typedef sequence<string>      string_array;
   typedef sequence<short>       short_array;
   typedef sequence<long>        ListOfLong;
@@ -877,45 +915,52 @@ module GEOM
                              in long        theShapeType);
 
     /*!
-     *  Get sub-shapes of theShape of the given type,
-     *  laying on the specified plane.
+     *  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.
      *  \param theShape Shape to find sub-shapes of.
      *  \param theShapeType Type of sub-shapes to be retrieved.
-     *  \param thePlane Face, specifying the plane to find shapes on.
-     *  \return Group of all found sub-shapes.
+     *  \param theAx1 Vector (or line, or linear edge), specifying normal
+     *                direction and location of the plane to find shapes on.
+     *  \param theState The state of the subshapes to find.
+     *  \return List of all found sub-shapes.
      */
-    GEOM_Object GetShapesOnPlane (in GEOM_Object theShape,
-                                 in long        theShapeType,
-                                 in GEOM_Object thePlane);
+    ListOfGO GetShapesOnPlane (in GEOM_Object theShape,
+                              in long        theShapeType,
+                              in GEOM_Object theAx1,
+                              in shape_state theState);
 
     /*!
-     *  Get sub-shape of theShape of the given type,
-     *  laying on the specified cylinder.
+     *  Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
+     *  the specified cylinder 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 theAxis Vector (or line, or linear edge), specifying
      *                 axis of the cylinder to find shapes on.
      *  \param theRadius Radius of the cylinder to find shapes on.
-     *  \return Group of all found sub-shapes.
+     *  \param theState The state of the subshapes to find.
+     *  \return List of all found sub-shapes.
      */
-    GEOM_Object GetShapesOnCylinder (in GEOM_Object theShape,
-                                    in long        theShapeType,
-                                    in GEOM_Object theAxis,
-                                    in double      theRadius);
+    ListOfGO GetShapesOnCylinder (in GEOM_Object theShape,
+                                 in long        theShapeType,
+                                 in GEOM_Object theAxis,
+                                 in double      theRadius,
+                                 in shape_state theState);
 
     /*!
-     *  Get sub-shape of theShape of the given type,
-     *  laying on the specified sphere.
+     *  Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
+     *  the specified sphere 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.
-     *  \return Group of all found sub-shapes.
-     */
-    GEOM_Object GetShapesOnSphere (in GEOM_Object theShape,
-                                  in long        theShapeType,
-                                  in GEOM_Object theCenter,
-                                  in double      theRadius);
+     *  \param theState The state of the subshapes to find.
+     *  \return List of all found sub-shapes.
+     */
+    ListOfGO GetShapesOnSphere (in GEOM_Object theShape,
+                               in long        theShapeType,
+                               in GEOM_Object theCenter,
+                               in double      theRadius,
+                               in shape_state theState);
 
     /*!
      *  Get sub-shape(s) of theShapeWhere, which are
index 71ff1b32ddc01c4b1a4c04452711dadb6e106f56..60ef003672c766723fe7b33d2032d5ee8b461143 100644 (file)
@@ -17,6 +17,8 @@ using namespace std;
 
 #include "GEOM_Function.hxx"
 
+#include "GEOMAlgo_FinderShapeOn.hxx"
+
 #include "utilities.h"
 #include "OpUtil.hxx"
 #include "Utils_ExceptHandlers.hxx"
@@ -1014,19 +1016,20 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetSharedShapes
  *  GetShapesOnPlane
  */
 //=============================================================================
-Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetShapesOnPlane
-                                          (Handle(GEOM_Object)    theShape,
-                                           const Standard_Integer theShapeType,
-                                           Handle(GEOM_Object)    thePlane)
+Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnPlane
+                                        (const Handle(GEOM_Object)& theShape,
+                                         const Standard_Integer     theShapeType,
+                                         const Handle(GEOM_Object)& theAx1,
+                                         const GEOMAlgo_State       theState)
 {
   SetErrorCode(KO);
 
-  if (theShape.IsNull() || thePlane.IsNull()) return NULL;
+  if (theShape.IsNull() || theAx1.IsNull()) return NULL;
 
   TopoDS_Shape aShape = theShape->GetValue();
-  TopoDS_Shape aPlane = thePlane->GetValue();
+  TopoDS_Shape anAx1  = theAx1->GetValue();
 
-  if (aShape.IsNull() || aPlane.IsNull()) return NULL;
+  if (aShape.IsNull() || anAx1.IsNull()) return NULL;
 
   TopAbs_ShapeEnum aShapeType = TopAbs_ShapeEnum(theShapeType);
   if (aShapeType != TopAbs_VERTEX &&
@@ -1036,139 +1039,339 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetShapesOnPlane
     return NULL;
   }
 
-  //Get plane parameters
-  if (aPlane.IsNull() || aPlane.ShapeType() != TopAbs_FACE) return NULL;
-  TopoDS_Face aFace = TopoDS::Face(aPlane);
-  Handle(Geom_Surface) surf = BRep_Tool::Surface(aFace);
-  Handle(Geom_Plane) pln = Handle(Geom_Plane)::DownCast(surf);
-  if (pln.IsNull()) {
-    SetErrorCode("Not planar face given");
+  // Create plane
+  if (anAx1.ShapeType() != TopAbs_EDGE) return NULL;
+  TopoDS_Edge anEdge = TopoDS::Edge(anAx1);
+  TopoDS_Vertex V1, V2;
+  TopExp::Vertices(anEdge, V1, V2, Standard_True);
+  if (V1.IsNull() || V2.IsNull()) {
+    SetErrorCode("Bad edge given for the plane normal vector");
+    return NULL;
+  }
+  gp_Pnt aLoc = BRep_Tool::Pnt(V1);
+  gp_Vec aVec (aLoc, BRep_Tool::Pnt(V2));
+  if (aVec.Magnitude() < Precision::Confusion()) {
+    SetErrorCode("Vector with null magnitude given");
     return NULL;
   }
-  const gp_Ax3 pos = pln->Position();
-  const gp_Pnt loc = pos.Location();
-  const gp_Dir dir = pos.Direction();
 
-  //Find sub-shapes on the plane
-  TopTools_ListOfShape listSS;
-  TopTools_MapOfShape mapShapes;
-  TopExp_Explorer exp (aShape, aShapeType);
-  for (; exp.More(); exp.Next()) {
-    TopoDS_Shape aSS = exp.Current();
-    if (mapShapes.Add(aSS)) {
-      switch (aShapeType) {
-      case TopAbs_VERTEX:
-        {
-          TopoDS_Vertex aV = TopoDS::Vertex(aSS);
-          gp_Pnt aP = BRep_Tool::Pnt(aV);
-          gp_Vec vecToLoc (aP, loc);
-          if (vecToLoc.IsNormal(dir, Precision::Angular())) {
-            listSS.Append(aSS);
-          }
-        }
-        break;
-      case TopAbs_EDGE:
-        {
-          TopoDS_Edge anEdge = TopoDS::Edge(aSS);
-          Standard_Real f, l;
-          Handle(Geom2d_Curve) PC;
-          Handle(Geom_Surface) cur_surf;
-          TopLoc_Location L;
-          Standard_Integer i = 0;
+  Handle(Geom_Plane) aPlane = new Geom_Plane(aLoc, - aVec);
+  // The "-" is because interpretation of normale differs
+  // between interface and algorithm for the case of plane
+
+  // Call algo
+  GEOMAlgo_FinderShapeOn aFinder;
+  Standard_Real aTol = 0.0001; // default value
+
+  aFinder.SetShape(aShape);
+  aFinder.SetTolerance(aTol);
+  aFinder.SetSurface(aPlane);
+  aFinder.SetShapeType(aShapeType);
+  aFinder.SetState(theState);
+
+  aFinder.Perform();
+
+  // Interprete results
+  Standard_Integer iErr = aFinder.ErrorStatus();
+  // the detailed description of error codes is in GEOMAlgo_FinderShapeOn.cxx
+  if (iErr) {
+    MESSAGE(" iErr : " << iErr);
+    TCollection_AsciiString aMsg (" iErr : ");
+    aMsg += TCollection_AsciiString(iErr);
+    SetErrorCode(aMsg);
+    return NULL;
+  }
+  Standard_Integer iWrn = aFinder.WarningStatus();
+  // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn.cxx
+  if (iWrn) {
+    MESSAGE(" *** iWrn : " << iWrn);
+  }
 
-          // iterate on the surfaces of the edge
-          while (Standard_True) {
-            i++;
-            BRep_Tool::CurveOnSurface(anEdge, PC , cur_surf, L, f, l, i);
-            if (cur_surf.IsNull()) break;
+  const TopTools_ListOfShape& listSS = aFinder.Shapes(); // the result
 
-            Handle(Geom_Plane) cur_pln = Handle(Geom_Plane)::DownCast(cur_surf);
-            if (!cur_pln.IsNull()) {
-              const gp_Ax3 cur_pos = cur_pln->Position();
-              const gp_Pnt cur_loc = cur_pos.Location();
-              const gp_Dir cur_dir = cur_pos.Direction();
-              gp_Vec vecToLoc (cur_loc, loc);
-              if (vecToLoc.IsNormal(dir, Precision::Angular()) &&
-                  cur_dir.IsParallel(dir, Precision::Angular())) {
-                listSS.Append(aSS);
-              }
-            }
-          }
-        }
-        break;
-      case TopAbs_FACE:
-        {
-          TopoDS_Face aF = TopoDS::Face(aSS);
-          Handle(Geom_Surface) cur_surf = BRep_Tool::Surface(aF);
-          Handle(Geom_Plane) cur_pln = Handle(Geom_Plane)::DownCast(cur_surf);
-          if (!cur_pln.IsNull()) {
-            const gp_Ax3 cur_pos = cur_pln->Position();
-            const gp_Pnt cur_loc = cur_pos.Location();
-            const gp_Dir cur_dir = cur_pos.Direction();
-            gp_Vec vecToLoc (cur_loc, loc);
-            if (vecToLoc.IsNormal(dir, Precision::Angular()) &&
-                cur_dir.IsParallel(dir, Precision::Angular())) {
-              listSS.Append(aSS);
-            }
-          }
-        }
-        break;
-      default:
-        break;
-      }
-    }
+  if (listSS.Extent() < 1) {
+    SetErrorCode("Not a single sub-shape of the requested type found on the given plane");
+    return NULL;
+  }
+
+  // Fill sequence of objects
+  TopTools_IndexedMapOfShape anIndices;
+  TopExp::MapShapes(aShape, anIndices);
+
+  Handle(GEOM_Object) anObj;
+  Handle(TColStd_HArray1OfInteger) anArray;
+  Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
+
+  TopTools_ListIteratorOfListOfShape itSub (listSS);
+  for (int index = 1; itSub.More(); itSub.Next(), ++index) {
+    int id = anIndices.FindIndex(itSub.Value());
+    anArray = new TColStd_HArray1OfInteger(1,1);
+    anArray->SetValue(1, id);
+    anObj = GetEngine()->AddSubShape(theShape, anArray);
+    aSeq->Append(anObj);
+  }
+  
+  // The GetShapesOnPlane() doesn't change object so no new function is required.
+  Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
+
+  // Make a Python command
+  TCollection_AsciiString anEntry, aDescr
+    ("\nlistShapesOnPlane = IShapesOperations.GetShapesOnPlane(");
+  TDF_Tool::Entry(theShape->GetEntry(), anEntry);
+  aDescr += anEntry + TCollection_AsciiString(theShapeType) + ",";
+  TDF_Tool::Entry(theAx1->GetEntry(), anEntry);
+  aDescr += anEntry + ",";
+  aDescr += TCollection_AsciiString(theState) + ")";
+
+  TCollection_AsciiString anOldDescr = aFunction->GetDescription();
+  anOldDescr += aDescr;
+  aFunction->SetDescription(anOldDescr);
+
+  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 (aShapeType != TopAbs_VERTEX &&
+      aShapeType != TopAbs_EDGE &&
+      aShapeType != TopAbs_FACE) {
+    SetErrorCode("Not implemented for the given sub-shape type");
+    return NULL;
   }
 
+  //Axis of the cylinder
+  if (anAxis.ShapeType() != TopAbs_EDGE) {
+    SetErrorCode("Not an edge given for the axis");
+    return NULL;
+  }
+  TopoDS_Edge anEdge = TopoDS::Edge(anAxis);
+  TopoDS_Vertex V1, V2;
+  TopExp::Vertices(anEdge, V1, V2, Standard_True);
+  if (V1.IsNull() || V2.IsNull()) {
+    SetErrorCode("Bad edge given for the axis");
+    return NULL;
+  }
+  gp_Pnt aLoc = BRep_Tool::Pnt(V1);
+  gp_Vec aVec (aLoc, BRep_Tool::Pnt(V2));
+  if (aVec.Magnitude() < Precision::Confusion()) {
+    SetErrorCode("Vector with null magnitude given");
+    return NULL;
+  }
+
+  gp_Ax3 anAx3 (aLoc, aVec);
+  Handle(Geom_CylindricalSurface) aCylinder =
+    new Geom_CylindricalSurface(anAx3, theRadius);
+
+  // Call algo
+  GEOMAlgo_FinderShapeOn aFinder;
+  Standard_Real aTol = 0.0001; // default value
+
+  aFinder.SetShape(aShape);
+  aFinder.SetTolerance(aTol);
+  aFinder.SetSurface(aCylinder);
+  aFinder.SetShapeType(aShapeType);
+  aFinder.SetState(theState);
+
+  aFinder.Perform();
+
+  // Interprete results
+  Standard_Integer iErr = aFinder.ErrorStatus();
+  // the detailed description of error codes is in GEOMAlgo_FinderShapeOn.cxx
+  if (iErr) {
+    MESSAGE(" iErr : " << iErr);
+    TCollection_AsciiString aMsg (" iErr : ");
+    aMsg += TCollection_AsciiString(iErr);
+    SetErrorCode(aMsg);
+    return NULL;
+  }
+  Standard_Integer iWrn = aFinder.WarningStatus();
+  // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn.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 plane");
+    SetErrorCode("Not a single sub-shape of the requested type found on the given cylinder");
     return NULL;
   }
 
-  //Fill array of indices
+  // Fill sequence of objects
   TopTools_IndexedMapOfShape anIndices;
   TopExp::MapShapes(aShape, anIndices);
 
-  Handle(TColStd_HArray1OfInteger) anArray =
-    new TColStd_HArray1OfInteger (1, listSS.Extent());
+  Handle(GEOM_Object) anObj;
+  Handle(TColStd_HArray1OfInteger) anArray;
+  Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
+
   TopTools_ListIteratorOfListOfShape itSub (listSS);
   for (int index = 1; itSub.More(); itSub.Next(), ++index) {
     int id = anIndices.FindIndex(itSub.Value());
-    anArray->SetValue(index, id);
+    anArray = new TColStd_HArray1OfInteger(1,1);
+    anArray->SetValue(1, id);
+    anObj = GetEngine()->AddSubShape(theShape, anArray);
+    aSeq->Append(anObj);
   }
   
-  //Add a new group object
-  Handle(GEOM_Object) aGroup = GetEngine()->AddSubShape(theShape, anArray);
+  // The GetShapesOnCylinder() doesn't change object so no new function is required.
+  Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
 
-  //Set a GROUP type
-  aGroup->SetType(GEOM_GROUP);
+  // Make a Python command
+  TCollection_AsciiString anEntry, aDescr
+    ("\nlistShapesOnCylinder = IShapesOperations.GetShapesOnCylinder(");
+  TDF_Tool::Entry(theShape->GetEntry(), anEntry);
+  aDescr += anEntry + TCollection_AsciiString(theShapeType) + ",";
+  TDF_Tool::Entry(theAxis->GetEntry(), anEntry);
+  aDescr += anEntry + ",";
+  aDescr += TCollection_AsciiString(theRadius) + ",";
+  aDescr += TCollection_AsciiString(theState) + ")";
 
-  //Set a sub shape type
-  TDF_Label aFreeLabel = aGroup->GetFreeLabel();
-  TDataStd_Integer::Set(aFreeLabel, (Standard_Integer)theShapeType);
-  //Make a Python command
-  TCollection_AsciiString anEntry, aDescr;
-  TDF_Tool::Entry(aGroup->GetEntry(), anEntry);
-  aDescr += anEntry;
-  aDescr += " = IShapesOperations.GetShapesOnPlane(";
+  TCollection_AsciiString anOldDescr = aFunction->GetDescription();
+  anOldDescr += aDescr;
+  aFunction->SetDescription(anOldDescr);
+
+  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 (aShapeType != TopAbs_VERTEX &&
+      aShapeType != TopAbs_EDGE &&
+      aShapeType != TopAbs_FACE) {
+    SetErrorCode("Not implemented for the given sub-shape type");
+    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);
+
+  // Call algo
+  GEOMAlgo_FinderShapeOn aFinder;
+  Standard_Real aTol = 0.0001; // default value
+
+  aFinder.SetShape(aShape);
+  aFinder.SetTolerance(aTol);
+  aFinder.SetSurface(aSphere);
+  aFinder.SetShapeType(aShapeType);
+  aFinder.SetState(theState);
+
+  aFinder.Perform();
+
+  // Interprete results
+  Standard_Integer iErr = aFinder.ErrorStatus();
+  // the detailed description of error codes is in GEOMAlgo_FinderShapeOn.cxx
+  if (iErr) {
+    MESSAGE(" iErr : " << iErr);
+    TCollection_AsciiString aMsg (" iErr : ");
+    aMsg += TCollection_AsciiString(iErr);
+    SetErrorCode(aMsg);
+    return NULL;
+  }
+  Standard_Integer iWrn = aFinder.WarningStatus();
+  // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn.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 sphere");
+    return NULL;
+  }
+
+  // Fill sequence of objects
+  TopTools_IndexedMapOfShape anIndices;
+  TopExp::MapShapes(aShape, anIndices);
+
+  Handle(GEOM_Object) anObj;
+  Handle(TColStd_HArray1OfInteger) anArray;
+  Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
+
+  TopTools_ListIteratorOfListOfShape itSub (listSS);
+  for (int index = 1; itSub.More(); itSub.Next(), ++index) {
+    int id = anIndices.FindIndex(itSub.Value());
+    anArray = new TColStd_HArray1OfInteger(1,1);
+    anArray->SetValue(1, id);
+    anObj = GetEngine()->AddSubShape(theShape, anArray);
+    aSeq->Append(anObj);
+  }
+  
+  // The GetShapesOnSphere() doesn't change object so no new function is required.
+  Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
+
+  // Make a Python command
+  TCollection_AsciiString anEntry, aDescr
+    ("\nlistShapesOnSphere = IShapesOperations.GetShapesOnSphere(");
   TDF_Tool::Entry(theShape->GetEntry(), anEntry);
   aDescr += anEntry + TCollection_AsciiString(theShapeType) + ",";
-  TDF_Tool::Entry(thePlane->GetEntry(), anEntry);
-  aDescr += anEntry + ")";
+  TDF_Tool::Entry(theCenter->GetEntry(), anEntry);
+  aDescr += anEntry + ",";
+  aDescr += TCollection_AsciiString(theRadius) + ",";
+  aDescr += TCollection_AsciiString(theState) + ")";
 
-  Handle(GEOM_Function) aFunction = aGroup->GetFunction(1);
-  aFunction->SetDescription(aDescr);
+  TCollection_AsciiString anOldDescr = aFunction->GetDescription();
+  anOldDescr += aDescr;
+  aFunction->SetDescription(anOldDescr);
 
   SetErrorCode(OK);
-  return aGroup;
+  return aSeq;
 }
 
 //=============================================================================
 /*!
- *  GetShapesOnCylinder
+ *  GetShapesOnCylinderOld
  */
 //=============================================================================
-Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetShapesOnCylinder
+Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetShapesOnCylinderOld
                                           (Handle(GEOM_Object)    theShape,
                                            const Standard_Integer theShapeType,
                                            Handle(GEOM_Object)    theAxis,
@@ -1329,10 +1532,10 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetShapesOnCylinder
 
 //=============================================================================
 /*!
- *  GetShapesOnSphere
+ *  GetShapesOnSphereOld
  */
 //=============================================================================
-Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetShapesOnSphere
+Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetShapesOnSphereOld
                                           (Handle(GEOM_Object)    theShape,
                                            const Standard_Integer theShapeType,
                                            Handle(GEOM_Object)    theCenter,
index 469f8854114796af483141f9b3de0ce7015d00a3..3980e8878265a415b9bb0b0d5710b06d2d0b799e 100644 (file)
@@ -4,6 +4,8 @@
 
 #include "GEOM_IOperations.hxx"
 
+#include "GEOMAlgo_State.hxx"
+
 #include <TopTools_ListOfShape.hxx>
 #include <TColStd_HSequenceOfTransient.hxx>
 #include <TColStd_HSequenceOfInteger.hxx>
@@ -62,19 +64,32 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations {
                                                         Handle(GEOM_Object)    theShape2,
                                                         const Standard_Integer theShapeType);
 
-  Handle(GEOM_Object) GetShapesOnPlane (Handle(GEOM_Object)    theShape,
-                                        const Standard_Integer theShapeType,
-                                        Handle(GEOM_Object)    thePlane);
-
-  Handle(GEOM_Object) GetShapesOnCylinder (Handle(GEOM_Object)    theShape,
-                                           const Standard_Integer theShapeType,
-                                           Handle(GEOM_Object)    theAxis,
-                                           const Standard_Real    theRadius);
-
-  Handle(GEOM_Object) GetShapesOnSphere (Handle(GEOM_Object)    theShape,
-                                         const Standard_Integer theShapeType,
-                                         Handle(GEOM_Object)    theCenter,
-                                         const Standard_Real    theRadius);
+  Handle(TColStd_HSequenceOfTransient) GetShapesOnPlane (const Handle(GEOM_Object)& theShape,
+                                                         const Standard_Integer     theShapeType,
+                                                         const Handle(GEOM_Object)& theAx1,
+                                                         const GEOMAlgo_State       theState);
+
+  Handle(TColStd_HSequenceOfTransient) GetShapesOnCylinder (const Handle(GEOM_Object)& theShape,
+                                                            const Standard_Integer     theShapeType,
+                                                            const Handle(GEOM_Object)& theAxis,
+                                                            const Standard_Real        theRadius,
+                                                            const GEOMAlgo_State       theState);
+
+  Handle(TColStd_HSequenceOfTransient) GetShapesOnSphere (const Handle(GEOM_Object)& theShape,
+                                                          const Standard_Integer     theShapeType,
+                                                          const Handle(GEOM_Object)& theCenter,
+                                                          const Standard_Real        theRadius,
+                                                          const GEOMAlgo_State       theState);
+
+  Handle(GEOM_Object) GetShapesOnCylinderOld (Handle(GEOM_Object)    theShape,
+                                              const Standard_Integer theShapeType,
+                                              Handle(GEOM_Object)    theAxis,
+                                              const Standard_Real    theRadius);
+
+  Handle(GEOM_Object) GetShapesOnSphereOld (Handle(GEOM_Object)    theShape,
+                                            const Standard_Integer theShapeType,
+                                            Handle(GEOM_Object)    theCenter,
+                                            const Standard_Real    theRadius);
 
   Handle(GEOM_Object) GetInPlace (Handle(GEOM_Object) theShapeWhere,
                                   Handle(GEOM_Object) theShapeWhat);
index 9bfdf7f6b873244366374d2595e7774e34205735..0ba7ed8354a33c3f4e590e3beb49605351d39b92 100644 (file)
@@ -491,6 +491,9 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::ChangeOrientation
 //=============================================================================
 GEOM::ListOfLong* GEOM_IShapesOperations_i::GetFreeFacesIDs (GEOM::GEOM_Object_ptr theShape)
 {
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
   GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
   if (theShape == NULL) return aSeq._retn();
 
@@ -519,6 +522,9 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapes
                                           GEOM::GEOM_Object_ptr theShape2,
                                           const CORBA::Long     theShapeType)
 {
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
   if (theShape1 == NULL ||
       theShape2 == NULL) return aSeq._retn();
@@ -544,40 +550,72 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSharedShapes
   return aSeq._retn();
 }
 
+static GEOMAlgo_State ShapeState (const GEOM::shape_state theState)
+{
+  GEOMAlgo_State aState = GEOMAlgo_ST_UNKNOWN;
+
+  switch (theState) {
+  case GEOM::ST_ON:
+    aState = GEOMAlgo_ST_ON;
+    break;
+  case GEOM::ST_OUT:
+    aState = GEOMAlgo_ST_OUT;
+    break;
+  case GEOM::ST_ONOUT:
+    aState = GEOMAlgo_ST_ONOUT;
+    break;
+  case GEOM::ST_IN:
+    aState = GEOMAlgo_ST_IN;
+    break;
+  case GEOM::ST_ONIN:
+    aState = GEOMAlgo_ST_ONIN;
+    break;
+  default:
+    break;
+  }
+
+  return aState;
+}
+
 //=============================================================================
 /*!
  *  GetShapesOnPlane
  */
 //=============================================================================
-GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnPlane
-                                                (GEOM::GEOM_Object_ptr theShape,
-                                                const CORBA::Long     theShapeType,
-                                                GEOM::GEOM_Object_ptr thePlane)
+GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnPlane
+                                                (GEOM::GEOM_Object_ptr   theShape,
+                                                const CORBA::Long       theShapeType,
+                                                GEOM::GEOM_Object_ptr   theAx1,
+                                                const GEOM::shape_state theState)
 {
-  GEOM::GEOM_Object_var aGEOMObject;
+  GEOM::ListOfGO_var aSeq;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theShape == NULL ||
-      thePlane == NULL) return aGEOMObject._retn();
+  if (theShape == NULL || theAx1 == NULL) return aSeq._retn();
 
   //Get the reference objects
   Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
     (theShape->GetStudyID(), theShape->GetEntry());
-  Handle(GEOM_Object) aPlane = GetOperations()->GetEngine()->GetObject
-    (thePlane->GetStudyID(), thePlane->GetEntry());
+  Handle(GEOM_Object) anAx1 = GetOperations()->GetEngine()->GetObject
+    (theAx1->GetStudyID(), theAx1->GetEntry());
 
-  if (aShape.IsNull() ||
-      aPlane.IsNull()) return aGEOMObject._retn();
+  if (aShape.IsNull() || anAx1.IsNull()) return aSeq._retn();
 
   //Get Shapes On Plane
-  Handle(GEOM_Object) anObject =
-    GetOperations()->GetShapesOnPlane(aShape, theShapeType, aPlane);
-  if (!GetOperations()->IsDone() || anObject.IsNull())
-    return aGEOMObject._retn();
+  Handle(TColStd_HSequenceOfTransient) aHSeq =
+    GetOperations()->GetShapesOnPlane(aShape, theShapeType, anAx1, ShapeState(theState));
+  if (!GetOperations()->IsDone() || aHSeq.IsNull())
+    return aSeq._retn();
 
-  return GetObject(anObject);
+  Standard_Integer aLength = aHSeq->Length();
+  aSeq = new GEOM::ListOfGO;
+  aSeq->length(aLength);
+  for (Standard_Integer i = 1; i <= aLength; i++)
+    aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+  return aSeq._retn();
 }
 
 //=============================================================================
@@ -585,19 +623,19 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnPlane
  *  GetShapesOnCylinder
  */
 //=============================================================================
-GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnCylinder
-                                                (GEOM::GEOM_Object_ptr theShape,
-                                                const CORBA::Long     theShapeType,
-                                                GEOM::GEOM_Object_ptr theAxis,
-                                                const CORBA::Double   theRadius)
+GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnCylinder
+                                                (GEOM::GEOM_Object_ptr   theShape,
+                                                const CORBA::Long       theShapeType,
+                                                GEOM::GEOM_Object_ptr   theAxis,
+                                                const CORBA::Double     theRadius,
+                                                const GEOM::shape_state theState)
 {
-  GEOM::GEOM_Object_var aGEOMObject;
+  GEOM::ListOfGO_var aSeq;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theShape == NULL ||
-      theAxis == NULL) return aGEOMObject._retn();
+  if (theShape == NULL || theAxis == NULL) return aSeq._retn();
 
   //Get the reference objects
   Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
@@ -605,16 +643,21 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnCylinder
   Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject
     (theAxis->GetStudyID(), theAxis->GetEntry());
 
-  if (aShape.IsNull() ||
-      anAxis.IsNull()) return aGEOMObject._retn();
+  if (aShape.IsNull() || anAxis.IsNull()) return aSeq._retn();
 
   //Get Shapes On Cylinder
-  Handle(GEOM_Object) anObject =
-    GetOperations()->GetShapesOnCylinder(aShape, theShapeType, anAxis, theRadius);
-  if (!GetOperations()->IsDone() || anObject.IsNull())
-    return aGEOMObject._retn();
+  Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnCylinder
+    (aShape, theShapeType, anAxis, theRadius, ShapeState(theState));
+  if (!GetOperations()->IsDone() || aHSeq.IsNull())
+    return aSeq._retn();
 
-  return GetObject(anObject);
+  Standard_Integer aLength = aHSeq->Length();
+  aSeq = new GEOM::ListOfGO;
+  aSeq->length(aLength);
+  for (Standard_Integer i = 1; i <= aLength; i++)
+    aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+  return aSeq._retn();
 }
 
 //=============================================================================
@@ -622,19 +665,19 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnCylinder
  *  GetShapesOnSphere
  */
 //=============================================================================
-GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnSphere
-                                                (GEOM::GEOM_Object_ptr theShape,
-                                                const CORBA::Long     theShapeType,
-                                                GEOM::GEOM_Object_ptr theCenter,
-                                                const CORBA::Double   theRadius)
+GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnSphere
+                                                (GEOM::GEOM_Object_ptr   theShape,
+                                                const CORBA::Long       theShapeType,
+                                                GEOM::GEOM_Object_ptr   theCenter,
+                                                const CORBA::Double     theRadius,
+                                                const GEOM::shape_state theState)
 {
-  GEOM::GEOM_Object_var aGEOMObject;
+  GEOM::ListOfGO_var aSeq;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theShape == NULL ||
-      theCenter == NULL) return aGEOMObject._retn();
+  if (theShape == NULL || theCenter == NULL) return aSeq._retn();
 
   //Get the reference objects
   Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
@@ -642,16 +685,21 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnSphere
   Handle(GEOM_Object) aCenter = GetOperations()->GetEngine()->GetObject
     (theCenter->GetStudyID(), theCenter->GetEntry());
 
-  if (aShape.IsNull() ||
-      aCenter.IsNull()) return aGEOMObject._retn();
+  if (aShape.IsNull() || aCenter.IsNull()) return aSeq._retn();
 
   //Get Shapes On Sphere
-  Handle(GEOM_Object) anObject =
-    GetOperations()->GetShapesOnSphere(aShape, theShapeType, aCenter, theRadius);
-  if (!GetOperations()->IsDone() || anObject.IsNull())
-    return aGEOMObject._retn();
+  Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnSphere
+    (aShape, theShapeType, aCenter, theRadius, ShapeState(theState));
+  if (!GetOperations()->IsDone() || aHSeq.IsNull())
+    return aSeq._retn();
 
-  return GetObject(anObject);
+  Standard_Integer aLength = aHSeq->Length();
+  aSeq = new GEOM::ListOfGO;
+  aSeq->length(aLength);
+  for (Standard_Integer i = 1; i <= aLength; i++)
+    aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+  return aSeq._retn();
 }
 
 //=============================================================================
index dea3af3294999a3f731425ab1da7fbed36921422..e4e8c4a1111b9f44b98b988887c110a4b3a9c085 100644 (file)
@@ -65,19 +65,22 @@ class GEOM_IShapesOperations_i :
                                   GEOM::GEOM_Object_ptr theShape2,
                                   const CORBA::Long     theShapeType);
 
-  GEOM::GEOM_Object_ptr GetShapesOnPlane (GEOM::GEOM_Object_ptr theShape,
-                                         const CORBA::Long     theShapeType,
-                                         GEOM::GEOM_Object_ptr thePlane);
-
-  GEOM::GEOM_Object_ptr GetShapesOnCylinder (GEOM::GEOM_Object_ptr theShape,
-                                            const CORBA::Long     theShapeType,
-                                            GEOM::GEOM_Object_ptr theAxis,
-                                            const CORBA::Double   theRadius);
-
-  GEOM::GEOM_Object_ptr GetShapesOnSphere (GEOM::GEOM_Object_ptr theShape,
-                                          const CORBA::Long     theShapeType,
-                                          GEOM::GEOM_Object_ptr theCenter,
-                                          const CORBA::Double   theRadius);
+  GEOM::ListOfGO* GetShapesOnPlane (GEOM::GEOM_Object_ptr   theShape,
+                                   const CORBA::Long       theShapeType,
+                                   GEOM::GEOM_Object_ptr   theAx1,
+                                   const GEOM::shape_state theState);
+
+  GEOM::ListOfGO* GetShapesOnCylinder (GEOM::GEOM_Object_ptr   theShape,
+                                      const CORBA::Long       theShapeType,
+                                      GEOM::GEOM_Object_ptr   theAxis,
+                                      const CORBA::Double     theRadius,
+                                      const GEOM::shape_state theState);
+
+  GEOM::ListOfGO* GetShapesOnSphere (GEOM::GEOM_Object_ptr   theShape,
+                                    const CORBA::Long       theShapeType,
+                                    GEOM::GEOM_Object_ptr   theCenter,
+                                    const CORBA::Double     theRadius,
+                                    const GEOM::shape_state theState);
 
   GEOM::GEOM_Object_ptr GetInPlace (GEOM::GEOM_Object_ptr theShapeWhere,
                                    GEOM::GEOM_Object_ptr theShapeWhat);
index 356e23fc5d3bdb4e289e78cec933c68adf03e5c8..0d2c4fd6f62ece8cefea4f227b7a601ac86dd54f 100644 (file)
@@ -233,17 +233,49 @@ def TestOtherOperations (geompy, math):
   v_pp0 = geompy.MakeVectorDXDYDZ( 1,  1,  0)
   v_np0 = geompy.MakeVectorDXDYDZ(-1,  1,  0)
 
-  pln_0pp = geompy.MakePlane(p0, v_0pp, 200)
-  pln_0np = geompy.MakePlane(p0, v_0np, 200)
-  pln_p0p = geompy.MakePlane(p0, v_p0p, 200)
-  pln_n0p = geompy.MakePlane(p0, v_n0p, 200)
-  pln_pp0 = geompy.MakePlane(p0, v_pp0, 200)
-  pln_np0 = geompy.MakePlane(p0, v_np0, 200)
-
-  part_tool = geompy.MakePartition([b0, pln_0pp, pln_0np, pln_p0p, pln_n0p, pln_pp0, pln_np0],
-                                   [],
-                                   [],
-                                   [b0])
+  pln_0pp = geompy.MakePlane(p0, v_0pp, 300)
+  pln_0np = geompy.MakePlane(p0, v_0np, 300)
+  pln_p0p = geompy.MakePlane(p0, v_p0p, 300)
+  pln_n0p = geompy.MakePlane(p0, v_n0p, 300)
+  pln_pp0 = geompy.MakePlane(p0, v_pp0, 300)
+  pln_np0 = geompy.MakePlane(p0, v_np0, 300)
+
+  part_tool_1 = geompy.MakePartition([b0, pln_0pp, pln_0np, pln_p0p, pln_n0p, pln_pp0, pln_np0],
+                                     [],
+                                     [],
+                                     [b0])
+
+  pt_pnt_1  = geompy.MakeVertex( 55,   0,  55)
+  pt_pnt_2  = geompy.MakeVertex(  0,  55,  55)
+  pt_pnt_3  = geompy.MakeVertex(-55,   0,  55)
+  pt_pnt_4  = geompy.MakeVertex(  0, -55,  55)
+  pt_pnt_5  = geompy.MakeVertex( 55,  55,   0)
+  pt_pnt_6  = geompy.MakeVertex( 55, -55,   0)
+  pt_pnt_7  = geompy.MakeVertex(-55,  55,   0)
+  pt_pnt_8  = geompy.MakeVertex(-55, -55,   0)
+  pt_pnt_9  = geompy.MakeVertex( 55,   0, -55)
+  pt_pnt_10 = geompy.MakeVertex(  0,  55, -55)
+  pt_pnt_11 = geompy.MakeVertex(-55,   0, -55)
+  pt_pnt_12 = geompy.MakeVertex(  0, -55, -55)
+
+  pt_face_1  = geompy.GetFaceNearPoint(part_tool_1, pt_pnt_1)
+  pt_face_2  = geompy.GetFaceNearPoint(part_tool_1, pt_pnt_2)
+  pt_face_3  = geompy.GetFaceNearPoint(part_tool_1, pt_pnt_3)
+  pt_face_4  = geompy.GetFaceNearPoint(part_tool_1, pt_pnt_4)
+  pt_face_5  = geompy.GetFaceNearPoint(part_tool_1, pt_pnt_5)
+  pt_face_6  = geompy.GetFaceNearPoint(part_tool_1, pt_pnt_6)
+  pt_face_7  = geompy.GetFaceNearPoint(part_tool_1, pt_pnt_7)
+  pt_face_8  = geompy.GetFaceNearPoint(part_tool_1, pt_pnt_8)
+  pt_face_9  = geompy.GetFaceNearPoint(part_tool_1, pt_pnt_9)
+  pt_face_10 = geompy.GetFaceNearPoint(part_tool_1, pt_pnt_10)
+  pt_face_11 = geompy.GetFaceNearPoint(part_tool_1, pt_pnt_11)
+  pt_face_12 = geompy.GetFaceNearPoint(part_tool_1, pt_pnt_12)
+
+  pt_box = geompy.GetBlockNearPoint(part_tool_1, p0)
+
+  part_tool = geompy.MakeCompound([pt_face_1, pt_face_4, pt_face_7, pt_face_10,
+                                   pt_face_2, pt_face_5, pt_face_8, pt_face_11,
+                                   pt_face_3, pt_face_6, pt_face_9, pt_face_12, pt_box])
   id_part_tool = geompy.addToStudy(part_tool, "part_tool")
 
   part = geompy.MakePartition([s0], [part_tool])
@@ -302,8 +334,22 @@ def TestOtherOperations (geompy, math):
 
   geompy.addToStudyInFather(blocksComp, b0_image, "b0 image")
 
-  # GetShapesOnPlane(theShape, theShapeType, thePlane)
-  # GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius)
-  # GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius)
+  # GetShapesOnPlane
+  faces_on_pln = geompy.GetShapesOnPlane(blocksComp, geompy.ShapeType["FACE"],
+                                         v_0pp, geompy.GEOM.ST_ONIN)
+  for face_i in faces_on_pln:
+    geompy.addToStudy(face_i, "Face on Plane or in direction of normale (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:
+    geompy.addToStudy(edge_i, "Edge out of Cylinder (axis = (0, 1, 0), r = 55)")
+
+  # GetShapesOnSphere
+  vertices_on_sph = geompy.GetShapesOnSphere(blocksComp, geompy.ShapeType["VERTEX"],
+                                             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)")
 
   # GetInPlace(theShapeWhere, theShapeWhat)
index b6008af41e647c34d86ec6ce44ce3b53b1c25de7..b0228685230e0bee84c0e0422ceb08c5947562c4 100644 (file)
@@ -405,24 +405,24 @@ def GetSharedShapes(theShape1, theShape2, theShapeType):
       print "GetSharedShapes : ", ShapesOp.GetErrorCode()
     return aList
 
-#def GetShapesOnPlane(theShape, theShapeType, thePlane):
-#    anObj = ShapesOp.GetShapesOnPlane(theShape, theShapeType, thePlane)
-#    if ShapesOp.IsDone() == 0:
-#      print "GetShapesOnPlane : ", ShapesOp.GetErrorCode()
-#    return anObj
-#
-#def GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius):
-#    anObj = ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius)
-#    if ShapesOp.IsDone() == 0:
-#      print "GetShapesOnCylinder : ", ShapesOp.GetErrorCode()
-#    return anObj
-#
-#def GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius):
-#    anObj = ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius)
-#    if ShapesOp.IsDone() == 0:
-#      print "GetShapesOnSphere : ", ShapesOp.GetErrorCode()
-#    return anObj
-#
+def GetShapesOnPlane(theShape, theShapeType, theAx1, theState):
+    aList = ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState)
+    if ShapesOp.IsDone() == 0:
+      print "GetShapesOnPlane : ", ShapesOp.GetErrorCode()
+    return aList
+
+def GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState):
+    aList = ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState)
+    if ShapesOp.IsDone() == 0:
+      print "GetShapesOnCylinder : ", ShapesOp.GetErrorCode()
+    return aList
+
+def GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState):
+    aList = ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState)
+    if ShapesOp.IsDone() == 0:
+      print "GetShapesOnSphere : ", ShapesOp.GetErrorCode()
+    return aList
+
 #def GetInPlace(theShapeWhere, theShapeWhat):
 #    anObj = ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
 #    if ShapesOp.IsDone() == 0:
index 4aef913f145575c5150b6c3eb7ce88b164482e05..3e67e79903d7d6dd64afeb641e93a64911d27b8e 100644 (file)
@@ -862,70 +862,77 @@ def GetSharedShapes(theShape1, theShape2, theShapeType):
     return aList
 
 """
-     *  Get sub-shapes of theShape of the given type,
-     *  laying on the specified plane.
+     *  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.
      *  \param theShape Shape to find sub-shapes of.
      *  \param theShapeType Type of sub-shapes to be retrieved.
-     *  \param thePlane Face, specifying the plane to find shapes on.
-     *  \return Group of all found sub-shapes.
+     *  \param theAx1 Vector (or line, or linear edge), specifying normal
+     *                direction and location of the plane 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
 """
-def GetShapesOnPlane(theShape, theShapeType, thePlane):
-    anObj = ShapesOp.GetShapesOnPlane(theShape, theShapeType, thePlane)
+def GetShapesOnPlane(theShape, theShapeType, theAx1, theState):
+    aList = ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState)
     if ShapesOp.IsDone() == 0:
       print "GetShapesOnPlane : ", ShapesOp.GetErrorCode()
-    return anObj
+    return aList
 
 """
-     *  Get sub-shape of theShape of the given type,
-     *  laying on the specified cylinder.
+     *  Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
+     *  the specified cylinder 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 theAxis Vector (or line, or linear edge), specifying
      *                 axis of the cylinder to find shapes on.
      *  \param theRadius Radius of the cylinder to find shapes on.
-     *  \return Group of all found sub-shapes.
+     *  \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
 """
-def GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius):
-    anObj = ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius)
+def GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState):
+    aList = ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState)
     if ShapesOp.IsDone() == 0:
       print "GetShapesOnCylinder : ", ShapesOp.GetErrorCode()
-    return anObj
+    return aList
 
 """
-     *  Get sub-shape of theShape of the given type,
-     *  laying on the specified sphere.
+     *  Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
+     *  the specified sphere 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.
-     *  \return Group of all found sub-shapes.
+     *  \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
 """
-def GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius):
-    anObj = ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius)
+def GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState):
+    aList = ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState)
     if ShapesOp.IsDone() == 0:
       print "GetShapesOnSphere : ", ShapesOp.GetErrorCode()
-    return anObj
-
-"""
-     *  Get sub-shape(s) of theShapeWhere, which are
-     *  coincident with \a theShapeWhat or could be a part of it.
-     *  \param theShapeWhere Shape to find sub-shapes of.
-     *  \param theShapeWhat Shape, specifying what to find.
-     *  \return Group of all found sub-shapes or a single found sub-shape.
+    return aList
 
-     *  Example: see GEOM_TestOthers.py
-"""
-def GetInPlace(theShapeWhere, theShapeWhat):
-    anObj = ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
-    if ShapesOp.IsDone() == 0:
-      print "GetInPlace : ", ShapesOp.GetErrorCode()
-    return anObj
+#"""
+#     *  Get sub-shape(s) of theShapeWhere, which are
+#     *  coincident with \a theShapeWhat or could be a part of it.
+#     *  \param theShapeWhere Shape to find sub-shapes of.
+#     *  \param theShapeWhat Shape, specifying what to find.
+#     *  \return Group of all found sub-shapes or a single found sub-shape.
+#
+#     *  Example: see GEOM_TestOthers.py
+#"""
+#def GetInPlace(theShapeWhere, theShapeWhat):
+#    anObj = ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
+#    if ShapesOp.IsDone() == 0:
+#      print "GetInPlace : ", ShapesOp.GetErrorCode()
+#    return anObj
 
 # -----------------------------------------------------------------------------
 # Access to sub-shapes by their unique IDs inside the main shape.