]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
0022338: EDF GEOM: Regression when partitoning a compound by a plane
authorskv <skv@opencascade.com>
Tue, 26 Nov 2013 07:06:56 +0000 (07:06 +0000)
committerskv <skv@opencascade.com>
Tue, 26 Nov 2013 07:06:56 +0000 (07:06 +0000)
13 files changed:
doc/salome/gui/GEOM/input/partition.doc
idl/GEOM_Gen.idl
src/AdvancedEngine/GEOMImpl_IAdvancedOperations.cxx
src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx
src/GEOMImpl/GEOMImpl_IBooleanOperations.hxx
src/GEOMImpl/GEOMImpl_IPartition.hxx
src/GEOMImpl/GEOMImpl_PartitionDriver.cxx
src/GEOM_I/GEOM_IBooleanOperations_i.cc
src/GEOM_I/GEOM_IBooleanOperations_i.hh
src/GEOM_I_Superv/GEOM_Superv_i.cc
src/GEOM_SWIG/geomBuilder.py
src/OperationGUI/OperationGUI_PartitionDlg.cxx
src/OperationGUI/OperationGUI_PartitionDlg.h

index dfee4899f83d0454687e638f6071c8092d56d7ba..27fdc0dad331af36018c39534398cb66ec855b8e 100644 (file)
@@ -54,6 +54,12 @@ computed. If this option is switched on, the intersection between
 sub-shapes will not be performed. In this case the Partition algorithm
 will work faster, but the result might differ from the default behavior.
 
+<b>Detect Self-intersections</b> check box is used to check arguments
+self-intersections. If this option is switched on (default behavior)
+each input shape is checked for self-intersection. In case of its detection
+the operation is aborted. If this option is switched off, the partition
+algorithm is performed without self-intersection checks.
+
  <b>Advanced option:</b>
    \ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments".
 
@@ -67,13 +73,13 @@ will work faster, but the result might differ from the default behavior.
 
 <em>geompy.MakePartition(ListOfShapes, ListOfTools, ListOfKeepInside,
 ListOfRemoveInside, Limit, RemoveWebs, ListOfMaterials,
-KeepNonlimitShapes)</em>
+KeepNonlimitShapes, checkSelfInte)</em>
 
 <b>TUI Command (without sub-shapes intersection):</b>
 
 <em>geompy.MakePartitionNonSelfIntersectedShape(ListOfShapes,
 ListOfTools, ListOfKeepInside, ListOfRemoveInside, Limit, RemoveWebs,
-ListOfMaterials, KeepNonlimitShapes)</em>
+ListOfMaterials, KeepNonlimitShapes, checkSelfInte)</em>
 
 Here,
 - \em ListOfShapes is a list of shapes to be intersected
@@ -82,6 +88,8 @@ Here,
 - \em Limit is a Type of resulting shapes
 - \em KeepNonlimitShapes is a flag that allows to preserve standalone
 shapes of low dimension (than \em Limit) in the result.
+- \em checkSelfInte is a flag that tells if the arguments should
+be checked for self-intersection prior to the operation.
 - Other parameters are obsolete and kept only for compatibility with
 previous versions of SALOME.
 
@@ -99,6 +107,8 @@ previous versions of SALOME.
 <em>geompy.MakeHalfPartition(Shape, Plane)</em>, where:
 - \em Shape is a source shape to be intersected by the \em Plane
 - \em Plane is a tool shape, to intersect the \em Shape.
+- \em checkSelfInte is a flag that tells if the arguments should
+be checked for self-intersection prior to the operation.
 
 <b>Examples:</b>
 
index a9ad919b6f5ff8910467aae70f07514f9db4e9a2..5149fd6226a1c3260b8addf6a7a63147072cbccb 100644 (file)
@@ -2968,6 +2968,8 @@ module GEOM
      *         Each shape from theRemoveInside must belong to theShapes also.
      *  \param theRemoveWebs If TRUE, perform Glue 3D algorithm.
      *  \param theMaterials Material indices for each shape. Make sence, only if theRemoveWebs is TRUE.
+     *  \param IsCheckSelfInte If TRUE, perform check self intersection
+     *                         of arguments before an operation.
      *
      *  \return New GEOM_Object, containing the result shapes.
      */
