From: skv Date: Thu, 27 Mar 2014 07:59:05 +0000 (+0400) Subject: 0022471: EDF 2604 GEOM: Suppress the boundary edges of the tools in the fuse operation X-Git-Tag: V7_4_0a1~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ef95b8ac70d50ab64058ffcc124ef9f2cf7ba9cc;p=modules%2Fgeom.git 0022471: EDF 2604 GEOM: Suppress the boundary edges of the tools in the fuse operation --- diff --git a/doc/salome/gui/GEOM/images/bool1.png b/doc/salome/gui/GEOM/images/bool1.png index cc8956387..c259c3fcc 100755 Binary files a/doc/salome/gui/GEOM/images/bool1.png and b/doc/salome/gui/GEOM/images/bool1.png differ diff --git a/doc/salome/gui/GEOM/input/fuse_operation.doc b/doc/salome/gui/GEOM/input/fuse_operation.doc index 95dc6ce06..e0a31b777 100644 --- a/doc/salome/gui/GEOM/input/fuse_operation.doc +++ b/doc/salome/gui/GEOM/input/fuse_operation.doc @@ -12,6 +12,7 @@ In this dialog: - 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 Objects to be fused. - Activate the corresponding check-box if you wish to Detect Self-intersections . +- Activate the corresponding check-box if you wish to remove extra edges . - Activate \ref restore_presentation_parameters_page "Advanced options" if required. - Press "Apply" or "Apply & Close" button to get the result (GEOM_Object). @@ -24,15 +25,17 @@ In this dialog: This operation can be performed using a TUI Command: -geompy.MakeFuseList(theShapesList, checkSelfInte) +geompy.MakeFuseList(theShapesList, checkSelfInte, rmExtraEdges) -Arguments: Name + a list of shapes + an optional flag for self-intersection check. +Arguments: Name + a list of shapes + an optional flag for +self-intersection check + an optional flag to remove extra edges. There is also a special TUI Command for \b Fuse operation on two shapes : -geompy.MakeFuse(s1, s2, checkSelfInte) +geompy.MakeFuse(s1, s2, checkSelfInte, rmExtraEdges) -Arguments: Name + 2 shapes + an optional flag for self-intersection check. +Arguments: Name + 2 shapes + an optional flag for self-intersection +check + an optional flag to remove extra edges. Example: diff --git a/doc/salome/gui/GEOM/input/using_boolean_operations.doc b/doc/salome/gui/GEOM/input/using_boolean_operations.doc index 74acd1e8b..02a30251d 100644 --- a/doc/salome/gui/GEOM/input/using_boolean_operations.doc +++ b/doc/salome/gui/GEOM/input/using_boolean_operations.doc @@ -23,7 +23,7 @@ a list of others. You can use advanced TUI commands performing these operations independently from each other: \par -geompy.MakeFuseList(theShapesList, checkSelfInte), where \em theShapesList is +geompy.MakeFuseList(theShapesList, checkSelfInte, rmExtraEdges), where \em theShapesList is the list of shapes for Fuse operation; \par geompy.MakeCommonList(theShapesList, checkSelfInte), where \em theShapesList is @@ -51,7 +51,7 @@ a Boolean operation, \em Operation is the type of a Boolean operation (1 Besides, you can use advanced TUI commands performing these operations independently from each other: \par -geompy.MakeFuse(Shape1, Shape2, checkSelfInte), where \em Shape1 is the first +geompy.MakeFuse(Shape1, Shape2, checkSelfInte, rmExtraEdges), where \em Shape1 is the first argument and \em Shape2 is the second argument of Fuse operation; \par geompy.MakeCommon(Shape1, Shape2, checkSelfInte), where \em Shape1 is the first @@ -73,6 +73,17 @@ not valid for boolean operations. all self-intersections use \ref check_self_intersections_page "Detect Self-intersection tool". +The flag \em rmExtraEdges is used for \em MakeFuseList and \em MakeFuse +operations only. It indicates if Remove Extra Edges operation should be +performed during the operation. Its default value is \em False, which +means that there is no need to do it. + +\note \em rmExtraEdges is not available for \em MakeBoolean call with + operation type 3 (Fuse). \em MakeBoolean operation doesn't perform + Remove Extra Edges. So the call geompy.MakeBoolean(Shape1, Shape2, + 3, checkSelfInte) is equivalent to geompy.MakeFuse(Shape1, + Shape2, checkSelfInte, False). + Our TUI Scripts provide you with useful examples of the use of \ref tui_boolean_operations_page "Boolean Operations". diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 921e35995..542a1e8e8 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -2917,16 +2917,33 @@ module GEOM in GEOM_Object theShape2, in long theOperation, in boolean IsCheckSelfInte); + /*! + * \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. + * \return New GEOM_Object, containing the result shape. + */ + GEOM_Object MakeFuse (in GEOM_Object theShape1, + in GEOM_Object theShape2, + in boolean IsCheckSelfInte, + in boolean IsRmExtraEdges); /*! * \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. * \return New GEOM_Object, containing the result shape. */ GEOM_Object MakeFuseList (in ListOfGO theShapes, - in boolean IsCheckSelfInte); + in boolean IsCheckSelfInte, + in boolean IsRmExtraEdges); /*! * \brief Perform common boolean operation on list of objects. diff --git a/src/BooleanGUI/BooleanGUI_Dialog.cxx b/src/BooleanGUI/BooleanGUI_Dialog.cxx index 3b57da1ca..3ee6ba47c 100644 --- a/src/BooleanGUI/BooleanGUI_Dialog.cxx +++ b/src/BooleanGUI/BooleanGUI_Dialog.cxx @@ -93,7 +93,7 @@ BooleanGUI_Dialog::BooleanGUI_Dialog (const int theOperation, GeometryGUI* theGe mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); mainFrame()->RadioButton3->close(); - myGroup = new DlgRef_2Sel2Spin1Check(centralWidget()); + myGroup = new DlgRef_2Sel2Spin3Check(centralWidget()); myGroup->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); if (myOperation == BooleanGUI::CUT) { @@ -108,21 +108,30 @@ BooleanGUI_Dialog::BooleanGUI_Dialog (const int theOperation, GeometryGUI* theGe myGroup->TextLabel2->hide(); myGroup->PushButton2->hide(); myGroup->LineEdit2->hide(); + + if (myOperation == BooleanGUI::FUSE) { + myGroup->CheckBox2->setText(tr("GEOM_BOOL_REMOVE_EXTRA_EDGES")); + } } myGroup->PushButton1->setIcon(image1); myGroup->LineEdit1->setReadOnly(true); - if (myOperation != BooleanGUI::FUSE && myOperation != BooleanGUI::COMMON) { - myGroup->PushButton2->setIcon(image1); - myGroup->LineEdit2->setReadOnly(true); + if (myOperation != BooleanGUI::FUSE) { + myGroup->CheckBox2->hide(); + + if (myOperation != BooleanGUI::COMMON) { + myGroup->PushButton2->setIcon(image1); + myGroup->LineEdit2->setReadOnly(true); + } } myGroup->TextLabel3->hide(); myGroup->TextLabel4->hide(); myGroup->SpinBox_DX->hide(); myGroup->SpinBox_DY->hide(); - myGroup->CheckButton1->setText(tr("GEOM_CHECK_SELF_INTERSECTIONS")); + myGroup->CheckBox3->hide(); + myGroup->CheckBox1->setText(tr("GEOM_CHECK_SELF_INTERSECTIONS")); QVBoxLayout* layout = new QVBoxLayout(centralWidget()); layout->setMargin(0); layout->setSpacing(6); @@ -158,7 +167,12 @@ void BooleanGUI_Dialog::Init() myGroup->LineEdit1->setText(""); myGroup->LineEdit2->setText(""); - myGroup->CheckButton1->setChecked(true); + myGroup->CheckBox1->setChecked(true); + + if (myOperation == BooleanGUI::FUSE) { + myGroup->CheckBox2->setChecked(true); + } + myObject1.nullify(); reset(); @@ -409,11 +423,16 @@ bool BooleanGUI_Dialog::execute (ObjectList& objects) GEOM::GEOM_Object_var anObj; GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation()); - const bool isCheckSelfInte = myGroup->CheckButton1->isChecked(); + const bool isCheckSelfInte = myGroup->CheckBox1->isChecked(); switch (myOperation) { case BooleanGUI::FUSE: - anObj = anOper->MakeFuseList(myObjects, isCheckSelfInte); + { + const bool isRmExtraEdges = myGroup->CheckBox2->isChecked(); + + anObj = anOper->MakeFuseList + (myObjects, isCheckSelfInte, isRmExtraEdges); + } break; case BooleanGUI::COMMON: anObj = anOper->MakeCommonList(myObjects, isCheckSelfInte); diff --git a/src/BooleanGUI/BooleanGUI_Dialog.h b/src/BooleanGUI/BooleanGUI_Dialog.h index f7726a72c..99ead05a6 100644 --- a/src/BooleanGUI/BooleanGUI_Dialog.h +++ b/src/BooleanGUI/BooleanGUI_Dialog.h @@ -30,7 +30,7 @@ #include "GEOMBase_Skeleton.h" #include "GEOM_GenericObjPtr.h" -class DlgRef_2Sel2Spin1Check; +class DlgRef_2Sel2Spin3Check; //================================================================================= // class : BooleanGUI_Dialog @@ -65,7 +65,7 @@ private: GEOM::GeomObjPtr myObject1; GEOM::ListOfGO_var myObjects; - DlgRef_2Sel2Spin1Check* myGroup; + DlgRef_2Sel2Spin3Check* myGroup; private slots: void ClickOnOk(); diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index d57c18ef5..35cf49d7f 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -4640,6 +4640,10 @@ Please, select face, shell or solid and try again GEOM_REMOVE_EXTRA_EDGES_TITLE Remove extra edges + + GEOM_BOOL_REMOVE_EXTRA_EDGES + Remove extra edges + GEOM_REMOVE_EXTRA_EDGES Object to remove extra edges diff --git a/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx b/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx index 99c2ab976..32b0b04fa 100644 --- a/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx @@ -26,6 +26,8 @@ #include #include #include +#include +#include #include @@ -61,6 +63,49 @@ // here check level is decreased to more appropriate value to avoid problems with performance). #define BOP_SELF_INTERSECTIONS_LEVEL 4 +/** + * This function performs extra edges removal. + * + * \param theShape the shape to be processed. + * \return the modified shape or null shape in case of failure. + */ +static TopoDS_Shape RemoveExtraEdges(const TopoDS_Shape &theShape) +{ + TopoDS_Shape aResult; + + if (theShape.IsNull() == Standard_False) { + BlockFix_BlockFixAPI aTool; + + aTool.OptimumNbFaces() = 0; + aTool.SetShape(theShape); + aTool.Perform(); + aResult = aTool.Shape(); + + // Repair result + BRepCheck_Analyzer anAna (aResult, false); + Standard_Boolean isValid = anAna.IsValid(); + + if (!isValid) { + TopoDS_Shape aFixed; + ShHealOper_ShapeProcess aHealer; + + aHealer.Perform(aResult, aFixed); + + if (aHealer.isDone()) { + aResult = aFixed; + anAna.Init(aResult, false); + isValid = anAna.IsValid(); + } + } + + if (!isValid) { + aResult.Nullify(); + } + } + + return aResult; +} + //======================================================================= //function : GetID //purpose : @@ -91,6 +136,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const GEOMImpl_IBoolean aCI (aFunction); Standard_Integer aType = aFunction->GetType(); const Standard_Boolean isCheckSelfInte = aCI.GetCheckSelfIntersection(); + const Standard_Boolean isRmExtraEdges = aCI.GetRmExtraEdges(); TopoDS_Shape aShape; @@ -139,8 +185,13 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const aShape = performOperation (aShapeCopy1, aShapeCopy2, aType); - if (aShape.IsNull()) + if (isRmExtraEdges) { + aShape = RemoveExtraEdges(aShape); + } + + if (aShape.IsNull()) { return 0; + } } } break; @@ -208,6 +259,10 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const aShapeCopy.Nullify(); TNaming_CopyShape::CopyTool(aShape2, aMapTShapes, aShapeCopy); aShape = performOperation (aShape, aShapeCopy, aSimpleType); + + if (isRmExtraEdges) { + aShape = RemoveExtraEdges(aShape); + } if (aShape.IsNull()) { return 0; @@ -621,40 +676,50 @@ GetCreationInformation(std::string& theOperationName, GEOMImpl_IBoolean aCI (function); Standard_Integer aType = function->GetType(); + Standard_Boolean isCheckSelfInte = aCI.GetCheckSelfIntersection(); switch ( aType ) { case BOOLEAN_COMMON: theOperationName = "COMMON"; AddParam( theParams, "Object 1", aCI.GetShape1() ); AddParam( theParams, "Object 2", aCI.GetShape2() ); + AddParam( theParams, "Check self-intersections", isCheckSelfInte ); break; case BOOLEAN_CUT: theOperationName = "CUT"; AddParam( theParams, "Main Object", aCI.GetShape1() ); AddParam( theParams, "Tool Object", aCI.GetShape2() ); + AddParam( theParams, "Check self-intersections", isCheckSelfInte ); break; case BOOLEAN_FUSE: theOperationName = "FUSE"; AddParam( theParams, "Object 1", aCI.GetShape1() ); AddParam( theParams, "Object 2", aCI.GetShape2() ); + AddParam( theParams, "Check self-intersections", isCheckSelfInte ); + AddParam( theParams, "Remove extra edges", aCI.GetRmExtraEdges() ); break; case BOOLEAN_SECTION: theOperationName = "SECTION"; AddParam( theParams, "Object 1", aCI.GetShape1() ); AddParam( theParams, "Object 2", aCI.GetShape2() ); + AddParam( theParams, "Check self-intersections", isCheckSelfInte ); break; case BOOLEAN_COMMON_LIST: theOperationName = "COMMON"; AddParam( theParams, "Selected objects", aCI.GetShapes() ); + AddParam( theParams, "Check self-intersections", isCheckSelfInte ); break; case BOOLEAN_FUSE_LIST: theOperationName = "FUSE"; AddParam( theParams, "Selected objects", aCI.GetShapes() ); + AddParam( theParams, "Check self-intersections", isCheckSelfInte ); + AddParam( theParams, "Remove extra edges", aCI.GetRmExtraEdges() ); break; case BOOLEAN_CUT_LIST: theOperationName = "CUT"; AddParam( theParams, "Main Object", aCI.GetShape1() ); AddParam( theParams, "Tool Objects", aCI.GetShapes() ); + AddParam( theParams, "Check self-intersections", isCheckSelfInte ); break; default: return false; diff --git a/src/GEOMImpl/GEOMImpl_IBoolean.hxx b/src/GEOMImpl/GEOMImpl_IBoolean.hxx index 1985e1afa..7d9460fce 100644 --- a/src/GEOMImpl/GEOMImpl_IBoolean.hxx +++ b/src/GEOMImpl/GEOMImpl_IBoolean.hxx @@ -29,6 +29,7 @@ #define BOOL_ARG_SHAPE2 2 #define BOOL_ARG_SHAPES 3 #define BOOL_ARG_CHECK_SELF_INTERSECTION 4 +#define BOOL_ARG_RM_EXTRA_EDGES 5 class GEOMImpl_IBoolean { @@ -42,6 +43,8 @@ class GEOMImpl_IBoolean { _func->SetReferenceList(BOOL_ARG_SHAPES, theShapes); } void SetCheckSelfIntersection (Standard_Boolean theFlag) { _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); } Handle(GEOM_Function) GetShape1() { return _func->GetReference(BOOL_ARG_SHAPE1); } Handle(GEOM_Function) GetShape2() { return _func->GetReference(BOOL_ARG_SHAPE2); } @@ -49,6 +52,8 @@ class GEOMImpl_IBoolean { return _func->GetReferenceList(BOOL_ARG_SHAPES); } Standard_Boolean GetCheckSelfIntersection() { return (_func->GetInteger(BOOL_ARG_CHECK_SELF_INTERSECTION) != 0); } + Standard_Boolean GetRmExtraEdges() + { return (_func->GetInteger(BOOL_ARG_RM_EXTRA_EDGES) != 0); } private: diff --git a/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx b/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx index a503e4c09..644422c4c 100644 --- a/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx @@ -148,6 +148,72 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeBoolean return aBool; } +//============================================================================= +/*! + * MakeFuse + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuse + (Handle(GEOM_Object) theShape1, + Handle(GEOM_Object) theShape2, + const bool IsCheckSelfInte, + const bool IsRmExtraEdges) +{ + SetErrorCode(KO); + + if (theShape1.IsNull() || theShape2.IsNull()) return NULL; + + //Add a new Boolean object + Handle(GEOM_Object) aBool = GetEngine()->AddObject(GetDocID(), GEOM_BOOLEAN); + + //Add a new Boolean function + Handle(GEOM_Function) aFunction = + aBool->AddFunction(GEOMImpl_BooleanDriver::GetID(), BOOLEAN_FUSE); + + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_BooleanDriver::GetID()) return NULL; + + GEOMImpl_IBoolean aCI (aFunction); + + Handle(GEOM_Function) aRef1 = theShape1->GetLastFunction(); + Handle(GEOM_Function) aRef2 = theShape2->GetLastFunction(); + + if (aRef1.IsNull() || aRef2.IsNull()) return NULL; + + aCI.SetShape1(aRef1); + aCI.SetShape2(aRef2); + aCI.SetCheckSelfIntersection(IsCheckSelfInte); + aCI.SetRmExtraEdges(IsRmExtraEdges); + + //Compute the Boolean value + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Boolean driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + + pd << aBool << " = geompy.MakeFuse("; + pd << theShape1 << ", " << theShape2 << ", " + << IsCheckSelfInte << ", " << IsRmExtraEdges << ")"; + + SetErrorCode(OK); + return aBool; +} + //============================================================================= /*! * MakeFuseList @@ -155,7 +221,8 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeBoolean //============================================================================= Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuseList (const Handle(TColStd_HSequenceOfTransient)& theShapes, - const Standard_Boolean IsCheckSelfInte) + const bool IsCheckSelfInte, + const bool IsRmExtraEdges) { SetErrorCode(KO); @@ -183,6 +250,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuseList aCI.SetShapes(aShapesSeq); aCI.SetCheckSelfIntersection(IsCheckSelfInte); + aCI.SetRmExtraEdges(IsRmExtraEdges); //Compute the Boolean value try { @@ -203,14 +271,8 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuseList //Make a Python command GEOM::TPythonDump pd (aFunction); - pd << aBool << - " = geompy.MakeFuseList([" << aDescription.ToCString() << "]"; - - if (IsCheckSelfInte) { - pd << ", True"; - } - - pd << ")"; + pd << aBool << " = geompy.MakeFuseList([" << aDescription.ToCString() << "], " + << IsCheckSelfInte << ", " << IsRmExtraEdges << ")"; SetErrorCode(OK); return aBool; diff --git a/src/GEOMImpl/GEOMImpl_IBooleanOperations.hxx b/src/GEOMImpl/GEOMImpl_IBooleanOperations.hxx index 8db023a01..75c230e2c 100644 --- a/src/GEOMImpl/GEOMImpl_IBooleanOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IBooleanOperations.hxx @@ -42,9 +42,16 @@ class GEOMImpl_IBooleanOperations : public GEOM_IOperations { const Standard_Integer theOp, const Standard_Boolean IsCheckSelfInte); + Standard_EXPORT Handle(GEOM_Object) MakeFuse + (Handle(GEOM_Object) theShape1, + Handle(GEOM_Object) theShape2, + const bool IsCheckSelfInte, + const bool IsRmExtraEdges); + Standard_EXPORT Handle(GEOM_Object) MakeFuseList (const Handle(TColStd_HSequenceOfTransient)& theShapes, - const Standard_Boolean IsCheckSelfInte); + const bool IsCheckSelfInte, + const bool IsRmExtraEdges); Standard_EXPORT Handle(GEOM_Object) MakeCommonList (const Handle(TColStd_HSequenceOfTransient)& theShapes, diff --git a/src/GEOM_I/GEOM_IBooleanOperations_i.cc b/src/GEOM_I/GEOM_IBooleanOperations_i.cc index 66dbcd625..2df45a9f2 100644 --- a/src/GEOM_I/GEOM_IBooleanOperations_i.cc +++ b/src/GEOM_I/GEOM_IBooleanOperations_i.cc @@ -87,6 +87,38 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeBoolean return GetObject(anObject); } +//============================================================================= +/*! + * 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) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the reference shapes + Handle(GEOM_Object) aSh1 = GetObjectImpl(theShape1); + Handle(GEOM_Object) aSh2 = GetObjectImpl(theShape2); + + if (aSh1.IsNull() || aSh2.IsNull()) return aGEOMObject._retn(); + + // Make Boolean + Handle(GEOM_Object) anObject = GetOperations()->MakeFuse + (aSh1, aSh2, IsCheckSelfInte, IsRmExtraEdges); + + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + //============================================================================= /*! * MakeFuseList @@ -94,7 +126,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeBoolean //============================================================================= GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeFuseList (const GEOM::ListOfGO& theShapes, - CORBA::Boolean IsCheckSelfInte) + CORBA::Boolean IsCheckSelfInte, + CORBA::Boolean IsRmExtraEdges) { GEOM::GEOM_Object_var aGEOMObject; @@ -110,7 +143,7 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeFuseList // Make fusion Handle(GEOM_Object) anObject = - GetOperations()->MakeFuseList(aShapes, IsCheckSelfInte); + GetOperations()->MakeFuseList(aShapes, IsCheckSelfInte, IsRmExtraEdges); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); diff --git a/src/GEOM_I/GEOM_IBooleanOperations_i.hh b/src/GEOM_I/GEOM_IBooleanOperations_i.hh index dea57d833..943f6cb9b 100644 --- a/src/GEOM_I/GEOM_IBooleanOperations_i.hh +++ b/src/GEOM_I/GEOM_IBooleanOperations_i.hh @@ -47,8 +47,14 @@ class GEOM_I_EXPORT GEOM_IBooleanOperations_i : CORBA::Long theOp, CORBA::Boolean IsCheckSelfInte); + GEOM::GEOM_Object_ptr MakeFuse (GEOM::GEOM_Object_ptr theShape1, + GEOM::GEOM_Object_ptr theShape2, + CORBA::Boolean IsCheckSelfInte, + CORBA::Boolean IsRmExtraEdges); + GEOM::GEOM_Object_ptr MakeFuseList (const GEOM::ListOfGO& theShapes, - CORBA::Boolean IsCheckSelfInte); + CORBA::Boolean IsCheckSelfInte, + CORBA::Boolean IsRmExtraEdges); GEOM::GEOM_Object_ptr MakeCommonList (const GEOM::ListOfGO& theShapes, CORBA::Boolean IsCheckSelfInte); diff --git a/src/GEOM_SWIG/geomBuilder.py b/src/GEOM_SWIG/geomBuilder.py index c269bc765..057e6b064 100644 --- a/src/GEOM_SWIG/geomBuilder.py +++ b/src/GEOM_SWIG/geomBuilder.py @@ -6846,6 +6846,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): # @param theShape2 Second argument for boolean operation. # @param checkSelfInte The flag that tells if the arguments should # be checked for self-intersection prior to the operation. + # @param rmExtraEdges The flag that tells if Remove Extra Edges + # operation should be performed during the 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. @@ -6862,7 +6864,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): # # @ref tui_fuse "Example 1" # \n @ref swig_MakeCommon "Example 2" - def MakeFuse(self, theShape1, theShape2, checkSelfInte=False, theName=None): + def MakeFuse(self, theShape1, theShape2, checkSelfInte=False, + rmExtraEdges=False, theName=None): """ Perform Fuse boolean operation on two given shapes. @@ -6872,6 +6875,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): checkSelfInte The flag that tells if the arguments should be checked for self-intersection prior to the operation. + rmExtraEdges The flag that tells if Remove Extra Edges + operation should be performed during the operation. 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. @@ -6890,8 +6895,11 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): """ # Example: see GEOM_TestOthers.py - # note: auto-publishing is done in self.MakeBoolean() - return self.MakeBoolean(theShape1, theShape2, 3, checkSelfInte, theName) + anObj = self.BoolOp.MakeFuse(theShape1, theShape2, + checkSelfInte, rmExtraEdges) + RaiseIfFailed("MakeFuse", self.BoolOp) + self._autoPublish(anObj, theName, "fuse") + return anObj ## Perform Section boolean operation on two given shapes. # @param theShape1 First argument for boolean operation. @@ -6949,6 +6957,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): # @param theShapesList Shapes to be fused. # @param checkSelfInte The flag that tells if the arguments should # be checked for self-intersection prior to the operation. + # @param rmExtraEdges The flag that tells if Remove Extra Edges + # operation should be performed during the 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. @@ -6965,7 +6975,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): # # @ref tui_fuse "Example 1" # \n @ref swig_MakeCommon "Example 2" - def MakeFuseList(self, theShapesList, checkSelfInte=False, theName=None): + def MakeFuseList(self, theShapesList, checkSelfInte=False, + rmExtraEdges=False, theName=None): """ Perform Fuse boolean operation on the list of shapes. @@ -6974,6 +6985,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): checkSelfInte The flag that tells if the arguments should be checked for self-intersection prior to the operation. + rmExtraEdges The flag that tells if Remove Extra Edges + operation should be performed during the operation. 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. @@ -6992,7 +7005,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): """ # Example: see GEOM_TestOthers.py - anObj = self.BoolOp.MakeFuseList(theShapesList, checkSelfInte) + anObj = self.BoolOp.MakeFuseList(theShapesList, checkSelfInte, + rmExtraEdges) RaiseIfFailed("MakeFuseList", self.BoolOp) self._autoPublish(anObj, theName, "fuse") return anObj @@ -12662,8 +12676,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): Returns: New GEOM_Object, containing the created shape. """ - anObj = self.AdvOp.MakeSmoothingSurface - (thelPoints, theNbMax, theDegMax, theDMax) + anObj = self.AdvOp.MakeSmoothingSurface(thelPoints, theNbMax, + theDegMax, theDMax) RaiseIfFailed("MakeSmoothingSurface", self.AdvOp) self._autoPublish(anObj, theName, "smoothing") return anObj