0022471: EDF 2604 GEOM: Suppress the boundary edges of the tools in the fuse operation

This commit is contained in:
skv 2014-03-27 11:59:05 +04:00
parent a4aaa470ae
commit ef95b8ac70
14 changed files with 284 additions and 38 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

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

View File

@ -23,7 +23,7 @@ a list of others. </li>
You can use advanced TUI commands performing these operations You can use advanced TUI commands performing these operations
independently from each other: independently from each other:
\par \par
<em>geompy.MakeFuseList(theShapesList, checkSelfInte)</em>, where \em theShapesList is <em>geompy.MakeFuseList(theShapesList, checkSelfInte, rmExtraEdges)</em>, where \em theShapesList is
the list of shapes for Fuse operation; the list of shapes for Fuse operation;
\par \par
<em>geompy.MakeCommonList(theShapesList, checkSelfInte)</em>, where \em theShapesList is <em>geompy.MakeCommonList(theShapesList, checkSelfInte)</em>, 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 Besides, you can use advanced TUI commands performing these operations
independently from each other: independently from each other:
\par \par
<em>geompy.MakeFuse(Shape1, Shape2, checkSelfInte)</em>, where \em Shape1 is the first <em>geompy.MakeFuse(Shape1, Shape2, checkSelfInte, rmExtraEdges)</em>, where \em Shape1 is the first
argument and \em Shape2 is the second argument of Fuse operation; argument and \em Shape2 is the second argument of Fuse operation;
\par \par
<em>geompy.MakeCommon(Shape1, Shape2, checkSelfInte)</em>, where \em Shape1 is the first <em>geompy.MakeCommon(Shape1, Shape2, checkSelfInte)</em>, where \em Shape1 is the first
@ -73,6 +73,17 @@ not valid for boolean operations.
all self-intersections use \ref check_self_intersections_page all self-intersections use \ref check_self_intersections_page
"Detect Self-intersection tool". "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 <em>geompy.MakeBoolean(Shape1, Shape2,
3, checkSelfInte)</em> is equivalent to <em>geompy.MakeFuse(Shape1,
Shape2, checkSelfInte, False)</em>.
Our <b>TUI Scripts</b> provide you with useful examples of the use of Our <b>TUI Scripts</b> provide you with useful examples of the use of
\ref tui_boolean_operations_page "Boolean Operations". \ref tui_boolean_operations_page "Boolean Operations".

View File