@@ -2978,7 +2980,8 @@ module GEOM
                                in short      theLimit,
                                in boolean    theRemoveWebs,
                                in ListOfLong theMaterials,
-                               in short      theKeepNonlimitShapes);
+                               in short      theKeepNonlimitShapes,
+                               in boolean    IsCheckSelfInte);
 
     /*!
      *  \brief Perform partition operation.
@@ -3001,16 +3004,20 @@ module GEOM
                                                       in short      theLimit,
                                                       in boolean    theRemoveWebs,
                                                       in ListOfLong theMaterials,
-                                                      in short      theKeepNonlimitShapes);
+                                                      in short      theKeepNonlimitShapes,
+                                                      in boolean    IsCheckSelfInte);
 
     /*!
      *  \brief Perform partition of the Shape with the Plane
      *  \param theShape Shape to be intersected.
      *  \param thePlane Tool shape, to intersect theShape.
+     *  \param IsCheckSelfInte If TRUE, perform check self intersection
+     *                         of arguments before an operation.
      *  \return New GEOM_Object, containing the result shape.
      */
     GEOM_Object MakeHalfPartition (in GEOM_Object theShape,
-                                   in GEOM_Object thePlane);
+                                   in GEOM_Object thePlane,
+                                   in boolean     IsCheckSelfInte);
   };
 
  // # GEOM_ICurvesOperations:
index 36961c7e6d55b70655173257e3328030ee5c51b4..065776d637d19a42c1fc90d44602b22e8efd9623 100644 (file)
@@ -1574,7 +1574,7 @@ bool GEOMImpl_IAdvancedOperations::MakePipeTShapePartition(Handle(GEOM_Object) t
 
     Te3 = myBooleanOperations->MakePartition
               (partitionShapes, theTools, theKeepInside, theRemoveInside,
-              TopAbs_SOLID, false, theMaterials, 0, false);
+              TopAbs_SOLID, false, theMaterials, 0, false, Standard_False);
     if (Te3.IsNull()) {
       SetErrorCode("Impossible to build partition of TShape");
       return false;
index be4bfb3d3757ff306d8725eb3181a79e247c8753..9cd7b2005a3d0b938d7d6e2119d5327caa3714f6 100644 (file)
@@ -371,7 +371,8 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition
                               const Standard_Boolean                      theRemoveWebs,
                               const Handle(TColStd_HArray1OfInteger)&     theMaterials,
                               const Standard_Integer theKeepNonlimitShapes,
-                              const Standard_Boolean thePerformSelfIntersections)
+                              const Standard_Boolean thePerformSelfIntersections,
+                              const Standard_Boolean IsCheckSelfInte)
 {
   SetErrorCode(KO);
 
@@ -437,6 +438,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition
   // Limit
   aCI.SetLimit(theLimit);
   aCI.SetKeepNonlimitShapes(theKeepNonlimitShapes);
+  aCI.SetCheckSelfIntersection(IsCheckSelfInte);
 
   // Materials
   if (theRemoveWebs) {
@@ -488,7 +490,13 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition
       pd << ", " << theMaterials->Value(i);
     }
   }
-  pd << "], " << theKeepNonlimitShapes <<")";
+  pd << "], " << theKeepNonlimitShapes;
+
+  if (IsCheckSelfInte) {
+    pd << ", True";
+  }
+
+  pd << ")";
 
   SetErrorCode(OK);
   return aPartition;
@@ -500,7 +508,8 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition
  */
 //=============================================================================
 Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeHalfPartition
