0022338: EDF GEOM: Regression when partitoning a compound by a plane

This commit is contained in:
skv 2013-11-26 07:06:56 +00:00
parent 1688b97eda
commit 7a38491062
13 changed files with 152 additions and 36 deletions

View 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 sub-shapes will not be performed. In this case the Partition algorithm
will work faster, but the result might differ from the default behavior. 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> <b>Advanced option:</b>
\ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments". \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, <em>geompy.MakePartition(ListOfShapes, ListOfTools, ListOfKeepInside,
ListOfRemoveInside, Limit, RemoveWebs, ListOfMaterials, ListOfRemoveInside, Limit, RemoveWebs, ListOfMaterials,
KeepNonlimitShapes)</em> KeepNonlimitShapes, checkSelfInte)</em>
<b>TUI Command (without sub-shapes intersection):</b> <b>TUI Command (without sub-shapes intersection):</b>
<em>geompy.MakePartitionNonSelfIntersectedShape(ListOfShapes, <em>geompy.MakePartitionNonSelfIntersectedShape(ListOfShapes,
ListOfTools, ListOfKeepInside, ListOfRemoveInside, Limit, RemoveWebs, ListOfTools, ListOfKeepInside, ListOfRemoveInside, Limit, RemoveWebs,
ListOfMaterials, KeepNonlimitShapes)</em> ListOfMaterials, KeepNonlimitShapes, checkSelfInte)</em>
Here, Here,
- \em ListOfShapes is a list of shapes to be intersected - \em ListOfShapes is a list of shapes to be intersected
@ -82,6 +88,8 @@ Here,
- \em Limit is a Type of resulting shapes - \em Limit is a Type of resulting shapes
- \em KeepNonlimitShapes is a flag that allows to preserve standalone - \em KeepNonlimitShapes is a flag that allows to preserve standalone
shapes of low dimension (than \em Limit) in the result. 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 - Other parameters are obsolete and kept only for compatibility with
previous versions of SALOME. previous versions of SALOME.
@ -99,6 +107,8 @@ previous versions of SALOME.
<em>geompy.MakeHalfPartition(Shape, Plane)</em>, where: <em>geompy.MakeHalfPartition(Shape, Plane)</em>, where:
- \em Shape is a source shape to be intersected by the \em Plane - \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 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> <b>Examples:</b>

View File

@ -2968,6 +2968,8 @@ module GEOM
* Each shape from theRemoveInside must belong to theShapes also. * Each shape from theRemoveInside must belong to theShapes also.
* \param theRemoveWebs If TRUE, perform Glue 3D algorithm. * \param theRemoveWebs If TRUE, perform Glue 3D algorithm.
* \param theMaterials Material indices for each shape. Make sence, only if theRemoveWebs is TRUE. * \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. * \return New GEOM_Object, containing the result shapes.
*/ */
@ -2978,7 +2980,8 @@ module GEOM
in short theLimit, in short theLimit,
in boolean theRemoveWebs, in boolean theRemoveWebs,
in ListOfLong theMaterials, in ListOfLong theMaterials,
in short theKeepNonlimitShapes); in short theKeepNonlimitShapes,
in boolean IsCheckSelfInte);
/*! /*!
* \brief Perform partition operation. * \brief Perform partition operation.
@ -3001,16 +3004,20 @@ module GEOM
in short theLimit, in short theLimit,
in boolean theRemoveWebs, in boolean theRemoveWebs,
in ListOfLong theMaterials, in ListOfLong theMaterials,
in short theKeepNonlimitShapes); in short theKeepNonlimitShapes,
in boolean IsCheckSelfInte);
/*! /*!
* \brief Perform partition of the Shape with the Plane * \brief Perform partition of the Shape with the Plane
* \param theShape Shape to be intersected. * \param theShape Shape to be intersected.
* \param thePlane Tool shape, to intersect theShape. * \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. * \return New GEOM_Object, containing the result shape.
*/ */
GEOM_Object MakeHalfPartition (in GEOM_Object theShape, GEOM_Object MakeHalfPartition (in GEOM_Object theShape,
in GEOM_Object thePlane); in GEOM_Object thePlane,
in boolean IsCheckSelfInte);
}; };
// # GEOM_ICurvesOperations: // # GEOM_ICurvesOperations:

View File