@ -2917,16 +2917,33 @@ module GEOM
in GEOM_Object theShape2, in GEOM_Object theShape2,
in long theOperation, in long theOperation,
in boolean IsCheckSelfInte); 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. * \brief Perform fusion boolean operation on list of objects.
* \param theShapes Shapes to be fused. * \param theShapes Shapes to be fused.
* \param IsCheckSelfInte If TRUE, perform check self intersection * \param IsCheckSelfInte If TRUE, perform check self intersection
* of arguments before an operation. * 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. * \return New GEOM_Object, containing the result shape.
*/ */
GEOM_Object MakeFuseList (in ListOfGO theShapes, GEOM_Object MakeFuseList (in ListOfGO theShapes,
in boolean IsCheckSelfInte); in boolean IsCheckSelfInte,
in boolean IsRmExtraEdges);
/*! /*!
* \brief Perform common boolean operation on list of objects. * \brief Perform common boolean operation on list of objects.

View File

@ -93,7 +93,7 @@ BooleanGUI_Dialog::BooleanGUI_Dialog (const int theOperation, GeometryGUI* theGe
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton3->close(); mainFrame()->RadioButton3->close();
myGroup = new DlgRef_2Sel2Spin1Check(centralWidget()); myGroup = new DlgRef_2Sel2Spin3Check(centralWidget());
myGroup->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); myGroup->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
if (myOperation == BooleanGUI::CUT) { if (myOperation == BooleanGUI::CUT) {
@ -108,21 +108,30 @@ BooleanGUI_Dialog::BooleanGUI_Dialog (const int theOperation, GeometryGUI* theGe
myGroup->TextLabel2->hide(); myGroup->TextLabel2->hide();
myGroup->PushButton2->hide(); myGroup->PushButton2->hide();
myGroup->LineEdit2->hide(); myGroup->LineEdit2->hide();
if (myOperation == BooleanGUI::FUSE) {
myGroup->CheckBox2->setText(tr("GEOM_BOOL_REMOVE_EXTRA_EDGES"));
}
} }
myGroup->PushButton1->setIcon(image1); myGroup->PushButton1->setIcon(image1);
myGroup->LineEdit1->setReadOnly(true); myGroup->LineEdit1->setReadOnly(true);
if (myOperation != BooleanGUI::FUSE && myOperation != BooleanGUI::COMMON) { if (myOperation != BooleanGUI::FUSE) {
myGroup->PushButton2->setIcon(image1); myGroup->CheckBox2->hide();
myGroup->LineEdit2->setReadOnly(true);
if (myOperation != BooleanGUI::COMMON) {
myGroup->PushButton2->setIcon(image1);
myGroup->LineEdit2->setReadOnly(true);
}
} }
myGroup->TextLabel3->hide(); myGroup->TextLabel3->hide();
myGroup->TextLabel4->hide(); myGroup->TextLabel4->hide();
myGroup->SpinBox_DX->hide(); myGroup->SpinBox_DX->hide();
myGroup->SpinBox_DY->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()); QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0); layout->setSpacing(6); layout->setMargin(0); layout->setSpacing(6);
@ -158,7 +167,12 @@ void BooleanGUI_Dialog::Init()
myGroup->LineEdit1->setText(""); myGroup->LineEdit1->setText("");
myGroup->LineEdit2->setText(""); myGroup->LineEdit2->setText("");
myGroup->CheckButton1->setChecked(true); myGroup->CheckBox1->setChecked(true);
if (myOperation == BooleanGUI::FUSE) {
myGroup->CheckBox2->setChecked(true);
}
myObject1.nullify(); myObject1.nullify();
reset(); reset();
@ -409,11 +423,16 @@ bool BooleanGUI_Dialog::execute (ObjectList& objects)
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation()); GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation());
const bool isCheckSelfInte = myGroup->CheckButton1->isChecked(); const bool isCheckSelfInte = myGroup->CheckBox1->isChecked();
switch (myOperation) { switch (myOperation) {
case BooleanGUI::FUSE: case BooleanGUI::FUSE:
anObj = anOper->MakeFuseList(myObjects, isCheckSelfInte); {
const bool isRmExtraEdges = myGroup->CheckBox2->isChecked();
anObj = anOper->MakeFuseList
(myObjects, isCheckSelfInte, isRmExtraEdges);
}
break; break;
case BooleanGUI::COMMON: case BooleanGUI::COMMON:
anObj = anOper->MakeCommonList(myObjects, isCheckSelfInte); anObj = anOper->MakeCommonList(myObjects, isCheckSelfInte);

View File

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

View File

@ -4640,6 +4640,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_REMOVE_EXTRA_EDGES_TITLE</source> <source>GEOM_REMOVE_EXTRA_EDGES_TITLE</source>
<translation>Remove extra edges</translation> <translation>Remove extra edges</translation>
</message> </message>
<message>
<source>GEOM_BOOL_REMOVE_EXTRA_EDGES</source>
<translation>Remove extra edges</translation>
</message>
<message> <message>
<source>GEOM_REMOVE_EXTRA_EDGES</source> <source>GEOM_REMOVE_EXTRA_EDGES</source>
<translation>Object to remove extra edges</translation> <translation>Object to remove extra edges</translation>

View File

@ -26,6 +26,8 @@
#include <GEOMImpl_GlueDriver.hxx> #include <GEOMImpl_GlueDriver.hxx>
#include <GEOM_Function.hxx> #include <GEOM_Function.hxx>
#include <GEOMUtils.hxx> #include <GEOMUtils.hxx>
#include <BlockFix_BlockFixAPI.hxx>
#include <ShHealOper_ShapeProcess.hxx>
#include <TNaming_CopyShape.hxx> #include <TNaming_CopyShape.hxx>
@ -61,6 +63,49 @@
// here check level is decreased to more appropriate value to avoid problems with performance). // here check level is decreased to more appropriate value to avoid problems with performance).
#define BOP_SELF_INTERSECTIONS_LEVEL 4 #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 //function : GetID
//purpose : //purpose :
@ -91,6 +136,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const
GEOMImpl_IBoolean aCI (aFunction); GEOMImpl_IBoolean aCI (aFunction);
Standard_Integer aType = aFunction->GetType(); Standard_Integer aType = aFunction->GetType();
const Standard_Boolean isCheckSelfInte = aCI.GetCheckSelfIntersection(); const Standard_Boolean isCheckSelfInte = aCI.GetCheckSelfIntersection();
const Standard_Boolean isRmExtraEdges = aCI.GetRmExtraEdges();
TopoDS_Shape aShape; TopoDS_Shape aShape;
@ -139,8 +185,13 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const
aShape = performOperation (aShapeCopy1, aShapeCopy2, aType); aShape = performOperation (aShapeCopy1, aShapeCopy2, aType);
if (aShape.IsNull()) if (isRmExtraEdges) {
aShape = RemoveExtraEdges(aShape);
}
if (aShape.IsNull()) {
return 0; return 0;
}
} }
} }
break; break;
@ -208,6 +259,10 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const
aShapeCopy.Nullify(); aShapeCopy.Nullify();
TNaming_CopyShape::CopyTool(aShape2, aMapTShapes, aShapeCopy); TNaming_CopyShape::CopyTool(aShape2, aMapTShapes, aShapeCopy);
aShape = performOperation (aShape, aShapeCopy, aSimpleType); aShape = performOperation (aShape, aShapeCopy, aSimpleType);
if (isRmExtraEdges) {
aShape = RemoveExtraEdges(aShape);
}
if (aShape.IsNull()) { if (aShape.IsNull()) {
return 0; return 0;
@ -621,40 +676,50 @@ GetCreationInformation(std::string& theOperationName,
GEOMImpl_IBoolean aCI (function); GEOMImpl_IBoolean aCI (function);
Standard_Integer aType = function->GetType(); Standard_Integer aType = function->GetType();
Standard_Boolean isCheckSelfInte = aCI.GetCheckSelfIntersection();
switch ( aType ) { switch ( aType ) {
case BOOLEAN_COMMON: case BOOLEAN_COMMON:
theOperationName = "COMMON"; theOperationName = "COMMON";
AddParam( theParams, "Object 1", aCI.GetShape1() ); AddParam( theParams, "Object 1", aCI.GetShape1() );
AddParam( theParams, "Object 2", aCI.GetShape2() ); AddParam( theParams, "Object 2", aCI.GetShape2() );
AddParam( theParams, "Check self-intersections", isCheckSelfInte );
break; break;
case BOOLEAN_CUT: case BOOLEAN_CUT:
theOperationName = "CUT"; theOperationName = "CUT";
AddParam( theParams, "Main Object", aCI.GetShape1() ); AddParam( theParams, "Main Object", aCI.GetShape1() );
AddParam( theParams, "Tool Object", aCI.GetShape2() ); AddParam( theParams, "Tool Object", aCI.GetShape2() );
AddParam( theParams, "Check self-intersections", isCheckSelfInte );
break; break;
case BOOLEAN_FUSE: case BOOLEAN_FUSE:
theOperationName = "FUSE"; theOperationName = "FUSE";
AddParam( theParams, "Object 1", aCI.GetShape1() ); AddParam( theParams, "Object 1", aCI.GetShape1() );
AddParam( theParams, "Object 2", aCI.GetShape2() ); AddParam( theParams, "Object 2", aCI.GetShape2() );
AddParam( theParams, "Check self-intersections", isCheckSelfInte );
AddParam( theParams, "Remove extra edges", aCI.GetRmExtraEdges() );
break; break;
case BOOLEAN_SECTION: case BOOLEAN_SECTION:
theOperationName = "SECTION"; theOperationName = "SECTION";
AddParam( theParams, "Object 1", aCI.GetShape1() ); AddParam( theParams, "Object 1", aCI.GetShape1() );
AddParam( theParams, "Object 2", aCI.GetShape2() ); AddParam( theParams, "Object 2", aCI.GetShape2() );
AddParam( theParams, "Check self-intersections", isCheckSelfInte );
break; break;
case BOOLEAN_COMMON_LIST: case BOOLEAN_COMMON_LIST:
theOperationName = "COMMON"; theOperationName = "COMMON";
AddParam( theParams, "Selected objects", aCI.GetShapes() ); AddParam( theParams, "Selected objects", aCI.GetShapes() );
AddParam( theParams, "Check self-intersections", isCheckSelfInte );
break; break;
case BOOLEAN_FUSE_LIST: case BOOLEAN_FUSE_LIST:
theOperationName = "FUSE"; theOperationName = "FUSE";
AddParam( theParams, "Selected objects", aCI.GetShapes() ); AddParam( theParams, "Selected objects", aCI.GetShapes() );
AddParam( theParams, "Check self-intersections", isCheckSelfInte );
AddParam( theParams, "Remove extra edges", aCI.GetRmExtraEdges() );
break; break;
case BOOLEAN_CUT_LIST: case BOOLEAN_CUT_LIST:
theOperationName = "CUT"; theOperationName = "CUT";
AddParam( theParams, "Main Object", aCI.GetShape1() ); AddParam( theParams, "Main Object", aCI.GetShape1() );
AddParam( theParams, "Tool Objects", aCI.GetShapes() ); AddParam( theParams, "Tool Objects", aCI.GetShapes() );
AddParam( theParams, "Check self-intersections", isCheckSelfInte );
break; break;
default: default:
return false; return false;

View File

@ -29,6 +29,7 @@
#define BOOL_ARG_SHAPE2 2 #define BOOL_ARG_SHAPE2 2
#define BOOL_ARG_SHAPES 3 #define BOOL_ARG_SHAPES 3
#define BOOL_ARG_CHECK_SELF_INTERSECTION 4 #define BOOL_ARG_CHECK_SELF_INTERSECTION 4
#define BOOL_ARG_RM_EXTRA_EDGES 5
class GEOMImpl_IBoolean class GEOMImpl_IBoolean
{ {
@ -42,6 +43,8 @@ class GEOMImpl_IBoolean
{ _func->SetReferenceList(BOOL_ARG_SHAPES, theShapes); } { _func->SetReferenceList(BOOL_ARG_SHAPES, theShapes); }
void SetCheckSelfIntersection (Standard_Boolean theFlag) void SetCheckSelfIntersection (Standard_Boolean theFlag)
{ _func->SetInteger(BOOL_ARG_CHECK_SELF_INTERSECTION, theFlag ? 1 : 0); } { _func->SetInteger(BOOL_ARG_CHECK_SELF_INTERSECTION, theFlag ? 1 : 0); }
void SetRmExtraEdges (Standard_Boolean theFlag)
{ _func->SetInteger(BOOL_ARG_RM_EXTRA_EDGES, theFlag ? 1 : 0); }
Handle(GEOM_Function) GetShape1() { return _func->GetReference(BOOL_ARG_SHAPE1); } Handle(GEOM_Function) GetShape1() { return _func->GetReference(BOOL_ARG_SHAPE1); }
Handle(GEOM_Function) GetShape2() { return _func->GetReference(BOOL_ARG_SHAPE2); } Handle(GEOM_Function) GetShape2() { return _func->GetReference(BOOL_ARG_SHAPE2); }
@ -49,6 +52,8 @@ class GEOMImpl_IBoolean
{ return _func->GetReferenceList(BOOL_ARG_SHAPES); } { return _func->GetReferenceList(BOOL_ARG_SHAPES); }
Standard_Boolean GetCheckSelfIntersection() Standard_Boolean GetCheckSelfIntersection()
{ return (_func->GetInteger(BOOL_ARG_CHECK_SELF_INTERSECTION) != 0); } { return (_func->GetInteger(BOOL_ARG_CHECK_SELF_INTERSECTION) != 0); }
Standard_Boolean GetRmExtraEdges()
{ return (_func->GetInteger(BOOL_ARG_RM_EXTRA_EDGES) != 0); }
private: private:

View File

@ -148,6 +148,72 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeBoolean
return aBool; 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 * MakeFuseList
@ -155,7 +221,8 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeBoolean
//============================================================================= //=============================================================================
Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuseList Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuseList
(const Handle(TColStd_HSequenceOfTransient)& theShapes, (const Handle(TColStd_HSequenceOfTransient)& theShapes,
const Standard_Boolean IsCheckSelfInte) const bool IsCheckSelfInte,
const bool IsRmExtraEdges)
{ {
SetErrorCode(KO); SetErrorCode(KO);
@ -183,6 +250,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuseList
aCI.SetShapes(aShapesSeq); aCI.SetShapes(aShapesSeq);
aCI.SetCheckSelfIntersection(IsCheckSelfInte); aCI.SetCheckSelfIntersection(IsCheckSelfInte);
aCI.SetRmExtraEdges(IsRmExtraEdges);
//Compute the Boolean value //Compute the Boolean value
try { try {
@ -203,14 +271,8 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuseList
//Make a Python command //Make a Python command
GEOM::TPythonDump pd (aFunction); GEOM::TPythonDump pd (aFunction);
pd << aBool << pd << aBool << " = geompy.MakeFuseList([" << aDescription.ToCString() << "], "
" = geompy.MakeFuseList([" << aDescription.ToCString() << "]"; << IsCheckSelfInte << ", " << IsRmExtraEdges << ")";
if (IsCheckSelfInte) {
pd << ", True";
}
pd << ")";
SetErrorCode(OK); SetErrorCode(OK);
return aBool; return aBool;

View File

@ -42,9 +42,16 @@ class GEOMImpl_IBooleanOperations : public GEOM_IOperations {
const Standard_Integer theOp, const Standard_Integer theOp,
const Standard_Boolean IsCheckSelfInte); 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 Standard_EXPORT Handle(GEOM_Object) MakeFuseList
(const Handle(TColStd_HSequenceOfTransient)& theShapes, (const Handle(TColStd_HSequenceOfTransient)& theShapes,
const Standard_Boolean IsCheckSelfInte); const bool IsCheckSelfInte,
const bool IsRmExtraEdges);
Standard_EXPORT Handle(GEOM_Object) MakeCommonList Standard_EXPORT Handle(GEOM_Object) MakeCommonList
(const Handle(TColStd_HSequenceOfTransient)& theShapes, (const Handle(TColStd_HSequenceOfTransient)& theShapes,

View File

@ -87,6 +87,38 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeBoolean
return GetObject(anObject); 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 * MakeFuseList
@ -94,7 +126,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeBoolean
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeFuseList GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeFuseList
(const GEOM::ListOfGO& theShapes, (const GEOM::ListOfGO& theShapes,
CORBA::Boolean IsCheckSelfInte) CORBA::Boolean IsCheckSelfInte,
CORBA::Boolean IsRmExtraEdges)
{ {
GEOM::GEOM_Object_var aGEOMObject; GEOM::GEOM_Object_var aGEOMObject;
@ -110,7 +143,7 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeFuseList
// Make fusion // Make fusion
Handle(GEOM_Object) anObject = Handle(GEOM_Object) anObject =
GetOperations()->MakeFuseList(aShapes, IsCheckSelfInte); GetOperations()->MakeFuseList(aShapes, IsCheckSelfInte, IsRmExtraEdges);
if (!GetOperations()->IsDone() || anObject.IsNull()) if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();

View File

@ -47,8 +47,14 @@ class GEOM_I_EXPORT GEOM_IBooleanOperations_i :
CORBA::Long theOp, CORBA::Long theOp,
CORBA::Boolean IsCheckSelfInte); CORBA::Boolean IsCheckSelfInte);
GEOM::GEOM_Object_ptr MakeFuse (GEOM::GEOM_Object_ptr theShape1,
GEOM::GEOM_Object_ptr theShape2,
CORBA::Boolean IsCheckSelfInte,
CORBA::Boolean IsRmExtraEdges);
GEOM::GEOM_Object_ptr MakeFuseList (const GEOM::ListOfGO& theShapes, 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, GEOM::GEOM_Object_ptr MakeCommonList (const GEOM::ListOfGO& theShapes,
CORBA::Boolean IsCheckSelfInte); CORBA::Boolean IsCheckSelfInte);

View File

@ -6846,6 +6846,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# @param theShape2 Second argument for boolean operation. # @param theShape2 Second argument for boolean operation.
# @param checkSelfInte The flag that tells if the arguments should # @param checkSelfInte The flag that tells if the arguments should
# be checked for self-intersection prior to the operation. # be checked for self-intersection prior to the operation.
# @param 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 # @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic # for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name. # publication is switched on, default value is used for result name.
@ -6862,7 +6864,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# #
# @ref tui_fuse "Example 1" # @ref tui_fuse "Example 1"
# \n @ref swig_MakeCommon "Example 2" # \n @ref swig_MakeCommon "Example 2"
def MakeFuse(self, theShape1, theShape2, checkSelfInte=False, theName=None): def MakeFuse(self, theShape1, theShape2, checkSelfInte=False,
rmExtraEdges=False, theName=None):
""" """
Perform Fuse boolean operation on two given shapes. 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 checkSelfInte The flag that tells if the arguments should
be checked for self-intersection prior to be checked for self-intersection prior to
the operation. 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 theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name. publication is switched on, default value is used for result name.
@ -6890,8 +6895,11 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
""" """
# Example: see GEOM_TestOthers.py # Example: see GEOM_TestOthers.py
# note: auto-publishing is done in self.MakeBoolean() anObj = self.BoolOp.MakeFuse(theShape1, theShape2,
return self.MakeBoolean(theShape1, theShape2, 3, checkSelfInte, theName) checkSelfInte, rmExtraEdges)
RaiseIfFailed("MakeFuse", self.BoolOp)
self._autoPublish(anObj, theName, "fuse")
return anObj
## Perform Section boolean operation on two given shapes. ## Perform Section boolean operation on two given shapes.
# @param theShape1 First argument for boolean operation. # @param theShape1 First argument for boolean operation.
@ -6949,6 +6957,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# @param theShapesList Shapes to be fused. # @param theShapesList Shapes to be fused.
# @param checkSelfInte The flag that tells if the arguments should # @param checkSelfInte The flag that tells if the arguments should
# be checked for self-intersection prior to the operation. # be checked for self-intersection prior to the operation.
# @param 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 # @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic # for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name. # publication is switched on, default value is used for result name.
@ -6965,7 +6975,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# #
# @ref tui_fuse "Example 1" # @ref tui_fuse "Example 1"
# \n @ref swig_MakeCommon "Example 2" # \n @ref swig_MakeCommon "Example 2"
def MakeFuseList(self, theShapesList, checkSelfInte=False, theName=None): def MakeFuseList(self, theShapesList, checkSelfInte=False,
rmExtraEdges=False, theName=None):
""" """
Perform Fuse boolean operation on the list of shapes. 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 checkSelfInte The flag that tells if the arguments should
be checked for self-intersection prior to be checked for self-intersection prior to
the operation. 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 theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name. publication is switched on, default value is used for result name.
@ -6992,7 +7005,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
""" """
# Example: see GEOM_TestOthers.py # Example: see GEOM_TestOthers.py
anObj = self.BoolOp.MakeFuseList(theShapesList, checkSelfInte) anObj = self.BoolOp.MakeFuseList(theShapesList, checkSelfInte,
rmExtraEdges)
RaiseIfFailed("MakeFuseList", self.BoolOp) RaiseIfFailed("MakeFuseList", self.BoolOp)
self._autoPublish(anObj, theName, "fuse") self._autoPublish(anObj, theName, "fuse")
return anObj return anObj
@ -12662,8 +12676,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
Returns: Returns:
New GEOM_Object, containing the created shape. New GEOM_Object, containing the created shape.
""" """
anObj = self.AdvOp.MakeSmoothingSurface anObj = self.AdvOp.MakeSmoothingSurface(thelPoints, theNbMax,
(thelPoints, theNbMax, theDegMax, theDMax) theDegMax, theDMax)
RaiseIfFailed("MakeSmoothingSurface", self.AdvOp) RaiseIfFailed("MakeSmoothingSurface", self.AdvOp)
self._autoPublish(anObj, theName, "smoothing") self._autoPublish(anObj, theName, "smoothing")
return anObj return anObj