-       (Handle(GEOM_Object) theShape, Handle(GEOM_Object) thePlane)
+       (Handle(GEOM_Object) theShape, Handle(GEOM_Object) thePlane,
+        const Standard_Boolean IsCheckSelfInte)
 {
   SetErrorCode(KO);
 
@@ -526,6 +535,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeHalfPartition
 
   aCI.SetShape(aRef1);
   aCI.SetPlane(aRef2);
+  aCI.SetCheckSelfIntersection(IsCheckSelfInte);
 
   //Compute the Partition value
   try {
@@ -544,8 +554,15 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeHalfPartition
   }
 
   //Make a Python command
-  GEOM::TPythonDump(aFunction) << aPart << " = geompy.MakeHalfPartition("
-                               << theShape << ", " << thePlane << ")";
+  GEOM::TPythonDump pd (aFunction);
+  pd << aPart << " = geompy.MakeHalfPartition("
+     << theShape << ", " << thePlane;
+
+  if (IsCheckSelfInte) {
+    pd << ", True";
+  }
+
+  pd << ")";
 
   SetErrorCode(OK);
   return aPart;
index ad3f9e5b870d9311cac5f48a98877b871679130b..a3c321e3870b2b69eb81cfc9cc2fc111715b0824 100644 (file)
@@ -64,10 +64,12 @@ class GEOMImpl_IBooleanOperations : public GEOM_IOperations {
                    const Standard_Boolean                      theRemoveWebs,
                    const Handle(TColStd_HArray1OfInteger)&     theMaterials,
                    const Standard_Integer theKeepNonlimitShapes,
-                   const Standard_Boolean thePerformSelfIntersections);
+                   const Standard_Boolean thePerformSelfIntersections,
+                   const Standard_Boolean IsCheckSelfInte);
 
-  Standard_EXPORT Handle(GEOM_Object) MakeHalfPartition (Handle(GEOM_Object) theShape,
-                                                         Handle(GEOM_Object) thePlane);
+  Standard_EXPORT Handle(GEOM_Object) MakeHalfPartition (Handle(GEOM_Object)    theShape,
+                                                         Handle(GEOM_Object)    thePlane,
+                                                         const Standard_Boolean IsCheckSelfInte);
 
 private:
 
index 14f08e6953e00b59a5605df70c4e294bf32b0f44..d0c2022068c7b7298fbca1886069be18bbcb6814 100644 (file)
@@ -39,6 +39,7 @@
 #define PART_ARG_PLANE 8
 
 #define PART_ARG_KEEP_NONLIMIT_SHAPES 9
+#define BOOL_ARG_CHECK_SELF_INTERSECTION 10
 
 class GEOMImpl_IPartition
 {
@@ -66,6 +67,8 @@ class GEOMImpl_IPartition
   void SetMaterials(const Handle(TColStd_HArray1OfInteger)& theMaterials)
   { _func->SetIntegerArray(PART_ARG_MATERIALS, theMaterials); }
 
+  void SetCheckSelfIntersection (Standard_Boolean theFlag)
+  { _func->SetInteger(BOOL_ARG_CHECK_SELF_INTERSECTION, theFlag ? 1 : 0); }
 
   int GetLimit() { return _func->GetInteger(PART_ARG_LIMIT); }
 
@@ -85,6 +88,9 @@ class GEOMImpl_IPartition
   Handle(GEOM_Function) GetShape() { return _func->GetReference(PART_ARG_SHAPE); }
   Handle(GEOM_Function) GetPlane() { return _func->GetReference(PART_ARG_PLANE); }
 
+  Standard_Boolean GetCheckSelfIntersection()
+  { return (_func->GetInteger(BOOL_ARG_CHECK_SELF_INTERSECTION) != 0); }
+
  private:
 
   Handle(GEOM_Function) _func;
index ed632e060950dfd6d33334a26a8f9b4f5beb6884..641a122af03d108be8a5c9b03a3e319bfc77f374 100644 (file)
 #include <TColStd_ListIteratorOfListOfInteger.hxx>
 #include <TColStd_ListOfInteger.hxx>
 #include <Standard_NullObject.hxx>
+#include <StdFail_NotDone.hxx>
 #include <Precision.hxx>
 #include <gp_Pnt.hxx>
+#include <BOPAlgo_CheckerSI.hxx>
 #include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
 #include <BOPCol_ListOfShape.hxx>
+#include <BOPDS_DS.hxx>
+
+// Depth of self-intersection check (see BOPAlgo_CheckerSI::SetLevelOfCheck() for more details)
+// Default value for BOPAlgo_CheckerSI gives very long computation when checking face-to-face intersections;
+// here check level is decreased to more appropriate value to avoid problems with performance).
+#define BOP_SELF_INTERSECTIONS_LEVEL 4
 
 //=======================================================================
 //function : GetID
@@ -107,6 +115,21 @@ static void PrepareShapes (const TopoDS_Shape&   theShape,
   }
 }
 
