0022338: implement check self-intersection option for boolean operations

This commit is contained in:
skv 2013-10-16 11:22:29 +00:00
parent 5dd2cb307e
commit 265dfeb97b
19 changed files with 309 additions and 168 deletions

View File

@ -8,8 +8,8 @@ This operation cuts the common part of a list of shapes and transforms it into a
The \b Result will be a \b GEOM_Object. The \b Result will be a \b GEOM_Object.
<b>TUI Command:</b> <em>geompy.MakeCommonList(theShapesList)</em>\n <b>TUI Command:</b> <em>geompy.MakeCommonList(theShapesList, checkSelfInte)</em>\n
<b>Arguments:</b> Name + a list of shapes.\n <b>Arguments:</b> Name + a list of shapes + an optional flag for self-intersection check.\n
<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".
@ -17,8 +17,8 @@ The \b Result will be a \b GEOM_Object.
For a particular case with two shapes for the Common operation there is the following TUI command: For a particular case with two shapes for the Common operation there is the following TUI command:
<b>TUI Command:</b> <em>geompy.MakeCommon(s1, s2)</em>\n <b>TUI Command:</b> <em>geompy.MakeCommon(s1, s2, checkSelfInte)</em>\n
<b>Arguments:</b> Name + 2 shapes. <b>Arguments:</b> Name + 2 shapes + an optional flag for self-intersection check.
<b>Example:</b> <b>Example:</b>

View File

@ -8,8 +8,8 @@ This operation cuts a shape with a list of other shapes.
The \b Result will be a \b GEOM_Object. The \b Result will be a \b GEOM_Object.
<b>TUI Command:</b> <em>geompy.MakeCutList(theMainShape, theShapesList)</em>\n <b>TUI Command:</b> <em>geompy.MakeCutList(theMainShape, theShapesList, checkSelfInte)</em>\n
<b>Arguments:</b> Name + a main shape + a list of other shapes.\n <b>Arguments:</b> Name + a main shape + a list of other shapes + an optional flag for self-intersection check.\n
<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".
@ -17,8 +17,8 @@ The \b Result will be a \b GEOM_Object.
For a particular case with two shapes (object and tool) for the Cut operation there is the following TUI command: For a particular case with two shapes (object and tool) for the Cut operation there is the following TUI command:
<b>TUI Command:</b> <em>geompy.MakeCut(s1, s2)</em>\n <b>TUI Command:</b> <em>geompy.MakeCut(s1, s2, checkSelfInte)</em>\n
<b>Arguments:</b> Name + the object + the tool. <b>Arguments:</b> Name + the object + the tool + an optional flag for self-intersection check.
<b>Example:</b> <b>Example:</b>

View File

@ -9,8 +9,8 @@ This operation creates one shape from a list of shapes.
The \b Result will be a \b GEOM_Object. The \b Result will be a \b GEOM_Object.
<b>TUI Command:</b> <em>geompy.MakeFuseList(theShapesList)</em>\n <b>TUI Command:</b> <em>geompy.MakeFuseList(theShapesList, checkSelfInte)</em>\n
<b>Arguments:</b> Name + a list of shapes.\n <b>Arguments:</b> Name + a list of shapes + an optional flag for self-intersection check.\n
<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".
@ -18,8 +18,8 @@ The \b Result will be a \b GEOM_Object.
For a particular case with two shapes to be fused there is the following TUI command: For a particular case with two shapes to be fused there is the following TUI command:
<b>TUI Command:</b> <em>geompy.MakeFuse(s1, s2)</em>\n <b>TUI Command:</b> <em>geompy.MakeFuse(s1, s2, checkSelfInte)</em>\n
<b>Arguments:</b> Name + 2 shapes. <b>Arguments:</b> Name + 2 shapes + an optional flag for self-intersection check.
<b>Example:</b> <b>Example:</b>

View File

@ -9,8 +9,8 @@ This operation creates the section between 2 shapes.
The \b Result will be any \b GEOM_Object (EDGE or WIRE). The \b Result will be any \b GEOM_Object (EDGE or WIRE).
<b>TUI Command:</b> <em>geompy.MakeSection(s1, s2)</em>\n <b>TUI Command:</b> <em>geompy.MakeSection(s1, s2, checkSelfInte)</em>\n
<b>Arguments:</b> Name + 2 shapes.\n <b>Arguments:</b> Name + 2 shapes + an optional flag for self-intersection check.\n
<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".

View File

