[bos #40619][CEA] Add Fuzzy parameter to partition and boolean operators

This commit is contained in:
mbs 2024-03-08 22:36:58 +00:00
parent 3bfb88115e
commit e3ce834889
31 changed files with 981 additions and 175 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -12,6 +12,8 @@ In this dialog:
- Input or accept the default \b Name of the resulting shape. - Input or accept the default \b Name of the resulting shape.
- Click the arrow button and select in the Object Browser or in the Viewer the <b>Objects</b> the common part which of should be found. - Click the arrow button and select in the Object Browser or in the Viewer the <b>Objects</b> the common part which of should be found.
- Activate the corresponding check-box if you wish to <b> Detect Self-intersections </b> - Activate the corresponding check-box if you wish to <b> Detect Self-intersections </b>
- Activate the corresponding check-box if you wish to use a <b> fuzzy parameter </b>.
If activated, you can define the fuzzy tolerance in the <b> fuzzy parameter </b> input box.
- Activate \ref restore_presentation_parameters_page "Advanced options" if required. - Activate \ref restore_presentation_parameters_page "Advanced options" if required.
- Press "Apply" or "Apply & Close" button to get the result (GEOM_Object). - Press "Apply" or "Apply & Close" button to get the result (GEOM_Object).
@ -26,15 +28,15 @@ In this dialog:
This operation can be performed using a <b>TUI Command:</b> This operation can be performed using a <b>TUI Command:</b>
<em>geompy.MakeCommonList(theShapesList, checkSelfInte)</em> <em>geompy.MakeCommonList(theShapesList, checkSelfInte, name, fuzzyParam)</em>
<b>Arguments:</b> Name + a list of shapes + an optional flag for self-intersection check. <b>Arguments:</b> a list of shapes + an optional flag for self-intersection check + an optional name + an optional fuzzy parameter.
There is also a special <b>TUI Command</b> for the Common operation on two shapes : There is also a special <b>TUI Command</b> for the Common operation on two shapes :
<em>geompy.MakeCommon(s1, s2, checkSelfInte)</em> <em>geompy.MakeCommon(s1, s2, checkSelfInte, name, fuzzyParam)</em>
<b>Arguments:</b> Name + 2 shapes + an optional flag for self-intersection check. <b>Arguments:</b> 2 shapes + an optional flag for self-intersection check + an optional name + an optional fuzzy parameter.
<b>Example:</b> <b>Example:</b>

View File

@ -13,6 +13,8 @@ In this dialog:
- Click the arrow button and select in the Object Browser or in the Viewer the <b>Main Object</b>, which will be cut by tool objects. - Click the arrow button and select in the Object Browser or in the Viewer the <b>Main Object</b>, which will be cut by tool objects.
- Select the <b>Tool objects</b>, which will cut the main object. - Select the <b>Tool objects</b>, which will cut the main object.
- Activate the corresponding check-box if you wish to <b> Detect Self-intersections </b>. - Activate the corresponding check-box if you wish to <b> Detect Self-intersections </b>.
- Activate the corresponding check-box if you wish to use a <b> fuzzy parameter </b>.
If activated, you can define the fuzzy tolerance in the <b> fuzzy parameter </b> input box.
- Activate \ref restore_presentation_parameters_page "Advanced options" if required. - Activate \ref restore_presentation_parameters_page "Advanced options" if required.
- Press "Apply" or "Apply & Close" button to get the result (GEOM_Object). - Press "Apply" or "Apply & Close" button to get the result (GEOM_Object).
@ -25,15 +27,17 @@ In this dialog:
This operation can be performed using a <b>TUI Command:</b> This operation can be performed using a <b>TUI Command:</b>
<em>geompy.MakeCutList(theMainShape, theShapesList, checkSelfInte)</em> <em>geompy.MakeCutList(theMainShape, theShapesList, checkSelfInte, name, fuzzyParam)</em>
<b>Arguments:</b> Name + a main shape + a list of other shapes + an optional flag for self-intersection check. <b>Arguments:</b> a main shape + a list of other shapes + an optional flag for self-intersection
check + an optional name + an optional fuzzy parameter.
There is also a special <b>TUI Command:</b> for the Cut operation on two shapes (object and tool) : There is also a special <b>TUI Command:</b> for the Cut operation on two shapes (object and tool) :
<em>geompy.MakeCut(s1, s2, checkSelfInte)</em> <em>geompy.MakeCut(s1, s2, checkSelfInte, name, fuzzyParam)</em>
<b>Arguments:</b> Name + the object + the tool + an optional flag for self-intersection check. <b>Arguments:</b> the object + the tool + an optional flag for self-intersection check + an
optional name + an optional fuzzy parameter.
<b>Example:</b> <b>Example:</b>

View File

@ -13,6 +13,8 @@ In this dialog:
- Click the arrow button and select in the Object Browser or in the Viewer the <b>Objects</b> to be fused. - Click the arrow button and select in the Object Browser or in the Viewer the <b>Objects</b> to be fused.
- Activate the corresponding check-box if you wish to <b> Detect Self-intersections </b>. - Activate the corresponding check-box if you wish to <b> Detect Self-intersections </b>.
- Activate the corresponding check-box if you wish to <b> remove extra edges </b>. - Activate the corresponding check-box if you wish to <b> remove extra edges </b>.
- Activate the corresponding check-box if you wish to use a <b> fuzzy parameter </b>.
If activated, you can define the fuzzy tolerance in the <b> fuzzy parameter </b> input box.
- Activate \ref restore_presentation_parameters_page "Advanced options" if required. - Activate \ref restore_presentation_parameters_page "Advanced options" if required.
- Press "Apply" or "Apply & Close" button to get the result (GEOM_Object). - Press "Apply" or "Apply & Close" button to get the result (GEOM_Object).
@ -25,17 +27,17 @@ In this dialog:
This operation can be performed using a <b>TUI Command:</b> This operation can be performed using a <b>TUI Command:</b>
<em>geompy.MakeFuseList(theShapesList, checkSelfInte, rmExtraEdges)</em> <em>geompy.MakeFuseList(theShapesList, checkSelfInte, rmExtraEdges, name, fuzzyParam)</em>
<b>Arguments:</b> Name + a list of shapes + an optional flag for <b>Arguments:</b> a list of shapes + an optional flag for self-intersection
self-intersection check + an optional flag to remove extra edges. check + an optional flag to remove extra edges + an optional name + an optional fuzzy parameter.
There is also a special <b>TUI Command</b> for \b Fuse operation on two shapes : There is also a special <b>TUI Command</b> for \b Fuse operation on two shapes :
<em>geompy.MakeFuse(s1, s2, checkSelfInte, rmExtraEdges)</em> <em>geompy.MakeFuse(s1, s2, checkSelfInte, rmExtraEdges, name, fuzzyParam)</em>
<b>Arguments:</b> Name + 2 shapes + an optional flag for self-intersection <b>Arguments:</b> 2 shapes + an optional flag for self-intersection
check + an optional flag to remove extra edges. check + an optional flag to remove extra edges + an optional name + an optional fuzzy parameter.
<b>Example:</b> <b>Example:</b>

View File

@ -62,6 +62,10 @@ If self-intersection is detected, the operation is aborted.
all self-intersections please use \ref check_self_intersections_page all self-intersections please use \ref check_self_intersections_page
"Detect Self-intersection tool". "Detect Self-intersection tool".
<b>Use Fuzzy Parameter</b> check box is used to enable the usage of the fuzzy tolerance
inside the partition algorithm. The fuzzy tolerance itself can be given in the Fuzzy
Parameter input box.
- Activate \ref restore_presentation_parameters_page "Advanced options" if required. - Activate \ref restore_presentation_parameters_page "Advanced options" if required.
\note Partition is a complex operation, so its result of it depends \note Partition is a complex operation, so its result of it depends
@ -74,13 +78,13 @@ If self-intersection is detected, the operation is aborted.
<em>geompy.MakePartition(ListOfShapes, ListOfTools, ListOfKeepInside, <em>geompy.MakePartition(ListOfShapes, ListOfTools, ListOfKeepInside,
ListOfRemoveInside, Limit, RemoveWebs, ListOfMaterials, ListOfRemoveInside, Limit, RemoveWebs, ListOfMaterials,
KeepNonlimitShapes)</em> KeepNonlimitShapes, fuzzyParam)</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, checkSelfInte)</em> ListOfMaterials, KeepNonlimitShapes, checkSelfInte, fuzzyParam)</em>
Here, Here,
- \em ListOfShapes is a list of shapes to be intersected - \em ListOfShapes is a list of shapes to be intersected
@ -91,6 +95,8 @@ Here,
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 indicates if the arguments should - \em checkSelfInte is a flag that indicates if the arguments should
be checked for self-intersection prior to the operation. be checked for self-intersection prior to the operation.
- \em fuzzyParam is the used fuzzy tolerance inside the partition algorithm.
This tolerance is ignored, if this parameter is omitted or not positive.
- 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.

View File