@ -1574,7 +1574,7 @@ bool GEOMImpl_IAdvancedOperations::MakePipeTShapePartition(Handle(GEOM_Object) t
Te3 = myBooleanOperations->MakePartition Te3 = myBooleanOperations->MakePartition
(partitionShapes, theTools, theKeepInside, theRemoveInside, (partitionShapes, theTools, theKeepInside, theRemoveInside,
TopAbs_SOLID, false, theMaterials, 0, false); TopAbs_SOLID, false, theMaterials, 0, false, Standard_False);
if (Te3.IsNull()) { if (Te3.IsNull()) {
SetErrorCode("Impossible to build partition of TShape"); SetErrorCode("Impossible to build partition of TShape");
return false; return false;

View File

@ -371,7 +371,8 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition
const Standard_Boolean theRemoveWebs, const Standard_Boolean theRemoveWebs,
const Handle(TColStd_HArray1OfInteger)& theMaterials, const Handle(TColStd_HArray1OfInteger)& theMaterials,
const Standard_Integer theKeepNonlimitShapes, const Standard_Integer theKeepNonlimitShapes,
const Standard_Boolean thePerformSelfIntersections) const Standard_Boolean thePerformSelfIntersections,
const Standard_Boolean IsCheckSelfInte)
{ {
SetErrorCode(KO); SetErrorCode(KO);
@ -437,6 +438,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition
// Limit // Limit
aCI.SetLimit(theLimit); aCI.SetLimit(theLimit);
aCI.SetKeepNonlimitShapes(theKeepNonlimitShapes); aCI.SetKeepNonlimitShapes(theKeepNonlimitShapes);
aCI.SetCheckSelfIntersection(IsCheckSelfInte);
// Materials // Materials
if (theRemoveWebs) { if (theRemoveWebs) {
@ -488,7 +490,13 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition
pd << ", " << theMaterials->Value(i); pd << ", " << theMaterials->Value(i);
} }
} }
pd << "], " << theKeepNonlimitShapes <<")"; pd << "], " << theKeepNonlimitShapes;
if (IsCheckSelfInte) {
pd << ", True";
}
pd << ")";
SetErrorCode(OK); SetErrorCode(OK);
return aPartition; return aPartition;
@ -500,7 +508,8 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition
*/ */
//============================================================================= //=============================================================================
Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeHalfPartition 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); SetErrorCode(KO);
@ -526,6 +535,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeHalfPartition
aCI.SetShape(aRef1); aCI.SetShape(aRef1);
aCI.SetPlane(aRef2); aCI.SetPlane(aRef2);
aCI.SetCheckSelfIntersection(IsCheckSelfInte);
//Compute the Partition value //Compute the Partition value
try { try {
@ -544,8 +554,15 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeHalfPartition
} }
//Make a Python command //Make a Python command
GEOM::TPythonDump(aFunction) << aPart << " = geompy.MakeHalfPartition(" GEOM::TPythonDump pd (aFunction);
<< theShape << ", " << thePlane << ")"; pd << aPart << " = geompy.MakeHalfPartition("
<< theShape << ", " << thePlane;
if (IsCheckSelfInte) {
pd << ", True";
}
pd << ")";
SetErrorCode(OK); SetErrorCode(OK);
return aPart; return aPart;

View File

@ -64,10 +64,12 @@ class GEOMImpl_IBooleanOperations : public GEOM_IOperations {
const Standard_Boolean theRemoveWebs, const Standard_Boolean theRemoveWebs,
const Handle(TColStd_HArray1OfInteger)& theMaterials, const Handle(TColStd_HArray1OfInteger)& theMaterials,
const Standard_Integer theKeepNonlimitShapes, 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, Standard_EXPORT Handle(GEOM_Object) MakeHalfPartition (Handle(GEOM_Object) theShape,
Handle(GEOM_Object) thePlane); Handle(GEOM_Object) thePlane,
const Standard_Boolean IsCheckSelfInte);
private: private:

View File