@ -23,17 +23,17 @@ a list of others. </li>
You can use advanced TUI commands performing these operations You can use advanced TUI commands performing these operations
independently from each other: independently from each other:
\par \par
<em>geompy.MakeFuseList(theShapesList)</em>, where \em theShapesList is <em>geompy.MakeFuseList(theShapesList, checkSelfInte)</em>, where \em theShapesList is
the list of shapes for Fuse operation; the list of shapes for Fuse operation;
\par \par
<em>geompy.MakeCommonList(theShapesList)</em>, where \em theShapesList is <em>geompy.MakeCommonList(theShapesList, checkSelfInte)</em>, where \em theShapesList is
the list of shapes for Common operation; the list of shapes for Common operation;
\par \par
<em>geompy.MakeCutList(theMainShape, theShapesList)</em>, where \em <em>geompy.MakeCutList(theMainShape, theShapesList, checkSelfInte)</em>, where \em
theMainShape is the object of the operation and \em theShapesList is theMainShape is the object of the operation and \em theShapesList is
the list of tools for Cut operation; the list of tools for Cut operation;
\par \par
<em>geompy.MakeSection(Shape1, Shape2)</em>, where \em Shape1 is the first <em>geompy.MakeSection(Shape1, Shape2, checkSelfInte)</em>, where \em Shape1 is the first
argument and \em Shape2 is the second argument of Section operation; argument and \em Shape2 is the second argument of Section operation;
@ -42,7 +42,7 @@ with only two arguments. There is a general TUI command covering these
operations, which can be used alongside with separate commands for each operations, which can be used alongside with separate commands for each
operation. operation.
\par \par
<em>geompy.MakeBoolean(Shape1, Shape2, Operation),</em> where \em <em>geompy.MakeBoolean(Shape1, Shape2, Operation, checkSelfInte),</em> where \em
Shape1 is the first argument and \em Shape2 is the second argument of Shape1 is the first argument and \em Shape2 is the second argument of
Boolean operation, \em Operation is a type of the Boolean operation (1 Boolean operation, \em Operation is a type of the Boolean operation (1
&mdash; Common, 2 &mdash; Cut, 3 &mdash; Fuse, 4 &mdash; Section). &mdash; Common, 2 &mdash; Cut, 3 &mdash; Fuse, 4 &mdash; Section).
@ -51,15 +51,22 @@ Boolean operation, \em Operation is a type of the Boolean operation (1
Besides, you can use advanced TUI commands performing these operations Besides, you can use advanced TUI commands performing these operations
independently from each other: independently from each other:
\par \par
<em>geompy.MakeFuse(Shape1, Shape2)</em>, where \em Shape1 is the first <em>geompy.MakeFuse(Shape1, Shape2, checkSelfInte)</em>, where \em Shape1 is the first
argument and \em Shape2 is the second argument of Fuse operation; argument and \em Shape2 is the second argument of Fuse operation;
\par \par
<em>geompy.MakeCommon(Shape1, Shape2)</em>, where \em Shape1 is the first <em>geompy.MakeCommon(Shape1, Shape2, checkSelfInte)</em>, where \em Shape1 is the first
argument and \em Shape2 is the second argument of Common operation; argument and \em Shape2 is the second argument of Common operation;
\par \par
<em>geompy.MakeCut(Shape1, Shape2)</em>, where \em Shape1 is the first <em>geompy.MakeCut(Shape1, Shape2, checkSelfInte)</em>, where \em Shape1 is the first
argument and \em Shape2 is the second argument of Cut operation; argument and \em Shape2 is the second argument of Cut operation;
The flag \em checkSelfInte tells whether arguments should be checked for
self-intersection prior to an operation. Its default value is \em False which
means that there is no need to check it. This option is provided to ensure that
an operation is performed on not self-intersected shapes as these shapes are
not valid for boolean operations.
Our <b>TUI Scripts</b> provide you with useful examples of the use of Our <b>TUI Scripts</b> provide you with useful examples of the use of
\ref tui_boolean_operations_page "Boolean Operations". \ref tui_boolean_operations_page "Boolean Operations".

View File

@ -2887,34 +2887,46 @@ module GEOM
* \param theShape2 Second argument for boolean operation. * \param theShape2 Second argument for boolean operation.
* \param theOperation Indicates the operation to be done: * \param theOperation Indicates the operation to be done:
* 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section. * 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
* \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 MakeBoolean (in GEOM_Object theShape1, GEOM_Object MakeBoolean (in GEOM_Object theShape1,
in GEOM_Object theShape2, in GEOM_Object theShape2,
in long theOperation); in long theOperation,
in boolean IsCheckSelfInte);
/*! /*!
* \brief Perform fusion boolean operation on list of objects. * \brief Perform fusion boolean operation on list of objects.
* \param theShapes Shapes to be fused. * \param theShapes Shapes to be fused.
* \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 MakeFuseList (in ListOfGO theShapes); GEOM_Object MakeFuseList (in ListOfGO theShapes,
in boolean IsCheckSelfInte);
/*! /*!
* \brief Perform common boolean operation on list of objects. * \brief Perform common boolean operation on list of objects.
* \param theShapes Shapes for common operation. * \param theShapes Shapes for common operation.
* \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 MakeCommonList (in ListOfGO theShapes); GEOM_Object MakeCommonList (in ListOfGO theShapes,
in boolean IsCheckSelfInte);
/*! /*!
* \brief Perform cutting of list of objects from theMainShape. * \brief Perform cutting of list of objects from theMainShape.
* \param theMainShape the object for cut operation. * \param theMainShape the object for cut operation.
* \param theShapes Shapes to be cut from theMainShape (tools). * \param theShapes Shapes to be cut from theMainShape (tools).
* \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 MakeCutList (in GEOM_Object theMainShape, GEOM_Object MakeCutList (in GEOM_Object theMainShape,
in ListOfGO theShapes); in ListOfGO theShapes,
in boolean IsCheckSelfInte);
/*! /*!
* \brief Perform partition operation. * \brief Perform partition operation.

View File

@ -238,9 +238,11 @@ module GEOM
//-----------------------------------------------------------// //-----------------------------------------------------------//
GEOM_Object MakeBoolean (in GEOM_Object theShape1, GEOM_Object MakeBoolean (in GEOM_Object theShape1,
in GEOM_Object theShape2, in GEOM_Object theShape2,
in long theOperation) ; in long theOperation,
in boolean IsCheckSelfInte) ;
GEOM_Object MakeFuse (in GEOM_Object theShape1, GEOM_Object MakeFuse (in GEOM_Object theShape1,
in GEOM_Object theShape2) ; in GEOM_Object theShape2,
in boolean IsCheckSelfInte) ;
GEOM_Object MakePartition (in GEOM_List theShapes, GEOM_Object MakePartition (in GEOM_List theShapes,
in GEOM_List theTools, in GEOM_List theTools,
in GEOM_List theKeepInside, in GEOM_List theKeepInside,

View File

@ -322,7 +322,8 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(Handle(GEOM_Object) theShape, int
aBox->GetLastFunction()->SetDescription(""); aBox->GetLastFunction()->SetDescription("");
aShell->GetLastFunction()->SetDescription(""); aShell->GetLastFunction()->SetDescription("");
// Get the common shapes between shell and shape // Get the common shapes between shell and shape
Handle(GEOM_Object) aCommonCompound = myBooleanOperations->MakeBoolean (theShape, aShell, 1); // MakeCommon Handle(GEOM_Object) aCommonCompound = myBooleanOperations->MakeBoolean
(theShape, aShell, 1, Standard_False); // MakeCommon
if (aCommonCompound.IsNull()) { if (aCommonCompound.IsNull()) {
SetErrorCode(myBooleanOperations->GetErrorCode()); SetErrorCode(myBooleanOperations->GetErrorCode());
return false; return false;

View File

@ -93,7 +93,7 @@ BooleanGUI_Dialog::BooleanGUI_Dialog (const int theOperation, GeometryGUI* theGe
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton3->close(); mainFrame()->RadioButton3->close();
myGroup = new DlgRef_2Sel(centralWidget()); myGroup = new DlgRef_2Sel2Spin1Check(centralWidget());
myGroup->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); myGroup->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
if (myOperation == BooleanGUI::CUT) { if (myOperation == BooleanGUI::CUT) {
@ -118,6 +118,12 @@ BooleanGUI_Dialog::BooleanGUI_Dialog (const int theOperation, GeometryGUI* theGe
myGroup->LineEdit2->setReadOnly(true); myGroup->LineEdit2->setReadOnly(true);
} }
myGroup->TextLabel3->hide();
myGroup->TextLabel4->hide();
myGroup->SpinBox_DX->hide();
myGroup->SpinBox_DY->hide();
myGroup->CheckButton1->setText(tr("GEOM_CHECK_SELF_INTERSECTIONS"));
QVBoxLayout* layout = new QVBoxLayout(centralWidget()); QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0); layout->setSpacing(6); layout->setMargin(0); layout->setSpacing(6);
layout->addWidget(myGroup); layout->addWidget(myGroup);
@ -152,6 +158,7 @@ void BooleanGUI_Dialog::Init()
myGroup->LineEdit1->setText(""); myGroup->LineEdit1->setText("");
myGroup->LineEdit2->setText(""); myGroup->LineEdit2->setText("");
myGroup->CheckButton1->setChecked(true);
myObject1.nullify(); myObject1.nullify();
reset(); reset();
@ -402,19 +409,22 @@ bool BooleanGUI_Dialog::execute (ObjectList& objects)
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation()); GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation());
const bool isCheckSelfInte = myGroup->CheckButton1->isChecked();
switch (myOperation) { switch (myOperation) {
case BooleanGUI::FUSE: case BooleanGUI::FUSE:
anObj = anOper->MakeFuseList(myObjects); anObj = anOper->MakeFuseList(myObjects, isCheckSelfInte);
break; break;
case BooleanGUI::COMMON: case BooleanGUI::COMMON:
anObj = anOper->MakeCommonList(myObjects); anObj = anOper->MakeCommonList(myObjects, isCheckSelfInte);
break; break;
case BooleanGUI::CUT: case BooleanGUI::CUT:
anObj = anOper->MakeCutList(myObject1.get(), myObjects); anObj =
anOper->MakeCutList(myObject1.get(), myObjects, isCheckSelfInte);
break; break;
case BooleanGUI::SECTION: case BooleanGUI::SECTION:
anObj = anOper->MakeBoolean(myObject1.get(), myObjects[0], myOperation); anObj = anOper->MakeBoolean
(myObject1.get(), myObjects[0], myOperation, isCheckSelfInte);
break; break;
default: default:
break; break;

View File

@ -30,7 +30,7 @@
#include "GEOMBase_Skeleton.h" #include "GEOMBase_Skeleton.h"
#include "GEOM_GenericObjPtr.h" #include "GEOM_GenericObjPtr.h"
class DlgRef_2Sel; class DlgRef_2Sel2Spin1Check;
//================================================================================= //=================================================================================
// class : BooleanGUI_Dialog // class : BooleanGUI_Dialog
@ -65,7 +65,7 @@ private:
GEOM::GeomObjPtr myObject1; GEOM::GeomObjPtr myObject1;
GEOM::ListOfGO_var myObjects; GEOM::ListOfGO_var myObjects;
DlgRef_2Sel* myGroup; DlgRef_2Sel2Spin1Check* myGroup;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();

View File

@ -56,8 +56,6 @@
#include <Standard_ConstructionError.hxx> #include <Standard_ConstructionError.hxx>
#include <StdFail_NotDone.hxx> #include <StdFail_NotDone.hxx>
// Comment next macro in order to avoid check of boolean operations arguments for self-intersections
#define BOP_CHECK_SELF_INTERSECTIONS
// Depth of self-intersection check (see BOPAlgo_CheckerSI::SetLevelOfCheck() for more details) // 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; // 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). // here check level is decreased to more appropriate value to avoid problems with performance).
@ -92,6 +90,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const
GEOMImpl_IBoolean aCI (aFunction); GEOMImpl_IBoolean aCI (aFunction);
Standard_Integer aType = aFunction->GetType(); Standard_Integer aType = aFunction->GetType();
const Standard_Boolean isCheckSelfInte = aCI.GetCheckSelfIntersection();
TopoDS_Shape aShape; TopoDS_Shape aShape;
@ -115,7 +114,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const
if (!ana.IsValid()) if (!ana.IsValid())
StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid"); StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid");
#ifdef BOP_CHECK_SELF_INTERSECTIONS if (isCheckSelfInte) {
BOPAlgo_CheckerSI aCSI; // checker of self-interferences BOPAlgo_CheckerSI aCSI; // checker of self-interferences
aCSI.SetLevelOfCheck(BOP_SELF_INTERSECTIONS_LEVEL); aCSI.SetLevelOfCheck(BOP_SELF_INTERSECTIONS_LEVEL);
BOPCol_ListOfShape aList1, aList2; BOPCol_ListOfShape aList1, aList2;
@ -129,7 +128,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const
aCSI.Perform(); aCSI.Perform();
if (aCSI.ErrorStatus() || aCSI.DS().Interferences().Extent() > 0) if (aCSI.ErrorStatus() || aCSI.DS().Interferences().Extent() > 0)
StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is self-intersected"); StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is self-intersected");
#endif }
// Make a copy to prevent the original shape changes. // Make a copy to prevent the original shape changes.
TopoDS_Shape aShapeCopy1; TopoDS_Shape aShapeCopy1;
@ -162,15 +161,14 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const
if (!aShape.IsNull()) { if (!aShape.IsNull()) {
BRepCheck_Analyzer anAna (aShape, Standard_True); BRepCheck_Analyzer anAna (aShape, Standard_True);
#ifdef BOP_CHECK_SELF_INTERSECTIONS
BOPAlgo_CheckerSI aCSI; // checker of self-interferences
aCSI.SetLevelOfCheck(BOP_SELF_INTERSECTIONS_LEVEL);
#endif
if (!anAna.IsValid()) { if (!anAna.IsValid()) {
StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid"); StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid");
} }
#ifdef BOP_CHECK_SELF_INTERSECTIONS BOPAlgo_CheckerSI aCSI; // checker of self-interferences
if (isCheckSelfInte) {
aCSI.SetLevelOfCheck(BOP_SELF_INTERSECTIONS_LEVEL);
BOPCol_ListOfShape aList1; BOPCol_ListOfShape aList1;
aList1.Append(aShape); aList1.Append(aShape);
aCSI.SetArguments(aList1); aCSI.SetArguments(aList1);
@ -178,7 +176,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const
if (aCSI.ErrorStatus() || aCSI.DS().Interferences().Extent() > 0) { if (aCSI.ErrorStatus() || aCSI.DS().Interferences().Extent() > 0) {
StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is self-intersected"); StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is self-intersected");
} }
#endif }
// Copy shape // Copy shape
TopoDS_Shape aShapeCopy; TopoDS_Shape aShapeCopy;
@ -196,7 +194,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const
StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid"); StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid");
} }
#ifdef BOP_CHECK_SELF_INTERSECTIONS if (isCheckSelfInte) {
BOPCol_ListOfShape aList2; BOPCol_ListOfShape aList2;
aList2.Append(aShape2); aList2.Append(aShape2);
aCSI.SetArguments(aList2); aCSI.SetArguments(aList2);
@ -204,7 +202,8 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const
if (aCSI.ErrorStatus() || aCSI.DS().Interferences().Extent() > 0) { if (aCSI.ErrorStatus() || aCSI.DS().Interferences().Extent() > 0) {
StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is self-intersected"); StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is self-intersected");
} }
#endif }
// Copy shape // Copy shape
TNaming_CopyShape::CopyTool(aShape2, aMapTShapes, aShapeCopy); TNaming_CopyShape::CopyTool(aShape2, aMapTShapes, aShapeCopy);
aShape = performOperation (aShape, aShapeCopy, aSimpleType); aShape = performOperation (aShape, aShapeCopy, aSimpleType);
@ -226,15 +225,15 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const
if (!aShape.IsNull()) { if (!aShape.IsNull()) {
// check arguments for Mantis issue 0021019 // check arguments for Mantis issue 0021019
BRepCheck_Analyzer anAna (aShape, Standard_True); BRepCheck_Analyzer anAna (aShape, Standard_True);
#ifdef BOP_CHECK_SELF_INTERSECTIONS
BOPAlgo_CheckerSI aCSI; // checker of self-interferences
aCSI.SetLevelOfCheck(BOP_SELF_INTERSECTIONS_LEVEL);
#endif
if (!anAna.IsValid()) { if (!anAna.IsValid()) {
StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid"); StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid");
} }
#ifdef BOP_CHECK_SELF_INTERSECTIONS BOPAlgo_CheckerSI aCSI; // checker of self-interferences
if (isCheckSelfInte) {
aCSI.SetLevelOfCheck(BOP_SELF_INTERSECTIONS_LEVEL);
BOPCol_ListOfShape aList1; BOPCol_ListOfShape aList1;
aList1.Append(aShape); aList1.Append(aShape);
aCSI.SetArguments(aList1); aCSI.SetArguments(aList1);
@ -242,7 +241,8 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const
if (aCSI.ErrorStatus() || aCSI.DS().Interferences().Extent() > 0) { if (aCSI.ErrorStatus() || aCSI.DS().Interferences().Extent() > 0) {
StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is self-intersected"); StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is self-intersected");
} }
#endif }
// Copy shape // Copy shape
TopoDS_Shape aShapeCopy; TopoDS_Shape aShapeCopy;
TColStd_IndexedDataMapOfTransientTransient aMapTShapes; TColStd_IndexedDataMapOfTransientTransient aMapTShapes;
@ -265,7 +265,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const
StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid"); StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is not valid");
} }
#ifdef BOP_CHECK_SELF_INTERSECTIONS if (isCheckSelfInte) {
BOPCol_ListOfShape aList2; BOPCol_ListOfShape aList2;
aList2.Append(aTool); aList2.Append(aTool);
aCSI.SetArguments(aList2); aCSI.SetArguments(aList2);
@ -273,7 +273,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const
if (aCSI.ErrorStatus() || aCSI.DS().Interferences().Extent() > 0) { if (aCSI.ErrorStatus() || aCSI.DS().Interferences().Extent() > 0) {
StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is self-intersected"); StdFail_NotDone::Raise("Boolean operation will not be performed, because argument shape is self-intersected");
} }
#endif }
// Copy shape // Copy shape
TNaming_CopyShape::CopyTool(aTool, aMapTShapes, aShapeCopy); TNaming_CopyShape::CopyTool(aTool, aMapTShapes, aShapeCopy);

View File

@ -28,6 +28,7 @@
#define BOOL_ARG_SHAPE1 1 #define BOOL_ARG_SHAPE1 1
#define BOOL_ARG_SHAPE2 2 #define BOOL_ARG_SHAPE2 2
#define BOOL_ARG_SHAPES 3 #define BOOL_ARG_SHAPES 3
#define BOOL_ARG_CHECK_SELF_INTERSECTION 4
class GEOMImpl_IBoolean class GEOMImpl_IBoolean
{ {
@ -39,11 +40,15 @@ class GEOMImpl_IBoolean
void SetShape2(Handle(GEOM_Function) theRef) { _func->SetReference(BOOL_ARG_SHAPE2, theRef); } void SetShape2(Handle(GEOM_Function) theRef) { _func->SetReference(BOOL_ARG_SHAPE2, theRef); }
void SetShapes(const Handle(TColStd_HSequenceOfTransient)& theShapes) void SetShapes(const Handle(TColStd_HSequenceOfTransient)& theShapes)
{ _func->SetReferenceList(BOOL_ARG_SHAPES, theShapes); } { _func->SetReferenceList(BOOL_ARG_SHAPES, theShapes); }
void SetCheckSelfIntersection (Standard_Boolean theFlag)
{ _func->SetInteger(BOOL_ARG_CHECK_SELF_INTERSECTION, theFlag ? 1 : 0); }
Handle(GEOM_Function) GetShape1() { return _func->GetReference(BOOL_ARG_SHAPE1); } Handle(GEOM_Function) GetShape1() { return _func->GetReference(BOOL_ARG_SHAPE1); }
Handle(GEOM_Function) GetShape2() { return _func->GetReference(BOOL_ARG_SHAPE2); } Handle(GEOM_Function) GetShape2() { return _func->GetReference(BOOL_ARG_SHAPE2); }
Handle(TColStd_HSequenceOfTransient) GetShapes() Handle(TColStd_HSequenceOfTransient) GetShapes()
{ return _func->GetReferenceList(BOOL_ARG_SHAPES); } { return _func->GetReferenceList(BOOL_ARG_SHAPES); }
Standard_Boolean GetCheckSelfIntersection()
{ return (_func->GetInteger(BOOL_ARG_CHECK_SELF_INTERSECTION) != 0); }
private: private:

View File

@ -71,9 +71,11 @@ GEOMImpl_IBooleanOperations::~GEOMImpl_IBooleanOperations()
* MakeBoolean * MakeBoolean
*/ */
//============================================================================= //=============================================================================
Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeBoolean (Handle(GEOM_Object) theShape1, Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeBoolean
(Handle(GEOM_Object) theShape1,
Handle(GEOM_Object) theShape2, Handle(GEOM_Object) theShape2,
Standard_Integer theOp) const Standard_Integer theOp,
const Standard_Boolean IsCheckSelfInte)
{ {
SetErrorCode(KO); SetErrorCode(KO);
@ -108,6 +110,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeBoolean (Handle(GEOM_Object
aCI.SetShape1(aRef1); aCI.SetShape1(aRef1);
aCI.SetShape2(aRef2); aCI.SetShape2(aRef2);
aCI.SetCheckSelfIntersection(IsCheckSelfInte);
//Compute the Boolean value //Compute the Boolean value
try { try {
@ -133,7 +136,13 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeBoolean (Handle(GEOM_Object
else if (theOp == 3) pd << " = geompy.MakeFuse("; else if (theOp == 3) pd << " = geompy.MakeFuse(";
else if (theOp == 4) pd << " = geompy.MakeSection("; else if (theOp == 4) pd << " = geompy.MakeSection(";
else {} else {}
pd << theShape1 << ", " << theShape2 << ")"; pd << theShape1 << ", " << theShape2;
if (IsCheckSelfInte) {
pd << ", True";
}
pd << ")";
SetErrorCode(OK); SetErrorCode(OK);
return aBool; return aBool;
@ -145,7 +154,8 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeBoolean (Handle(GEOM_Object
*/ */
//============================================================================= //=============================================================================
Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuseList Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuseList
(const Handle(TColStd_HSequenceOfTransient)& theShapes) (const Handle(TColStd_HSequenceOfTransient)& theShapes,
const Standard_Boolean IsCheckSelfInte)
{ {
SetErrorCode(KO); SetErrorCode(KO);
@ -172,6 +182,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuseList
if (aShapesSeq.IsNull()) return NULL; if (aShapesSeq.IsNull()) return NULL;
aCI.SetShapes(aShapesSeq); aCI.SetShapes(aShapesSeq);
aCI.SetCheckSelfIntersection(IsCheckSelfInte);
//Compute the Boolean value //Compute the Boolean value
try { try {
@ -190,8 +201,16 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuseList
} }
//Make a Python command //Make a Python command
GEOM::TPythonDump(aFunction) << aBool << GEOM::TPythonDump pd (aFunction);
" = geompy.MakeFuseList([" << aDescription.ToCString() << "])";
pd << aBool <<
" = geompy.MakeFuseList([" << aDescription.ToCString() << "]";
if (IsCheckSelfInte) {
pd << ", True";
}
pd << ")";
SetErrorCode(OK); SetErrorCode(OK);
return aBool; return aBool;
@ -203,7 +222,8 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuseList
*/ */
//============================================================================= //=============================================================================
Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeCommonList Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeCommonList
(const Handle(TColStd_HSequenceOfTransient)& theShapes) (const Handle(TColStd_HSequenceOfTransient)& theShapes,
const Standard_Boolean IsCheckSelfInte)
{ {
SetErrorCode(KO); SetErrorCode(KO);
@ -230,6 +250,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeCommonList
if (aShapesSeq.IsNull()) return NULL; if (aShapesSeq.IsNull()) return NULL;
aCI.SetShapes(aShapesSeq); aCI.SetShapes(aShapesSeq);
aCI.SetCheckSelfIntersection(IsCheckSelfInte);
//Compute the Boolean value //Compute the Boolean value
try { try {
@ -248,8 +269,16 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeCommonList
} }
//Make a Python command //Make a Python command
GEOM::TPythonDump(aFunction) << aBool << GEOM::TPythonDump pd (aFunction);
" = geompy.MakeCommonList([" << aDescription.ToCString() << "])";
pd << aBool <<
" = geompy.MakeCommonList([" << aDescription.ToCString() << "]";
if (IsCheckSelfInte) {
pd << ", True";
}
pd << ")";
SetErrorCode(OK); SetErrorCode(OK);
return aBool; return aBool;
@ -262,7 +291,8 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeCommonList
//============================================================================= //=============================================================================
Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeCutList Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeCutList
(Handle(GEOM_Object) theMainShape, (Handle(GEOM_Object) theMainShape,
const Handle(TColStd_HSequenceOfTransient)& theShapes) const Handle(TColStd_HSequenceOfTransient)& theShapes,
const Standard_Boolean IsCheckSelfInte)
{ {
SetErrorCode(KO); SetErrorCode(KO);
@ -293,6 +323,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeCutList
aCI.SetShape1(aMainRef); aCI.SetShape1(aMainRef);
aCI.SetShapes(aShapesSeq); aCI.SetShapes(aShapesSeq);
aCI.SetCheckSelfIntersection(IsCheckSelfInte);
//Compute the Boolean value //Compute the Boolean value
try { try {
@ -311,8 +342,16 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeCutList
} }
//Make a Python command //Make a Python command
GEOM::TPythonDump(aFunction) << aBool << " = geompy.MakeCutList(" GEOM::TPythonDump pd (aFunction);
<< theMainShape << ", [" << aDescription.ToCString() << "])";
pd << aBool << " = geompy.MakeCutList("
<< theMainShape << ", [" << aDescription.ToCString() << "]";
if (IsCheckSelfInte) {
pd << ", True";
}
pd << ")";
SetErrorCode(OK); SetErrorCode(OK);
return aBool; return aBool;

View File

@ -36,19 +36,24 @@ class GEOMImpl_IBooleanOperations : public GEOM_IOperations {
Standard_EXPORT GEOMImpl_IBooleanOperations(GEOM_Engine* theEngine, int theDocID); Standard_EXPORT GEOMImpl_IBooleanOperations(GEOM_Engine* theEngine, int theDocID);
Standard_EXPORT ~GEOMImpl_IBooleanOperations(); Standard_EXPORT ~GEOMImpl_IBooleanOperations();
Standard_EXPORT Handle(GEOM_Object) MakeBoolean (Handle(GEOM_Object) theShape1, Standard_EXPORT Handle(GEOM_Object) MakeBoolean
(Handle(GEOM_Object) theShape1,
Handle(GEOM_Object) theShape2, Handle(GEOM_Object) theShape2,
Standard_Integer theOp); const Standard_Integer theOp,
const Standard_Boolean IsCheckSelfInte);
Standard_EXPORT Handle(GEOM_Object) MakeFuseList Standard_EXPORT Handle(GEOM_Object) MakeFuseList
(const Handle(TColStd_HSequenceOfTransient)& theShapes); (const Handle(TColStd_HSequenceOfTransient)& theShapes,
const Standard_Boolean IsCheckSelfInte);
Standard_EXPORT Handle(GEOM_Object) MakeCommonList Standard_EXPORT Handle(GEOM_Object) MakeCommonList
(const Handle(TColStd_HSequenceOfTransient)& theShapes); (const Handle(TColStd_HSequenceOfTransient)& theShapes,
const Standard_Boolean IsCheckSelfInte);
Standard_EXPORT Handle(GEOM_Object) MakeCutList Standard_EXPORT Handle(GEOM_Object) MakeCutList
(Handle(GEOM_Object) theMainShape, (Handle(GEOM_Object) theMainShape,
const Handle(TColStd_HSequenceOfTransient)& theShapes); const Handle(TColStd_HSequenceOfTransient)& theShapes,
const Standard_Boolean IsCheckSelfInte);
Standard_EXPORT Handle(GEOM_Object) MakePartition Standard_EXPORT Handle(GEOM_Object) MakePartition
(const Handle(TColStd_HSequenceOfTransient)& theShapes, (const Handle(TColStd_HSequenceOfTransient)& theShapes,

View File

@ -64,7 +64,8 @@ GEOM_IBooleanOperations_i::~GEOM_IBooleanOperations_i()
GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeBoolean GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeBoolean
(GEOM::GEOM_Object_ptr theShape1, (GEOM::GEOM_Object_ptr theShape1,
GEOM::GEOM_Object_ptr theShape2, GEOM::GEOM_Object_ptr theShape2,
CORBA::Long theOp) CORBA::Long theOp,
CORBA::Boolean IsCheckSelfInte)
{ {
GEOM::GEOM_Object_var aGEOMObject; GEOM::GEOM_Object_var aGEOMObject;
@ -78,7 +79,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeBoolean
if (aSh1.IsNull() || aSh2.IsNull()) return aGEOMObject._retn(); if (aSh1.IsNull() || aSh2.IsNull()) return aGEOMObject._retn();
// Make Boolean // Make Boolean
Handle(GEOM_Object) anObject = GetOperations()->MakeBoolean(aSh1, aSh2, theOp); Handle(GEOM_Object) anObject =
GetOperations()->MakeBoolean(aSh1, aSh2, theOp, IsCheckSelfInte);
if (!GetOperations()->IsDone() || anObject.IsNull()) if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();
@ -91,7 +93,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeBoolean
*/ */
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeFuseList GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeFuseList
(const GEOM::ListOfGO& theShapes) (const GEOM::ListOfGO& theShapes,
CORBA::Boolean IsCheckSelfInte)
{ {
GEOM::GEOM_Object_var aGEOMObject; GEOM::GEOM_Object_var aGEOMObject;
@ -106,7 +109,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeFuseList
} }
// Make fusion // Make fusion
Handle(GEOM_Object) anObject = GetOperations()->MakeFuseList(aShapes); Handle(GEOM_Object) anObject =
GetOperations()->MakeFuseList(aShapes, IsCheckSelfInte);
if (!GetOperations()->IsDone() || anObject.IsNull()) if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();
@ -120,7 +124,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeFuseList
*/ */
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeCommonList GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeCommonList
(const GEOM::ListOfGO& theShapes) (const GEOM::ListOfGO& theShapes,
CORBA::Boolean IsCheckSelfInte)
{ {
GEOM::GEOM_Object_var aGEOMObject; GEOM::GEOM_Object_var aGEOMObject;
@ -135,7 +140,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeCommonList
} }
// Make fusion // Make fusion
Handle(GEOM_Object) anObject = GetOperations()->MakeCommonList(aShapes); Handle(GEOM_Object) anObject =
GetOperations()->MakeCommonList(aShapes, IsCheckSelfInte);
if (!GetOperations()->IsDone() || anObject.IsNull()) if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();
@ -150,7 +156,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeCommonList
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeCutList GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeCutList
(GEOM::GEOM_Object_ptr theMainShape, (GEOM::GEOM_Object_ptr theMainShape,
const GEOM::ListOfGO& theShapes) const GEOM::ListOfGO& theShapes,
CORBA::Boolean IsCheckSelfInte)
{ {
GEOM::GEOM_Object_var aGEOMObject; GEOM::GEOM_Object_var aGEOMObject;
@ -171,7 +178,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeCutList
} }
// Make fusion // Make fusion
Handle(GEOM_Object) anObject = GetOperations()->MakeCutList(aMainShape, aShapes); Handle(GEOM_Object) anObject =
GetOperations()->MakeCutList(aMainShape, aShapes, IsCheckSelfInte);
if (!GetOperations()->IsDone() || anObject.IsNull()) if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();

View File

@ -44,14 +44,18 @@ class GEOM_I_EXPORT GEOM_IBooleanOperations_i :
GEOM::GEOM_Object_ptr MakeBoolean (GEOM::GEOM_Object_ptr theShape1, GEOM::GEOM_Object_ptr MakeBoolean (GEOM::GEOM_Object_ptr theShape1,
GEOM::GEOM_Object_ptr theShape2, GEOM::GEOM_Object_ptr theShape2,
CORBA::Long theOp); CORBA::Long theOp,
CORBA::Boolean IsCheckSelfInte);
GEOM::GEOM_Object_ptr MakeFuseList (const GEOM::ListOfGO& theShapes); GEOM::GEOM_Object_ptr MakeFuseList (const GEOM::ListOfGO& theShapes,
CORBA::Boolean IsCheckSelfInte);
GEOM::GEOM_Object_ptr MakeCommonList (const GEOM::ListOfGO& theShapes); GEOM::GEOM_Object_ptr MakeCommonList (const GEOM::ListOfGO& theShapes,
CORBA::Boolean IsCheckSelfInte);
GEOM::GEOM_Object_ptr MakeCutList (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr MakeCutList (GEOM::GEOM_Object_ptr theMainShape,
const GEOM::ListOfGO& theShapes); const GEOM::ListOfGO& theShapes,
CORBA::Boolean IsCheckSelfInte);
GEOM::GEOM_Object_ptr MakePartition (const GEOM::ListOfGO& theShapes, GEOM::GEOM_Object_ptr MakePartition (const GEOM::ListOfGO& theShapes,
const GEOM::ListOfGO& theTools, const GEOM::ListOfGO& theTools,

View File

@ -1337,16 +1337,19 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilling (GEOM::GEOM_Object_ptr theShape
//============================================================================= //=============================================================================
// MakeBoolean: // MakeBoolean:
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeBoolean (GEOM::GEOM_Object_ptr theShape1, GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeBoolean
(GEOM::GEOM_Object_ptr theShape1,
GEOM::GEOM_Object_ptr theShape2, GEOM::GEOM_Object_ptr theShape2,
CORBA::Long theOperation) CORBA::Long theOperation,
CORBA::Boolean IsCheckSelfInte)
{ {
beginService( " GEOM_Superv_i::MakeBoolean" ); beginService( " GEOM_Superv_i::MakeBoolean" );
// theOperation indicates the operation to be done: // theOperation indicates the operation to be done:
// 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section // 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section
MESSAGE("GEOM_Superv_i::MakeBoolean"); MESSAGE("GEOM_Superv_i::MakeBoolean");
getBoolOp(); getBoolOp();
GEOM::GEOM_Object_ptr anObj = myBoolOp->MakeBoolean(theShape1, theShape2, theOperation); GEOM::GEOM_Object_ptr anObj =
myBoolOp->MakeBoolean(theShape1, theShape2, theOperation, IsCheckSelfInte);
endService( " GEOM_Superv_i::MakeBoolean" ); endService( " GEOM_Superv_i::MakeBoolean" );
return anObj; return anObj;
} }
@ -1447,13 +1450,16 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeBiNormalAlongVector
//============================================================================= //=============================================================================
// MakeFuse: // MakeFuse:
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFuse (GEOM::GEOM_Object_ptr theShape1, GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFuse
GEOM::GEOM_Object_ptr theShape2) (GEOM::GEOM_Object_ptr theShape1,
GEOM::GEOM_Object_ptr theShape2,
CORBA::Boolean IsCheckSelfInte)
{ {
beginService( " GEOM_Superv_i::MakeFuse" ); beginService( " GEOM_Superv_i::MakeFuse" );
MESSAGE("GEOM_Superv_i::MakeFuse"); MESSAGE("GEOM_Superv_i::MakeFuse");
getBoolOp(); getBoolOp();
GEOM::GEOM_Object_ptr anObj = myBoolOp->MakeBoolean(theShape1, theShape2, 3); GEOM::GEOM_Object_ptr anObj =
myBoolOp->MakeBoolean(theShape1, theShape2, 3, IsCheckSelfInte);
endService( " GEOM_Superv_i::MakeFuse" ); endService( " GEOM_Superv_i::MakeFuse" );
return anObj; return anObj;
} }

View File

@ -332,9 +332,11 @@ public:
//-----------------------------------------------------------// //-----------------------------------------------------------//
GEOM::GEOM_Object_ptr MakeBoolean (GEOM::GEOM_Object_ptr theShape1, GEOM::GEOM_Object_ptr MakeBoolean (GEOM::GEOM_Object_ptr theShape1,
GEOM::GEOM_Object_ptr theShape2, GEOM::GEOM_Object_ptr theShape2,
CORBA::Long theOperation); CORBA::Long theOperation,
CORBA::Boolean IsCheckSelfInte);
GEOM::GEOM_Object_ptr MakeFuse (GEOM::GEOM_Object_ptr theShape1, GEOM::GEOM_Object_ptr MakeFuse (GEOM::GEOM_Object_ptr theShape1,
GEOM::GEOM_Object_ptr theShape2); GEOM::GEOM_Object_ptr theShape2,
CORBA::Boolean IsCheckSelfInte);
GEOM::GEOM_Object_ptr MakePartition (GEOM::GEOM_List_ptr theShapes, GEOM::GEOM_Object_ptr MakePartition (GEOM::GEOM_List_ptr theShapes,
GEOM::GEOM_List_ptr theTools, GEOM::GEOM_List_ptr theTools,
GEOM::GEOM_List_ptr theKeepInside, GEOM::GEOM_List_ptr theKeepInside,

View File

@ -6601,6 +6601,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# @param theShape2 Second argument for boolean operation. # @param theShape2 Second argument for boolean operation.
# @param theOperation Indicates the operation to be done:\n # @param theOperation Indicates the operation to be done:\n
# 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section. # 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
# @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.
@ -6608,7 +6610,7 @@ 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_fuse "Example" # @ref tui_fuse "Example"
def MakeBoolean(self, theShape1, theShape2, theOperation, theName=None): def MakeBoolean(self, theShape1, theShape2, theOperation, checkSelfInte=False, theName=None):
""" """
Perform one of boolean operations on two given shapes. Perform one of boolean operations on two given shapes.
@ -6617,6 +6619,9 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
theShape2 Second argument for boolean operation. theShape2 Second argument for boolean operation.
theOperation Indicates the operation to be done: theOperation Indicates the operation to be done:
1 - Common, 2 - Cut, 3 - Fuse, 4 - Section. 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
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.
@ -6625,7 +6630,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.MakeBoolean(theShape1, theShape2, theOperation) anObj = self.BoolOp.MakeBoolean(theShape1, theShape2, theOperation, checkSelfInte)
RaiseIfFailed("MakeBoolean", self.BoolOp) RaiseIfFailed("MakeBoolean", self.BoolOp)
def_names = { 1: "common", 2: "cut", 3: "fuse", 4: "section" } def_names = { 1: "common", 2: "cut", 3: "fuse", 4: "section" }
self._autoPublish(anObj, theName, def_names[theOperation]) self._autoPublish(anObj, theName, def_names[theOperation])
@ -6634,6 +6639,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
## Perform Common boolean operation on two given shapes. ## Perform Common boolean operation on two given shapes.
# @param theShape1 First argument for boolean operation. # @param theShape1 First argument for boolean operation.
# @param theShape2 Second argument for boolean operation. # @param theShape2 Second argument for boolean operation.
# @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.
@ -6642,13 +6649,16 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# #
# @ref tui_common "Example 1" # @ref tui_common "Example 1"
# \n @ref swig_MakeCommon "Example 2" # \n @ref swig_MakeCommon "Example 2"
def MakeCommon(self, theShape1, theShape2, theName=None): def MakeCommon(self, theShape1, theShape2, checkSelfInte=False, theName=None):
""" """
Perform Common boolean operation on two given shapes. Perform Common boolean operation on two given shapes.
Parameters: Parameters:
theShape1 First argument for boolean operation. theShape1 First argument for boolean operation.
theShape2 Second argument for boolean operation. theShape2 Second argument for boolean operation.
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.
@ -6658,11 +6668,13 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
""" """
# Example: see GEOM_TestOthers.py # Example: see GEOM_TestOthers.py
# note: auto-publishing is done in self.MakeBoolean() # note: auto-publishing is done in self.MakeBoolean()
return self.MakeBoolean(theShape1, theShape2, 1, theName) return self.MakeBoolean(theShape1, theShape2, 1, checkSelfInte, theName)
## Perform Cut boolean operation on two given shapes. ## Perform Cut boolean operation on two given shapes.
# @param theShape1 First argument for boolean operation. # @param theShape1 First argument for boolean operation.
# @param theShape2 Second argument for boolean operation. # @param theShape2 Second argument for boolean operation.
# @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.
@ -6671,13 +6683,16 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# #
# @ref tui_cut "Example 1" # @ref tui_cut "Example 1"
# \n @ref swig_MakeCommon "Example 2" # \n @ref swig_MakeCommon "Example 2"
def MakeCut(self, theShape1, theShape2, theName=None): def MakeCut(self, theShape1, theShape2, checkSelfInte=False, theName=None):
""" """
Perform Cut boolean operation on two given shapes. Perform Cut boolean operation on two given shapes.
Parameters: Parameters:
theShape1 First argument for boolean operation. theShape1 First argument for boolean operation.
theShape2 Second argument for boolean operation. theShape2 Second argument for boolean operation.
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.
@ -6688,11 +6703,13 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
""" """
# Example: see GEOM_TestOthers.py # Example: see GEOM_TestOthers.py
# note: auto-publishing is done in self.MakeBoolean() # note: auto-publishing is done in self.MakeBoolean()
return self.MakeBoolean(theShape1, theShape2, 2, theName) return self.MakeBoolean(theShape1, theShape2, 2, checkSelfInte, theName)
## Perform Fuse boolean operation on two given shapes. ## Perform Fuse boolean operation on two given shapes.
# @param theShape1 First argument for boolean operation. # @param theShape1 First argument for boolean operation.
# @param theShape2 Second argument for boolean operation. # @param theShape2 Second argument for boolean operation.
# @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.
@ -6701,13 +6718,16 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# #
# @ref tui_fuse "Example 1" # @ref tui_fuse "Example 1"
# \n @ref swig_MakeCommon "Example 2" # \n @ref swig_MakeCommon "Example 2"
def MakeFuse(self, theShape1, theShape2, theName=None): def MakeFuse(self, theShape1, theShape2, checkSelfInte=False, theName=None):
""" """
Perform Fuse boolean operation on two given shapes. Perform Fuse boolean operation on two given shapes.
Parameters: Parameters:
theShape1 First argument for boolean operation. theShape1 First argument for boolean operation.
theShape2 Second argument for boolean operation. theShape2 Second argument for boolean operation.
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.
@ -6718,11 +6738,13 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
""" """
# Example: see GEOM_TestOthers.py # Example: see GEOM_TestOthers.py
# note: auto-publishing is done in self.MakeBoolean() # note: auto-publishing is done in self.MakeBoolean()
return self.MakeBoolean(theShape1, theShape2, 3, theName) return self.MakeBoolean(theShape1, theShape2, 3, checkSelfInte, theName)
## Perform Section boolean operation on two given shapes. ## Perform Section boolean operation on two given shapes.
# @param theShape1 First argument for boolean operation. # @param theShape1 First argument for boolean operation.
# @param theShape2 Second argument for boolean operation. # @param theShape2 Second argument for boolean operation.
# @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.
@ -6731,13 +6753,16 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# #
# @ref tui_section "Example 1" # @ref tui_section "Example 1"
# \n @ref swig_MakeCommon "Example 2" # \n @ref swig_MakeCommon "Example 2"
def MakeSection(self, theShape1, theShape2, theName=None): def MakeSection(self, theShape1, theShape2, checkSelfInte=False, theName=None):
""" """
Perform Section boolean operation on two given shapes. Perform Section boolean operation on two given shapes.
Parameters: Parameters:
theShape1 First argument for boolean operation. theShape1 First argument for boolean operation.
theShape2 Second argument for boolean operation. theShape2 Second argument for boolean operation.
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.
@ -6748,10 +6773,12 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
""" """
# Example: see GEOM_TestOthers.py # Example: see GEOM_TestOthers.py
# note: auto-publishing is done in self.MakeBoolean() # note: auto-publishing is done in self.MakeBoolean()
return self.MakeBoolean(theShape1, theShape2, 4, theName) return self.MakeBoolean(theShape1, theShape2, 4, checkSelfInte, theName)
## Perform Fuse boolean operation on the list of shapes. ## Perform Fuse boolean operation on the list of shapes.
# @param theShapesList Shapes to be fused. # @param theShapesList Shapes to be fused.
# @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.
@ -6760,12 +6787,15 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# #
# @ref tui_fuse "Example 1" # @ref tui_fuse "Example 1"
# \n @ref swig_MakeCommon "Example 2" # \n @ref swig_MakeCommon "Example 2"
def MakeFuseList(self, theShapesList, theName=None): def MakeFuseList(self, theShapesList, checkSelfInte=False, theName=None):
""" """
Perform Fuse boolean operation on the list of shapes. Perform Fuse boolean operation on the list of shapes.
Parameters: Parameters:
theShapesList Shapes to be fused. theShapesList Shapes to be fused.
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.
@ -6775,13 +6805,15 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
""" """
# Example: see GEOM_TestOthers.py # Example: see GEOM_TestOthers.py
anObj = self.BoolOp.MakeFuseList(theShapesList) anObj = self.BoolOp.MakeFuseList(theShapesList, checkSelfInte)
RaiseIfFailed("MakeFuseList", self.BoolOp) RaiseIfFailed("MakeFuseList", self.BoolOp)
self._autoPublish(anObj, theName, "fuse") self._autoPublish(anObj, theName, "fuse")
return anObj return anObj
## Perform Common boolean operation on the list of shapes. ## Perform Common boolean operation on the list of shapes.
# @param theShapesList Shapes for Common operation. # @param theShapesList Shapes for Common operation.
# @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.
@ -6790,12 +6822,15 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# #
# @ref tui_common "Example 1" # @ref tui_common "Example 1"
# \n @ref swig_MakeCommon "Example 2" # \n @ref swig_MakeCommon "Example 2"
def MakeCommonList(self, theShapesList, theName=None): def MakeCommonList(self, theShapesList, checkSelfInte=False, theName=None):
""" """
Perform Common boolean operation on the list of shapes. Perform Common boolean operation on the list of shapes.
Parameters: Parameters:
theShapesList Shapes for Common operation. theShapesList Shapes for Common operation.
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.
@ -6805,7 +6840,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
""" """
# Example: see GEOM_TestOthers.py # Example: see GEOM_TestOthers.py
anObj = self.BoolOp.MakeCommonList(theShapesList) anObj = self.BoolOp.MakeCommonList(theShapesList, checkSelfInte)
RaiseIfFailed("MakeCommonList", self.BoolOp) RaiseIfFailed("MakeCommonList", self.BoolOp)
self._autoPublish(anObj, theName, "common") self._autoPublish(anObj, theName, "common")
return anObj return anObj
@ -6813,6 +6848,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
## Perform Cut boolean operation on one object and the list of tools. ## Perform Cut boolean operation on one object and the list of tools.
# @param theMainShape The object of the operation. # @param theMainShape The object of the operation.
# @param theShapesList The list of tools of the operation. # @param theShapesList The list of tools of the operation.
# @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.
@ -6821,13 +6858,16 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# #
# @ref tui_cut "Example 1" # @ref tui_cut "Example 1"
# \n @ref swig_MakeCommon "Example 2" # \n @ref swig_MakeCommon "Example 2"
def MakeCutList(self, theMainShape, theShapesList, theName=None): def MakeCutList(self, theMainShape, theShapesList, checkSelfInte=False, theName=None):
""" """
Perform Cut boolean operation on one object and the list of tools. Perform Cut boolean operation on one object and the list of tools.
Parameters: Parameters:
theMainShape The object of the operation. theMainShape The object of the operation.
theShapesList The list of tools of the operation. theShapesList The list of tools of the operation.
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.
@ -6837,7 +6877,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
""" """
# Example: see GEOM_TestOthers.py # Example: see GEOM_TestOthers.py
anObj = self.BoolOp.MakeCutList(theMainShape, theShapesList) anObj = self.BoolOp.MakeCutList(theMainShape, theShapesList, checkSelfInte)
RaiseIfFailed("MakeCutList", self.BoolOp) RaiseIfFailed("MakeCutList", self.BoolOp)
self._autoPublish(anObj, theName, "cut") self._autoPublish(anObj, theName, "cut")
return anObj return anObj