@ -1,6 +1,6 @@
/*! /*!
\page section_opeartion_page Intersection \page section_operation_page Intersection
\b Intersection operation creates a vertex, an edge, a wire or a compound \b Intersection operation creates a vertex, an edge, a wire or a compound
of them representing the intersection of two shapes. of them representing the intersection of two shapes.
@ -13,6 +13,8 @@ In this dialog:
- Input or accept the default \b Name of the resulting shape. - Input or accept the default \b Name of the resulting shape.
- Click the arrow button and select in the Object Browser or in the Viewer the intersecting <b>Objects</b>. - Click the arrow button and select in the Object Browser or in the Viewer the intersecting <b>Objects</b>.
- Activate the corresponding check-box if you wish to <b> Detect Self-intersections</b>. If a self-intersection detected the operation fails. - Activate the corresponding check-box if you wish to <b> Detect Self-intersections</b>. If a self-intersection detected the operation fails.
- Activate the corresponding check-box if you wish to use a <b> fuzzy parameter </b>.
If activated, you can define the fuzzy tolerance in the <b> fuzzy parameter </b> input box.
- Activate \ref restore_presentation_parameters_page "Advanced options" if required. - Activate \ref restore_presentation_parameters_page "Advanced options" if required.
- Press "Apply" or "Apply & Close" button to get the result (VERTEX, EDGE, WIRE or COMPOUND). - Press "Apply" or "Apply & Close" button to get the result (VERTEX, EDGE, WIRE or COMPOUND).
@ -26,9 +28,9 @@ of the GUI module's documentation.
This operation can be performed using a <b>TUI Command:</b> This operation can be performed using a <b>TUI Command:</b>
<em>geompy.MakeSection(s1, s2, checkSelfInte)</em> <em>geompy.MakeSection(s1, s2, checkSelfInte, name, fuzzyParam)</em>
<b>Arguments:</b> Name + 2 shapes + an optional flag for self-intersection check. <b>Arguments:</b> 2 shapes + an optional flag for self-intersection check + an optional name + an optional fuzzy parameter.
<b>Example:</b> <b>Example:</b>

View File

@ -17,7 +17,7 @@ complex geometrical objects (2D & 3D elements):
of a list of objects into an independent object.</li> of a list of objects into an independent object.</li>
<li>\subpage cut_operation_page "Cut" - cuts one shape with <li>\subpage cut_operation_page "Cut" - cuts one shape with
a list of others. </li> a list of others. </li>
<li>\subpage section_opeartion_page "Intersection" - performs an intersection between two shapes.</li> <li>\subpage section_operation_page "Intersection" - performs an intersection between two shapes.</li>
</ul> </ul>
You can use advanced TUI commands performing these operations You can use advanced TUI commands performing these operations

View File

@ -3397,6 +3397,190 @@ module GEOM
*/ */
GEOM_Object MakeHalfPartition (in GEOM_Object theShape, GEOM_Object MakeHalfPartition (in GEOM_Object theShape,
in GEOM_Object thePlane); in GEOM_Object thePlane);
/*!
* [bos#40619] [CEA] Add Fuzzy parameter to partition and boolean operators
* New interface methods were added to support a fuzzy parameter in
* all boolean and partition operations:
* - MakeBooleanWithFuzzy
* - MakeFuseWithFuzzy
* - MakeFuseListWithFuzzy
* - MakeCommonListWithFuzzy
* - MakeCutListWithFuzzy
* - MakePartitionWithFuzzy
* - MakePartitionNonSelfIntersectedShapeWithFuzzy
* - MakeHalfPartitionWithFuzzy
*/
/*!
* \brief Perform one of boolean operations on two given shapes.
* \param theShape1 First argument for boolean operation.
* \param theShape2 Second argument for boolean operation.
* \param theOperation Indicates the operation to be done:
* 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
* \param IsCheckSelfInte If TRUE, perform check self intersection
* of arguments before an operation.
* \param theFuzzyParam The fuzzy tolerance to be used in the boolean
* algorithm, if the value is positive.
* \return New GEOM_Object, containing the result shape.
*/
GEOM_Object MakeBooleanWithFuzzy (in GEOM_Object theShape1,
in GEOM_Object theShape2,
in long theOperation,
in boolean IsCheckSelfInte,
in double theFuzzyParam);
/*!
* \brief Perform fusion boolean operation on two given shapes.
* \param theShape1 First argument for fuse operation.
* \param theShape2 Second argument for fuse operation.
* \param IsCheckSelfInte If TRUE, perform check self intersection
* of arguments before an operation.
* \param IsRmExtraEdges If TRUE, perform removal of extra edges
* during an operation.
* \param theFuzzyParam The fuzzy tolerance to be used in the boolean
* algorithm, if the value is positive.
* \return New GEOM_Object, containing the result shape.
*/
GEOM_Object MakeFuseWithFuzzy (in GEOM_Object theShape1,
in GEOM_Object theShape2,
in boolean IsCheckSelfInte,
in boolean IsRmExtraEdges,
in double theFuzzyParam);
/*!
* \brief Perform fusion boolean operation on list of objects.
* \param theShapes Shapes to be fused.
* \param IsCheckSelfInte If TRUE, perform check self intersection
* of arguments before an operation.
* \param IsRmExtraEdges If TRUE, perform removal of extra edges
* during an operation.
* \param theFuzzyParam The fuzzy tolerance to be used in the boolean
* algorithm, if the value is positive.
* \return New GEOM_Object, containing the result shape.
*/
GEOM_Object MakeFuseListWithFuzzy (in ListOfGO theShapes,
in boolean IsCheckSelfInte,
in boolean IsRmExtraEdges,
in double theFuzzyParam);
/*!
* \brief Perform common boolean operation on list of objects.
* \param theShapes Shapes for common operation.
* \param IsCheckSelfInte If TRUE, perform check self intersection
* of arguments before an operation.
* \param theFuzzyParam The fuzzy tolerance to be used in the boolean
* algorithm, if the value is positive.
* \return New GEOM_Object, containing the result shape.
*/
GEOM_Object MakeCommonListWithFuzzy (in ListOfGO theShapes,
in boolean IsCheckSelfInte,
in double theFuzzyParam);
/*!
* \brief Perform cutting of list of objects from theMainShape.
* \param theMainShape the object for cut operation.
* \param theShapes Shapes to be cut from theMainShape (tools).
* \param IsCheckSelfInte If TRUE, perform check self intersection
* of arguments before an operation.
* \param theFuzzyParam The fuzzy tolerance to be used in the boolean
* algorithm, if the value is positive.
* \return New GEOM_Object, containing the result shape.
*/
GEOM_Object MakeCutListWithFuzzy (in GEOM_Object theMainShape,
in ListOfGO theShapes,
in boolean IsCheckSelfInte,
in double theFuzzyParam);
/*!
* \brief Perform partition operation.
*
* \param theShapes Shapes to be intersected.
* \param theTools Shapes to intersect theShapes.
* \note Each compound from ListShapes and ListTools will be exploded in order
* to avoid possible intersection between shapes from this compound.
* \param theLimit Type of resulting shapes (corresponding to TopAbs_ShapeEnum).
* \param theKeepNonlimitShapes: if this parameter == 0, then only shapes of
* target type (equal to Limit) are kept in the result,
* else standalone shapes of lower dimension
* are kept also (if they exist).
* \param theFuzzyParam The fuzzy tolerance to be used in the partition
* algorithm, if the value is positive.
*
* After implementation new version of PartitionAlgo (October 2006)
* other parameters are ignored by current functionality. They are kept
* in this function only for supporting old versions.
* Ignored parameters:
* \param theKeepInside Shapes, outside which the results will be deleted.
* Each shape from theKeepInside must belong to theShapes also.
* \param theRemoveInside Shapes, inside which the results will be deleted.
* Each shape from theRemoveInside must belong to theShapes also.
* \param theRemoveWebs If TRUE, perform Glue 3D algorithm.
* \param theMaterials Material indices for each shape. Make sense, only if theRemoveWebs is TRUE.
*
* \return New GEOM_Object, containing the result shapes.
*/
GEOM_Object MakePartitionWithFuzzy (in ListOfGO theShapes,
in ListOfGO theTools,
in ListOfGO theKeepInside,
in ListOfGO theRemoveInside,
in short theLimit,
in boolean theRemoveWebs,
in ListOfLong theMaterials,
in short theKeepNonlimitShapes,
in double theFuzzyParam);
/*!
* \brief Perform partition operation.
*
* This method may be useful if it is needed to make a partition for
* a compound containing nonintersected shapes. Performance will be better
* since intersection between shapes from compound is not performed.
*
* 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.
* \param theFuzzyParam The fuzzy tolerance to be used in the partition
* algorithm, if the value is positive.
*
* \note Passed compounds (via ListShapes or via ListTools)
* have to consist of nonintersecting shapes.
*
* \return New GEOM_Object, containing the result shapes.
*/
GEOM_Object MakePartitionNonSelfIntersectedShapeWithFuzzy (in ListOfGO theShapes,
in ListOfGO theTools,
in ListOfGO theKeepInside,
in ListOfGO theRemoveInside,
in short theLimit,
in boolean theRemoveWebs,
in ListOfLong theMaterials,
in short theKeepNonlimitShapes,
in boolean IsCheckSelfInte,
in double theFuzzyParam);
/*!
* \brief Perform partition of the Shape with the Plane
* \param theShape Shape to be intersected.
* \param thePlane Tool shape, to intersect theShape.
* \param theFuzzyParam The fuzzy tolerance to be used in the partition
* algorithm, if the value is positive.
* \return New GEOM_Object, containing the result shape.
*
* \note This operation is a shortcut to the more general \ref MakePartition
* operation, where \a theShape specifies single "object" (shape being partitioned)
* and \a thePlane specifies single "tool" (intersector shape). Other parameters of
* \ref MakePartition operation have default values:
* - \a theLimit: GEOM::SHAPE (shape limit corresponds to the type of \a theShape)
* - \a theKeepNonlimitShapes: 0
* - \a theKeepInside, \a theRemoveInside, \a theRemoveWebs,
* \a theMaterials (obsolete parameters): empty
*
* \sa MakePartition, MakePartitionNonSelfIntersectedShape
*/
GEOM_Object MakeHalfPartitionWithFuzzy (in GEOM_Object theShape,
in GEOM_Object thePlane,
in double theFuzzyParam);
}; };
// # GEOM_ICurvesOperations: // # GEOM_ICurvesOperations:

View File

@ -41,6 +41,9 @@
// Comment next line to enable preview in BOP dialog box // Comment next line to enable preview in BOP dialog box
#define NO_PREVIEW #define NO_PREVIEW
#define DEFAULT_FUZZY_VALUE 1e-5
//================================================================================= //=================================================================================
// class : BooleanGUI_Dialog() // class : BooleanGUI_Dialog()
// purpose : Constructs a BooleanGUI_Dialog which is a child of 'parent', with the // purpose : Constructs a BooleanGUI_Dialog which is a child of 'parent', with the
@ -78,7 +81,7 @@ BooleanGUI_Dialog::BooleanGUI_Dialog (const int theOperation, GeometryGUI* theGe
image0 = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_SECTION"))); image0 = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_SECTION")));
aTitle = tr("GEOM_SECTION"); aTitle = tr("GEOM_SECTION");
aCaption = tr("GEOM_SECTION_TITLE"); aCaption = tr("GEOM_SECTION_TITLE");
setHelpFileName("section_opeartion_page.html"); setHelpFileName("section_operation_page.html");
break; break;
} }
QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
@ -130,9 +133,21 @@ BooleanGUI_Dialog::BooleanGUI_Dialog (const int theOperation, GeometryGUI* theGe
myGroup->TextLabel4->hide(); myGroup->TextLabel4->hide();
myGroup->SpinBox_DX->hide(); myGroup->SpinBox_DX->hide();
myGroup->SpinBox_DY->hide(); myGroup->SpinBox_DY->hide();
myGroup->CheckBox3->hide();
myGroup->CheckBox1->setText(tr("GEOM_CHECK_SELF_INTERSECTIONS")); myGroup->CheckBox1->setText(tr("GEOM_CHECK_SELF_INTERSECTIONS"));
// Add all "fuzzy parameter" related widgets
myGroup->CheckBox3->setText(tr("GEOM_USE_FUZZY_PARAMETER"));
myFuzzyLbl = new QLabel(myGroup->GroupBox1);
myFuzzyLbl->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
myFuzzyLbl->setText(tr("GEOM_FUZZY_PARAMETER"));
myGroup->gridLayout1->addWidget(myFuzzyLbl, 7, 0, 1, 2);
myFuzzyEdt = new SalomeApp_DoubleSpinBox(myGroup->GroupBox1);
initSpinBox( myFuzzyEdt, 1.e-7, 10.0, DEFAULT_FUZZY_VALUE, "length_tol_precision" );
myFuzzyEdt->setValue(DEFAULT_FUZZY_VALUE);
myGroup->gridLayout1->addWidget(myFuzzyEdt, 7, 2);
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);
@ -173,6 +188,11 @@ void BooleanGUI_Dialog::Init()
myGroup->CheckBox2->setChecked(true); myGroup->CheckBox2->setChecked(true);
} }
// Do not use Fuzzy parameter by default
myGroup->CheckBox3->setChecked(false);
myFuzzyLbl->setEnabled(false);
myFuzzyEdt->setEnabled(false);
myObject1.nullify(); myObject1.nullify();
reset(); reset();
@ -186,6 +206,10 @@ void BooleanGUI_Dialog::Init()
connect(myGroup->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(myGroup->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
} }
if (!myGroup->CheckBox3->isHidden()) {
connect(myGroup->CheckBox3, SIGNAL(stateChanged(int)), this, SLOT(UseFuzzyChanged(int)));
}
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()), Qt::UniqueConnection); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()), Qt::UniqueConnection);
@ -314,6 +338,21 @@ void BooleanGUI_Dialog::SelectionIntoArgument()
processPreview(); processPreview();
} }
//=================================================================================
// function : UseFuzzyChanged()
// purpose : This slot is called whenever the status of CheckButton3 has changed
//=================================================================================
void BooleanGUI_Dialog::UseFuzzyChanged(int state)
{
QCheckBox* send = (QCheckBox*)sender();
if (send == myGroup->CheckBox3) {
bool isChecked = (state != Qt::Unchecked);
myFuzzyLbl->setEnabled(isChecked);
myFuzzyEdt->setEnabled(isChecked);
}
}
//================================================================================= //=================================================================================
// function : SetEditCurrentArgument() // function : SetEditCurrentArgument()
// purpose : // purpose :
@ -417,6 +456,8 @@ bool BooleanGUI_Dialog::execute (ObjectList& objects)
GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation()); GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation());
const bool isCheckSelfInte = myGroup->CheckBox1->isChecked(); const bool isCheckSelfInte = myGroup->CheckBox1->isChecked();
const bool useFuzzyParam = myGroup->CheckBox3->isChecked();
const double fuzzyValue = (useFuzzyParam ? myFuzzyEdt->value() : -1);
GEOM::ListOfGO_var anObjects = new GEOM::ListOfGO(); GEOM::ListOfGO_var anObjects = new GEOM::ListOfGO();
anObjects->length( myObjects.count() ); anObjects->length( myObjects.count() );
@ -427,24 +468,20 @@ bool BooleanGUI_Dialog::execute (ObjectList& objects)
case BooleanGUI::FUSE: case BooleanGUI::FUSE:
{ {
const bool isRmExtraEdges = myGroup->CheckBox2->isChecked(); const bool isRmExtraEdges = myGroup->CheckBox2->isChecked();
anObj = anOper->MakeFuseListWithFuzzy(anObjects, isCheckSelfInte, isRmExtraEdges, fuzzyValue);
anObj = anOper->MakeFuseList
(anObjects, isCheckSelfInte, isRmExtraEdges);
} }
break; break;
case BooleanGUI::COMMON: case BooleanGUI::COMMON:
anObj = anOper->MakeCommonList(anObjects, isCheckSelfInte); anObj = anOper->MakeCommonListWithFuzzy(anObjects, isCheckSelfInte, fuzzyValue);
break; break;
case BooleanGUI::CUT: case BooleanGUI::CUT:
anObj = anObj = anOper->MakeCutListWithFuzzy(myObject1.get(), anObjects, isCheckSelfInte, fuzzyValue);
anOper->MakeCutList(myObject1.get(), anObjects, isCheckSelfInte); break;
break; case BooleanGUI::SECTION:
case BooleanGUI::SECTION: anObj = anOper->MakeBooleanWithFuzzy(myObject1.get(), anObjects[0], myOperation, isCheckSelfInte, fuzzyValue);
anObj = anOper->MakeBoolean break;
(myObject1.get(), anObjects[0], myOperation, isCheckSelfInte); default:
break; break;
default:
break;
} }
if (!anObj->_is_nil()) if (!anObj->_is_nil())

View File

@ -31,6 +31,8 @@
#include "GEOM_GenericObjPtr.h" #include "GEOM_GenericObjPtr.h"
class DlgRef_2Sel2Spin3Check; class DlgRef_2Sel2Spin3Check;
class QLabel;
class SalomeApp_DoubleSpinBox;
//================================================================================= //=================================================================================
// class : BooleanGUI_Dialog // class : BooleanGUI_Dialog
@ -68,10 +70,13 @@ private:
QList<GEOM::GeomObjPtr> myObjects; QList<GEOM::GeomObjPtr> myObjects;
DlgRef_2Sel2Spin3Check* myGroup; DlgRef_2Sel2Spin3Check* myGroup;
QLabel* myFuzzyLbl;
SalomeApp_DoubleSpinBox* myFuzzyEdt;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
bool ClickOnApply(); bool ClickOnApply();
void UseFuzzyChanged(int state);
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void SelectionIntoArgument(); void SelectionIntoArgument();
void ActivateThisDialog(); void ActivateThisDialog();

View File

@ -36,7 +36,7 @@
<property name="title" > <property name="title" >
<string/> <string/>
</property> </property>
<layout class="QGridLayout" > <layout class="QGridLayout" name="gridLayout1" >
<property name="leftMargin" > <property name="leftMargin" >
<number>9</number> <number>9</number>
</property> </property>

View File

