0022490: [CEA 1057] Default tick of "Detect self-intersections" in Partition

This commit is contained in:
skv 2014-02-26 13:13:55 +04:00
parent d8a06d4161
commit 2153a32ecf
12 changed files with 84 additions and 110 deletions

BIN
doc/salome/gui/GEOM/images/partition1.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 35 KiB

BIN
doc/salome/gui/GEOM/images/partition2.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 26 KiB

13
doc/salome/gui/GEOM/input/partition.doc Normal file → Executable file
View File

@ -51,10 +51,11 @@ In this case the Partition algorithm will work faster, but the result might diff
default behavior. default behavior.
<b>Detect Self-intersections</b> check box is used to check self-intersection of arguments. <b>Detect Self-intersections</b> check box is used to check self-intersection of arguments.
- If this option is switched on (by default), each input shape is checked for self-intersection. It is enabled only if <b>No sub-shapes intersection (Compounds only)</b> is checked.
- If this option is switched off (by default), the partition algorithm is
performed without self-intersection checks.
- If this option is switched on, each input shape is checked for self-intersection.
If self-intersection is detected, the operation is aborted. If self-intersection is detected, the operation is aborted.
- If this option is switched off, the partition algorithm is performed without self-intersection
checks.
\note This algorithm does not find all types of self-intersections. It is tuned \note This algorithm does not find all types of self-intersections. It is tuned
to detect vertex/vertex, vertex/edge, edge/edge, vertex/face and edge/face to detect vertex/vertex, vertex/edge, edge/edge, vertex/face and edge/face
@ -75,7 +76,7 @@ checks.
<em>geompy.MakePartition(ListOfShapes, ListOfTools, ListOfKeepInside, <em>geompy.MakePartition(ListOfShapes, ListOfTools, ListOfKeepInside,
ListOfRemoveInside, Limit, RemoveWebs, ListOfMaterials, ListOfRemoveInside, Limit, RemoveWebs, ListOfMaterials,
KeepNonlimitShapes, checkSelfInte)</em> KeepNonlimitShapes)</em>
<b>TUI Command (without sub-shapes intersection):</b> <b>TUI Command (without sub-shapes intersection):</b>
@ -105,11 +106,9 @@ Activate \ref restore_presentation_parameters_page "Advanced options" if require
<b>TUI Command:</b> <b>TUI Command:</b>
<em>geompy.MakeHalfPartition(Shape, Plane, checkSelfInte)</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 indicates if the arguments should
be checked for self-intersection prior to the operation.
<b>Examples:</b> <b>Examples:</b>

View File

@ -2968,8 +2968,6 @@ 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.
*/ */
@ -2980,8 +2978,7 @@ 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.
@ -2990,7 +2987,10 @@ module GEOM
* a compound containing nonintersected shapes. Performance will be better * a compound containing nonintersected shapes. Performance will be better
* since intersection between shapes from compound is not performed. * since intersection between shapes from compound is not performed.
* *
* Description of all parameters as in previous method MakePartition() * Description of all parameters as in previous method MakePartition().
* One additional parameter is provided:
* \param IsCheckSelfInte If TRUE, perform check self intersection
* of arguments before an operation.
* *
* \note Passed compounds (via ListShapes or via ListTools) * \note Passed compounds (via ListShapes or via ListTools)
* have to consist of nonintersecting shapes. * have to consist of nonintersecting shapes.
@ -3011,13 +3011,10 @@ module GEOM
* \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

