/*!
-\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 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
given tolerance value.
* \param theTolerance Maximum distance between faces, which can be considered as coincident.
* \param theFaces List of faces for gluing.
* \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.
*/
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.
GEOM_Object MakeGlueFacesByList (in GEOM_Object theShape,
in double theTolerance,
in ListOfGO theFaces,
- in boolean doKeepNonSolids);
+ in boolean doKeepNonSolids,
+ in boolean doGlueAllEdges);
GEOM_List MakeExplode (in GEOM_Object theShape,
in long theShapeType,
in boolean isSorted) ;
<source>SELECT_EDGES</source>
<translation>Select Edges</translation>
</message>
+ <message>
+ <source>GLUE_ALL_EDGES</source>
+ <translation>Glue all coincident edges</translation>
+ </message>
<message>
<source>THERE_ARE_NO_FACES_FOR_GLUING</source>
<translation>There are no faces for gluing</translation>
TopoDS_Shape GEOMImpl_GlueDriver::GlueByList (const TopoDS_Shape& theShape,
const Standard_Real theTolerance,
const Standard_Boolean doKeepNonSolids,
- const TopTools_MapOfShape& theShapesList)
+ const TopTools_MapOfShape& theShapesList,
+ const Standard_Boolean doGlueAllEdges)
{
TopoDS_Shape aRes;
const TopTools_ListOfShape& aLSD = aItMSD.Value();
TopTools_ListIteratorOfListOfShape anItLSD (aLSD);
bool isToGlue = false;
- for (; anItLSD.More() && !isToGlue; anItLSD.Next()) {
- if (theShapesList.Contains(anItLSD.Value())) {
- isToGlue = true;
- aMSG.Bind(aSx, aLSD);
+ if (doGlueAllEdges && aSx.ShapeType() == TopAbs_EDGE) {
+ isToGlue = true;
+ }
+ else {
+ for (; anItLSD.More() && !isToGlue; anItLSD.Next()) {
+ if (theShapesList.Contains(anItLSD.Value())) {
+ isToGlue = true;
+ }
}
}
+ if (isToGlue) {
+ aMSG.Bind(aSx, aLSD);
+ }
}
// 4. Set shapes to glue. If the operator is absent, the whole gluing will be done
if (!aFaces.Contains(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 = GlueByList(aShapeBase, tol3d, aKeepNonSolids, aFaces);
+ aShape = GlueByList(aShapeBase, tol3d, aKeepNonSolids, aFaces, aGlueAllEdges);
}
if (aShape.IsNull()) return 0;
Standard_EXPORT static TopoDS_Shape GlueByList (const TopoDS_Shape& theShape,
const Standard_Real theTolerance,
const Standard_Boolean doKeepNonSolids,
- const TopTools_MapOfShape& theShapesList);
+ const TopTools_MapOfShape& theShapesList,
+ const Standard_Boolean doGlueAllEdges);
// Type management
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// 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
-//
+
#include "GEOM_Function.hxx"
#include <TColStd_HSequenceOfTransient.hxx>
#define GLUE_ARG_TOLER 2
#define GLUE_ARG_FACES 3
#define GLUE_ARG_KEEPALL 4
+#define GLUE_ARG_GLUEEDG 5
class GEOMImpl_IGlue
{
void SetKeepNonSolids (Standard_Boolean theFlag) { _func->SetInteger(GLUE_ARG_KEEPALL, theFlag ? 1 : 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:
Handle(GEOM_Function) _func;
(Handle(GEOM_Object) theShape,
const Standard_Real theTolerance,
std::list<Handle(GEOM_Object)> theFaces,
- const Standard_Boolean doKeepNonSolids)
+ const Standard_Boolean doKeepNonSolids,
+ const Standard_Boolean doGlueAllEdges)
{
SetErrorCode(KO);
aCI.SetBase(aRefShape);
aCI.SetTolerance(theTolerance);
aCI.SetKeepNonSolids(doKeepNonSolids);
+ aCI.SetGlueAllEdges(doGlueAllEdges);
Handle(TColStd_HSequenceOfTransient) aFaces = new TColStd_HSequenceOfTransient;
std::list<Handle(GEOM_Object)>::iterator it = theFaces.begin();
pd << ", " << (*it++);
}
}
- pd << "])";
+ pd << "], " << (bool)doKeepNonSolids << ", " << (bool)doGlueAllEdges << ")";
// to provide warning
if (!isWarning) SetErrorCode(OK);
Standard_EXPORT Handle(GEOM_Object) MakeGlueFacesByList (Handle(GEOM_Object) theShape,
const Standard_Real theTolerance,
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,
const Standard_Real theTolerance);
(GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance,
const GEOM::ListOfGO& theFaces,
- CORBA::Boolean doKeepNonSolids)
+ CORBA::Boolean doKeepNonSolids,
+ CORBA::Boolean doGlueAllEdges)
{
GEOM::GEOM_Object_var aGEOMObject;
//Perform the gluing
Handle(GEOM_Object) anObject =
- GetOperations()->MakeGlueFacesByList(aShape, theTolerance, aFaces, doKeepNonSolids);
+ GetOperations()->MakeGlueFacesByList(aShape, theTolerance, aFaces, doKeepNonSolids, doGlueAllEdges);
//if (!GetOperations()->IsDone() || anObject.IsNull())
// to allow warning
if (anObject.IsNull())
GEOM::GEOM_Object_ptr MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance,
const GEOM::ListOfGO& theFaces,
- CORBA::Boolean doKeepNonSolids);
+ CORBA::Boolean doKeepNonSolids,
+ CORBA::Boolean doGlueAllEdges);
GEOM::GEOM_Object_ptr MakeGlueEdges (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance);
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance,
const GEOM::ListOfGO& theFaces,
- CORBA::Boolean doKeepNonSolids)
+ CORBA::Boolean doKeepNonSolids,
+ CORBA::Boolean doGlueAllEdges)
{
beginService( " GEOM_Superv_i::MakeGlueFacesByList" );
MESSAGE("GEOM_Superv_i::MakeGlueFacesByList");
getShapesOp();
GEOM::GEOM_Object_ptr anObj =
- myShapesOp->MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids);
+ myShapesOp->MakeGlueFacesByList(theShape, theTolerance, theFaces,
+ doKeepNonSolids, doGlueAllEdges);
endService( " GEOM_Superv_i::MakeGlueFacesByList" );
return anObj;
}
GEOM::GEOM_Object_ptr MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance,
const GEOM::ListOfGO& theFaces,
- CORBA::Boolean doKeepNonSolids);
+ CORBA::Boolean doKeepNonSolids,
+ CORBA::Boolean doGlueAllEdges);
GEOM::GEOM_List_ptr MakeExplode (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType,
CORBA::Boolean isSorted);
# @param theFaces List of faces for gluing.
# @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.
#
# @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
- anObj = self.ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces, doKeepNonSolids)
+ anObj = self.ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces,
+ doKeepNonSolids, doGlueAllEdges)
if anObj is None:
raise RuntimeError, "MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode()
return anObj
}
myDetectBtn = new QPushButton (tr("GEOM_DETECT") + aGlueString, GroupPoints2->Box);
mySubShapesChk = new QCheckBox (aSelString, GroupPoints2->Box);
+ myGlueAllEdgesChk = 0;
boxLayout = new QGridLayout(GroupPoints2->Box);
boxLayout->setMargin(0); boxLayout->setSpacing(6);
boxLayout->addWidget(myDetectBtn, 1, 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());
layout->setMargin(0); layout->setSpacing(6);
layout->addWidget(GroupPoints);
aListForGlue->length(added);
GEOM::GEOM_Object_var anObj;
- if (myGlueMode == TopAbs_FACE)
- anObj = anOper->MakeGlueFacesByList(myObject, myTolEdt2->value(), aListForGlue.in(), true);
+ if (myGlueMode == TopAbs_FACE) {
+ bool doGlueAllEdges = myGlueAllEdgesChk->isChecked();
+ anObj = anOper->MakeGlueFacesByList(myObject, myTolEdt2->value(), aListForGlue.in(), true, false);
+ }
else if (myGlueMode == TopAbs_EDGE)
anObj = anOper->MakeGlueEdgesByList(myObject, myTolEdt2->value(), aListForGlue.in());
SalomeApp_DoubleSpinBox* myTolEdt2;
QPushButton* myDetectBtn;
QCheckBox* mySubShapesChk;
+ QCheckBox* myGlueAllEdgesChk;
int myCurrConstrId;