@ -39,6 +39,7 @@
#define PART_ARG_PLANE 8 #define PART_ARG_PLANE 8
#define PART_ARG_KEEP_NONLIMIT_SHAPES 9 #define PART_ARG_KEEP_NONLIMIT_SHAPES 9
#define BOOL_ARG_CHECK_SELF_INTERSECTION 10
class GEOMImpl_IPartition class GEOMImpl_IPartition
{ {
@ -66,6 +67,8 @@ class GEOMImpl_IPartition
void SetMaterials(const Handle(TColStd_HArray1OfInteger)& theMaterials) void SetMaterials(const Handle(TColStd_HArray1OfInteger)& theMaterials)
{ _func->SetIntegerArray(PART_ARG_MATERIALS, 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); } 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) GetShape() { return _func->GetReference(PART_ARG_SHAPE); }
Handle(GEOM_Function) GetPlane() { return _func->GetReference(PART_ARG_PLANE); } Handle(GEOM_Function) GetPlane() { return _func->GetReference(PART_ARG_PLANE); }
Standard_Boolean GetCheckSelfIntersection()
{ return (_func->GetInteger(BOOL_ARG_CHECK_SELF_INTERSECTION) != 0); }
private: private:
Handle(GEOM_Function) _func; Handle(GEOM_Function) _func;

View File

@ -58,10 +58,18 @@
#include <TColStd_ListIteratorOfListOfInteger.hxx> #include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TColStd_ListOfInteger.hxx> #include <TColStd_ListOfInteger.hxx>
#include <Standard_NullObject.hxx> #include <Standard_NullObject.hxx>
#include <StdFail_NotDone.hxx>
#include <Precision.hxx> #include <Precision.hxx>
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
#include <BOPAlgo_CheckerSI.hxx>
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx> #include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
#include <BOPCol_ListOfShape.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 //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 //function : Execute
//purpose : //purpose :
@ -118,6 +141,7 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
GEOMImpl_IPartition aCI (aFunction); GEOMImpl_IPartition aCI (aFunction);
Standard_Integer aType = aFunction->GetType(); Standard_Integer aType = aFunction->GetType();
const Standard_Boolean isCheckSelfInte = aCI.GetCheckSelfIntersection();
TopoDS_Shape aShape; TopoDS_Shape aShape;
GEOMAlgo_Splitter PS; 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"); Standard_NullObject::Raise("In Partition a shape is null");
} }
// Check self-intersection.
if (isCheckSelfInte) {
CheckSelfIntersection(aShape_i);
}
TopoDS_Shape aShape_i_copy; TopoDS_Shape aShape_i_copy;
TNaming_CopyShape::CopyTool(aShape_i, aMapTShapes, 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()) { if (aShape_i.IsNull()) {
Standard_NullObject::Raise("In Partition a tool shape is null"); Standard_NullObject::Raise("In Partition a tool shape is null");
} }
// Check self-intersection.
if (isCheckSelfInte) {
CheckSelfIntersection(aShape_i);
}
// //
//BRepBuilderAPI_Copy aCopyTool (aShape_i); //BRepBuilderAPI_Copy aCopyTool (aShape_i);
TopoDS_Shape aShape_i_copy; 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"); 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 aShapeArg_copy;
TopoDS_Shape aPlaneArg_copy; TopoDS_Shape aPlaneArg_copy;
{ {

View File

@ -200,7 +200,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartition
CORBA::Short theLimit, CORBA::Short theLimit,
CORBA::Boolean theRemoveWebs, CORBA::Boolean theRemoveWebs,
const GEOM::ListOfLong& theMaterials, const GEOM::ListOfLong& theMaterials,
CORBA::Short theKeepNonlimitShapes) CORBA::Short theKeepNonlimitShapes,
CORBA::Boolean IsCheckSelfInte)
{ {
GEOM::GEOM_Object_var aGEOMObject; GEOM::GEOM_Object_var aGEOMObject;
@ -233,7 +234,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartition
GetOperations()->MakePartition(aShapes, aTools, aKeepIns, aRemIns, GetOperations()->MakePartition(aShapes, aTools, aKeepIns, aRemIns,
theLimit, theRemoveWebs, aMaterials, theLimit, theRemoveWebs, aMaterials,
theKeepNonlimitShapes, theKeepNonlimitShapes,
/*PerformSelfIntersections*/Standard_True); /*PerformSelfIntersections*/Standard_True,
IsCheckSelfInte);
if (!GetOperations()->IsDone() || anObject.IsNull()) if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();
@ -253,7 +255,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartitionNonSelfIntersected
CORBA::Short theLimit, CORBA::Short theLimit,
CORBA::Boolean theRemoveWebs, CORBA::Boolean theRemoveWebs,
const GEOM::ListOfLong& theMaterials, const GEOM::ListOfLong& theMaterials,
CORBA::Short theKeepNonlimitShapes) CORBA::Short theKeepNonlimitShapes,
CORBA::Boolean IsCheckSelfInte)
{ {
GEOM::GEOM_Object_var aGEOMObject; GEOM::GEOM_Object_var aGEOMObject;
@ -286,7 +289,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartitionNonSelfIntersected
GetOperations()->MakePartition(aShapes, aTools, aKeepIns, aRemIns, GetOperations()->MakePartition(aShapes, aTools, aKeepIns, aRemIns,
theLimit, theRemoveWebs, aMaterials, theLimit, theRemoveWebs, aMaterials,
theKeepNonlimitShapes, theKeepNonlimitShapes,
/*PerformSelfIntersections*/Standard_False); /*PerformSelfIntersections*/Standard_False,
IsCheckSelfInte);
if (!GetOperations()->IsDone() || anObject.IsNull()) if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn(); 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 GEOM_IBooleanOperations_i::MakeHalfPartition
(GEOM::GEOM_Object_ptr theShape, (GEOM::GEOM_Object_ptr theShape,
GEOM::GEOM_Object_ptr thePlane) GEOM::GEOM_Object_ptr thePlane,
CORBA::Boolean IsCheckSelfInte)
{ {
GEOM::GEOM_Object_var aGEOMObject; 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(); if (aSh.IsNull() || aPl.IsNull()) return aGEOMObject._retn();
// Make Half Partition // 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()) if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();

View File

@ -64,7 +64,8 @@ class GEOM_I_EXPORT GEOM_IBooleanOperations_i :
CORBA::Short theLimit, CORBA::Short theLimit,
CORBA::Boolean theRemoveWebs, CORBA::Boolean theRemoveWebs,
const GEOM::ListOfLong& theMaterials, const GEOM::ListOfLong& theMaterials,
CORBA::Short theKeepNonlimitShapes); CORBA::Short theKeepNonlimitShapes,
CORBA::Boolean IsCheckSelfInte);
GEOM::GEOM_Object_ptr MakePartitionNonSelfIntersectedShape (const GEOM::ListOfGO& theShapes, GEOM::GEOM_Object_ptr MakePartitionNonSelfIntersectedShape (const GEOM::ListOfGO& theShapes,
const GEOM::ListOfGO& theTools, const GEOM::ListOfGO& theTools,
@ -73,11 +74,13 @@ class GEOM_I_EXPORT GEOM_IBooleanOperations_i :
CORBA::Short theLimit, CORBA::Short theLimit,
CORBA::Boolean theRemoveWebs, CORBA::Boolean theRemoveWebs,
const GEOM::ListOfLong& theMaterials, 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 MakeHalfPartition (GEOM::GEOM_Object_ptr theShape,
GEOM::GEOM_Object_ptr thePlane); GEOM::GEOM_Object_ptr thePlane,
CORBA::Boolean IsCheckSelfInte);
::GEOMImpl_IBooleanOperations* GetOperations() ::GEOMImpl_IBooleanOperations* GetOperations()
{ return (::GEOMImpl_IBooleanOperations*)GetImpl(); } { return (::GEOMImpl_IBooleanOperations*)GetImpl(); }

View File

@ -1528,7 +1528,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePartition (GEOM::GEOM_List_ptr theSha
myBoolOp->MakePartition(aListImplS->GetList(), aListImplT->GetList(), myBoolOp->MakePartition(aListImplS->GetList(), aListImplT->GetList(),
aListImplKI->GetList(), aListImplRI->GetList(), aListImplKI->GetList(), aListImplRI->GetList(),
theLimit, theRemoveWebs, aListImplM->GetList(), theLimit, theRemoveWebs, aListImplM->GetList(),
theKeepNonlimitShapes); theKeepNonlimitShapes, false);
endService( " GEOM_Superv_i::MakePartition" ); endService( " GEOM_Superv_i::MakePartition" );
return anObj; return anObj;
} }
@ -1545,7 +1545,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeHalfPartition (GEOM::GEOM_Object_ptr th
beginService( " GEOM_Superv_i::MakeHalfPartition" ); beginService( " GEOM_Superv_i::MakeHalfPartition" );
MESSAGE("GEOM_Superv_i::MakeHalfPartition"); MESSAGE("GEOM_Superv_i::MakeHalfPartition");
getBoolOp(); 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" ); endService( " GEOM_Superv_i::MakeHalfPartition" );
return anObj; return anObj;
} }

View File

@ -6939,6 +6939,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# target type (equal to Limit) are kept in the result, # target type (equal to Limit) are kept in the result,
# else standalone shapes of lower dimension # else standalone shapes of lower dimension
# are kept also (if they exist). # 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 # @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic # for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name. # 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" # @ref tui_partition "Example"
def MakePartition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], def MakePartition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[], Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[],
KeepNonlimitShapes=0, theName=None): KeepNonlimitShapes=0, checkSelfInte=False, theName=None):
""" """
Perform partition operation. Perform partition operation.
@ -6976,6 +6978,9 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
target type (equal to Limit) are kept in the result, target type (equal to Limit) are kept in the result,
else standalone shapes of lower dimension else standalone shapes of lower dimension
are kept also (if they exist). 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 theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name. 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, anObj = self.BoolOp.MakePartition(ListShapes, ListTools,
ListKeepInside, ListRemoveInside, ListKeepInside, ListRemoveInside,
Limit, RemoveWebs, ListMaterials, Limit, RemoveWebs, ListMaterials,
KeepNonlimitShapes); KeepNonlimitShapes, checkSelfInte);
RaiseIfFailed("MakePartition", self.BoolOp) RaiseIfFailed("MakePartition", self.BoolOp)
self._autoPublish(anObj, theName, "partition") self._autoPublish(anObj, theName, "partition")
return anObj return anObj
@ -7031,7 +7036,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
ListKeepInside=[], ListRemoveInside=[], ListKeepInside=[], ListRemoveInside=[],
Limit=ShapeType["AUTO"], RemoveWebs=0, Limit=ShapeType["AUTO"], RemoveWebs=0,
ListMaterials=[], KeepNonlimitShapes=0, ListMaterials=[], KeepNonlimitShapes=0,
theName=None): checkSelfInte=False, theName=None):
""" """
Perform partition operation. Perform partition operation.
This method may be useful if it is needed to make a partition for 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, anObj = self.BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
ListKeepInside, ListRemoveInside, ListKeepInside, ListRemoveInside,
Limit, RemoveWebs, ListMaterials, Limit, RemoveWebs, ListMaterials,
KeepNonlimitShapes); KeepNonlimitShapes, checkSelfInte);
RaiseIfFailed("MakePartitionNonSelfIntersectedShape", self.BoolOp) RaiseIfFailed("MakePartitionNonSelfIntersectedShape", self.BoolOp)
self._autoPublish(anObj, theName, "partition") self._autoPublish(anObj, theName, "partition")
return anObj return anObj
@ -7068,7 +7073,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# \n @ref swig_Partition "Example 2" # \n @ref swig_Partition "Example 2"
def Partition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], def Partition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[], Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[],
KeepNonlimitShapes=0, theName=None): KeepNonlimitShapes=0, checkSelfInte=False, theName=None):
""" """
See method geompy.MakePartition for more information. See method geompy.MakePartition for more information.
""" """
@ -7077,12 +7082,15 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
anObj = self.MakePartition(ListShapes, ListTools, anObj = self.MakePartition(ListShapes, ListTools,
ListKeepInside, ListRemoveInside, ListKeepInside, ListRemoveInside,
Limit, RemoveWebs, ListMaterials, Limit, RemoveWebs, ListMaterials,
KeepNonlimitShapes, theName); KeepNonlimitShapes, checkSelfInte,
theName);
return anObj return anObj
## Perform partition of the Shape with the Plane ## Perform partition of the Shape with the Plane
# @param theShape Shape to be intersected. # @param theShape Shape to be intersected.
# @param thePlane Tool shape, to intersect theShape. # @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 # @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic # for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name. # 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. # @return New GEOM.GEOM_Object, containing the result shape.
# #
# @ref tui_partition "Example" # @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 Perform partition of the Shape with the Plane
Parameters: Parameters:
theShape Shape to be intersected. theShape Shape to be intersected.
thePlane Tool shape, to intersect theShape. 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 theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name. 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. New GEOM.GEOM_Object, containing the result shape.
""" """
# Example: see GEOM_TestAll.py # Example: see GEOM_TestAll.py
anObj = self.BoolOp.MakeHalfPartition(theShape, thePlane) anObj = self.BoolOp.MakeHalfPartition(theShape, thePlane, checkSelfInte)
RaiseIfFailed("MakeHalfPartition", self.BoolOp) RaiseIfFailed("MakeHalfPartition", self.BoolOp)
self._autoPublish(anObj, theName, "partition") self._autoPublish(anObj, theName, "partition")
return anObj return anObj