@ -492,7 +492,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition
} }
pd << "], " << theKeepNonlimitShapes; pd << "], " << theKeepNonlimitShapes;
if (IsCheckSelfInte) { if (IsCheckSelfInte && !thePerformSelfIntersections) {
pd << ", True"; pd << ", True";
} }
@ -508,8 +508,7 @@ 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);
@ -535,7 +534,6 @@ 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 {
@ -556,13 +554,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeHalfPartition
//Make a Python command //Make a Python command
GEOM::TPythonDump pd (aFunction); GEOM::TPythonDump pd (aFunction);
pd << aPart << " = geompy.MakeHalfPartition(" pd << aPart << " = geompy.MakeHalfPartition("
<< theShape << ", " << thePlane; << theShape << ", " << thePlane << ")";
if (IsCheckSelfInte) {
pd << ", True";
}
pd << ")";
SetErrorCode(OK); SetErrorCode(OK);
return aPart; return aPart;

View File

@ -68,8 +68,7 @@ class GEOMImpl_IBooleanOperations : public GEOM_IOperations {
const Standard_Boolean IsCheckSelfInte); 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

@ -174,7 +174,7 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
} }
// Check self-intersection. // Check self-intersection.
if (isCheckSelfInte) { if (isCheckSelfInte && aType == PARTITION_NO_SELF_INTERSECTIONS) {
CheckSelfIntersection(aShape_i); CheckSelfIntersection(aShape_i);
} }
@ -216,7 +216,7 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
} }
// Check self-intersection. // Check self-intersection.
if (isCheckSelfInte) { if (isCheckSelfInte && aType == PARTITION_NO_SELF_INTERSECTIONS) {
CheckSelfIntersection(aShape_i); CheckSelfIntersection(aShape_i);
} }
@ -359,12 +359,6 @@ 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;
{ {
@ -405,8 +399,20 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
} }
// add object shapes that are in ListShapes; // add object shapes that are in ListShapes;
PS.AddArgument(aShapeArg_copy); TopTools_ListOfShape aSimpleShapes;
//PS.AddShape(aShapeArg); TopTools_MapOfShape aShapesMap;
PrepareShapes(aShapeArg_copy, aType, aSimpleShapes);
TopTools_ListIteratorOfListOfShape aSimpleIter (aSimpleShapes);
for (; aSimpleIter.More(); aSimpleIter.Next()) {
const TopoDS_Shape& aSimpleSh = aSimpleIter.Value();
if (aShapesMap.Add(aSimpleSh)) {
PS.AddArgument(aSimpleSh);
}
}
// add tool shapes that are in ListTools and not in ListShapes; // add tool shapes that are in ListTools and not in ListShapes;
PS.AddTool(aPlaneArg_copy); PS.AddTool(aPlaneArg_copy);
@ -560,6 +566,10 @@ GetCreationInformation(std::string& theOperationName,
AddParam( theParams, "Resulting type", (TopAbs_ShapeEnum) aCI.GetLimit()); AddParam( theParams, "Resulting type", (TopAbs_ShapeEnum) aCI.GetLimit());
AddParam( theParams, "Keep shapes of lower type", aCI.GetKeepNonlimitShapes()); AddParam( theParams, "Keep shapes of lower type", aCI.GetKeepNonlimitShapes());
AddParam( theParams, "No object intersections", ( aType == PARTITION_NO_SELF_INTERSECTIONS )); AddParam( theParams, "No object intersections", ( aType == PARTITION_NO_SELF_INTERSECTIONS ));
if (aType == PARTITION_NO_SELF_INTERSECTIONS) {
AddParam( theParams, "Check self-intersections", aCI.GetCheckSelfIntersection());
}
break; break;
case PARTITION_HALF: case PARTITION_HALF:
AddParam( theParams, "Object", aCI.GetShape() ); AddParam( theParams, "Object", aCI.GetShape() );

View File

@ -200,8 +200,7 @@ 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;
@ -235,7 +234,7 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartition
theLimit, theRemoveWebs, aMaterials, theLimit, theRemoveWebs, aMaterials,
theKeepNonlimitShapes, theKeepNonlimitShapes,
/*PerformSelfIntersections*/Standard_True, /*PerformSelfIntersections*/Standard_True,
IsCheckSelfInte); /*IsCheckSelfInte*/Standard_False);
if (!GetOperations()->IsDone() || anObject.IsNull()) if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();
@ -304,8 +303,7 @@ 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;
@ -320,7 +318,7 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeHalfPartition
// Make Half Partition // Make Half Partition
Handle(GEOM_Object) anObject = Handle(GEOM_Object) anObject =
GetOperations()->MakeHalfPartition(aSh, aPl, IsCheckSelfInte); GetOperations()->MakeHalfPartition(aSh, aPl);
if (!GetOperations()->IsDone() || anObject.IsNull()) if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();

View File