+static void CheckSelfIntersection(const TopoDS_Shape &theShape)
+{
+  BOPAlgo_CheckerSI aCSI;  // checker of self-interferences
+  BOPCol_ListOfShape aList;
+
+  aList.Append(theShape);
+  aCSI.SetLevelOfCheck(BOP_SELF_INTERSECTIONS_LEVEL);
+  aCSI.SetArguments(aList);
+  aCSI.Perform();
+
+  if (aCSI.ErrorStatus() || aCSI.DS().Interferences().Extent() > 0) {
+    StdFail_NotDone::Raise("Partition operation will not be performed, because argument shape is self-intersected");
+  }
+}
+
 //=======================================================================
 //function : Execute
 //purpose  :
@@ -118,6 +141,7 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
 
   GEOMImpl_IPartition aCI (aFunction);
   Standard_Integer aType = aFunction->GetType();
+  const Standard_Boolean isCheckSelfInte = aCI.GetCheckSelfIntersection();
 
   TopoDS_Shape aShape;
   GEOMAlgo_Splitter PS;
@@ -149,6 +173,11 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
         Standard_NullObject::Raise("In Partition a shape is null");
       }
 
+      // Check self-intersection.
+      if (isCheckSelfInte) {
+        CheckSelfIntersection(aShape_i);
+      }
+
       TopoDS_Shape aShape_i_copy;
       TNaming_CopyShape::CopyTool(aShape_i, aMapTShapes, aShape_i_copy);
 
@@ -185,6 +214,12 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
       if (aShape_i.IsNull()) {
         Standard_NullObject::Raise("In Partition a tool shape is null");
       }
+
+      // Check self-intersection.
+      if (isCheckSelfInte) {
+        CheckSelfIntersection(aShape_i);
+      }
+
       //
       //BRepBuilderAPI_Copy aCopyTool (aShape_i);
       TopoDS_Shape aShape_i_copy;
@@ -324,6 +359,12 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
       Standard_NullObject::Raise("In Half Partition a shape or a plane is null");
     }
 
+    // Check self-intersection.
+    if (isCheckSelfInte) {
+      CheckSelfIntersection(aShapeArg);
+      CheckSelfIntersection(aPlaneArg);
+    }
+
     TopoDS_Shape aShapeArg_copy;
     TopoDS_Shape aPlaneArg_copy;
     {
index 84c513815f12b87aabd95d15a9b25d4c0d6321b5..f21a9ee7283e83893c46cb383b56111cbd2de039 100644 (file)
@@ -200,7 +200,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartition
                                        CORBA::Short            theLimit,
                                        CORBA::Boolean          theRemoveWebs,
                                        const GEOM::ListOfLong& theMaterials,
-                                       CORBA::Short theKeepNonlimitShapes)
+                                       CORBA::Short theKeepNonlimitShapes,
+                                       CORBA::Boolean          IsCheckSelfInte)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
@@ -233,7 +234,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartition
     GetOperations()->MakePartition(aShapes, aTools, aKeepIns, aRemIns,
                                    theLimit, theRemoveWebs, aMaterials,
                                    theKeepNonlimitShapes,
-                                   /*PerformSelfIntersections*/Standard_True);
+                                   /*PerformSelfIntersections*/Standard_True,
+                                   IsCheckSelfInte);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
@@ -253,7 +255,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartitionNonSelfIntersected
                                        CORBA::Short            theLimit,
                                        CORBA::Boolean          theRemoveWebs,
                                        const GEOM::ListOfLong& theMaterials,
-                                       CORBA::Short theKeepNonlimitShapes)
+                                       CORBA::Short theKeepNonlimitShapes,
+                                       CORBA::Boolean          IsCheckSelfInte)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
@@ -286,7 +289,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartitionNonSelfIntersected
     GetOperations()->MakePartition(aShapes, aTools, aKeepIns, aRemIns,
                                    theLimit, theRemoveWebs, aMaterials,
                                    theKeepNonlimitShapes,
-                                   /*PerformSelfIntersections*/Standard_False);
+                                   /*PerformSelfIntersections*/Standard_False,
+                                   IsCheckSelfInte);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
@@ -300,7 +304,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartitionNonSelfIntersected
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeHalfPartition
                                                  (GEOM::GEOM_Object_ptr theShape,
-                                                  GEOM::GEOM_Object_ptr thePlane)
+                                                  GEOM::GEOM_Object_ptr thePlane,
+                                                  CORBA::Boolean        IsCheckSelfInte)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
@@ -314,7 +319,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeHalfPartition
   if (aSh.IsNull() || aPl.IsNull()) return aGEOMObject._retn();
 
   // Make Half Partition
