IMPs 19998 and 21191: new gluing by PKV. Add option to glue all edges in MakeGlueFacesByList (old behaviour).

This commit is contained in:
jfa 2011-04-25 13:49:48 +00:00
parent 54e7e4bc3c
commit 5adc956854
21 changed files with 75 additions and 25 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -1,8 +1,9 @@
/*! /*!
\page glue_faces_operation_page Glue Faces \page glue_faces_operation_page Glue Faces / Edges
\n To <b>Glue Faces</b> in the <b>Main Menu</b> select <b>Repair - > Glue Faces</b>. \n To <b>Glue Faces</b> in the <b>Main Menu</b> select <b>Repair - > Glue Faces</b>.
\n To <b>Glue Edges</b> in the <b>Main Menu</b> select <b>Repair - > Glue Edges</b>.
\n This operation glues faces that are coincident with respect to the \n This operation glues faces that are coincident with respect to the
given tolerance value. given tolerance value.

View File

@ -1494,10 +1494,14 @@ module GEOM
* \param theTolerance Maximum distance between faces, which can be considered as coincident. * \param theTolerance Maximum distance between faces, which can be considered as coincident.
* \param theFaces List of faces for gluing. * \param theFaces List of faces for gluing.
* \param doKeepNonSolids If FALSE, only solids will present in the result, otherwise all initial shapes. * \param doKeepNonSolids If FALSE, only solids will present in the result, otherwise all initial shapes.
* \param doGlueAllEdges If TRUE, all coincident edges of <VAR>theShape</VAR>
* will be glued, otherwise only the edges,
* belonging to <VAR>theFaces</VAR>.
* \return New GEOM_Object, containing a copy of theShape without some faces. * \return New GEOM_Object, containing a copy of theShape without some faces.
*/ */
GEOM_Object MakeGlueFacesByList (in GEOM_Object theShape, in double theTolerance, GEOM_Object MakeGlueFacesByList (in GEOM_Object theShape, in double theTolerance,
in ListOfGO theFaces, in boolean doKeepNonSolids); in ListOfGO theFaces, in boolean doKeepNonSolids,
in boolean doGlueAllEdges);
/*! /*!
* Replace coincident edges in theShape by one edge. * Replace coincident edges in theShape by one edge.

View File

@ -392,7 +392,8 @@ module GEOM
GEOM_Object MakeGlueFacesByList (in GEOM_Object theShape, GEOM_Object MakeGlueFacesByList (in GEOM_Object theShape,
in double theTolerance, in double theTolerance,
in ListOfGO theFaces, in ListOfGO theFaces,
in boolean doKeepNonSolids); in boolean doKeepNonSolids,
in boolean doGlueAllEdges);
GEOM_List MakeExplode (in GEOM_Object theShape, GEOM_List MakeExplode (in GEOM_Object theShape,
in long theShapeType, in long theShapeType,
in boolean isSorted) ; in boolean isSorted) ;

View File

@ -4709,6 +4709,10 @@ Please close this message box and select edges for gluing</translation>
<source>SELECT_EDGES</source> <source>SELECT_EDGES</source>
<translation>Select Edges</translation> <translation>Select Edges</translation>
</message> </message>
<message>
<source>GLUE_ALL_EDGES</source>
<translation>Glue all coincident edges</translation>
</message>
<message> <message>
<source>THERE_ARE_NO_FACES_FOR_GLUING</source> <source>THERE_ARE_NO_FACES_FOR_GLUING</source>
<translation>There are no faces for gluing</translation> <translation>There are no faces for gluing</translation>

View File

@ -561,7 +561,8 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueWithWarnings (const TopoDS_Shape& theShape
TopoDS_Shape GEOMImpl_GlueDriver::GlueByList (const TopoDS_Shape& theShape, TopoDS_Shape GEOMImpl_GlueDriver::GlueByList (const TopoDS_Shape& theShape,
const Standard_Real theTolerance, const Standard_Real theTolerance,
const Standard_Boolean doKeepNonSolids, const Standard_Boolean doKeepNonSolids,
const TopTools_MapOfShape& theShapesList) const TopTools_MapOfShape& theShapesList,
const Standard_Boolean doGlueAllEdges)
{ {
TopoDS_Shape aRes; TopoDS_Shape aRes;
@ -606,13 +607,20 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueByList (const TopoDS_Shape& theShape,
const TopTools_ListOfShape& aLSD = aItMSD.Value(); const TopTools_ListOfShape& aLSD = aItMSD.Value();
TopTools_ListIteratorOfListOfShape anItLSD (aLSD); TopTools_ListIteratorOfListOfShape anItLSD (aLSD);
bool isToGlue = false; bool isToGlue = false;
if (doGlueAllEdges && aSx.ShapeType() == TopAbs_EDGE) {
isToGlue = true;
}
else {
for (; anItLSD.More() && !isToGlue; anItLSD.Next()) { for (; anItLSD.More() && !isToGlue; anItLSD.Next()) {
if (theShapesList.Contains(anItLSD.Value())) { if (theShapesList.Contains(anItLSD.Value())) {
isToGlue = true; isToGlue = true;
aMSG.Bind(aSx, aLSD);
} }
} }
} }
if (isToGlue) {
aMSG.Bind(aSx, aLSD);
}
}
// 4. Set shapes to glue. If the operator is absent, the whole gluing will be done // 4. Set shapes to glue. If the operator is absent, the whole gluing will be done
aGA.SetShapesToGlue(aMSG); aGA.SetShapesToGlue(aMSG);
@ -709,8 +717,13 @@ Standard_Integer GEOMImpl_GlueDriver::Execute(TFunction_Logbook& log) const
if (!aFaces.Contains(aFace)) if (!aFaces.Contains(aFace))
aFaces.Add(aFace); aFaces.Add(aFace);
} }
Standard_Boolean aGlueAllEdges = Standard_False;
if (aType == GLUE_FACES_BY_LIST)
aGlueAllEdges = aCI.GetGlueAllEdges();
//aShape = GlueFacesByList(aShapeBase, tol3d, aKeepNonSolids, aFaces); //aShape = GlueFacesByList(aShapeBase, tol3d, aKeepNonSolids, aFaces);
aShape = GlueByList(aShapeBase, tol3d, aKeepNonSolids, aFaces); aShape = GlueByList(aShapeBase, tol3d, aKeepNonSolids, aFaces, aGlueAllEdges);
} }
if (aShape.IsNull()) return 0; if (aShape.IsNull()) return 0;

View File

@ -174,7 +174,8 @@ Standard_EXPORT TopoDS_Shape GlueWithWarnings (const TopoDS_Shape& theShape,
Standard_EXPORT static TopoDS_Shape GlueByList (const TopoDS_Shape& theShape, Standard_EXPORT static TopoDS_Shape GlueByList (const TopoDS_Shape& theShape,
const Standard_Real theTolerance, const Standard_Real theTolerance,
const Standard_Boolean doKeepNonSolids, const Standard_Boolean doKeepNonSolids,
const TopTools_MapOfShape& theShapesList); const TopTools_MapOfShape& theShapesList,
const Standard_Boolean doGlueAllEdges);
// Type management // Type management

View File

@ -18,10 +18,9 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// NOTE: This is an interface to a function for the Glueing of faces // NOTE: This is an interface to a function for the Glueing of faces
//
#include "GEOM_Function.hxx" #include "GEOM_Function.hxx"
#include <TColStd_HSequenceOfTransient.hxx> #include <TColStd_HSequenceOfTransient.hxx>
@ -30,6 +29,7 @@
#define GLUE_ARG_TOLER 2 #define GLUE_ARG_TOLER 2
#define GLUE_ARG_FACES 3 #define GLUE_ARG_FACES 3
#define GLUE_ARG_KEEPALL 4 #define GLUE_ARG_KEEPALL 4
#define GLUE_ARG_GLUEEDG 5
class GEOMImpl_IGlue class GEOMImpl_IGlue
{ {
@ -56,6 +56,9 @@ class GEOMImpl_IGlue
void SetKeepNonSolids (Standard_Boolean theFlag) { _func->SetInteger(GLUE_ARG_KEEPALL, theFlag ? 1 : 0); } void SetKeepNonSolids (Standard_Boolean theFlag) { _func->SetInteger(GLUE_ARG_KEEPALL, theFlag ? 1 : 0); }
Standard_Boolean GetKeepNonSolids() { return (_func->GetInteger(GLUE_ARG_KEEPALL) != 0); } Standard_Boolean GetKeepNonSolids() { return (_func->GetInteger(GLUE_ARG_KEEPALL) != 0); }
void SetGlueAllEdges (Standard_Boolean theFlag) { _func->SetInteger(GLUE_ARG_GLUEEDG, theFlag ? 1 : 0); }
Standard_Boolean GetGlueAllEdges() { return (_func->GetInteger(GLUE_ARG_GLUEEDG) != 0); }
private: private:
Handle(GEOM_Function) _func; Handle(GEOM_Function) _func;

View File

@ -808,7 +808,8 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList
(Handle(GEOM_Object) theShape, (Handle(GEOM_Object) theShape,
const Standard_Real theTolerance, const Standard_Real theTolerance,
std::list<Handle(GEOM_Object)> theFaces, std::list<Handle(GEOM_Object)> theFaces,
const Standard_Boolean doKeepNonSolids) const Standard_Boolean doKeepNonSolids,
const Standard_Boolean doGlueAllEdges)
{ {
SetErrorCode(KO); SetErrorCode(KO);
@ -833,6 +834,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList
aCI.SetBase(aRefShape); aCI.SetBase(aRefShape);
aCI.SetTolerance(theTolerance); aCI.SetTolerance(theTolerance);
aCI.SetKeepNonSolids(doKeepNonSolids); aCI.SetKeepNonSolids(doKeepNonSolids);
aCI.SetGlueAllEdges(doGlueAllEdges);
Handle(TColStd_HSequenceOfTransient) aFaces = new TColStd_HSequenceOfTransient; Handle(TColStd_HSequenceOfTransient) aFaces = new TColStd_HSequenceOfTransient;
std::list<Handle(GEOM_Object)>::iterator it = theFaces.begin(); std::list<Handle(GEOM_Object)>::iterator it = theFaces.begin();
@ -881,7 +883,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList
pd << ", " << (*it++); pd << ", " << (*it++);
} }
} }
pd << "])"; pd << "], " << (bool)doKeepNonSolids << ", " << (bool)doGlueAllEdges << ")";
// to provide warning // to provide warning
if (!isWarning) SetErrorCode(OK); if (!isWarning) SetErrorCode(OK);

View File

@ -96,7 +96,8 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
Standard_EXPORT Handle(GEOM_Object) MakeGlueFacesByList (Handle(GEOM_Object) theShape, Standard_EXPORT Handle(GEOM_Object) MakeGlueFacesByList (Handle(GEOM_Object) theShape,
const Standard_Real theTolerance, const Standard_Real theTolerance,
std::list<Handle(GEOM_Object)> theFaces, std::list<Handle(GEOM_Object)> theFaces,
const Standard_Boolean doKeepNonSolids); const Standard_Boolean doKeepNonSolids,
const Standard_Boolean doGlueAllEdges);
Standard_EXPORT Handle(GEOM_Object) MakeGlueEdges (Handle(GEOM_Object) theShape, Standard_EXPORT Handle(GEOM_Object) MakeGlueEdges (Handle(GEOM_Object) theShape,
const Standard_Real theTolerance); const Standard_Real theTolerance);

View File

@ -442,7 +442,8 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList
(GEOM::GEOM_Object_ptr theShape, (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance, CORBA::Double theTolerance,
const GEOM::ListOfGO& theFaces, const GEOM::ListOfGO& theFaces,
CORBA::Boolean doKeepNonSolids) CORBA::Boolean doKeepNonSolids,
CORBA::Boolean doGlueAllEdges)
{ {
GEOM::GEOM_Object_var aGEOMObject; GEOM::GEOM_Object_var aGEOMObject;
@ -465,7 +466,7 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList
//Perform the gluing //Perform the gluing
Handle(GEOM_Object) anObject = Handle(GEOM_Object) anObject =
GetOperations()->MakeGlueFacesByList(aShape, theTolerance, aFaces, doKeepNonSolids); GetOperations()->MakeGlueFacesByList(aShape, theTolerance, aFaces, doKeepNonSolids, doGlueAllEdges);
//if (!GetOperations()->IsDone() || anObject.IsNull()) //if (!GetOperations()->IsDone() || anObject.IsNull())
// to allow warning // to allow warning
if (anObject.IsNull()) if (anObject.IsNull())

View File

@ -80,7 +80,8 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
GEOM::GEOM_Object_ptr MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance, CORBA::Double theTolerance,
const GEOM::ListOfGO& theFaces, const GEOM::ListOfGO& theFaces,
CORBA::Boolean doKeepNonSolids); CORBA::Boolean doKeepNonSolids,
CORBA::Boolean doGlueAllEdges);
GEOM::GEOM_Object_ptr MakeGlueEdges (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr MakeGlueEdges (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance); CORBA::Double theTolerance);

View File

@ -2182,13 +2182,15 @@ GEOM::GEOM_List_ptr GEOM_Superv_i::GetGlueFaces (GEOM::GEOM_Object_ptr theShape,
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance, CORBA::Double theTolerance,
const GEOM::ListOfGO& theFaces, const GEOM::ListOfGO& theFaces,
CORBA::Boolean doKeepNonSolids) CORBA::Boolean doKeepNonSolids,
CORBA::Boolean doGlueAllEdges)
{ {
beginService( " GEOM_Superv_i::MakeGlueFacesByList" ); beginService( " GEOM_Superv_i::MakeGlueFacesByList" );
MESSAGE("GEOM_Superv_i::MakeGlueFacesByList"); MESSAGE("GEOM_Superv_i::MakeGlueFacesByList");
getShapesOp(); getShapesOp();
GEOM::GEOM_Object_ptr anObj = GEOM::GEOM_Object_ptr anObj =
myShapesOp->MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids); myShapesOp->MakeGlueFacesByList(theShape, theTolerance, theFaces,
doKeepNonSolids, doGlueAllEdges);
endService( " GEOM_Superv_i::MakeGlueFacesByList" ); endService( " GEOM_Superv_i::MakeGlueFacesByList" );
return anObj; return anObj;
} }

View File

@ -486,7 +486,8 @@ public:
GEOM::GEOM_Object_ptr MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance, CORBA::Double theTolerance,
const GEOM::ListOfGO& theFaces, const GEOM::ListOfGO& theFaces,
CORBA::Boolean doKeepNonSolids); CORBA::Boolean doKeepNonSolids,
CORBA::Boolean doGlueAllEdges);
GEOM::GEOM_List_ptr MakeExplode (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_List_ptr MakeExplode (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType, CORBA::Long theShapeType,
CORBA::Boolean isSorted); CORBA::Boolean isSorted);

View File

@ -2571,13 +2571,18 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @param theFaces List of faces for gluing. # @param theFaces List of faces for gluing.
# @param doKeepNonSolids If FALSE, only solids will present in the result, # @param doKeepNonSolids If FALSE, only solids will present in the result,
# otherwise all initial shapes. # otherwise all initial shapes.
# @param doGlueAllEdges If TRUE, all coincident edges of <VAR>theShape</VAR>
# will be glued, otherwise only the edges,
# belonging to <VAR>theFaces</VAR>.
# @return New GEOM_Object, containing a copy of theShape # @return New GEOM_Object, containing a copy of theShape
# without some faces. # without some faces.
# #
# @ref swig_todo "Example" # @ref swig_todo "Example"
def MakeGlueFacesByList(self, theShape, theTolerance, theFaces, doKeepNonSolids=True): def MakeGlueFacesByList(self, theShape, theTolerance, theFaces,
doKeepNonSolids=True, doGlueAllEdges=True):
# Example: see GEOM_Spanner.py # Example: see GEOM_Spanner.py
anObj = self.ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids) anObj = self.ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces,
doKeepNonSolids, doGlueAllEdges)
if anObj is None: if anObj is None:
raise RuntimeError, "MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode() raise RuntimeError, "MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode()
return anObj return anObj

View File

@ -128,6 +128,7 @@ RepairGUI_GlueDlg::RepairGUI_GlueDlg(GeometryGUI* theGeometryGUI, QWidget* paren
} }
myDetectBtn = new QPushButton (tr("GEOM_DETECT") + aGlueString, GroupPoints2->Box); myDetectBtn = new QPushButton (tr("GEOM_DETECT") + aGlueString, GroupPoints2->Box);
mySubShapesChk = new QCheckBox (aSelString, GroupPoints2->Box); mySubShapesChk = new QCheckBox (aSelString, GroupPoints2->Box);
myGlueAllEdgesChk = 0;
boxLayout = new QGridLayout(GroupPoints2->Box); boxLayout = new QGridLayout(GroupPoints2->Box);
boxLayout->setMargin(0); boxLayout->setSpacing(6); boxLayout->setMargin(0); boxLayout->setSpacing(6);
@ -136,6 +137,12 @@ RepairGUI_GlueDlg::RepairGUI_GlueDlg(GeometryGUI* theGeometryGUI, QWidget* paren
boxLayout->addWidget(myDetectBtn, 1, 0, 1, 3); boxLayout->addWidget(myDetectBtn, 1, 0, 1, 3);
boxLayout->addWidget(mySubShapesChk, 2, 0, 1, 3); boxLayout->addWidget(mySubShapesChk, 2, 0, 1, 3);
if (theGlueMode == TopAbs_FACE) {
myGlueAllEdgesChk = new QCheckBox (tr("GLUE_ALL_EDGES"), GroupPoints2->Box);
boxLayout->addWidget(myGlueAllEdgesChk, 3, 0, 1, 3);
myGlueAllEdgesChk->setChecked(false);
}
QVBoxLayout* layout = new QVBoxLayout(centralWidget()); QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0); layout->setSpacing(6); layout->setMargin(0); layout->setSpacing(6);
layout->addWidget(GroupPoints); layout->addWidget(GroupPoints);
@ -483,8 +490,10 @@ bool RepairGUI_GlueDlg::execute(ObjectList& objects)
aListForGlue->length(added); aListForGlue->length(added);
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
if (myGlueMode == TopAbs_FACE) if (myGlueMode == TopAbs_FACE) {
anObj = anOper->MakeGlueFacesByList(myObject, myTolEdt2->value(), aListForGlue.in(), true); bool doGlueAllEdges = myGlueAllEdgesChk->isChecked();
anObj = anOper->MakeGlueFacesByList(myObject, myTolEdt2->value(), aListForGlue.in(), true, false);
}
else if (myGlueMode == TopAbs_EDGE) else if (myGlueMode == TopAbs_EDGE)
anObj = anOper->MakeGlueEdgesByList(myObject, myTolEdt2->value(), aListForGlue.in()); anObj = anOper->MakeGlueEdgesByList(myObject, myTolEdt2->value(), aListForGlue.in());

View File

@ -81,6 +81,7 @@ private:
SalomeApp_DoubleSpinBox* myTolEdt2; SalomeApp_DoubleSpinBox* myTolEdt2;
QPushButton* myDetectBtn; QPushButton* myDetectBtn;
QCheckBox* mySubShapesChk; QCheckBox* mySubShapesChk;
QCheckBox* myGlueAllEdgesChk;
int myCurrConstrId; int myCurrConstrId;