@ -64,8 +64,7 @@ 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,
@ -79,8 +78,7 @@ class GEOM_I_EXPORT GEOM_IBooleanOperations_i :
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, false); theKeepNonlimitShapes);
endService( " GEOM_Superv_i::MakePartition" ); endService( " GEOM_Superv_i::MakePartition" );
return anObj; return anObj;
} }
@ -1546,7 +1546,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeHalfPartition (GEOM::GEOM_Object_ptr th
MESSAGE("GEOM_Superv_i::MakeHalfPartition"); MESSAGE("GEOM_Superv_i::MakeHalfPartition");
getBoolOp(); getBoolOp();
GEOM::GEOM_Object_ptr anObj = GEOM::GEOM_Object_ptr anObj =
myBoolOp->MakeHalfPartition(theShape, thePlane, false); myBoolOp->MakeHalfPartition(theShape, thePlane);
endService( " GEOM_Superv_i::MakeHalfPartition" ); endService( " GEOM_Superv_i::MakeHalfPartition" );
return anObj; return anObj;
} }

View File

@ -7115,16 +7115,6 @@ 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.
#
# @note This algorithm doesn't find all types of self-intersections.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
# vertex/face and edge/face intersections. Face/face
# intersections detection is switched off as it is a
# time-consuming operation that gives an impact on performance.
# To find all self-intersections please use
# CheckSelfIntersections() method.
# #
# @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
@ -7149,7 +7139,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, checkSelfInte=False, theName=None): KeepNonlimitShapes=0, theName=None):
""" """
Perform partition operation. Perform partition operation.
@ -7163,18 +7153,6 @@ 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.
Note:
This algorithm doesn't find all types of self-intersections.
It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
vertex/face and edge/face intersections. Face/face
intersections detection is switched off as it is a
time-consuming operation that gives an impact on performance.
To find all self-intersections please use
CheckSelfIntersections() method.
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
@ -7209,7 +7187,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, checkSelfInte); KeepNonlimitShapes);
RaiseIfFailed("MakePartition", self.BoolOp) RaiseIfFailed("MakePartition", self.BoolOp)
self._autoPublish(anObj, theName, "partition") self._autoPublish(anObj, theName, "partition")
return anObj return anObj
@ -7219,7 +7197,18 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# compound contains nonintersected shapes. Performance will be better # compound contains nonintersected shapes. Performance will be better
# since intersection between shapes from compound is not performed. # since intersection between shapes from compound is not performed.
# #
# Description of all parameters as in previous method MakePartition() # Description of all parameters as in previous method MakePartition().
# One additional parameter is provided:
# @param checkSelfInte The flag that tells if the arguments should
# be checked for self-intersection prior to the operation.
#
# @note This algorithm doesn't find all types of self-intersections.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
# vertex/face and edge/face intersections. Face/face
# intersections detection is switched off as it is a
# time-consuming operation that gives an impact on performance.
# To find all self-intersections please use
# CheckSelfIntersections() method.
# #
# @note Passed compounds (via ListShapes or via ListTools) # @note Passed compounds (via ListShapes or via ListTools)
# have to consist of nonintersecting shapes. # have to consist of nonintersecting shapes.
@ -7239,7 +7228,20 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
since intersection between shapes from compound is not performed. since intersection between shapes from compound is not performed.
Parameters: Parameters:
Description of all parameters as in method geompy.MakePartition Description of all parameters as in method geompy.MakePartition.
One additional parameter is provided:
checkSelfInte The flag that tells if the arguments should
be checked for self-intersection prior to
the operation.
Note:
This algorithm doesn't find all types of self-intersections.
It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
vertex/face and edge/face intersections. Face/face
intersections detection is switched off as it is a
time-consuming operation that gives an impact on performance.
To find all self-intersections please use
CheckSelfIntersections() method.
NOTE: NOTE:
Passed compounds (via ListShapes or via ListTools) Passed compounds (via ListShapes or via ListTools)
@ -7268,7 +7270,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, checkSelfInte=False, theName=None): KeepNonlimitShapes=0, theName=None):
""" """
See method geompy.MakePartition for more information. See method geompy.MakePartition for more information.
""" """
@ -7277,58 +7279,35 @@ 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, checkSelfInte, KeepNonlimitShapes, theName);
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.
# #
# @note This algorithm doesn't find all types of self-intersections.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
# vertex/face and edge/face intersections. Face/face
# intersections detection is switched off as it is a
# time-consuming operation that gives an impact on performance.
# To find all self-intersections please use
# CheckSelfIntersections() method.
#
# @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, checkSelfInte=False, theName=None): def MakeHalfPartition(self, theShape, thePlane, 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.
Note:
This algorithm doesn't find all types of self-intersections.
It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
vertex/face and edge/face intersections. Face/face
intersections detection is switched off as it is a
time-consuming operation that gives an impact on performance.
To find all self-intersections please use
CheckSelfIntersections() method.
Returns: Returns:
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, checkSelfInte) anObj = self.BoolOp.MakeHalfPartition(theShape, thePlane)
RaiseIfFailed("MakeHalfPartition", self.BoolOp) RaiseIfFailed("MakeHalfPartition", self.BoolOp)
self._autoPublish(anObj, theName, "partition") self._autoPublish(anObj, theName, "partition")
return anObj return anObj