-  Handle(GEOM_Object) anObject = GetOperations()->MakeHalfPartition(aSh, aPl);
+  Handle(GEOM_Object) anObject =
+    GetOperations()->MakeHalfPartition(aSh, aPl, IsCheckSelfInte);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
index e8381d0853b04ea2bea177a2d4f04d7df838e27f..3f3a73b8b3420d4ba0e7b473051eaee9cca3c77a 100644 (file)
@@ -64,7 +64,8 @@ class GEOM_I_EXPORT GEOM_IBooleanOperations_i :
                                       CORBA::Short            theLimit,
                                       CORBA::Boolean          theRemoveWebs,
                                       const GEOM::ListOfLong& theMaterials,
-                                      CORBA::Short theKeepNonlimitShapes);
+                                      CORBA::Short theKeepNonlimitShapes,
+                                       CORBA::Boolean          IsCheckSelfInte);
 
   GEOM::GEOM_Object_ptr MakePartitionNonSelfIntersectedShape (const GEOM::ListOfGO&   theShapes,
                                                              const GEOM::ListOfGO&   theTools,
@@ -73,11 +74,13 @@ class GEOM_I_EXPORT GEOM_IBooleanOperations_i :
                                                              CORBA::Short            theLimit,
                                                              CORBA::Boolean          theRemoveWebs,
                                                              const GEOM::ListOfLong& theMaterials,
-                                                             CORBA::Short theKeepNonlimitShapes);
+                                                             CORBA::Short theKeepNonlimitShapes,
+                                                              CORBA::Boolean          IsCheckSelfInte);
 
 
   GEOM::GEOM_Object_ptr MakeHalfPartition (GEOM::GEOM_Object_ptr theShape,
-                                          GEOM::GEOM_Object_ptr thePlane);
+                                          GEOM::GEOM_Object_ptr thePlane,
+                                           CORBA::Boolean        IsCheckSelfInte);
 
   ::GEOMImpl_IBooleanOperations* GetOperations()
   { return (::GEOMImpl_IBooleanOperations*)GetImpl(); }
index 946f958d29bdf8e8714993ca95f092443680fcbb..ce29d33a744c0c36808da6e407ba8fe262865c0a 100644 (file)
@@ -1528,7 +1528,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePartition (GEOM::GEOM_List_ptr   theSha
       myBoolOp->MakePartition(aListImplS->GetList(), aListImplT->GetList(),
                               aListImplKI->GetList(), aListImplRI->GetList(),
                               theLimit, theRemoveWebs, aListImplM->GetList(),
-                              theKeepNonlimitShapes);
+                              theKeepNonlimitShapes, false);
     endService( " GEOM_Superv_i::MakePartition" );
     return anObj;
   }
@@ -1545,7 +1545,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeHalfPartition (GEOM::GEOM_Object_ptr th
   beginService( " GEOM_Superv_i::MakeHalfPartition" );
   MESSAGE("GEOM_Superv_i::MakeHalfPartition");
   getBoolOp();
-  GEOM::GEOM_Object_ptr anObj = myBoolOp->MakeHalfPartition(theShape, thePlane);
+  GEOM::GEOM_Object_ptr anObj =
+    myBoolOp->MakeHalfPartition(theShape, thePlane, false);
   endService( " GEOM_Superv_i::MakeHalfPartition" );
   return anObj;
 }
index a0d60cb5fe7c2b117628fada042ecef7454f8e25..82dd7ac1b63fde08c255e7690b14d53fead3f4b1 100644 (file)
@@ -6939,6 +6939,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #                             target type (equal to Limit) are kept in the result,
         #                             else standalone shapes of lower dimension
         #                             are kept also (if they exist).