@ -427,6 +427,14 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_CHECK_SELF_INTERSECTIONS</source> <source>GEOM_CHECK_SELF_INTERSECTIONS</source>
<translation>Detect Self-intersections</translation> <translation>Detect Self-intersections</translation>
</message> </message>
<message>
<source>GEOM_USE_FUZZY_PARAMETER</source>
<translation>Use Fuzzy Parameter</translation>
</message>
<message>
<source>GEOM_FUZZY_PARAMETER</source>
<translation>Fuzzy Parameter</translation>
</message>
<message> <message>
<source>GEOM_FAST_CHECK_INTERSECTIONS</source> <source>GEOM_FAST_CHECK_INTERSECTIONS</source>
<translation>Fast intersection</translation> <translation>Fast intersection</translation>

View File

@ -427,6 +427,14 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
<source>GEOM_CHECK_SELF_INTERSECTIONS</source> <source>GEOM_CHECK_SELF_INTERSECTIONS</source>
<translation>Détecter les auto-intersections</translation> <translation>Détecter les auto-intersections</translation>
</message> </message>
<message>
<source>GEOM_USE_FUZZY_PARAMETER</source>
<translation>Utiliser le paramètre flou</translation>
</message>
<message>
<source>GEOM_FUZZY_PARAMETER</source>
<translation>Paramètre flou</translation>
</message>
<message> <message>
<source>GEOM_FAST_CHECK_INTERSECTIONS</source> <source>GEOM_FAST_CHECK_INTERSECTIONS</source>
<translation>Intersection rapide</translation> <translation>Intersection rapide</translation>

View File

@ -423,6 +423,14 @@
<source>GEOM_CHECK_SELF_INTERSECTIONS</source> <source>GEOM_CHECK_SELF_INTERSECTIONS</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<source>GEOM_USE_FUZZY_PARAMETER</source>
<translation>使</translation>
</message>
<message>
<source>GEOM_FUZZY_PARAMETER</source>
<translation></translation>
</message>
<message> <message>
<source>GEOM_FAST_CHECK_INTERSECTIONS</source> <source>GEOM_FAST_CHECK_INTERSECTIONS</source>
<translation></translation> <translation></translation>

View File

