- 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.
- 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.
- Press "Apply" or "Apply & Close" button to get the result (GEOM_Object).
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 :
-<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>
- 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.
- 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.
- Press "Apply" or "Apply & Close" button to get the result (GEOM_Object).
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) :
-<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>
- 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> 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.
- Press "Apply" or "Apply & Close" button to get the result (GEOM_Object).
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
-self-intersection check + an optional flag to remove extra edges.
+<b>Arguments:</b> a list of shapes + an optional flag for self-intersection
+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 :
-<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
-check + an optional flag to remove extra edges.
+<b>Arguments:</b> 2 shapes + an optional flag for self-intersection
+check + an optional flag to remove extra edges + an optional name + an optional fuzzy parameter.
<b>Example:</b>
all self-intersections please use \ref check_self_intersections_page
"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.
\note Partition is a complex operation, so its result of it depends
<em>geompy.MakePartition(ListOfShapes, ListOfTools, ListOfKeepInside,
ListOfRemoveInside, Limit, RemoveWebs, ListOfMaterials,
-KeepNonlimitShapes)</em>
+KeepNonlimitShapes, fuzzyParam)</em>
<b>TUI Command (without sub-shapes intersection):</b>
<em>geompy.MakePartitionNonSelfIntersectedShape(ListOfShapes,
ListOfTools, ListOfKeepInside, ListOfRemoveInside, Limit, RemoveWebs,
-ListOfMaterials, KeepNonlimitShapes, checkSelfInte)</em>
+ListOfMaterials, KeepNonlimitShapes, checkSelfInte, fuzzyParam)</em>
Here,
- \em ListOfShapes is a list of shapes to be intersected
shapes of low dimension (than \em Limit) in the result.
- \em checkSelfInte is a flag that indicates if the arguments should
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
previous versions of SALOME.
/*!
-\page section_opeartion_page Intersection
+\page section_operation_page Intersection
\b Intersection operation creates a vertex, an edge, a wire or a compound
of them representing the intersection of two shapes.
- 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>.
- 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.
- Press "Apply" or "Apply & Close" button to get the result (VERTEX, EDGE, WIRE or COMPOUND).
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>
of a list of objects into an independent object.</li>
<li>\subpage cut_operation_page "Cut" - cuts one shape with
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>
You can use advanced TUI commands performing these operations
*/
GEOM_Object MakeHalfPartition (in GEOM_Object theShape,
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:
// Comment next line to enable preview in BOP dialog box
#define NO_PREVIEW
+#define DEFAULT_FUZZY_VALUE 1e-5
+
+
//=================================================================================
// class : BooleanGUI_Dialog()
// purpose : Constructs a BooleanGUI_Dialog which is a child of 'parent', with the
image0 = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_SECTION")));
aTitle = tr("GEOM_SECTION");
aCaption = tr("GEOM_SECTION_TITLE");
- setHelpFileName("section_opeartion_page.html");
+ setHelpFileName("section_operation_page.html");
break;
}
QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
myGroup->TextLabel4->hide();
myGroup->SpinBox_DX->hide();
myGroup->SpinBox_DY->hide();
- myGroup->CheckBox3->hide();
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());
layout->setMargin(0); layout->setSpacing(6);
layout->addWidget(myGroup);
myGroup->CheckBox2->setChecked(true);
}
+ // Do not use Fuzzy parameter by default
+ myGroup->CheckBox3->setChecked(false);
+ myFuzzyLbl->setEnabled(false);
+ myFuzzyEdt->setEnabled(false);
+
myObject1.nullify();
reset();
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(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()), Qt::UniqueConnection);
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()
// purpose :
GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation());
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();
anObjects->length( myObjects.count() );
case BooleanGUI::FUSE:
{
const bool isRmExtraEdges = myGroup->CheckBox2->isChecked();
-
- anObj = anOper->MakeFuseList
- (anObjects, isCheckSelfInte, isRmExtraEdges);
+ anObj = anOper->MakeFuseListWithFuzzy(anObjects, isCheckSelfInte, isRmExtraEdges, fuzzyValue);
}
- break;
+ break;
case BooleanGUI::COMMON:
- anObj = anOper->MakeCommonList(anObjects, isCheckSelfInte);
- break;
- case BooleanGUI::CUT:
- anObj =
- anOper->MakeCutList(myObject1.get(), anObjects, isCheckSelfInte);
- break;
- case BooleanGUI::SECTION:
- anObj = anOper->MakeBoolean
- (myObject1.get(), anObjects[0], myOperation, isCheckSelfInte);
- break;
- default:
- break;
+ anObj = anOper->MakeCommonListWithFuzzy(anObjects, isCheckSelfInte, fuzzyValue);
+ break;
+ case BooleanGUI::CUT:
+ anObj = anOper->MakeCutListWithFuzzy(myObject1.get(), anObjects, isCheckSelfInte, fuzzyValue);
+ break;
+ case BooleanGUI::SECTION:
+ anObj = anOper->MakeBooleanWithFuzzy(myObject1.get(), anObjects[0], myOperation, isCheckSelfInte, fuzzyValue);
+ break;
+ default:
+ break;
}
if (!anObj->_is_nil())
#include "GEOM_GenericObjPtr.h"
class DlgRef_2Sel2Spin3Check;
+class QLabel;
+class SalomeApp_DoubleSpinBox;
//=================================================================================
// class : BooleanGUI_Dialog
QList<GEOM::GeomObjPtr> myObjects;
DlgRef_2Sel2Spin3Check* myGroup;
+ QLabel* myFuzzyLbl;
+ SalomeApp_DoubleSpinBox* myFuzzyEdt;
private slots:
void ClickOnOk();
bool ClickOnApply();
+ void UseFuzzyChanged(int state);
void SetEditCurrentArgument();
void SelectionIntoArgument();
void ActivateThisDialog();
<property name="title" >
<string/>
</property>
- <layout class="QGridLayout" >
+ <layout class="QGridLayout" name="gridLayout1" >
<property name="leftMargin" >
<number>9</number>
</property>
<source>GEOM_CHECK_SELF_INTERSECTIONS</source>
<translation>Detect Self-intersections</translation>
</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>
<source>GEOM_FAST_CHECK_INTERSECTIONS</source>
<translation>Fast intersection</translation>
<source>GEOM_CHECK_SELF_INTERSECTIONS</source>
<translation>Détecter les auto-intersections</translation>
</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>
<source>GEOM_FAST_CHECK_INTERSECTIONS</source>
<translation>Intersection rapide</translation>
<source>GEOM_CHECK_SELF_INTERSECTIONS</source>
<translation>自己交差の検出</translation>
</message>
+ <message>
+ <source>GEOM_USE_FUZZY_PARAMETER</source>
+ <translation>ファジーパラメータを使用する</translation>
+ </message>
+ <message>
+ <source>GEOM_FUZZY_PARAMETER</source>
+ <translation>ファジーパラメータ</translation>
+ </message>
<message>
<source>GEOM_FAST_CHECK_INTERSECTIONS</source>
<translation>クイック交点</translation>
Standard_Integer aType = aFunction->GetType();
const Standard_Boolean isCheckSelfInte = aCI.GetCheckSelfIntersection();
const Standard_Boolean isRmExtraEdges = aCI.GetRmExtraEdges();
+ const Standard_Real aFuzzyParam = aCI.GetFuzzyParameter();
TopoDS_Shape aShape;
TNaming_CopyShape::CopyTool(aShape1, aMapTShapes, aShapeCopy1);
TNaming_CopyShape::CopyTool(aShape2, aMapTShapes, aShapeCopy2);
- aShape = performOperation (aShapeCopy1, aShapeCopy2, aType);
+ aShape = performOperation (aShapeCopy1, aShapeCopy2, aType, aFuzzyParam);
if (isRmExtraEdges) {
aShape = RemoveExtraEdges(aShape);
aList2.Append(aShape2);
aCSI.SetArguments(aList2);
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");
}
}
// Copy shape
aShapeCopy.Nullify();
TNaming_CopyShape::CopyTool(aShape2, aMapTShapes, aShapeCopy);
- aShape = performOperation (aShape, aShapeCopy, aSimpleType);
+ aShape = performOperation (aShape, aShapeCopy, aSimpleType, aFuzzyParam);
if (isRmExtraEdges) {
aShape = RemoveExtraEdges(aShape);
aList1.Append(aShape);
aCSI.SetArguments(aList1);
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");
}
}
aList2.Append(aTool);
aCSI.SetArguments(aList2);
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");
}
}
// Copy shape
aShapeCopy.Nullify();
TNaming_CopyShape::CopyTool(aTool, aMapTShapes, aShapeCopy);
- aShape = performOperation (aShape, aShapeCopy, BOOLEAN_CUT);
+ aShape = performOperation (aShape, aShapeCopy, BOOLEAN_CUT, aFuzzyParam);
if (aShape.IsNull()) {
return 0;
TopoDS_Shape GEOMImpl_BooleanDriver::performOperation
(const TopoDS_Shape theShape1,
const TopoDS_Shape theShape2,
- const Standard_Integer theType)const
+ const Standard_Integer theType,
+ const Standard_Real theFuzzyParam) const
{
TopoDS_Shape aShape;
TopTools_ListIteratorOfListOfShape itSub2 (listShape2);
for (; itSub2.More(); itSub2.Next()) {
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()) {
StdFail_NotDone::Raise("Common operation can not be performed on the given shapes");
}
TopTools_ListIteratorOfListOfShape itSub2 (listTools);
for (; itSub2.More(); itSub2.Next()) {
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()) {
StdFail_NotDone::Raise("Cut operation can not be performed on the given shapes");
}
}
// 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()) {
StdFail_NotDone::Raise("Fuse operation can not be performed on the given shapes");
}
for (; itSub2.More(); itSub2.Next()) {
TopoDS_Shape aValue2 = itSub2.Value();
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,
// where analytic curve is not possible. Without this flag in some cases
// we obtain BSpline curve of degree 1 (C0), which is slowly
GEOMImpl_IBoolean aCI (function);
Standard_Integer aType = function->GetType();
Standard_Boolean isCheckSelfInte = aCI.GetCheckSelfIntersection();
+ Standard_Real aFuzzyParam = aCI.GetFuzzyParameter();
switch ( aType ) {
case BOOLEAN_COMMON:
return false;
}
+ if (aFuzzyParam > 0)
+ AddParam( theParams, "Fuzzy Parameter", aFuzzyParam );
+
return true;
}
TopoDS_Shape performOperation(const TopoDS_Shape theShape1,
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;
#define BOOL_ARG_SHAPES 3
#define BOOL_ARG_CHECK_SELF_INTERSECTION 4
#define BOOL_ARG_RM_EXTRA_EDGES 5
+#define BOOL_ARG_FUZZY_PARAMETER 6
class GEOMImpl_IBoolean
{
{ _func->SetInteger(BOOL_ARG_CHECK_SELF_INTERSECTION, theFlag ? 1 : 0); }
void SetRmExtraEdges (Standard_Boolean theFlag)
{ _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) GetShape2() { return _func->GetReference(BOOL_ARG_SHAPE2); }
{ return (_func->GetInteger(BOOL_ARG_CHECK_SELF_INTERSECTION) != 0); }
Standard_Boolean GetRmExtraEdges()
{ return (_func->GetInteger(BOOL_ARG_RM_EXTRA_EDGES) != 0); }
+ Standard_Real GetFuzzyParameter()
+ { return _func->GetReal(BOOL_ARG_FUZZY_PARAMETER); }
private:
(Handle(GEOM_Object) theShape1,
Handle(GEOM_Object) theShape2,
const Standard_Integer theOp,
- const Standard_Boolean IsCheckSelfInte)
+ const Standard_Boolean IsCheckSelfInte,
+ const Standard_Real theFuzzyParam)
{
SetErrorCode(KO);
aCI.SetShape1(aRef1);
aCI.SetShape2(aRef2);
aCI.SetCheckSelfIntersection(IsCheckSelfInte);
+ aCI.SetFuzzyParameter(theFuzzyParam);
//Compute the Boolean value
try {
pd << ", True";
}
+ if (theFuzzyParam > 0) {
+ // Use named argument for the fuzzy parameter
+ pd << ", theFuzzyParam=" << theFuzzyParam;
+ }
+
pd << ")";
SetErrorCode(OK);
(Handle(GEOM_Object) theShape1,
Handle(GEOM_Object) theShape2,
const bool IsCheckSelfInte,
- const bool IsRmExtraEdges)
+ const bool IsRmExtraEdges,
+ const Standard_Real theFuzzyParam)
{
SetErrorCode(KO);
aCI.SetShape2(aRef2);
aCI.SetCheckSelfIntersection(IsCheckSelfInte);
aCI.SetRmExtraEdges(IsRmExtraEdges);
+ aCI.SetFuzzyParameter(theFuzzyParam);
//Compute the Boolean value
try {
pd << aBool << " = geompy.MakeFuse(";
pd << theShape1 << ", " << theShape2 << ", "
- << IsCheckSelfInte << ", " << IsRmExtraEdges << ")";
+ << IsCheckSelfInte << ", " << IsRmExtraEdges;
+ if (theFuzzyParam > 0) {
+ // Use named argument for the fuzzy parameter
+ pd << ", theFuzzyParam=" << theFuzzyParam;
+ }
+ pd << ")";
SetErrorCode(OK);
return aBool;
Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuseList
(const Handle(TColStd_HSequenceOfTransient)& theShapes,
const bool IsCheckSelfInte,
- const bool IsRmExtraEdges)
+ const bool IsRmExtraEdges,
+ const Standard_Real theFuzzyParam)
{
SetErrorCode(KO);
aCI.SetShapes(aShapesSeq);
aCI.SetCheckSelfIntersection(IsCheckSelfInte);
aCI.SetRmExtraEdges(IsRmExtraEdges);
+ aCI.SetFuzzyParameter(theFuzzyParam);
//Compute the Boolean value
try {
GEOM::TPythonDump pd (aFunction);
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);
return aBool;
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeCommonList
(const Handle(TColStd_HSequenceOfTransient)& theShapes,
- const Standard_Boolean IsCheckSelfInte)
+ const Standard_Boolean IsCheckSelfInte,
+ const Standard_Real theFuzzyParam)
{
SetErrorCode(KO);
aCI.SetShapes(aShapesSeq);
aCI.SetCheckSelfIntersection(IsCheckSelfInte);
+ aCI.SetFuzzyParameter(theFuzzyParam);
//Compute the Boolean value
try {
if (IsCheckSelfInte) {
pd << ", True";
}
-
+ if (theFuzzyParam > 0) {
+ // Use named argument for the fuzzy parameter
+ pd << ", theFuzzyParam=" << theFuzzyParam;
+ }
pd << ")";
SetErrorCode(OK);
Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeCutList
(Handle(GEOM_Object) theMainShape,
const Handle(TColStd_HSequenceOfTransient)& theShapes,
- const Standard_Boolean IsCheckSelfInte)
+ const Standard_Boolean IsCheckSelfInte,
+ const Standard_Real theFuzzyParam)
{
SetErrorCode(KO);
aCI.SetShape1(aMainRef);
aCI.SetShapes(aShapesSeq);
aCI.SetCheckSelfIntersection(IsCheckSelfInte);
+ aCI.SetFuzzyParameter(theFuzzyParam);
//Compute the Boolean value
try {
pd << ", True";
}
+ if (theFuzzyParam > 0) {
+ // Use named argument for the fuzzy parameter
+ pd << ", theFuzzyParam=" << theFuzzyParam;
+ }
+
pd << ")";
SetErrorCode(OK);
const Handle(TColStd_HArray1OfInteger)& theMaterials,
const Standard_Integer theKeepNonlimitShapes,
const Standard_Boolean thePerformSelfIntersections,
- const Standard_Boolean IsCheckSelfInte)
+ const Standard_Boolean IsCheckSelfInte,
+ const Standard_Real theFuzzyParam)
{
SetErrorCode(KO);
}
}
+ // Fuzzy parameter
+ aCI.SetFuzzyParameter(theFuzzyParam);
+
//Compute the Partition
try {
OCC_CATCH_SIGNALS;
if (IsCheckSelfInte && !thePerformSelfIntersections) {
pd << ", True";
}
+
+ if (theFuzzyParam > 0) {
+ // Use named argument for the fuzzy parameter
+ pd << ", theFuzzyParam=" << theFuzzyParam;
+ }
pd << ")";
*/
//=============================================================================
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);
aCI.SetShape(aRef1);
aCI.SetPlane(aRef2);
+ aCI.SetFuzzyParameter(theFuzzyParam);
//Compute the Partition value
try {
//Make a Python command
GEOM::TPythonDump pd (aFunction);
pd << aPart << " = geompy.MakeHalfPartition("
- << theShape << ", " << thePlane << ")";
+ << theShape << ", " << thePlane;
+ if (theFuzzyParam > 0) {
+ // Use named argument for the fuzzy parameter
+ pd << ", theFuzzyParam=" << theFuzzyParam;
+ }
+ pd << ")";
SetErrorCode(OK);
return aPart;
(Handle(GEOM_Object) theShape1,
Handle(GEOM_Object) theShape2,
const Standard_Integer theOp,
- const Standard_Boolean IsCheckSelfInte);
+ const Standard_Boolean IsCheckSelfInte,
+ const Standard_Real theFuzzyParam = -1.);
Standard_EXPORT Handle(GEOM_Object) MakeFuse
(Handle(GEOM_Object) theShape1,
Handle(GEOM_Object) theShape2,
const bool IsCheckSelfInte,
- const bool IsRmExtraEdges);
+ const bool IsRmExtraEdges,
+ const Standard_Real theFuzzyParam = -1.);
Standard_EXPORT Handle(GEOM_Object) MakeFuseList
(const Handle(TColStd_HSequenceOfTransient)& theShapes,
const bool IsCheckSelfInte,
- const bool IsRmExtraEdges);
+ const bool IsRmExtraEdges,
+ const Standard_Real theFuzzyParam = -1.);
Standard_EXPORT Handle(GEOM_Object) MakeCommonList
(const Handle(TColStd_HSequenceOfTransient)& theShapes,
- const Standard_Boolean IsCheckSelfInte);
+ const Standard_Boolean IsCheckSelfInte,
+ const Standard_Real theFuzzyParam = -1.);
Standard_EXPORT Handle(GEOM_Object) MakeCutList
- (Handle(GEOM_Object) theMainShape,
+ (Handle(GEOM_Object) theMainShape,
const Handle(TColStd_HSequenceOfTransient)& theShapes,
- const Standard_Boolean IsCheckSelfInte);
+ const Standard_Boolean IsCheckSelfInte,
+ const Standard_Real theFuzzyParam = -1.);
Standard_EXPORT Handle(GEOM_Object) MakePartition
(const Handle(TColStd_HSequenceOfTransient)& theShapes,
const Standard_Integer theLimit,
const Standard_Boolean theRemoveWebs,
const Handle(TColStd_HArray1OfInteger)& theMaterials,
- const Standard_Integer theKeepNonlimitShapes,
- const Standard_Boolean thePerformSelfIntersections,
- const Standard_Boolean IsCheckSelfInte);
-
- Standard_EXPORT Handle(GEOM_Object) MakeHalfPartition (Handle(GEOM_Object) theShape,
- Handle(GEOM_Object) thePlane);
+ const Standard_Integer theKeepNonlimitShapes,
+ const Standard_Boolean thePerformSelfIntersections,
+ const Standard_Boolean IsCheckSelfInte,
+ const Standard_Real theFuzzyParam = -1.);
+
+ Standard_EXPORT Handle(GEOM_Object) MakeHalfPartition (Handle(GEOM_Object) theShape,
+ Handle(GEOM_Object) thePlane,
+ const Standard_Real theFuzzyParam = -1.);
private:
#define PART_ARG_KEEP_NONLIMIT_SHAPES 9
#define PART_ARG_CHECK_SELF_INTERSECTION 10
+#define PART_ARG_FUZZY_PARAMETER 11
class GEOMImpl_IPartition
{
void SetCheckSelfIntersection (Standard_Boolean theFlag)
{ _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 GetKeepNonlimitShapes() { return _func->GetInteger(PART_ARG_KEEP_NONLIMIT_SHAPES); }
Standard_Boolean GetCheckSelfIntersection()
{ return (_func->GetInteger(PART_ARG_CHECK_SELF_INTERSECTION) != 0); }
+ Standard_Real GetFuzzyParameter()
+ { return _func->GetReal(PART_ARG_FUZZY_PARAMETER); }
+
private:
Handle(GEOM_Function) _func;
GEOMImpl_IPartition aCI (aFunction);
Standard_Integer aType = aFunction->GetType();
const Standard_Boolean isCheckSelfInte = aCI.GetCheckSelfIntersection();
+ const Standard_Real aFuzzyParam = aCI.GetFuzzyParameter();
TopoDS_Shape aShape;
GEOMAlgo_Splitter PS;
PS.SetLimitMode(aCI.GetKeepNonlimitShapes());
PS.SetLimit((TopAbs_ShapeEnum)aCI.GetLimit());
+ if (aFuzzyParam > 0) {
+ PS.SetFuzzyValue(aFuzzyParam);
+ }
+
// Set parallel processing mode (default is false)
Standard_Boolean bRunParallel = Standard_True;
PS.SetRunParallel(bRunParallel);
PS.AddTool(aPlaneArg_copy);
//PS.AddTool(aPlaneArg);
+ if (aFuzzyParam > 0) {
+ PS.SetFuzzyValue(aFuzzyParam);
+ }
+
//skl PS.Compute();
PS.Perform();
//PS.SetRemoveWebs(Standard_False);
GEOMImpl_IPartition aCI( function );
Standard_Integer aType = function->GetType();
+ Standard_Real aFuzzyParam = aCI.GetFuzzyParameter();
theOperationName = "PARTITION";
default:
return false;
}
+
+ if (aFuzzyParam > 0)
+ AddParam( theParams, "Fuzzy Parameter", aFuzzyParam );
return true;
}
GEOM::GEOM_Object_ptr theShape2,
CORBA::Long theOp,
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;
// Make Boolean
Handle(::GEOM_Object) anObject =
- GetOperations()->MakeBoolean(aSh1, aSh2, theOp, IsCheckSelfInte);
+ GetOperations()->MakeBoolean(aSh1, aSh2, theOp, IsCheckSelfInte, theFuzzyParam);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
//=============================================================================
/*!
- * 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 theShape2,
CORBA::Boolean IsCheckSelfInte,
- CORBA::Boolean IsRmExtraEdges)
+ CORBA::Boolean IsRmExtraEdges,
+ CORBA::Double theFuzzyParam)
{
GEOM::GEOM_Object_var aGEOMObject;
// Make Boolean
Handle(::GEOM_Object) anObject = GetOperations()->MakeFuse
- (aSh1, aSh2, IsCheckSelfInte, IsRmExtraEdges);
+ (aSh1, aSh2, IsCheckSelfInte, IsRmExtraEdges, theFuzzyParam);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
//=============================================================================
/*!
- * MakeFuseList
+ * MakeFuseListWithFuzzy
*/
//=============================================================================
-GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeFuseList
+GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeFuseListWithFuzzy
(const GEOM::ListOfGO& theShapes,
CORBA::Boolean IsCheckSelfInte,
- CORBA::Boolean IsRmExtraEdges)
+ CORBA::Boolean IsRmExtraEdges,
+ CORBA::Double theFuzzyParam)
{
GEOM::GEOM_Object_var aGEOMObject;
// Make fusion
Handle(::GEOM_Object) anObject =
- GetOperations()->MakeFuseList(aShapes, IsCheckSelfInte, IsRmExtraEdges);
+ GetOperations()->MakeFuseList(aShapes, IsCheckSelfInte, IsRmExtraEdges, theFuzzyParam);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
//=============================================================================
/*!
- * MakeCommonList
+ * MakeCommonListWithFuzzy
*/
//=============================================================================
-GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeCommonList
+GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeCommonListWithFuzzy
(const GEOM::ListOfGO& theShapes,
- CORBA::Boolean IsCheckSelfInte)
+ CORBA::Boolean IsCheckSelfInte,
+ CORBA::Double theFuzzyParam)
{
GEOM::GEOM_Object_var aGEOMObject;
// Make fusion
Handle(::GEOM_Object) anObject =
- GetOperations()->MakeCommonList(aShapes, IsCheckSelfInte);
+ GetOperations()->MakeCommonList(aShapes, IsCheckSelfInte, theFuzzyParam);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
//=============================================================================
/*!
- * MakeCutList
+ * MakeCutListWithFuzzy
*/
//=============================================================================
-GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeCutList
+GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeCutListWithFuzzy
(GEOM::GEOM_Object_ptr theMainShape,
const GEOM::ListOfGO& theShapes,
- CORBA::Boolean IsCheckSelfInte)
+ CORBA::Boolean IsCheckSelfInte,
+ CORBA::Double theFuzzyParam)
{
GEOM::GEOM_Object_var aGEOMObject;
// Make fusion
Handle(::GEOM_Object) anObject =
- GetOperations()->MakeCutList(aMainShape, aShapes, IsCheckSelfInte);
+ GetOperations()->MakeCutList(aMainShape, aShapes, IsCheckSelfInte, theFuzzyParam);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
//=============================================================================
/*!
- * 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& theTools,
const GEOM::ListOfGO& theKeepIns,
CORBA::Short theLimit,
CORBA::Boolean theRemoveWebs,
const GEOM::ListOfLong& theMaterials,
- CORBA::Short theKeepNonlimitShapes)
+ CORBA::Short theKeepNonlimitShapes,
+ CORBA::Double theFuzzyParam)
{
GEOM::GEOM_Object_var aGEOMObject;
theLimit, theRemoveWebs, aMaterials,
theKeepNonlimitShapes,
/*PerformSelfIntersections*/Standard_True,
- /*IsCheckSelfInte*/Standard_False);
+ /*IsCheckSelfInte*/Standard_False,
+ theFuzzyParam);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
//=============================================================================
/*!
- * 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& theTools,
const GEOM::ListOfGO& theKeepIns,
CORBA::Boolean theRemoveWebs,
const GEOM::ListOfLong& theMaterials,
CORBA::Short theKeepNonlimitShapes,
- CORBA::Boolean IsCheckSelfInte)
+ CORBA::Boolean IsCheckSelfInte,
+ CORBA::Double theFuzzyParam)
{
GEOM::GEOM_Object_var aGEOMObject;
theLimit, theRemoveWebs, aMaterials,
theKeepNonlimitShapes,
/*PerformSelfIntersections*/Standard_False,
- IsCheckSelfInte);
+ IsCheckSelfInte,
+ theFuzzyParam);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
//=============================================================================
/*!
- * 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 thePlane)
+ GEOM::GEOM_Object_ptr thePlane,
+ CORBA::Double theFuzzyParam)
{
GEOM::GEOM_Object_var aGEOMObject;
// Make Half Partition
Handle(::GEOM_Object) anObject =
- GetOperations()->MakeHalfPartition(aSh, aPl);
+ GetOperations()->MakeHalfPartition(aSh, aPl, theFuzzyParam);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
~GEOM_IBooleanOperations_i();
GEOM::GEOM_Object_ptr MakeBoolean (GEOM::GEOM_Object_ptr theShape1,
- GEOM::GEOM_Object_ptr theShape2,
- CORBA::Long theOp,
+ GEOM::GEOM_Object_ptr theShape2,
+ CORBA::Long theOp,
CORBA::Boolean IsCheckSelfInte);
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 IsRmExtraEdges);
CORBA::Boolean IsCheckSelfInte);
GEOM::GEOM_Object_ptr MakePartition (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);
+ 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);
GEOM::GEOM_Object_ptr MakePartitionNonSelfIntersectedShape (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,
+ 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);
-
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()
{ return (::GEOMImpl_IBooleanOperations*)GetImpl(); }
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
+ # @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.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
#
# @ref tui_fuse "Example"
@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.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
+ 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.
New GEOM.GEOM_Object, containing the result shape.
"""
# 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)
def_names = { 1: "common", 2: "cut", 3: "fuse", 4: "section" }
self._autoPublish(anObj, theName, def_names[theOperation])
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
+ # @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.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
#
# @ref tui_common "Example 1"
# \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.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
+ 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.
"""
# Example: see GEOM_TestOthers.py
# 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.
# @param theShape1 First argument for boolean operation.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
+ # @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.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
#
# @ref tui_cut "Example 1"
# \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.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
+ 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.
"""
# Example: see GEOM_TestOthers.py
# 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.
# @param theShape1 First argument for boolean operation.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
+ # @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.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
# \n @ref swig_MakeCommon "Example 2"
@ManageTransactions("BoolOp")
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.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
+ 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.
"""
# Example: see GEOM_TestOthers.py
- anObj = self.BoolOp.MakeFuse(theShape1, theShape2,
- checkSelfInte, rmExtraEdges)
+ anObj = self.BoolOp.MakeFuseWithFuzzy(theShape1, theShape2, checkSelfInte,
+ rmExtraEdges, theFuzzyParam)
RaiseIfFailed("MakeFuse", self.BoolOp)
self._autoPublish(anObj, theName, "fuse")
return anObj
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
+ # @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.
#
# @ref tui_section "Example 1"
# \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.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
+ 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:
New GEOM.GEOM_Object, containing the result shape.
"""
# Example: see GEOM_TestOthers.py
# 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.
# @param theShapesList Shapes to be fused.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
+ # @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.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
# \n @ref swig_MakeCommon "Example 2"
@ManageTransactions("BoolOp")
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.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
+ 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.
"""
# Example: see GEOM_TestOthers.py
- anObj = self.BoolOp.MakeFuseList(theShapesList, checkSelfInte,
- rmExtraEdges)
+ anObj = self.BoolOp.MakeFuseListWithFuzzy(theShapesList, checkSelfInte,
+ rmExtraEdges, theFuzzyParam)
RaiseIfFailed("MakeFuseList", self.BoolOp)
self._autoPublish(anObj, theName, "fuse")
return anObj
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
+ # @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.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
# @ref tui_common "Example 1"
# \n @ref swig_MakeCommon "Example 2"
@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.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
+ 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.
"""
# Example: see GEOM_TestOthers.py
- anObj = self.BoolOp.MakeCommonList(theShapesList, checkSelfInte)
+ anObj = self.BoolOp.MakeCommonListWithFuzzy(theShapesList, checkSelfInte, theFuzzyParam)
RaiseIfFailed("MakeCommonList", self.BoolOp)
self._autoPublish(anObj, theName, "common")
return anObj
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
+ # @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.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
# @ref tui_cut "Example 1"
# \n @ref swig_MakeCommon "Example 2"
@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.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
+ 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.
"""
# Example: see GEOM_TestOthers.py
- anObj = self.BoolOp.MakeCutList(theMainShape, theShapesList, checkSelfInte)
+ anObj = self.BoolOp.MakeCutListWithFuzzy(theMainShape, theShapesList, checkSelfInte, theFuzzyParam)
RaiseIfFailed("MakeCutList", self.BoolOp)
self._autoPublish(anObj, theName, "cut")
return anObj
# target type (equal to Limit) are kept in the result,
# else standalone shapes of lower dimension
# are kept also (if they exist).
- #
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
+ # @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
# in order to avoid possible intersection between shapes from this compound.
@ManageTransactions("BoolOp")
def MakePartition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[],
- KeepNonlimitShapes=0, theName=None):
+ KeepNonlimitShapes=0, theName=None, theFuzzyParam=-1):
"""
Perform partition operation.
for s in ListShapes: lim = min(lim, s.GetMaxShapeType())
Limit = EnumToLong(lim)
pass
- anObj = self.BoolOp.MakePartition(ListShapes, ListTools,
- ListKeepInside, ListRemoveInside,
- Limit, RemoveWebs, ListMaterials,
- KeepNonlimitShapes);
+ anObj = self.BoolOp.MakePartitionWithFuzzy(ListShapes, ListTools,
+ ListKeepInside, ListRemoveInside,
+ Limit, RemoveWebs, ListMaterials,
+ KeepNonlimitShapes, theFuzzyParam)
RaiseIfFailed("MakePartition", self.BoolOp)
self._autoPublish(anObj, theName, "partition")
return anObj
# One additional parameter is provided:
# @param checkSelfInte The flag that tells if the arguments should
# 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.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
ListKeepInside=[], ListRemoveInside=[],
Limit=ShapeType["AUTO"], RemoveWebs=0,
ListMaterials=[], KeepNonlimitShapes=0,
- checkSelfInte=False, theName=None):
+ checkSelfInte=False, theName=None,
+ theFuzzyParam=-1):
"""
Perform partition operation.
This method may be useful if it is needed to make a partition for
for s in ListShapes: lim = min(lim, s.GetMaxShapeType())
Limit = EnumToLong(lim)
pass
- anObj = self.BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
- ListKeepInside, ListRemoveInside,
- Limit, RemoveWebs, ListMaterials,
- KeepNonlimitShapes, checkSelfInte);
+ anObj = self.BoolOp.MakePartitionNonSelfIntersectedShapeWithFuzzy(ListShapes, ListTools,
+ ListKeepInside, ListRemoveInside,
+ Limit, RemoveWebs, ListMaterials,
+ KeepNonlimitShapes, checkSelfInte,
+ theFuzzyParam)
RaiseIfFailed("MakePartitionNonSelfIntersectedShape", self.BoolOp)
self._autoPublish(anObj, theName, "partition")
return anObj
# \n @ref swig_Partition "Example 2"
def Partition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[],
- KeepNonlimitShapes=0, theName=None):
+ KeepNonlimitShapes=0, theName=None, theFuzzyParam=-1):
"""
See method geompy.MakePartition for more information.
"""
anObj = self.MakePartition(ListShapes, ListTools,
ListKeepInside, ListRemoveInside,
Limit, RemoveWebs, ListMaterials,
- KeepNonlimitShapes, theName);
+ KeepNonlimitShapes, theName, theFuzzyParam)
return anObj
## Perform partition of the Shape with the Plane
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
+ # @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.
#
#
# @ref tui_partition "Example"
@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
Result = geompy.MakePartition([Object], [Plane])
"""
# Example: see GEOM_TestAll.py
- anObj = self.BoolOp.MakeHalfPartition(theShape, thePlane)
+ anObj = self.BoolOp.MakeHalfPartitionWithFuzzy(theShape, thePlane, theFuzzyParam)
RaiseIfFailed("MakeHalfPartition", self.BoolOp)
self._autoPublish(anObj, theName, "partition")
return anObj
// Comment next line to enable preview in Partition dialog box
#define NO_PREVIEW
+#define DEFAULT_FUZZY_VALUE 1e-5
+
+
//=================================================================================
// class : OperationGUI_PartitionDlg()
// purpose : Constructs a OperationGUI_PartitionDlg which is a child of 'parent', with the
mySelfInte->setText(tr("GEOM_CHECK_SELF_INTERSECTIONS"));
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() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
GroupPoints->CheckButton1->setChecked( false );
mySelfInte->setChecked(false);
+ // Do not use Fuzzy parameter by default
+ myFuzzyChk->setChecked(false);
+ myFuzzyLbl->setEnabled(false);
+ myFuzzyEdt->setEnabled(false);
+
mainFrame()->GroupBoxPublish->show();
/* signals and slots connections */
connect( GroupPoints->CheckButton2, SIGNAL(toggled(bool)), mySelfInte, SLOT(setEnabled(bool)) );
connect( mySelfInte, SIGNAL(toggled(bool)), this, SLOT(processPreview()) );
+ connect( myFuzzyChk, SIGNAL(stateChanged(int)), this, SLOT(UseFuzzyChanged(int)));
+
mySelfInte->setEnabled(GroupPoints->CheckButton2->isChecked());
initName( tr( "GEOM_PARTITION" ) );
disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
globalSelection();
- //myListShapes.length( 0 );
- //myListTools.length( 0 );
- //myListKeepInside.length( 0 ); // obsolete
- //myListRemoveInside.length( 0 ); // obsolete
- //myListMaterials.length( 0 ); // obsolete
-
switch ( constructorId ) {
case 0: /*Full partition */
GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION" ) );
}
+//=================================================================================
+// 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()
// purpose : Called when selection as changed or other case
GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation());
+ bool useFuzzyParam = myFuzzyChk->isChecked();
+ double aFuzzyParam = (useFuzzyParam ? myFuzzyEdt->value() : -1.0);
+
switch ( getConstructorId() ) {
case 0:
{
bool aNoSelfIntersection = GroupPoints->CheckButton2->isChecked();
anObj = aNoSelfIntersection ?
- anOper->MakePartitionNonSelfIntersectedShape(myListShapes, myListTools,
- myListKeepInside, myListRemoveInside,
- aLimit, false, myListMaterials, aKeepNonlimitShapes,
- isDetectSelfInte) :
- anOper->MakePartition(myListShapes, myListTools,
- myListKeepInside, myListRemoveInside,
- aLimit, false, myListMaterials, aKeepNonlimitShapes);
+ anOper->MakePartitionNonSelfIntersectedShapeWithFuzzy(myListShapes, myListTools,
+ myListKeepInside, myListRemoveInside,
+ aLimit, false, myListMaterials, aKeepNonlimitShapes,
+ isDetectSelfInte, aFuzzyParam) :
+ anOper->MakePartitionWithFuzzy(myListShapes, myListTools,
+ myListKeepInside, myListRemoveInside,
+ aLimit, false, myListMaterials, aKeepNonlimitShapes, aFuzzyParam);
res = true;
}
break;
case 1:
{
- anObj = anOper->MakeHalfPartition(myListShapes[0].in(), myListTools[0].in());
+ anObj = anOper->MakeHalfPartitionWithFuzzy(myListShapes[0].in(), myListTools[0].in(), aFuzzyParam);
res = true;
}
break;
//=======================================================================
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();
}
class DlgRef_2Sel1List2Check;
class QCheckBox;
+class QLabel;
+class SalomeApp_DoubleSpinBox;
//=================================================================================
// class : OperationGUI_PartitionDlg
GEOM::ListOfGO myListKeepInside;
DlgRef_2Sel1List2Check* GroupPoints;
- QCheckBox *mySelfInte;
+ QCheckBox* mySelfInte;
+ QCheckBox* myFuzzyChk;
+ QLabel* myFuzzyLbl;
+ SalomeApp_DoubleSpinBox* myFuzzyEdt;
private slots:
void ClickOnOk();
bool ClickOnApply();
+ void UseFuzzyChanged(int state);
void ActivateThisDialog();
void LineEditReturnPressed();
void SelectionIntoArgument();
--- /dev/null
+# -*- 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()
test_kind_of_shape.py
test_proximity_edge_edge.py
test_proximity_face_face.py
+ test_boolean_fuzzy.py
)
ENDIF()