+        #  @param checkSelfInte The flag that tells if the arguments should
+        #         be checked for self-intersection prior to the operation.
         #  @param theName Object name; when specified, this parameter is used
         #         for result publication in the study. Otherwise, if automatic
         #         publication is switched on, default value is used for result name.
@@ -6962,7 +6964,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #  @ref tui_partition "Example"
         def MakePartition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
                           Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[],
-                          KeepNonlimitShapes=0, theName=None):
+                          KeepNonlimitShapes=0, checkSelfInte=False, theName=None):
             """
             Perform partition operation.
 
@@ -6976,6 +6978,9 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
                                     target type (equal to Limit) are kept in the result,
                                     else standalone shapes of lower dimension
                                     are kept also (if they exist).
+                checkSelfInte The flag that tells if the arguments should
+                              be checked for self-intersection prior to
+                              the operation.
                 theName Object name; when specified, this parameter is used
                         for result publication in the study. Otherwise, if automatic
                         publication is switched on, default value is used for result name.
@@ -7009,7 +7014,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             anObj = self.BoolOp.MakePartition(ListShapes, ListTools,
                                               ListKeepInside, ListRemoveInside,
                                               Limit, RemoveWebs, ListMaterials,
-                                              KeepNonlimitShapes);
+                                              KeepNonlimitShapes, checkSelfInte);
             RaiseIfFailed("MakePartition", self.BoolOp)
             self._autoPublish(anObj, theName, "partition")
             return anObj
@@ -7031,7 +7036,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
                                                  ListKeepInside=[], ListRemoveInside=[],
                                                  Limit=ShapeType["AUTO"], RemoveWebs=0,
                                                  ListMaterials=[], KeepNonlimitShapes=0,
-                                                 theName=None):
+                                                 checkSelfInte=False, theName=None):
             """
             Perform partition operation.
             This method may be useful if it is needed to make a partition for
@@ -7057,7 +7062,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             anObj = self.BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
                                                                      ListKeepInside, ListRemoveInside,
                                                                      Limit, RemoveWebs, ListMaterials,
-                                                                     KeepNonlimitShapes);
+                                                                     KeepNonlimitShapes, checkSelfInte);
             RaiseIfFailed("MakePartitionNonSelfIntersectedShape", self.BoolOp)
             self._autoPublish(anObj, theName, "partition")
             return anObj
@@ -7068,7 +7073,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #  \n @ref swig_Partition "Example 2"
         def Partition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
                       Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[],
-                      KeepNonlimitShapes=0, theName=None):
+                      KeepNonlimitShapes=0, checkSelfInte=False, theName=None):
             """
             See method geompy.MakePartition for more information.
             """
@@ -7077,12 +7082,15 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             anObj = self.MakePartition(ListShapes, ListTools,
                                        ListKeepInside, ListRemoveInside,
                                        Limit, RemoveWebs, ListMaterials,
-                                       KeepNonlimitShapes, theName);
+                                       KeepNonlimitShapes, checkSelfInte,
+                                       theName);
             return anObj
 
         ## Perform partition of the Shape with the Plane
         #  @param theShape Shape to be intersected.
         #  @param thePlane Tool shape, to intersect theShape.
+        #  @param checkSelfInte The flag that tells if the arguments should
+        #         be checked for self-intersection prior to the operation.
         #  @param theName Object name; when specified, this parameter is used
         #         for result publication in the study. Otherwise, if automatic
         #         publication is switched on, default value is used for result name.
@@ -7090,13 +7098,16 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #  @return New GEOM.GEOM_Object, containing the result shape.
         #
         #  @ref tui_partition "Example"
-        def MakeHalfPartition(self, theShape, thePlane, theName=None):
+        def MakeHalfPartition(self, theShape, thePlane, checkSelfInte=False, theName=None):
             """
             Perform partition of the Shape with the Plane
 
             Parameters: 
                 theShape Shape to be intersected.
                 thePlane Tool shape, to intersect theShape.
+                checkSelfInte The flag that tells if the arguments should
+                              be checked for self-intersection prior to
+                              the operation.
                 theName Object name; when specified, this parameter is used
                         for result publication in the study. Otherwise, if automatic
                         publication is switched on, default value is used for result name.
@@ -7105,7 +7116,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
                 New GEOM.GEOM_Object, containing the result shape.
             """
             # Example: see GEOM_TestAll.py