@ -123,6 +123,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(Handle(TFunction_Logbook)& log)
Standard_Integer aType = aFunction->GetType(); Standard_Integer aType = aFunction->GetType();
const Standard_Boolean isCheckSelfInte = aCI.GetCheckSelfIntersection(); const Standard_Boolean isCheckSelfInte = aCI.GetCheckSelfIntersection();
const Standard_Boolean isRmExtraEdges = aCI.GetRmExtraEdges(); const Standard_Boolean isRmExtraEdges = aCI.GetRmExtraEdges();
const Standard_Real aFuzzyParam = aCI.GetFuzzyParameter();
TopoDS_Shape aShape; TopoDS_Shape aShape;
@ -165,7 +166,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(Handle(TFunction_Logbook)& log)
TNaming_CopyShape::CopyTool(aShape1, aMapTShapes, aShapeCopy1); TNaming_CopyShape::CopyTool(aShape1, aMapTShapes, aShapeCopy1);
TNaming_CopyShape::CopyTool(aShape2, aMapTShapes, aShapeCopy2); TNaming_CopyShape::CopyTool(aShape2, aMapTShapes, aShapeCopy2);
aShape = performOperation (aShapeCopy1, aShapeCopy2, aType); aShape = performOperation (aShapeCopy1, aShapeCopy2, aType, aFuzzyParam);
if (isRmExtraEdges) { if (isRmExtraEdges) {
aShape = RemoveExtraEdges(aShape); aShape = RemoveExtraEdges(aShape);
@ -229,7 +230,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(Handle(TFunction_Logbook)& log)
aList2.Append(aShape2); aList2.Append(aShape2);
aCSI.SetArguments(aList2); aCSI.SetArguments(aList2);
aCSI.Perform(); aCSI.Perform();
if (aCSI.HasErrors() || aCSI.DS().Interferences().Extent() > 0) { if (aCSI.HasErrors() || 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");
} }
} }
@ -237,7 +238,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(Handle(TFunction_Logbook)& log)
// Copy shape // Copy shape
aShapeCopy.Nullify(); aShapeCopy.Nullify();
TNaming_CopyShape::CopyTool(aShape2, aMapTShapes, aShapeCopy); TNaming_CopyShape::CopyTool(aShape2, aMapTShapes, aShapeCopy);
aShape = performOperation (aShape, aShapeCopy, aSimpleType); aShape = performOperation (aShape, aShapeCopy, aSimpleType, aFuzzyParam);
if (isRmExtraEdges) { if (isRmExtraEdges) {
aShape = RemoveExtraEdges(aShape); aShape = RemoveExtraEdges(aShape);
@ -270,7 +271,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(Handle(TFunction_Logbook)& log)
aList1.Append(aShape); aList1.Append(aShape);
aCSI.SetArguments(aList1); aCSI.SetArguments(aList1);
aCSI.Perform(); aCSI.Perform();
if (aCSI.HasErrors() || aCSI.DS().Interferences().Extent() > 0) { if (aCSI.HasErrors() || 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");
} }
} }
@ -300,7 +301,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(Handle(TFunction_Logbook)& log)
aList2.Append(aTool); aList2.Append(aTool);
aCSI.SetArguments(aList2); aCSI.SetArguments(aList2);
aCSI.Perform(); aCSI.Perform();
if (aCSI.HasErrors() || aCSI.DS().Interferences().Extent() > 0) { if (aCSI.HasErrors() || 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");
} }
} }
@ -308,7 +309,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(Handle(TFunction_Logbook)& log)
// Copy shape // Copy shape
aShapeCopy.Nullify(); aShapeCopy.Nullify();
TNaming_CopyShape::CopyTool(aTool, aMapTShapes, aShapeCopy); TNaming_CopyShape::CopyTool(aTool, aMapTShapes, aShapeCopy);
aShape = performOperation (aShape, aShapeCopy, BOOLEAN_CUT); aShape = performOperation (aShape, aShapeCopy, BOOLEAN_CUT, aFuzzyParam);
if (aShape.IsNull()) { if (aShape.IsNull()) {
return 0; return 0;
@ -391,7 +392,8 @@ TopoDS_Shape GEOMImpl_BooleanDriver::makeCompoundShellFromFaces
TopoDS_Shape GEOMImpl_BooleanDriver::performOperation TopoDS_Shape GEOMImpl_BooleanDriver::performOperation
(const TopoDS_Shape theShape1, (const TopoDS_Shape theShape1,
const TopoDS_Shape theShape2, const TopoDS_Shape theShape2,
const Standard_Integer theType)const const Standard_Integer theType,
const Standard_Real theFuzzyParam) const
{ {
TopoDS_Shape aShape; TopoDS_Shape aShape;
@ -414,7 +416,15 @@ TopoDS_Shape GEOMImpl_BooleanDriver::performOperation
TopTools_ListIteratorOfListOfShape itSub2 (listShape2); TopTools_ListIteratorOfListOfShape itSub2 (listShape2);
for (; itSub2.More(); itSub2.Next()) { for (; itSub2.More(); itSub2.Next()) {
TopoDS_Shape aValue2 = itSub2.Value(); TopoDS_Shape aValue2 = itSub2.Value();
BRepAlgoAPI_Common BO (aValue1, aValue2); BRepAlgoAPI_Common BO;
TopTools_ListOfShape aArgShapes, aToolShapes;
aArgShapes.Append(aValue1);
aToolShapes.Append(aValue2);
BO.SetArguments(aArgShapes);
BO.SetTools(aToolShapes);
if (theFuzzyParam > 0)
BO.SetFuzzyValue(theFuzzyParam);
BO.Build();
if (!BO.IsDone()) { if (!BO.IsDone()) {
StdFail_NotDone::Raise("Common operation can not be performed on the given shapes"); StdFail_NotDone::Raise("Common operation can not be performed on the given shapes");
} }
@ -475,7 +485,15 @@ TopoDS_Shape GEOMImpl_BooleanDriver::performOperation
TopTools_ListIteratorOfListOfShape itSub2 (listTools); TopTools_ListIteratorOfListOfShape itSub2 (listTools);
for (; itSub2.More(); itSub2.Next()) { for (; itSub2.More(); itSub2.Next()) {
TopoDS_Shape aTool = itSub2.Value(); TopoDS_Shape aTool = itSub2.Value();
BRepAlgoAPI_Cut BO (aCut, aTool); BRepAlgoAPI_Cut BO;
TopTools_ListOfShape aArgShapes, aToolShapes;
aArgShapes.Append(aCut);
aToolShapes.Append(aTool);
BO.SetArguments(aArgShapes);
BO.SetTools(aToolShapes);
if (theFuzzyParam > 0)
BO.SetFuzzyValue(theFuzzyParam);
BO.Build();
if (!BO.IsDone()) { if (!BO.IsDone()) {
StdFail_NotDone::Raise("Cut operation can not be performed on the given shapes"); StdFail_NotDone::Raise("Cut operation can not be performed on the given shapes");
} }
@ -537,7 +555,15 @@ TopoDS_Shape GEOMImpl_BooleanDriver::performOperation
} }
// Perform // Perform
BRepAlgoAPI_Fuse BO (theShape1, theShape2); BRepAlgoAPI_Fuse BO;
TopTools_ListOfShape aArgShapes, aToolShapes;
aArgShapes.Append(theShape1);
aToolShapes.Append(theShape2);
BO.SetArguments(aArgShapes);
BO.SetTools(aToolShapes);
if (theFuzzyParam > 0)
BO.SetFuzzyValue(theFuzzyParam);
BO.Build();
if (!BO.IsDone()) { if (!BO.IsDone()) {
StdFail_NotDone::Raise("Fuse operation can not be performed on the given shapes"); StdFail_NotDone::Raise("Fuse operation can not be performed on the given shapes");
} }
@ -566,6 +592,9 @@ TopoDS_Shape GEOMImpl_BooleanDriver::performOperation
for (; itSub2.More(); itSub2.Next()) { for (; itSub2.More(); itSub2.Next()) {
TopoDS_Shape aValue2 = itSub2.Value(); TopoDS_Shape aValue2 = itSub2.Value();
BRepAlgoAPI_Section BO (aValue1, aValue2, Standard_False); BRepAlgoAPI_Section BO (aValue1, aValue2, Standard_False);
// Set the fuzzy parameter, if it is valid (negative value <=> do not use fuzzy tolerance)
if (theFuzzyParam > 0)
BO.SetFuzzyValue(theFuzzyParam);
// Set approximation to have an attached 3D BSpline geometry to each edge, // Set approximation to have an attached 3D BSpline geometry to each edge,
// where analytic curve is not possible. Without this flag in some cases // where analytic curve is not possible. Without this flag in some cases
// we obtain BSpline curve of degree 1 (C0), which is slowly // we obtain BSpline curve of degree 1 (C0), which is slowly
@ -652,6 +681,7 @@ GetCreationInformation(std::string& theOperationName,
GEOMImpl_IBoolean aCI (function); GEOMImpl_IBoolean aCI (function);
Standard_Integer aType = function->GetType(); Standard_Integer aType = function->GetType();
Standard_Boolean isCheckSelfInte = aCI.GetCheckSelfIntersection(); Standard_Boolean isCheckSelfInte = aCI.GetCheckSelfIntersection();
Standard_Real aFuzzyParam = aCI.GetFuzzyParameter();
switch ( aType ) { switch ( aType ) {
case BOOLEAN_COMMON: case BOOLEAN_COMMON:
@ -700,6 +730,9 @@ GetCreationInformation(std::string& theOperationName,
return false; return false;
} }
if (aFuzzyParam > 0)
AddParam( theParams, "Fuzzy Parameter", aFuzzyParam );
return true; return true;
} }

View File

@ -50,7 +50,8 @@ private:
TopoDS_Shape performOperation(const TopoDS_Shape theShape1, TopoDS_Shape performOperation(const TopoDS_Shape theShape1,
const TopoDS_Shape theShape2, const TopoDS_Shape theShape2,
const Standard_Integer theType) const; const Standard_Integer theType,
const Standard_Real theFuzzyParam) const;
TopoDS_Shape makeCompoundShellFromFaces(const TopoDS_Shape theShape) const; TopoDS_Shape makeCompoundShellFromFaces(const TopoDS_Shape theShape) const;

View File

@ -30,6 +30,7 @@
#define BOOL_ARG_SHAPES 3 #define BOOL_ARG_SHAPES 3
#define BOOL_ARG_CHECK_SELF_INTERSECTION 4 #define BOOL_ARG_CHECK_SELF_INTERSECTION 4
#define BOOL_ARG_RM_EXTRA_EDGES 5 #define BOOL_ARG_RM_EXTRA_EDGES 5
#define BOOL_ARG_FUZZY_PARAMETER 6
class GEOMImpl_IBoolean class GEOMImpl_IBoolean
{ {
@ -45,6 +46,8 @@ class GEOMImpl_IBoolean
{ _func->SetInteger(BOOL_ARG_CHECK_SELF_INTERSECTION, theFlag ? 1 : 0); } { _func->SetInteger(BOOL_ARG_CHECK_SELF_INTERSECTION, theFlag ? 1 : 0); }
void SetRmExtraEdges (Standard_Boolean theFlag) void SetRmExtraEdges (Standard_Boolean theFlag)
{ _func->SetInteger(BOOL_ARG_RM_EXTRA_EDGES, theFlag ? 1 : 0); } { _func->SetInteger(BOOL_ARG_RM_EXTRA_EDGES, theFlag ? 1 : 0); }
void SetFuzzyParameter (Standard_Real theValue)
{ _func->SetReal(BOOL_ARG_FUZZY_PARAMETER, theValue); }
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); }
@ -54,6 +57,8 @@ class GEOMImpl_IBoolean
{ return (_func->GetInteger(BOOL_ARG_CHECK_SELF_INTERSECTION) != 0); } { return (_func->GetInteger(BOOL_ARG_CHECK_SELF_INTERSECTION) != 0); }
Standard_Boolean GetRmExtraEdges() Standard_Boolean GetRmExtraEdges()
{ return (_func->GetInteger(BOOL_ARG_RM_EXTRA_EDGES) != 0); } { return (_func->GetInteger(BOOL_ARG_RM_EXTRA_EDGES) != 0); }
Standard_Real GetFuzzyParameter()
{ return _func->GetReal(BOOL_ARG_FUZZY_PARAMETER); }
private: private:

View File

@ -73,7 +73,8 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeBoolean
(Handle(GEOM_Object) theShape1, (Handle(GEOM_Object) theShape1,
Handle(GEOM_Object) theShape2, Handle(GEOM_Object) theShape2,
const Standard_Integer theOp, const Standard_Integer theOp,
const Standard_Boolean IsCheckSelfInte) const Standard_Boolean IsCheckSelfInte,
const Standard_Real theFuzzyParam)
{ {
SetErrorCode(KO); SetErrorCode(KO);
@ -109,6 +110,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeBoolean
aCI.SetShape1(aRef1); aCI.SetShape1(aRef1);
aCI.SetShape2(aRef2); aCI.SetShape2(aRef2);
aCI.SetCheckSelfIntersection(IsCheckSelfInte); aCI.SetCheckSelfIntersection(IsCheckSelfInte);
aCI.SetFuzzyParameter(theFuzzyParam);
//Compute the Boolean value //Compute the Boolean value
try { try {
@ -137,6 +139,11 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeBoolean
pd << ", True"; pd << ", True";
} }
if (theFuzzyParam > 0) {
// Use named argument for the fuzzy parameter
pd << ", theFuzzyParam=" << theFuzzyParam;
}
pd << ")"; pd << ")";
SetErrorCode(OK); SetErrorCode(OK);
@ -152,7 +159,8 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuse
(Handle(GEOM_Object) theShape1, (Handle(GEOM_Object) theShape1,
Handle(GEOM_Object) theShape2, Handle(GEOM_Object) theShape2,
const bool IsCheckSelfInte, const bool IsCheckSelfInte,
const bool IsRmExtraEdges) const bool IsRmExtraEdges,
const Standard_Real theFuzzyParam)
{ {
SetErrorCode(KO); SetErrorCode(KO);
@ -181,6 +189,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuse
aCI.SetShape2(aRef2); aCI.SetShape2(aRef2);
aCI.SetCheckSelfIntersection(IsCheckSelfInte); aCI.SetCheckSelfIntersection(IsCheckSelfInte);
aCI.SetRmExtraEdges(IsRmExtraEdges); aCI.SetRmExtraEdges(IsRmExtraEdges);
aCI.SetFuzzyParameter(theFuzzyParam);
//Compute the Boolean value //Compute the Boolean value
try { try {
@ -200,7 +209,12 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuse
pd << aBool << " = geompy.MakeFuse("; pd << aBool << " = geompy.MakeFuse(";
pd << theShape1 << ", " << theShape2 << ", " pd << theShape1 << ", " << theShape2 << ", "
<< IsCheckSelfInte << ", " << IsRmExtraEdges << ")"; << IsCheckSelfInte << ", " << IsRmExtraEdges;
if (theFuzzyParam > 0) {
// Use named argument for the fuzzy parameter
pd << ", theFuzzyParam=" << theFuzzyParam;
}
pd << ")";
SetErrorCode(OK); SetErrorCode(OK);
return aBool; return aBool;
@ -214,7 +228,8 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuse
Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuseList Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuseList
(const Handle(TColStd_HSequenceOfTransient)& theShapes, (const Handle(TColStd_HSequenceOfTransient)& theShapes,
const bool IsCheckSelfInte, const bool IsCheckSelfInte,
const bool IsRmExtraEdges) const bool IsRmExtraEdges,
const Standard_Real theFuzzyParam)
{ {
SetErrorCode(KO); SetErrorCode(KO);
@ -243,6 +258,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuseList
aCI.SetShapes(aShapesSeq); aCI.SetShapes(aShapesSeq);
aCI.SetCheckSelfIntersection(IsCheckSelfInte); aCI.SetCheckSelfIntersection(IsCheckSelfInte);
aCI.SetRmExtraEdges(IsRmExtraEdges); aCI.SetRmExtraEdges(IsRmExtraEdges);
aCI.SetFuzzyParameter(theFuzzyParam);
//Compute the Boolean value //Compute the Boolean value
try { try {
@ -261,7 +277,12 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuseList
GEOM::TPythonDump pd (aFunction); GEOM::TPythonDump pd (aFunction);
pd << aBool << " = geompy.MakeFuseList([" << aDescription.ToCString() << "], " pd << aBool << " = geompy.MakeFuseList([" << aDescription.ToCString() << "], "
<< IsCheckSelfInte << ", " << IsRmExtraEdges << ")"; << IsCheckSelfInte << ", " << IsRmExtraEdges;
if (theFuzzyParam > 0) {
// Use named argument for the fuzzy parameter
pd << ", theFuzzyParam=" << theFuzzyParam;
}
pd << ")";
SetErrorCode(OK); SetErrorCode(OK);
return aBool; return aBool;
@ -274,7 +295,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) const Standard_Boolean IsCheckSelfInte,
const Standard_Real theFuzzyParam)
{ {
SetErrorCode(KO); SetErrorCode(KO);
@ -302,6 +324,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeCommonList
aCI.SetShapes(aShapesSeq); aCI.SetShapes(aShapesSeq);
aCI.SetCheckSelfIntersection(IsCheckSelfInte); aCI.SetCheckSelfIntersection(IsCheckSelfInte);
aCI.SetFuzzyParameter(theFuzzyParam);
//Compute the Boolean value //Compute the Boolean value
try { try {
@ -325,7 +348,10 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeCommonList
if (IsCheckSelfInte) { if (IsCheckSelfInte) {
pd << ", True"; pd << ", True";
} }
if (theFuzzyParam > 0) {
// Use named argument for the fuzzy parameter
pd << ", theFuzzyParam=" << theFuzzyParam;
}
pd << ")"; pd << ")";
SetErrorCode(OK); SetErrorCode(OK);
@ -340,7 +366,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) const Standard_Boolean IsCheckSelfInte,
const Standard_Real theFuzzyParam)
{ {
SetErrorCode(KO); SetErrorCode(KO);
@ -372,6 +399,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeCutList
aCI.SetShape1(aMainRef); aCI.SetShape1(aMainRef);
aCI.SetShapes(aShapesSeq); aCI.SetShapes(aShapesSeq);
aCI.SetCheckSelfIntersection(IsCheckSelfInte); aCI.SetCheckSelfIntersection(IsCheckSelfInte);
aCI.SetFuzzyParameter(theFuzzyParam);
//Compute the Boolean value //Compute the Boolean value
try { try {
@ -396,6 +424,11 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeCutList
pd << ", True"; pd << ", True";
} }
if (theFuzzyParam > 0) {
// Use named argument for the fuzzy parameter
pd << ", theFuzzyParam=" << theFuzzyParam;
}
pd << ")"; pd << ")";
SetErrorCode(OK); SetErrorCode(OK);
@ -417,7 +450,8 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition
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) const Standard_Boolean IsCheckSelfInte,
const Standard_Real theFuzzyParam)
{ {
SetErrorCode(KO); SetErrorCode(KO);
@ -497,6 +531,9 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition
} }
} }
// Fuzzy parameter
aCI.SetFuzzyParameter(theFuzzyParam);
//Compute the Partition //Compute the Partition
try { try {
OCC_CATCH_SIGNALS; OCC_CATCH_SIGNALS;
@ -537,6 +574,11 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition
if (IsCheckSelfInte && !thePerformSelfIntersections) { if (IsCheckSelfInte && !thePerformSelfIntersections) {
pd << ", True"; pd << ", True";
} }
if (theFuzzyParam > 0) {
// Use named argument for the fuzzy parameter
pd << ", theFuzzyParam=" << theFuzzyParam;
}
pd << ")"; pd << ")";
@ -550,7 +592,9 @@ 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_Real theFuzzyParam)
{ {
SetErrorCode(KO); SetErrorCode(KO);
@ -576,6 +620,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeHalfPartition
aCI.SetShape(aRef1); aCI.SetShape(aRef1);
aCI.SetPlane(aRef2); aCI.SetPlane(aRef2);
aCI.SetFuzzyParameter(theFuzzyParam);
//Compute the Partition value //Compute the Partition value
try { try {
@ -593,7 +638,12 @@ 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 (theFuzzyParam > 0) {
// Use named argument for the fuzzy parameter
pd << ", theFuzzyParam=" << theFuzzyParam;
}
pd << ")";
SetErrorCode(OK); SetErrorCode(OK);
return aPart; return aPart;

View File

@ -40,27 +40,32 @@ class GEOMImpl_IBooleanOperations : public GEOM_IOperations {
(Handle(GEOM_Object) theShape1, (Handle(GEOM_Object) theShape1,
Handle(GEOM_Object) theShape2, Handle(GEOM_Object) theShape2,
const Standard_Integer theOp, const Standard_Integer theOp,
const Standard_Boolean IsCheckSelfInte); const Standard_Boolean IsCheckSelfInte,
const Standard_Real theFuzzyParam = -1.);
Standard_EXPORT Handle(GEOM_Object) MakeFuse Standard_EXPORT Handle(GEOM_Object) MakeFuse
(Handle(GEOM_Object) theShape1, (Handle(GEOM_Object) theShape1,
Handle(GEOM_Object) theShape2, Handle(GEOM_Object) theShape2,
const bool IsCheckSelfInte, const bool IsCheckSelfInte,
const bool IsRmExtraEdges); const bool IsRmExtraEdges,
const Standard_Real theFuzzyParam = -1.);
Standard_EXPORT Handle(GEOM_Object) MakeFuseList Standard_EXPORT Handle(GEOM_Object) MakeFuseList
(const Handle(TColStd_HSequenceOfTransient)& theShapes, (const Handle(TColStd_HSequenceOfTransient)& theShapes,
const bool IsCheckSelfInte, const bool IsCheckSelfInte,
const bool IsRmExtraEdges); const bool IsRmExtraEdges,
const Standard_Real theFuzzyParam = -1.);
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); const Standard_Boolean IsCheckSelfInte,
const Standard_Real theFuzzyParam = -1.);
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); const Standard_Boolean IsCheckSelfInte,
const Standard_Real theFuzzyParam = -1.);
Standard_EXPORT Handle(GEOM_Object) MakePartition Standard_EXPORT Handle(GEOM_Object) MakePartition
(const Handle(TColStd_HSequenceOfTransient)& theShapes, (const Handle(TColStd_HSequenceOfTransient)& theShapes,
@ -70,12 +75,14 @@ class GEOMImpl_IBooleanOperations : public GEOM_IOperations {
const Standard_Integer theLimit, const Standard_Integer theLimit,
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); const Standard_Boolean IsCheckSelfInte,
const Standard_Real theFuzzyParam = -1.);
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_Real theFuzzyParam = -1.);
private: private:

View File

@ -40,6 +40,7 @@
#define PART_ARG_KEEP_NONLIMIT_SHAPES 9 #define PART_ARG_KEEP_NONLIMIT_SHAPES 9
#define PART_ARG_CHECK_SELF_INTERSECTION 10 #define PART_ARG_CHECK_SELF_INTERSECTION 10
#define PART_ARG_FUZZY_PARAMETER 11
class GEOMImpl_IPartition class GEOMImpl_IPartition
{ {
@ -70,6 +71,9 @@ class GEOMImpl_IPartition
void SetCheckSelfIntersection (Standard_Boolean theFlag) void SetCheckSelfIntersection (Standard_Boolean theFlag)
{ _func->SetInteger(PART_ARG_CHECK_SELF_INTERSECTION, theFlag ? 1 : 0); } { _func->SetInteger(PART_ARG_CHECK_SELF_INTERSECTION, theFlag ? 1 : 0); }
void SetFuzzyParameter (Standard_Real theValue)
{ _func->SetReal(PART_ARG_FUZZY_PARAMETER, theValue); }
int GetLimit() { return _func->GetInteger(PART_ARG_LIMIT); } int GetLimit() { return _func->GetInteger(PART_ARG_LIMIT); }
int GetKeepNonlimitShapes() { return _func->GetInteger(PART_ARG_KEEP_NONLIMIT_SHAPES); } int GetKeepNonlimitShapes() { return _func->GetInteger(PART_ARG_KEEP_NONLIMIT_SHAPES); }
@ -91,6 +95,9 @@ class GEOMImpl_IPartition
Standard_Boolean GetCheckSelfIntersection() Standard_Boolean GetCheckSelfIntersection()
{ return (_func->GetInteger(PART_ARG_CHECK_SELF_INTERSECTION) != 0); } { return (_func->GetInteger(PART_ARG_CHECK_SELF_INTERSECTION) != 0); }
Standard_Real GetFuzzyParameter()
{ return _func->GetReal(PART_ARG_FUZZY_PARAMETER); }
private: private:
Handle(GEOM_Function) _func; Handle(GEOM_Function) _func;

View File

@ -125,6 +125,7 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(Handle(TFunction_Logbook)& lo
GEOMImpl_IPartition aCI (aFunction); GEOMImpl_IPartition aCI (aFunction);
Standard_Integer aType = aFunction->GetType(); Standard_Integer aType = aFunction->GetType();
const Standard_Boolean isCheckSelfInte = aCI.GetCheckSelfIntersection(); const Standard_Boolean isCheckSelfInte = aCI.GetCheckSelfIntersection();
const Standard_Real aFuzzyParam = aCI.GetFuzzyParameter();
TopoDS_Shape aShape; TopoDS_Shape aShape;
GEOMAlgo_Splitter PS; GEOMAlgo_Splitter PS;
@ -311,6 +312,10 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(Handle(TFunction_Logbook)& lo
PS.SetLimitMode(aCI.GetKeepNonlimitShapes()); PS.SetLimitMode(aCI.GetKeepNonlimitShapes());
PS.SetLimit((TopAbs_ShapeEnum)aCI.GetLimit()); PS.SetLimit((TopAbs_ShapeEnum)aCI.GetLimit());
if (aFuzzyParam > 0) {
PS.SetFuzzyValue(aFuzzyParam);
}
// Set parallel processing mode (default is false) // Set parallel processing mode (default is false)
Standard_Boolean bRunParallel = Standard_True; Standard_Boolean bRunParallel = Standard_True;
PS.SetRunParallel(bRunParallel); PS.SetRunParallel(bRunParallel);
@ -406,6 +411,10 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(Handle(TFunction_Logbook)& lo
PS.AddTool(aPlaneArg_copy); PS.AddTool(aPlaneArg_copy);
//PS.AddTool(aPlaneArg); //PS.AddTool(aPlaneArg);
if (aFuzzyParam > 0) {
PS.SetFuzzyValue(aFuzzyParam);
}
//skl PS.Compute(); //skl PS.Compute();
PS.Perform(); PS.Perform();
//PS.SetRemoveWebs(Standard_False); //PS.SetRemoveWebs(Standard_False);
@ -523,6 +532,7 @@ GetCreationInformation(std::string& theOperationName,
GEOMImpl_IPartition aCI( function ); GEOMImpl_IPartition aCI( function );
Standard_Integer aType = function->GetType(); Standard_Integer aType = function->GetType();
Standard_Real aFuzzyParam = aCI.GetFuzzyParameter();
theOperationName = "PARTITION"; theOperationName = "PARTITION";
@ -557,6 +567,9 @@ GetCreationInformation(std::string& theOperationName,
default: default:
return false; return false;
} }
if (aFuzzyParam > 0)
AddParam( theParams, "Fuzzy Parameter", aFuzzyParam );
return true; return true;
} }

View File

@ -66,6 +66,127 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeBoolean
GEOM::GEOM_Object_ptr theShape2, GEOM::GEOM_Object_ptr theShape2,
CORBA::Long theOp, CORBA::Long theOp,
CORBA::Boolean IsCheckSelfInte) CORBA::Boolean IsCheckSelfInte)
{
return MakeBooleanWithFuzzy(theShape1, theShape2, theOp, IsCheckSelfInte, -1.0);
}
//=============================================================================
/*!
* MakeFuse
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeFuse
(GEOM::GEOM_Object_ptr theShape1,
GEOM::GEOM_Object_ptr theShape2,
CORBA::Boolean IsCheckSelfInte,
CORBA::Boolean IsRmExtraEdges)
{
return MakeFuseWithFuzzy(theShape1, theShape2, IsCheckSelfInte, IsRmExtraEdges, -1.0);
}
//=============================================================================
/*!
* MakeFuseList
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeFuseList
(const GEOM::ListOfGO& theShapes,
CORBA::Boolean IsCheckSelfInte,
CORBA::Boolean IsRmExtraEdges)
{
return MakeFuseListWithFuzzy(theShapes, IsCheckSelfInte, IsRmExtraEdges, -1.0);
}
//=============================================================================
/*!
* MakeCommonList
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeCommonList
(const GEOM::ListOfGO& theShapes,
CORBA::Boolean IsCheckSelfInte)
{
return MakeCommonListWithFuzzy(theShapes, IsCheckSelfInte, -1.0);
}
//=============================================================================
/*!
* MakeCutList
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeCutList
(GEOM::GEOM_Object_ptr theMainShape,
const GEOM::ListOfGO& theShapes,
CORBA::Boolean IsCheckSelfInte)
{
return MakeCutListWithFuzzy(theMainShape, theShapes, IsCheckSelfInte, -1.0);
}
//=============================================================================
/*!
* MakePartition
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartition
(const GEOM::ListOfGO& theShapes,
const GEOM::ListOfGO& theTools,
const GEOM::ListOfGO& theKeepIns,
const GEOM::ListOfGO& theRemoveIns,
CORBA::Short theLimit,
CORBA::Boolean theRemoveWebs,
const GEOM::ListOfLong& theMaterials,
CORBA::Short theKeepNonlimitShapes)
{
return MakePartitionWithFuzzy(theShapes, theTools, theKeepIns, theRemoveIns, theLimit,
theRemoveWebs, theMaterials, theKeepNonlimitShapes, -1.0);
}
//=============================================================================
/*!
* MakePartitionNonSelfIntersectedShape
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartitionNonSelfIntersectedShape
(const GEOM::ListOfGO& theShapes,
const GEOM::ListOfGO& theTools,
const GEOM::ListOfGO& theKeepIns,
const GEOM::ListOfGO& theRemoveIns,
CORBA::Short theLimit,
CORBA::Boolean theRemoveWebs,
const GEOM::ListOfLong& theMaterials,
CORBA::Short theKeepNonlimitShapes,
CORBA::Boolean IsCheckSelfInte)
{
return MakePartitionNonSelfIntersectedShapeWithFuzzy(theShapes, theTools, theKeepIns, theRemoveIns,
theLimit, theRemoveWebs, theMaterials,
theKeepNonlimitShapes, IsCheckSelfInte, -1.0);
}
//=============================================================================
/*!
* MakeHalfPartition
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeHalfPartition
(GEOM::GEOM_Object_ptr theShape,
GEOM::GEOM_Object_ptr thePlane)
{
return MakeHalfPartitionWithFuzzy(theShape, thePlane, -1.0);
}
//=============================================================================
/*!
* MakeBooleanWithFuzzy
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeBooleanWithFuzzy
(GEOM::GEOM_Object_ptr theShape1,
GEOM::GEOM_Object_ptr theShape2,
CORBA::Long theOp,
CORBA::Boolean IsCheckSelfInte,
CORBA::Double theFuzzyParam)
{ {
GEOM::GEOM_Object_var aGEOMObject; GEOM::GEOM_Object_var aGEOMObject;
@ -80,7 +201,7 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeBoolean
// Make Boolean // Make Boolean
Handle(::GEOM_Object) anObject = Handle(::GEOM_Object) anObject =
GetOperations()->MakeBoolean(aSh1, aSh2, theOp, IsCheckSelfInte); GetOperations()->MakeBoolean(aSh1, aSh2, theOp, IsCheckSelfInte, theFuzzyParam);
if (!GetOperations()->IsDone() || anObject.IsNull()) if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();
@ -89,14 +210,15 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeBoolean
//============================================================================= //=============================================================================
/*! /*!
* MakeFuse * MakeFuseWithFuzzy
*/ */
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeFuse GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeFuseWithFuzzy
(GEOM::GEOM_Object_ptr theShape1, (GEOM::GEOM_Object_ptr theShape1,
GEOM::GEOM_Object_ptr theShape2, GEOM::GEOM_Object_ptr theShape2,
CORBA::Boolean IsCheckSelfInte, CORBA::Boolean IsCheckSelfInte,
CORBA::Boolean IsRmExtraEdges) CORBA::Boolean IsRmExtraEdges,
CORBA::Double theFuzzyParam)
{ {
GEOM::GEOM_Object_var aGEOMObject; GEOM::GEOM_Object_var aGEOMObject;
@ -111,7 +233,7 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeFuse
// Make Boolean // Make Boolean
Handle(::GEOM_Object) anObject = GetOperations()->MakeFuse Handle(::GEOM_Object) anObject = GetOperations()->MakeFuse
(aSh1, aSh2, IsCheckSelfInte, IsRmExtraEdges); (aSh1, aSh2, IsCheckSelfInte, IsRmExtraEdges, theFuzzyParam);
if (!GetOperations()->IsDone() || anObject.IsNull()) if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();
@ -121,13 +243,14 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeFuse
//============================================================================= //=============================================================================
/*! /*!
* MakeFuseList * MakeFuseListWithFuzzy
*/ */
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeFuseList GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeFuseListWithFuzzy
(const GEOM::ListOfGO& theShapes, (const GEOM::ListOfGO& theShapes,
CORBA::Boolean IsCheckSelfInte, CORBA::Boolean IsCheckSelfInte,
CORBA::Boolean IsRmExtraEdges) CORBA::Boolean IsRmExtraEdges,
CORBA::Double theFuzzyParam)
{ {
GEOM::GEOM_Object_var aGEOMObject; GEOM::GEOM_Object_var aGEOMObject;
@ -143,7 +266,7 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeFuseList
// Make fusion // Make fusion
Handle(::GEOM_Object) anObject = Handle(::GEOM_Object) anObject =
GetOperations()->MakeFuseList(aShapes, IsCheckSelfInte, IsRmExtraEdges); GetOperations()->MakeFuseList(aShapes, IsCheckSelfInte, IsRmExtraEdges, theFuzzyParam);
if (!GetOperations()->IsDone() || anObject.IsNull()) if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();
@ -153,12 +276,13 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeFuseList
//============================================================================= //=============================================================================
/*! /*!
* MakeCommonList * MakeCommonListWithFuzzy
*/ */
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeCommonList GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeCommonListWithFuzzy
(const GEOM::ListOfGO& theShapes, (const GEOM::ListOfGO& theShapes,
CORBA::Boolean IsCheckSelfInte) CORBA::Boolean IsCheckSelfInte,
CORBA::Double theFuzzyParam)
{ {
GEOM::GEOM_Object_var aGEOMObject; GEOM::GEOM_Object_var aGEOMObject;
@ -174,7 +298,7 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeCommonList
// Make fusion // Make fusion
Handle(::GEOM_Object) anObject = Handle(::GEOM_Object) anObject =
GetOperations()->MakeCommonList(aShapes, IsCheckSelfInte); GetOperations()->MakeCommonList(aShapes, IsCheckSelfInte, theFuzzyParam);
if (!GetOperations()->IsDone() || anObject.IsNull()) if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();
@ -184,13 +308,14 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeCommonList
//============================================================================= //=============================================================================
/*! /*!
* MakeCutList * MakeCutListWithFuzzy
*/ */
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeCutList GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeCutListWithFuzzy
(GEOM::GEOM_Object_ptr theMainShape, (GEOM::GEOM_Object_ptr theMainShape,
const GEOM::ListOfGO& theShapes, const GEOM::ListOfGO& theShapes,
CORBA::Boolean IsCheckSelfInte) CORBA::Boolean IsCheckSelfInte,
CORBA::Double theFuzzyParam)
{ {
GEOM::GEOM_Object_var aGEOMObject; GEOM::GEOM_Object_var aGEOMObject;
@ -212,7 +337,7 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeCutList
// Make fusion // Make fusion
Handle(::GEOM_Object) anObject = Handle(::GEOM_Object) anObject =
GetOperations()->MakeCutList(aMainShape, aShapes, IsCheckSelfInte); GetOperations()->MakeCutList(aMainShape, aShapes, IsCheckSelfInte, theFuzzyParam);
if (!GetOperations()->IsDone() || anObject.IsNull()) if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();
@ -222,10 +347,10 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeCutList
//============================================================================= //=============================================================================
/*! /*!
* MakePartition * MakePartitionWithFuzzy
*/ */
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartition GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartitionWithFuzzy
(const GEOM::ListOfGO& theShapes, (const GEOM::ListOfGO& theShapes,
const GEOM::ListOfGO& theTools, const GEOM::ListOfGO& theTools,
const GEOM::ListOfGO& theKeepIns, const GEOM::ListOfGO& theKeepIns,
@ -233,7 +358,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::Double theFuzzyParam)
{ {
GEOM::GEOM_Object_var aGEOMObject; GEOM::GEOM_Object_var aGEOMObject;
@ -267,7 +393,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartition
theLimit, theRemoveWebs, aMaterials, theLimit, theRemoveWebs, aMaterials,
theKeepNonlimitShapes, theKeepNonlimitShapes,
/*PerformSelfIntersections*/Standard_True, /*PerformSelfIntersections*/Standard_True,
/*IsCheckSelfInte*/Standard_False); /*IsCheckSelfInte*/Standard_False,
theFuzzyParam);
if (!GetOperations()->IsDone() || anObject.IsNull()) if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();
@ -276,10 +403,10 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartition
//============================================================================= //=============================================================================
/*! /*!
* MakePartitionNonSelfIntersectedShape * MakePartitionNonSelfIntersectedShapeWithFuzzy
*/ */
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartitionNonSelfIntersectedShape GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartitionNonSelfIntersectedShapeWithFuzzy
(const GEOM::ListOfGO& theShapes, (const GEOM::ListOfGO& theShapes,
const GEOM::ListOfGO& theTools, const GEOM::ListOfGO& theTools,
const GEOM::ListOfGO& theKeepIns, const GEOM::ListOfGO& theKeepIns,
@ -288,7 +415,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartitionNonSelfIntersected
CORBA::Boolean theRemoveWebs, CORBA::Boolean theRemoveWebs,
const GEOM::ListOfLong& theMaterials, const GEOM::ListOfLong& theMaterials,
CORBA::Short theKeepNonlimitShapes, CORBA::Short theKeepNonlimitShapes,
CORBA::Boolean IsCheckSelfInte) CORBA::Boolean IsCheckSelfInte,
CORBA::Double theFuzzyParam)
{ {
GEOM::GEOM_Object_var aGEOMObject; GEOM::GEOM_Object_var aGEOMObject;
@ -322,7 +450,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartitionNonSelfIntersected
theLimit, theRemoveWebs, aMaterials, theLimit, theRemoveWebs, aMaterials,
theKeepNonlimitShapes, theKeepNonlimitShapes,
/*PerformSelfIntersections*/Standard_False, /*PerformSelfIntersections*/Standard_False,
IsCheckSelfInte); IsCheckSelfInte,
theFuzzyParam);
if (!GetOperations()->IsDone() || anObject.IsNull()) if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();
@ -331,12 +460,13 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartitionNonSelfIntersected
//============================================================================= //=============================================================================
/*! /*!
* MakeHalfPartition * MakeHalfPartitionWithFuzzy
*/ */
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeHalfPartition GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeHalfPartitionWithFuzzy
(GEOM::GEOM_Object_ptr theShape, (GEOM::GEOM_Object_ptr theShape,
GEOM::GEOM_Object_ptr thePlane) GEOM::GEOM_Object_ptr thePlane,
CORBA::Double theFuzzyParam)
{ {
GEOM::GEOM_Object_var aGEOMObject; GEOM::GEOM_Object_var aGEOMObject;
@ -351,7 +481,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); GetOperations()->MakeHalfPartition(aSh, aPl, theFuzzyParam);
if (!GetOperations()->IsDone() || anObject.IsNull()) if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();

View File

@ -43,12 +43,12 @@ class GEOM_I_EXPORT GEOM_IBooleanOperations_i :
~GEOM_IBooleanOperations_i(); ~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); 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, CORBA::Boolean IsCheckSelfInte,
CORBA::Boolean IsRmExtraEdges); CORBA::Boolean IsRmExtraEdges);
@ -64,27 +64,79 @@ class GEOM_I_EXPORT GEOM_IBooleanOperations_i :
CORBA::Boolean IsCheckSelfInte); 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,
const GEOM::ListOfGO& theKeepInside, const GEOM::ListOfGO& theKeepInside,
const GEOM::ListOfGO& theRemoveInside, const GEOM::ListOfGO& theRemoveInside,
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);
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,
const GEOM::ListOfGO& theKeepInside, const GEOM::ListOfGO& theKeepInside,
const GEOM::ListOfGO& theRemoveInside, const GEOM::ListOfGO& theRemoveInside,
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); 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);
// New interface methods with "Fuzzy parameter" support
GEOM::GEOM_Object_ptr MakeBooleanWithFuzzy (GEOM::GEOM_Object_ptr theShape1,
GEOM::GEOM_Object_ptr theShape2,
CORBA::Long theOp,
CORBA::Boolean IsCheckSelfInte,
CORBA::Double theFuzzyParam);
GEOM::GEOM_Object_ptr MakeFuseWithFuzzy (GEOM::GEOM_Object_ptr theShape1,
GEOM::GEOM_Object_ptr theShape2,
CORBA::Boolean IsCheckSelfInte,
CORBA::Boolean IsRmExtraEdges,
CORBA::Double theFuzzyParam);
GEOM::GEOM_Object_ptr MakeFuseListWithFuzzy (const GEOM::ListOfGO& theShapes,
CORBA::Boolean IsCheckSelfInte,
CORBA::Boolean IsRmExtraEdges,
CORBA::Double theFuzzyParam);
GEOM::GEOM_Object_ptr MakeCommonListWithFuzzy (const GEOM::ListOfGO& theShapes,
CORBA::Boolean IsCheckSelfInte,
CORBA::Double theFuzzyParam);
GEOM::GEOM_Object_ptr MakeCutListWithFuzzy (GEOM::GEOM_Object_ptr theMainShape,
const GEOM::ListOfGO& theShapes,
CORBA::Boolean IsCheckSelfInte,
CORBA::Double theFuzzyParam);
GEOM::GEOM_Object_ptr MakePartitionWithFuzzy (const GEOM::ListOfGO& theShapes,
const GEOM::ListOfGO& theTools,
const GEOM::ListOfGO& theKeepInside,
const GEOM::ListOfGO& theRemoveInside,
CORBA::Short theLimit,
CORBA::Boolean theRemoveWebs,
const GEOM::ListOfLong& theMaterials,
CORBA::Short theKeepNonlimitShapes,
CORBA::Double theFuzzyParam);
GEOM::GEOM_Object_ptr MakePartitionNonSelfIntersectedShapeWithFuzzy (const GEOM::ListOfGO& theShapes,
const GEOM::ListOfGO& theTools,
const GEOM::ListOfGO& theKeepInside,
const GEOM::ListOfGO& theRemoveInside,
CORBA::Short theLimit,
CORBA::Boolean theRemoveWebs,
const GEOM::ListOfLong& theMaterials,
CORBA::Short theKeepNonlimitShapes,
CORBA::Boolean IsCheckSelfInte,
CORBA::Double theFuzzyParam);
GEOM::GEOM_Object_ptr MakeHalfPartitionWithFuzzy (GEOM::GEOM_Object_ptr theShape,
GEOM::GEOM_Object_ptr thePlane,
CORBA::Double theFuzzyParam);
::GEOMImpl_IBooleanOperations* GetOperations() ::GEOMImpl_IBooleanOperations* GetOperations()
{ return (::GEOMImpl_IBooleanOperations*)GetImpl(); } { return (::GEOMImpl_IBooleanOperations*)GetImpl(); }

View File

@ -7762,6 +7762,9 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
# @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.
# @param theFuzzyParam The fuzzy parameter to be used for the boolean
# operation. If the value is not positive, no fuzzy tolerance will
# be considered for the boolean operation.
# #
# @note This algorithm doesn't find all types of self-intersections. # @note This algorithm doesn't find all types of self-intersections.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge, # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
@ -7775,7 +7778,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
# #
# @ref tui_fuse "Example" # @ref tui_fuse "Example"
@ManageTransactions("BoolOp") @ManageTransactions("BoolOp")
def MakeBoolean(self, theShape1, theShape2, theOperation, checkSelfInte=False, theName=None): def MakeBoolean(self, theShape1, theShape2, theOperation, checkSelfInte=False, theName=None, theFuzzyParam=-1):
""" """
Perform one of boolean operations on two given shapes. Perform one of boolean operations on two given shapes.
@ -7790,6 +7793,9 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
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.
theFuzzyParam The fuzzy parameter to be used for the boolean operation.
If the value is not positive, no fuzzy tolerance will be
considered for the boolean operation.
Note: Note:
This algorithm doesn't find all types of self-intersections. This algorithm doesn't find all types of self-intersections.
@ -7804,7 +7810,7 @@ class geomBuilder(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, checkSelfInte) anObj = self.BoolOp.MakeBooleanWithFuzzy(theShape1, theShape2, theOperation, checkSelfInte, theFuzzyParam)
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])
@ -7818,6 +7824,9 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
# @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.
# @param theFuzzyParam The fuzzy parameter to be used for the boolean
# operation. If the value is not positive, no fuzzy tolerance will
# be considered for the boolean operation.
# #
# @note This algorithm doesn't find all types of self-intersections. # @note This algorithm doesn't find all types of self-intersections.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge, # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
@ -7831,7 +7840,7 @@ class geomBuilder(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, checkSelfInte=False, theName=None): def MakeCommon(self, theShape1, theShape2, checkSelfInte=False, theName=None, theFuzzyParam=-1):
""" """
Perform Common boolean operation on two given shapes. Perform Common boolean operation on two given shapes.
@ -7844,6 +7853,9 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
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.
theFuzzyParam The fuzzy parameter to be used for the boolean operation.
If the value is not positive, no fuzzy tolerance will be
considered for the boolean operation.
Note: Note:
This algorithm doesn't find all types of self-intersections. This algorithm doesn't find all types of self-intersections.
@ -7859,7 +7871,7 @@ class geomBuilder(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, checkSelfInte, theName) return self.MakeBoolean(theShape1, theShape2, 1, checkSelfInte, theName, theFuzzyParam)
## 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.
@ -7869,6 +7881,9 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
# @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.
# @param theFuzzyParam The fuzzy parameter to be used for the boolean
# operation. If the value is not positive, no fuzzy tolerance will
# be considered for the boolean operation.
# #
# @note This algorithm doesn't find all types of self-intersections. # @note This algorithm doesn't find all types of self-intersections.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge, # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
@ -7882,7 +7897,7 @@ class geomBuilder(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, checkSelfInte=False, theName=None): def MakeCut(self, theShape1, theShape2, checkSelfInte=False, theName=None, theFuzzyParam=-1):
""" """
Perform Cut boolean operation on two given shapes. Perform Cut boolean operation on two given shapes.
@ -7895,6 +7910,9 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
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.
theFuzzyParam The fuzzy parameter to be used for the boolean operation.
If the value is not positive, no fuzzy tolerance will be
considered for the boolean operation.
Note: Note:
This algorithm doesn't find all types of self-intersections. This algorithm doesn't find all types of self-intersections.
@ -7911,7 +7929,7 @@ class geomBuilder(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, checkSelfInte, theName) return self.MakeBoolean(theShape1, theShape2, 2, checkSelfInte, theName, theFuzzyParam)
## 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.
@ -7923,6 +7941,9 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
# @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.
# @param theFuzzyParam The fuzzy parameter to be used for the boolean
# operation. If the value is not positive, no fuzzy tolerance will
# be considered for the boolean operation.
# #
# @note This algorithm doesn't find all types of self-intersections. # @note This algorithm doesn't find all types of self-intersections.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge, # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
@ -7938,7 +7959,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
# \n @ref swig_MakeCommon "Example 2" # \n @ref swig_MakeCommon "Example 2"
@ManageTransactions("BoolOp") @ManageTransactions("BoolOp")
def MakeFuse(self, theShape1, theShape2, checkSelfInte=False, def MakeFuse(self, theShape1, theShape2, checkSelfInte=False,
rmExtraEdges=False, theName=None): rmExtraEdges=False, theName=None, theFuzzyParam=-1):
""" """
Perform Fuse boolean operation on two given shapes. Perform Fuse boolean operation on two given shapes.
@ -7953,6 +7974,9 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
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.
theFuzzyParam The fuzzy parameter to be used for the boolean operation.
If the value is not positive, no fuzzy tolerance will be
considered for the boolean operation.
Note: Note:
This algorithm doesn't find all types of self-intersections. This algorithm doesn't find all types of self-intersections.
@ -7968,8 +7992,8 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
""" """
# Example: see GEOM_TestOthers.py # Example: see GEOM_TestOthers.py
anObj = self.BoolOp.MakeFuse(theShape1, theShape2, anObj = self.BoolOp.MakeFuseWithFuzzy(theShape1, theShape2, checkSelfInte,
checkSelfInte, rmExtraEdges) rmExtraEdges, theFuzzyParam)
RaiseIfFailed("MakeFuse", self.BoolOp) RaiseIfFailed("MakeFuse", self.BoolOp)
self._autoPublish(anObj, theName, "fuse") self._autoPublish(anObj, theName, "fuse")
return anObj return anObj
@ -7983,11 +8007,14 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
# @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.
# @param theFuzzyParam The fuzzy parameter to be used for the boolean
# operation. If the value is not positive, no fuzzy tolerance will
# be considered for the boolean operation.
# @return New GEOM.GEOM_Object, containing the result shape. # @return New GEOM.GEOM_Object, containing the result shape.
# #
# @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, checkSelfInte=False, theName=None): def MakeSection(self, theShape1, theShape2, checkSelfInte=False, theName=None, theFuzzyParam=-1):
""" """
Perform Section boolean operation on two given shapes. Perform Section boolean operation on two given shapes.
@ -8000,13 +8027,16 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
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.
theFuzzyParam The fuzzy parameter to be used for the boolean operation.
If the value is not positive, no fuzzy tolerance will be
considered for the boolean operation.
Returns: Returns:
New GEOM.GEOM_Object, containing the result shape. New GEOM.GEOM_Object, containing the result shape.
""" """
# 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, checkSelfInte, theName) return self.MakeBoolean(theShape1, theShape2, 4, checkSelfInte, theName, theFuzzyParam)
## 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.
@ -8017,6 +8047,9 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
# @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.
# @param theFuzzyParam The fuzzy parameter to be used for the boolean
# operation. If the value is not positive, no fuzzy tolerance will
# be considered for the boolean operation.
# #
# @note This algorithm doesn't find all types of self-intersections. # @note This algorithm doesn't find all types of self-intersections.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge, # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
@ -8032,7 +8065,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
# \n @ref swig_MakeCommon "Example 2" # \n @ref swig_MakeCommon "Example 2"
@ManageTransactions("BoolOp") @ManageTransactions("BoolOp")
def MakeFuseList(self, theShapesList, checkSelfInte=False, def MakeFuseList(self, theShapesList, checkSelfInte=False,
rmExtraEdges=False, theName=None): rmExtraEdges=False, theName=None, theFuzzyParam=-1):
""" """
Perform Fuse boolean operation on the list of shapes. Perform Fuse boolean operation on the list of shapes.
@ -8046,6 +8079,9 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
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.
theFuzzyParam The fuzzy parameter to be used for the boolean operation.
If the value is not positive, no fuzzy tolerance will be
considered for the boolean operation.
Note: Note:
This algorithm doesn't find all types of self-intersections. This algorithm doesn't find all types of self-intersections.
@ -8061,8 +8097,8 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
""" """
# Example: see GEOM_TestOthers.py # Example: see GEOM_TestOthers.py
anObj = self.BoolOp.MakeFuseList(theShapesList, checkSelfInte, anObj = self.BoolOp.MakeFuseListWithFuzzy(theShapesList, checkSelfInte,
rmExtraEdges) rmExtraEdges, theFuzzyParam)
RaiseIfFailed("MakeFuseList", self.BoolOp) RaiseIfFailed("MakeFuseList", self.BoolOp)
self._autoPublish(anObj, theName, "fuse") self._autoPublish(anObj, theName, "fuse")
return anObj return anObj
@ -8074,6 +8110,9 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
# @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.
# @param theFuzzyParam The fuzzy parameter to be used for the boolean
# operation. If the value is not positive, no fuzzy tolerance will
# be considered for the boolean operation.
# #
# @note This algorithm doesn't find all types of self-intersections. # @note This algorithm doesn't find all types of self-intersections.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge, # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
@ -8088,7 +8127,7 @@ class geomBuilder(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"
@ManageTransactions("BoolOp") @ManageTransactions("BoolOp")
def MakeCommonList(self, theShapesList, checkSelfInte=False, theName=None): def MakeCommonList(self, theShapesList, checkSelfInte=False, theName=None, theFuzzyParam=-1):
""" """
Perform Common boolean operation on the list of shapes. Perform Common boolean operation on the list of shapes.
@ -8100,6 +8139,9 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
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.
theFuzzyParam The fuzzy parameter to be used for the boolean operation.
If the value is not positive, no fuzzy tolerance will be
considered for the boolean operation.
Note: Note:
This algorithm doesn't find all types of self-intersections. This algorithm doesn't find all types of self-intersections.
@ -8115,7 +8157,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
""" """
# Example: see GEOM_TestOthers.py # Example: see GEOM_TestOthers.py
anObj = self.BoolOp.MakeCommonList(theShapesList, checkSelfInte) anObj = self.BoolOp.MakeCommonListWithFuzzy(theShapesList, checkSelfInte, theFuzzyParam)
RaiseIfFailed("MakeCommonList", self.BoolOp) RaiseIfFailed("MakeCommonList", self.BoolOp)
self._autoPublish(anObj, theName, "common") self._autoPublish(anObj, theName, "common")
return anObj return anObj
@ -8128,6 +8170,9 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
# @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.
# @param theFuzzyParam The fuzzy parameter to be used for the boolean
# operation. If the value is not positive, no fuzzy tolerance will
# be considered for the boolean operation.
# #
# @note This algorithm doesn't find all types of self-intersections. # @note This algorithm doesn't find all types of self-intersections.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge, # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
@ -8142,7 +8187,7 @@ class geomBuilder(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"
@ManageTransactions("BoolOp") @ManageTransactions("BoolOp")
def MakeCutList(self, theMainShape, theShapesList, checkSelfInte=False, theName=None): def MakeCutList(self, theMainShape, theShapesList, checkSelfInte=False, theName=None, theFuzzyParam=-1):
""" """
Perform Cut boolean operation on one object and the list of tools. Perform Cut boolean operation on one object and the list of tools.
@ -8155,6 +8200,9 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
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.
theFuzzyParam The fuzzy parameter to be used for the boolean operation.
If the value is not positive, no fuzzy tolerance will be
considered for the boolean operation.
Note: Note:
This algorithm doesn't find all types of self-intersections. This algorithm doesn't find all types of self-intersections.
@ -8170,7 +8218,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
""" """
# Example: see GEOM_TestOthers.py # Example: see GEOM_TestOthers.py
anObj = self.BoolOp.MakeCutList(theMainShape, theShapesList, checkSelfInte) anObj = self.BoolOp.MakeCutListWithFuzzy(theMainShape, theShapesList, checkSelfInte, theFuzzyParam)
RaiseIfFailed("MakeCutList", self.BoolOp) RaiseIfFailed("MakeCutList", self.BoolOp)
self._autoPublish(anObj, theName, "cut") self._autoPublish(anObj, theName, "cut")
return anObj return anObj
@ -8191,10 +8239,12 @@ class geomBuilder(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 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.
# @param theFuzzyParam The fuzzy parameter to be used for the partition
# operation. If the value is not positive, no fuzzy tolerance will
# be considered for the partition operation.
# #
# @note Each compound from ListShapes and ListTools will be exploded # @note Each compound from ListShapes and ListTools will be exploded
# in order to avoid possible intersection between shapes from this compound. # in order to avoid possible intersection between shapes from this compound.
@ -8216,7 +8266,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
@ManageTransactions("BoolOp") @ManageTransactions("BoolOp")
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, theName=None, theFuzzyParam=-1):
""" """
Perform partition operation. Perform partition operation.
@ -8261,10 +8311,10 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
for s in ListShapes: lim = min(lim, s.GetMaxShapeType()) for s in ListShapes: lim = min(lim, s.GetMaxShapeType())
Limit = EnumToLong(lim) Limit = EnumToLong(lim)
pass pass
anObj = self.BoolOp.MakePartition(ListShapes, ListTools, anObj = self.BoolOp.MakePartitionWithFuzzy(ListShapes, ListTools,
ListKeepInside, ListRemoveInside, ListKeepInside, ListRemoveInside,
Limit, RemoveWebs, ListMaterials, Limit, RemoveWebs, ListMaterials,
KeepNonlimitShapes); KeepNonlimitShapes, theFuzzyParam)
RaiseIfFailed("MakePartition", self.BoolOp) RaiseIfFailed("MakePartition", self.BoolOp)
self._autoPublish(anObj, theName, "partition") self._autoPublish(anObj, theName, "partition")
return anObj return anObj
@ -8278,6 +8328,9 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
# One additional parameter is provided: # One additional parameter is provided:
# @param checkSelfInte The flag that tells if the arguments should # @param checkSelfInte The flag that tells if the arguments should
# be checked for self-intersection prior to the operation. # be checked for self-intersection prior to the operation.
# @param theFuzzyParam The fuzzy parameter to be used for the partition
# operation. If the value is not positive, no fuzzy tolerance will
# be considered for the partition operation.
# #
# @note This algorithm doesn't find all types of self-intersections. # @note This algorithm doesn't find all types of self-intersections.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge, # It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
@ -8298,7 +8351,8 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
ListKeepInside=[], ListRemoveInside=[], ListKeepInside=[], ListRemoveInside=[],
Limit=ShapeType["AUTO"], RemoveWebs=0, Limit=ShapeType["AUTO"], RemoveWebs=0,
ListMaterials=[], KeepNonlimitShapes=0, ListMaterials=[], KeepNonlimitShapes=0,
checkSelfInte=False, theName=None): checkSelfInte=False, theName=None,
theFuzzyParam=-1):
""" """
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
@ -8334,10 +8388,11 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
for s in ListShapes: lim = min(lim, s.GetMaxShapeType()) for s in ListShapes: lim = min(lim, s.GetMaxShapeType())
Limit = EnumToLong(lim) Limit = EnumToLong(lim)
pass pass
anObj = self.BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools, anObj = self.BoolOp.MakePartitionNonSelfIntersectedShapeWithFuzzy(ListShapes, ListTools,
ListKeepInside, ListRemoveInside, ListKeepInside, ListRemoveInside,
Limit, RemoveWebs, ListMaterials, Limit, RemoveWebs, ListMaterials,
KeepNonlimitShapes, checkSelfInte); KeepNonlimitShapes, checkSelfInte,
theFuzzyParam)
RaiseIfFailed("MakePartitionNonSelfIntersectedShape", self.BoolOp) RaiseIfFailed("MakePartitionNonSelfIntersectedShape", self.BoolOp)
self._autoPublish(anObj, theName, "partition") self._autoPublish(anObj, theName, "partition")
return anObj return anObj
@ -8348,7 +8403,7 @@ class geomBuilder(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, theName=None, theFuzzyParam=-1):
""" """
See method geompy.MakePartition for more information. See method geompy.MakePartition for more information.
""" """
@ -8357,7 +8412,7 @@ class geomBuilder(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, theName, theFuzzyParam)
return anObj return anObj
## Perform partition of the Shape with the Plane ## Perform partition of the Shape with the Plane
@ -8366,6 +8421,9 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
# @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.
# @param theFuzzyParam The fuzzy parameter to be used for the partition
# operation. If the value is not positive, no fuzzy tolerance will
# be considered for the partition operation.
# #
# @return New GEOM.GEOM_Object, containing the result shape. # @return New GEOM.GEOM_Object, containing the result shape.
# #
@ -8388,7 +8446,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
# #
# @ref tui_partition "Example" # @ref tui_partition "Example"
@ManageTransactions("BoolOp") @ManageTransactions("BoolOp")
def MakeHalfPartition(self, theShape, thePlane, theName=None): def MakeHalfPartition(self, theShape, thePlane, theName=None, theFuzzyParam=-1):
""" """
Perform partition of the Shape with the Plane Perform partition of the Shape with the Plane
@ -8415,7 +8473,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
Result = geompy.MakePartition([Object], [Plane]) Result = geompy.MakePartition([Object], [Plane])
""" """
# Example: see GEOM_TestAll.py # Example: see GEOM_TestAll.py
anObj = self.BoolOp.MakeHalfPartition(theShape, thePlane) anObj = self.BoolOp.MakeHalfPartitionWithFuzzy(theShape, thePlane, theFuzzyParam)
RaiseIfFailed("MakeHalfPartition", self.BoolOp) RaiseIfFailed("MakeHalfPartition", self.BoolOp)
self._autoPublish(anObj, theName, "partition") self._autoPublish(anObj, theName, "partition")
return anObj return anObj

View File

@ -46,6 +46,9 @@
// Comment next line to enable preview in Partition dialog box // Comment next line to enable preview in Partition dialog box
#define NO_PREVIEW #define NO_PREVIEW
#define DEFAULT_FUZZY_VALUE 1e-5
//================================================================================= //=================================================================================
// class : OperationGUI_PartitionDlg() // class : OperationGUI_PartitionDlg()
// purpose : Constructs a OperationGUI_PartitionDlg which is a child of 'parent', with the // purpose : Constructs a OperationGUI_PartitionDlg which is a child of 'parent', with the
@ -91,6 +94,21 @@ OperationGUI_PartitionDlg::OperationGUI_PartitionDlg( GeometryGUI* theGeometryGU
mySelfInte->setText(tr("GEOM_CHECK_SELF_INTERSECTIONS")); mySelfInte->setText(tr("GEOM_CHECK_SELF_INTERSECTIONS"));
GroupPoints->gridLayout1->addWidget(mySelfInte, 5, 0, 1, 3); GroupPoints->gridLayout1->addWidget(mySelfInte, 5, 0, 1, 3);
// Add all "fuzzy parameter" related widgets
myFuzzyChk = new QCheckBox(GroupPoints->GroupBox1);
myFuzzyChk->setText(tr("GEOM_USE_FUZZY_PARAMETER"));
GroupPoints->gridLayout1->addWidget(myFuzzyChk, 6, 0, 1, 3);
myFuzzyLbl = new QLabel(GroupPoints->GroupBox1);
myFuzzyLbl->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
myFuzzyLbl->setText(tr("GEOM_FUZZY_PARAMETER"));
GroupPoints->gridLayout1->addWidget(myFuzzyLbl, 7, 0, 1, 2);
myFuzzyEdt = new SalomeApp_DoubleSpinBox(GroupPoints->GroupBox1);
initSpinBox( myFuzzyEdt, 1.e-7, 10.0, DEFAULT_FUZZY_VALUE, "length_tol_precision" );
myFuzzyEdt->setValue(DEFAULT_FUZZY_VALUE);
GroupPoints->gridLayout1->addWidget(myFuzzyEdt, 7, 2);
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 );
@ -148,6 +166,11 @@ void OperationGUI_PartitionDlg::Init()
GroupPoints->CheckButton1->setChecked( false ); GroupPoints->CheckButton1->setChecked( false );
mySelfInte->setChecked(false); mySelfInte->setChecked(false);
// Do not use Fuzzy parameter by default
myFuzzyChk->setChecked(false);
myFuzzyLbl->setEnabled(false);
myFuzzyEdt->setEnabled(false);
mainFrame()->GroupBoxPublish->show(); mainFrame()->GroupBoxPublish->show();
/* signals and slots connections */ /* signals and slots connections */
@ -172,6 +195,8 @@ void OperationGUI_PartitionDlg::Init()
connect( GroupPoints->CheckButton2, SIGNAL(toggled(bool)), mySelfInte, SLOT(setEnabled(bool)) ); 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()) );
connect( myFuzzyChk, SIGNAL(stateChanged(int)), this, SLOT(UseFuzzyChanged(int)));
mySelfInte->setEnabled(GroupPoints->CheckButton2->isChecked()); mySelfInte->setEnabled(GroupPoints->CheckButton2->isChecked());
initName( tr( "GEOM_PARTITION" ) ); initName( tr( "GEOM_PARTITION" ) );
@ -189,12 +214,6 @@ void OperationGUI_PartitionDlg::ConstructorsClicked( int constructorId )
disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 ); disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
globalSelection(); globalSelection();
//myListShapes.length( 0 );
//myListTools.length( 0 );
//myListKeepInside.length( 0 ); // obsolete
//myListRemoveInside.length( 0 ); // obsolete
//myListMaterials.length( 0 ); // obsolete
switch ( constructorId ) { switch ( constructorId ) {
case 0: /*Full partition */ case 0: /*Full partition */
GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION" ) ); GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION" ) );
@ -268,6 +287,22 @@ bool OperationGUI_PartitionDlg::ClickOnApply()
} }
//=================================================================================
// function : UseFuzzyChanged()
// purpose : This slot is called whenever the status of CheckButton3 has changed
//=================================================================================
void OperationGUI_PartitionDlg::UseFuzzyChanged(int state)
{
QCheckBox* send = (QCheckBox*)sender();
if (send == myFuzzyChk) {
bool isChecked = (state != Qt::Unchecked);
myFuzzyLbl->setEnabled(isChecked);
myFuzzyEdt->setEnabled(isChecked);
}
}
//================================================================================= //=================================================================================
// function : SelectionIntoArgument() // function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case // purpose : Called when selection as changed or other case
@ -455,6 +490,9 @@ bool OperationGUI_PartitionDlg::execute (ObjectList& objects)
GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation()); GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation());
bool useFuzzyParam = myFuzzyChk->isChecked();
double aFuzzyParam = (useFuzzyParam ? myFuzzyEdt->value() : -1.0);
switch ( getConstructorId() ) { switch ( getConstructorId() ) {
case 0: case 0:
{ {
@ -464,19 +502,19 @@ bool OperationGUI_PartitionDlg::execute (ObjectList& objects)
bool aNoSelfIntersection = GroupPoints->CheckButton2->isChecked(); bool aNoSelfIntersection = GroupPoints->CheckButton2->isChecked();
anObj = aNoSelfIntersection ? anObj = aNoSelfIntersection ?
anOper->MakePartitionNonSelfIntersectedShape(myListShapes, myListTools, anOper->MakePartitionNonSelfIntersectedShapeWithFuzzy(myListShapes, myListTools,
myListKeepInside, myListRemoveInside, myListKeepInside, myListRemoveInside,
aLimit, false, myListMaterials, aKeepNonlimitShapes, aLimit, false, myListMaterials, aKeepNonlimitShapes,
isDetectSelfInte) : isDetectSelfInte, aFuzzyParam) :
anOper->MakePartition(myListShapes, myListTools, anOper->MakePartitionWithFuzzy(myListShapes, myListTools,
myListKeepInside, myListRemoveInside, myListKeepInside, myListRemoveInside,
aLimit, false, myListMaterials, aKeepNonlimitShapes); aLimit, false, myListMaterials, aKeepNonlimitShapes, aFuzzyParam);
res = true; res = true;
} }
break; break;
case 1: case 1:
{ {
anObj = anOper->MakeHalfPartition(myListShapes[0].in(), myListTools[0].in()); anObj = anOper->MakeHalfPartitionWithFuzzy(myListShapes[0].in(), myListTools[0].in(), aFuzzyParam);
res = true; res = true;
} }
break; break;
@ -522,13 +560,6 @@ void OperationGUI_PartitionDlg::restoreSubShapes( SALOMEDS::SObject_ptr theSObje
//======================================================================= //=======================================================================
void OperationGUI_PartitionDlg::ComboTextChanged() void OperationGUI_PartitionDlg::ComboTextChanged()
{ {
//bool IsEnabled = GroupPoints->ComboBox1->currentItem() < 3;
//GroupPoints->LineEdit3->setEnabled(IsEnabled);
//GroupPoints->LineEdit4->setEnabled(IsEnabled);
//GroupPoints->TextLabel4->setEnabled(IsEnabled);
//GroupPoints->TextLabel5->setEnabled(IsEnabled);
//GroupPoints->PushButton3->setEnabled(IsEnabled);
//GroupPoints->PushButton4->setEnabled(IsEnabled);
processPreview(); processPreview();
} }

View File

@ -29,6 +29,8 @@
class DlgRef_2Sel1List2Check; class DlgRef_2Sel1List2Check;
class QCheckBox; class QCheckBox;
class QLabel;
class SalomeApp_DoubleSpinBox;
//================================================================================= //=================================================================================
// class : OperationGUI_PartitionDlg // class : OperationGUI_PartitionDlg
@ -66,11 +68,15 @@ private:
GEOM::ListOfGO myListKeepInside; GEOM::ListOfGO myListKeepInside;
DlgRef_2Sel1List2Check* GroupPoints; DlgRef_2Sel1List2Check* GroupPoints;
QCheckBox *mySelfInte; QCheckBox* mySelfInte;
QCheckBox* myFuzzyChk;
QLabel* myFuzzyLbl;
SalomeApp_DoubleSpinBox* myFuzzyEdt;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
bool ClickOnApply(); bool ClickOnApply();
void UseFuzzyChanged(int state);
void ActivateThisDialog(); void ActivateThisDialog();
void LineEditReturnPressed(); void LineEditReturnPressed();
void SelectionIntoArgument(); void SelectionIntoArgument();

146
test/test_boolean_fuzzy.py Normal file
View File

@ -0,0 +1,146 @@
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
import salome
###
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
import math
import SALOMEDS
geompy = geomBuilder.New()
import unittest
def HasSameSubShapes( shape, expected_info ):
"""
Compare topology information about shape with expected data
param shape - shape to be checked
param expected_info - expected WhatIsInformation for the shape
return True, if number of shapes are equal - False, otherwise
"""
name = shape.GetName()
if name:
name = '"%s"' % name
what_is = geompy.WhatIs( shape )
what_is_list = what_is.strip().split( "\n" )
# Remove flat content
if what_is_list.count( " Flat content : " ):
wIndex = what_is_list.index( " Flat content : " )
what_is_list = what_is_list[:( wIndex - len( what_is_list ) - 1 )]
got_info_dict = {}
for item in what_is_list:
pair = item.split( ":" )
if len(pair)==2:
type = item.split( ":" )[0].strip()
value = item.split( ":" )[1].strip()
if type.find( "Number of sub-shapes" ) == -1:
got_info_dict[type] = value
if len( expected_info ) > len( got_info_dict ):
print( "ERROR!!! Got topology information about shape %s isn't complete..." % name )
return False
for key in expected_info:
if key not in got_info_dict:
print( "ERROR!!! There is no information about number of " + key + "(s) in %s shape!!!" % name )
return False
elif str( expected_info[key] ).find( str( got_info_dict[key] )) == -1 or len( str( expected_info[key] )) != len( str( got_info_dict[key] )):
print( "ERROR!!! The number of " + key + "(s) is incorrect in %s shape!!! ( " % name + str( got_info_dict[key] ) + " instead of " + str( expected_info[key] ) + " )" )
return False
return True
class GEOMTestBooleanFuzzy(unittest.TestCase):
def testFuse(self):
Vertex_1 = geompy.MakeVertex(10, 0, 0)
Vertex_2 = geompy.MakeVertex(20, 10.0001, 10.0001)
Box_1 = geompy.MakeBoxDXDYDZ(10, 10, 10)
Box_2 = geompy.MakeBoxTwoPnt(Vertex_1, Vertex_2)
# Fuse without fuzzy parameter
Fuse_1 = geompy.MakeFuse(Box_1, Box_2, True, True)
WHAT_IS_1={"VERTEX":14, "EDGE":21, "WIRE":9, "FACE":9, "SHELL":1, "SOLID":1, "COMPSOLID":0, "COMPOUND":0, "SHAPE":55}
assert(HasSameSubShapes(Fuse_1, WHAT_IS_1))
# Fuse with fuzzy parameter
Fuse_2 = geompy.MakeFuse(Box_1, Box_2, True, True, None, 1.e-4)
WHAT_IS_2={"VERTEX":11, "EDGE":17, "WIRE":8, "FACE":8, "SHELL":1, "SOLID":1, "COMPSOLID":0, "COMPOUND":0, "SHAPE":46}
assert(HasSameSubShapes(Fuse_2, WHAT_IS_2))
def testCommon(self):
Vertex_1 = geompy.MakeVertex(0, 9.999995, 0)
Sphere_1 = geompy.MakeSphereR(5)
Sphere_2 = geompy.MakeSpherePntR(Vertex_1, 5)
# Common without fuzzy parameter
Common_1 = geompy.MakeCommon(Sphere_1, Sphere_2, True)
WHAT_IS_1={"VERTEX":1, "EDGE":1, "WIRE":2, "FACE":2, "SHELL":1, "SOLID":1, "COMPSOLID":0, "COMPOUND":0, "SHAPE":8}
assert(HasSameSubShapes(Common_1, WHAT_IS_1))
# Common with fuzzy parameter
Common_2 = geompy.MakeCommon(Sphere_1, Sphere_2, True, None, 1.e-5)
WHAT_IS_2={"VERTEX":0, "EDGE":0, "WIRE":0, "FACE":0, "SHELL":0, "SOLID":0, "COMPSOLID":0, "COMPOUND":1, "SHAPE":1}
assert(HasSameSubShapes(Common_2, WHAT_IS_2))
def testCut(self):
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
Vertex_1 = geompy.MakeVertex(5.e-5, 5, 5)
Box_1 = geompy.MakeBoxDXDYDZ(10, 10, 10)
Cylinder_1 = geompy.MakeCylinder(Vertex_1, OX, 6, 13)
# Cut with low fuzzy parameter
Cut_1 = geompy.MakeCut(Box_1, Cylinder_1, True, None, 1.e-5)
WHAT_IS_1={"VERTEX":24, "EDGE":36, "WIRE":14, "FACE":14, "SHELL":1, "SOLID":1, "COMPSOLID":0, "COMPOUND":0, "SHAPE":90}
assert(HasSameSubShapes(Cut_1, WHAT_IS_1))
# Cut with high fuzzy parameter
Cut_2 = geompy.MakeCut(Box_1, Cylinder_1, True, None, 5.e-5)
WHAT_IS_2={"VERTEX":24, "EDGE":36, "WIRE":20, "FACE":20, "SHELL":4, "SOLID":4, "COMPSOLID":0, "COMPOUND":1, "SHAPE":109}
assert(HasSameSubShapes(Cut_2, WHAT_IS_2))
def testBoolean(self):
Vertex_1 = geompy.MakeVertex(0, 9.999995, 0)
Sphere_1 = geompy.MakeSphereR(5)
Sphere_2 = geompy.MakeSpherePntR(Vertex_1, 5)
# Common without fuzzy parameter
Common_1 = geompy.MakeBoolean(Sphere_1, Sphere_2, 1, True)
WHAT_IS_1={"VERTEX":1, "EDGE":1, "WIRE":2, "FACE":2, "SHELL":1, "SOLID":1, "COMPSOLID":0, "COMPOUND":0, "SHAPE":8}
assert(HasSameSubShapes(Common_1, WHAT_IS_1))
# Common with fuzzy parameter
Common_2 = geompy.MakeBoolean(Sphere_1, Sphere_2, 1, True, None, 1.e-5)
WHAT_IS_2={"VERTEX":0, "EDGE":0, "WIRE":0, "FACE":0, "SHELL":0, "SOLID":0, "COMPSOLID":0, "COMPOUND":1, "SHAPE":1}
assert(HasSameSubShapes(Common_2, WHAT_IS_2))
def testPartition(self):
Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
Cylinder_1 = geompy.MakeCylinderRH(100, 300)
Box_2 = geompy.MakeBoxDXDYDZ(200, 200, 200)
Box_translated_slightly_inside = geompy.MakeTranslation(Box_2, 0, -199.9999, 0)
Box_translated_slightly_outside = geompy.MakeTranslation(Box_2, 0, -200.0001, 0)
Partitition_small_intersection = geompy.MakePartition([Box_1, Cylinder_1, Box_translated_slightly_inside])
WHAT_IS_1={"VERTEX":25, "EDGE":49, "WIRE":32, "FACE":32, "SHELL":7, "SOLID":7, "COMPSOLID":0, "COMPOUND":1, "SHAPE":153}
assert(HasSameSubShapes(Partitition_small_intersection, WHAT_IS_1))
Partitition_small_intersection_fixed_by_fuzzy = geompy.MakePartition([Box_1, Cylinder_1, Box_translated_slightly_inside], theFuzzyParam=0.0001)
WHAT_IS_2={"VERTEX":19, "EDGE":36, "WIRE":23, "FACE":23, "SHELL":5, "SOLID":5, "COMPSOLID":0, "COMPOUND":1, "SHAPE":112}
assert(HasSameSubShapes(Partitition_small_intersection_fixed_by_fuzzy, WHAT_IS_2))
Partitition_small_gap = geompy.MakePartition([Box_1, Cylinder_1, Box_translated_slightly_outside])
WHAT_IS_3={"VERTEX":25, "EDGE":44, "WIRE":25, "FACE":25, "SHELL":5, "SOLID":5, "COMPSOLID":0, "COMPOUND":1, "SHAPE":130}
assert(HasSameSubShapes(Partitition_small_gap, WHAT_IS_3))
Partitition_small_gap_fixed_by_fuzzy = geompy.MakePartition([Box_1, Cylinder_1, Box_translated_slightly_inside], theFuzzyParam=0.0001)
WHAT_IS_4={"VERTEX":19, "EDGE":36, "WIRE":23, "FACE":23, "SHELL":5, "SOLID":5, "COMPSOLID":0, "COMPOUND":1, "SHAPE":112}
assert(HasSameSubShapes(Partitition_small_gap_fixed_by_fuzzy, WHAT_IS_4))
if __name__ == '__main__':
unittest.main()

View File

@ -30,5 +30,6 @@ IF(${OpenCASCADE_VERSION}.${OpenCASCADE_SP_VERSION} VERSION_GREATER "7.5.3.3")
test_kind_of_shape.py test_kind_of_shape.py
test_proximity_edge_edge.py test_proximity_edge_edge.py
test_proximity_face_face.py test_proximity_face_face.py
test_boolean_fuzzy.py
) )
ENDIF() ENDIF()