View File

@ -144,7 +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); mySelfInte->setChecked(false);
mainFrame()->GroupBoxPublish->show(); mainFrame()->GroupBoxPublish->show();
@ -167,8 +167,10 @@ 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( GroupPoints->CheckButton2, SIGNAL(toggled(bool)), mySelfInte, SLOT(setEnabled(bool)) );
connect( mySelfInte, SIGNAL(toggled(bool)), this, SLOT(processPreview()) ); connect( mySelfInte, SIGNAL(toggled(bool)), this, SLOT(processPreview()) );
mySelfInte->setEnabled(GroupPoints->CheckButton2->isChecked());
initName( tr( "GEOM_PARTITION" ) ); initName( tr( "GEOM_PARTITION" ) );
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
@ -201,6 +203,7 @@ void OperationGUI_PartitionDlg::ConstructorsClicked( int constructorId )
GroupPoints->ComboBox1->setCurrentIndex( 0 ); GroupPoints->ComboBox1->setCurrentIndex( 0 );
GroupPoints->CheckButton1->show(); GroupPoints->CheckButton1->show();
GroupPoints->CheckButton2->show(); GroupPoints->CheckButton2->show();
mySelfInte->show();
GroupPoints->PushButton1->setDown( true ); GroupPoints->PushButton1->setDown( true );
GroupPoints->PushButton2->setDown( false ); GroupPoints->PushButton2->setDown( false );
GroupPoints->LineEdit1->setEnabled(true); GroupPoints->LineEdit1->setEnabled(true);
@ -214,6 +217,7 @@ void OperationGUI_PartitionDlg::ConstructorsClicked( int constructorId )
GroupPoints->TextLabel2->setText( tr( "GEOM_PLANE" ) ); GroupPoints->TextLabel2->setText( tr( "GEOM_PLANE" ) );
GroupPoints->CheckButton1->hide(); GroupPoints->CheckButton1->hide();
GroupPoints->CheckButton2->hide(); GroupPoints->CheckButton2->hide();
mySelfInte->hide();
GroupPoints->PushButton1->setDown( true ); GroupPoints->PushButton1->setDown( true );
GroupPoints->LineEdit1->setEnabled(true); GroupPoints->LineEdit1->setEnabled(true);
break; break;
@ -446,13 +450,13 @@ 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());
switch ( getConstructorId() ) { switch ( getConstructorId() ) {
case 0: case 0:
{ {
bool isDetectSelfInte = mySelfInte->isChecked();
int aLimit = GetLimit(); int aLimit = GetLimit();
int aKeepNonlimitShapes = GroupPoints->CheckButton1->isChecked(); int aKeepNonlimitShapes = GroupPoints->CheckButton1->isChecked();
bool aNoSelfIntersection = GroupPoints->CheckButton2->isChecked(); bool aNoSelfIntersection = GroupPoints->CheckButton2->isChecked();
@ -464,15 +468,13 @@ bool OperationGUI_PartitionDlg::execute (ObjectList& objects)
isDetectSelfInte) : 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;