-            anObj = self.BoolOp.MakeHalfPartition(theShape, thePlane)
+            anObj = self.BoolOp.MakeHalfPartition(theShape, thePlane, checkSelfInte)
             RaiseIfFailed("MakeHalfPartition", self.BoolOp)
             self._autoPublish(anObj, theName, "partition")
             return anObj
index b51d7b488ffc2eff65a0b60c6a9e4e75fccee872..a6a989e960436981bd8cb169e65a45397bfaf322 100644 (file)
@@ -85,6 +85,10 @@ OperationGUI_PartitionDlg::OperationGUI_PartitionDlg( GeometryGUI* theGeometryGU
   GroupPoints->CheckButton1->setText( tr( "GEOM_KEEP_NONLIMIT_SHAPES" ) );
   GroupPoints->CheckButton2->setText( tr( "GEOM_NO_SELF_INTERSECTION" ) );
 
+  mySelfInte = new QCheckBox(GroupPoints->GroupBox1);
+  mySelfInte->setText(tr("GEOM_CHECK_SELF_INTERSECTIONS"));
+  GroupPoints->gridLayout1->addWidget(mySelfInte, 5, 0, 1, 3);
+
   QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
   layout->setMargin( 0 ); layout->setSpacing( 6 );
   layout->addWidget( GroupPoints );
@@ -140,6 +144,7 @@ void OperationGUI_PartitionDlg::Init()
   GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_VERTEX" ) );
   GroupPoints->ComboBox1->setItemData(GroupPoints->ComboBox1->count()-1, GEOM::VERTEX);
   GroupPoints->CheckButton1->setChecked( false );
+  mySelfInte->setChecked(true);
 
   mainFrame()->GroupBoxPublish->show();
 
@@ -162,6 +167,7 @@ void OperationGUI_PartitionDlg::Init()
 
   connect( GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(processPreview()) );
   connect( GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(processPreview()) );
+  connect( mySelfInte,                SIGNAL(toggled(bool)), this, SLOT(processPreview()) );
 
   initName( tr( "GEOM_PARTITION" ) );
 
@@ -440,6 +446,7 @@ bool OperationGUI_PartitionDlg::execute (ObjectList& objects)
 {
   bool res = false;
   GEOM::GEOM_Object_var anObj;
+  bool isDetectSelfInte = mySelfInte->isChecked();
 
   GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation());
 
@@ -453,16 +460,19 @@ bool OperationGUI_PartitionDlg::execute (ObjectList& objects)
       anObj = aNoSelfIntersection ?
         anOper->MakePartitionNonSelfIntersectedShape(myListShapes, myListTools,
                                                      myListKeepInside, myListRemoveInside,
-                                                     aLimit, false, myListMaterials, aKeepNonlimitShapes) :
+                                                     aLimit, false, myListMaterials, aKeepNonlimitShapes,
+                                                     isDetectSelfInte) :
         anOper->MakePartition(myListShapes, myListTools,
                               myListKeepInside, myListRemoveInside,
-                              aLimit, false, myListMaterials, aKeepNonlimitShapes);
+                              aLimit, false, myListMaterials, aKeepNonlimitShapes,
+                              isDetectSelfInte);
       res = true;
     }
     break;
   case 1:
     {
-      anObj = anOper->MakeHalfPartition( myListShapes[0].in(), myListTools[0].in() );
+      anObj = anOper->MakeHalfPartition( myListShapes[0].in(), myListTools[0].in(),
+                                         isDetectSelfInte );
       res = true;
     }
     break;
index dcfdf80da7e834ab93ac1fc916d346a38e074cac..2363b4d9a4e2c76f006c4acce5c042585692ab1f 100644 (file)
@@ -28,6 +28,7 @@
 #include <GEOMBase_Skeleton.h>
 
 class DlgRef_2Sel1List2Check;
+class QCheckBox;
 
 //=================================================================================
 // class    : OperationGUI_PartitionDlg
@@ -64,6 +65,7 @@ private:
   GEOM::ListOfGO                     myListKeepInside;
 
   DlgRef_2Sel1List2Check*            GroupPoints;
+  QCheckBox                         *mySelfInte;
 
 private slots:
   void                               ClickOnOk();