View File

@ -85,6 +85,10 @@ OperationGUI_PartitionDlg::OperationGUI_PartitionDlg( GeometryGUI* theGeometryGU
GroupPoints->CheckButton1->setText( tr( "GEOM_KEEP_NONLIMIT_SHAPES" ) ); GroupPoints->CheckButton1->setText( tr( "GEOM_KEEP_NONLIMIT_SHAPES" ) );
GroupPoints->CheckButton2->setText( tr( "GEOM_NO_SELF_INTERSECTION" ) ); 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() ); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 ); layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints ); layout->addWidget( GroupPoints );
@ -140,6 +144,7 @@ void OperationGUI_PartitionDlg::Init()
GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_VERTEX" ) ); GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_VERTEX" ) );
GroupPoints->ComboBox1->setItemData(GroupPoints->ComboBox1->count()-1, GEOM::VERTEX); GroupPoints->ComboBox1->setItemData(GroupPoints->ComboBox1->count()-1, GEOM::VERTEX);
GroupPoints->CheckButton1->setChecked( false ); GroupPoints->CheckButton1->setChecked( false );
mySelfInte->setChecked(true);
mainFrame()->GroupBoxPublish->show(); mainFrame()->GroupBoxPublish->show();
@ -162,6 +167,7 @@ void OperationGUI_PartitionDlg::Init()
connect( GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(processPreview()) ); connect( GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(processPreview()) );
connect( GroupPoints->CheckButton2, 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" ) ); initName( tr( "GEOM_PARTITION" ) );
@ -440,6 +446,7 @@ bool OperationGUI_PartitionDlg::execute (ObjectList& objects)
{ {
bool res = false; bool res = false;
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
bool isDetectSelfInte = mySelfInte->isChecked();
GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation()); GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation());
@ -453,16 +460,19 @@ bool OperationGUI_PartitionDlg::execute (ObjectList& objects)
anObj = aNoSelfIntersection ? anObj = aNoSelfIntersection ?
anOper->MakePartitionNonSelfIntersectedShape(myListShapes, myListTools, anOper->MakePartitionNonSelfIntersectedShape(myListShapes, myListTools,
myListKeepInside, myListRemoveInside, myListKeepInside, myListRemoveInside,
aLimit, false, myListMaterials, aKeepNonlimitShapes) : aLimit, false, myListMaterials, aKeepNonlimitShapes,
isDetectSelfInte) :
anOper->MakePartition(myListShapes, myListTools, anOper->MakePartition(myListShapes, myListTools,
myListKeepInside, myListRemoveInside, myListKeepInside, myListRemoveInside,
aLimit, false, myListMaterials, aKeepNonlimitShapes); aLimit, false, myListMaterials, aKeepNonlimitShapes,
isDetectSelfInte);
res = true; res = true;
} }
break; break;
case 1: case 1:
{ {
anObj = anOper->MakeHalfPartition( myListShapes[0].in(), myListTools[0].in() ); anObj = anOper->MakeHalfPartition( myListShapes[0].in(), myListTools[0].in(),
isDetectSelfInte );
res = true; res = true;
} }
break; break;

View File

@ -28,6 +28,7 @@
#include <GEOMBase_Skeleton.h> #include <GEOMBase_Skeleton.h>
class DlgRef_2Sel1List2Check; class DlgRef_2Sel1List2Check;
class QCheckBox;
//================================================================================= //=================================================================================
// class : OperationGUI_PartitionDlg // class : OperationGUI_PartitionDlg
@ -64,6 +65,7 @@ private:
GEOM::ListOfGO myListKeepInside; GEOM::ListOfGO myListKeepInside;
DlgRef_2Sel1List2Check* GroupPoints; DlgRef_2Sel1List2Check* GroupPoints;
QCheckBox *mySelfInte;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();