From: jfa Date: Mon, 25 Apr 2011 13:49:48 +0000 (+0000) Subject: IMPs 19998 and 21191: new gluing by PKV. Add option to glue all edges in MakeGlueFace... X-Git-Tag: V6_3_0b1~18 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5adc9568546295ec63619094f30e0d1c63310395;p=modules%2Fgeom.git IMPs 19998 and 21191: new gluing by PKV. Add option to glue all edges in MakeGlueFacesByList (old behaviour). --- diff --git a/doc/salome/gui/GEOM/images/glue2.png b/doc/salome/gui/GEOM/images/glue2.png index 08fb4f97e..2df8a68b4 100644 Binary files a/doc/salome/gui/GEOM/images/glue2.png and b/doc/salome/gui/GEOM/images/glue2.png differ diff --git a/doc/salome/gui/GEOM/images/glue4.png b/doc/salome/gui/GEOM/images/glue4.png new file mode 100644 index 000000000..32e07ec22 Binary files /dev/null and b/doc/salome/gui/GEOM/images/glue4.png differ diff --git a/doc/salome/gui/GEOM/images/glue5.png b/doc/salome/gui/GEOM/images/glue5.png new file mode 100644 index 000000000..3a9a266e2 Binary files /dev/null and b/doc/salome/gui/GEOM/images/glue5.png differ diff --git a/doc/salome/gui/GEOM/images/projection_dlg.png b/doc/salome/gui/GEOM/images/projection_dlg.png new file mode 100644 index 000000000..ac912b9a8 Binary files /dev/null and b/doc/salome/gui/GEOM/images/projection_dlg.png differ diff --git a/doc/salome/gui/GEOM/images/projection_preview.png b/doc/salome/gui/GEOM/images/projection_preview.png new file mode 100644 index 000000000..85d767eab Binary files /dev/null and b/doc/salome/gui/GEOM/images/projection_preview.png differ diff --git a/doc/salome/gui/GEOM/input/glue_faces_operation.doc b/doc/salome/gui/GEOM/input/glue_faces_operation.doc index f940075d5..ebdbe9c34 100644 --- a/doc/salome/gui/GEOM/input/glue_faces_operation.doc +++ b/doc/salome/gui/GEOM/input/glue_faces_operation.doc @@ -1,8 +1,9 @@ /*! -\page glue_faces_operation_page Glue Faces +\page glue_faces_operation_page Glue Faces / Edges \n To Glue Faces in the Main Menu select Repair - > Glue Faces. +\n To Glue Edges in the Main Menu select Repair - > Glue Edges. \n This operation glues faces that are coincident with respect to the given tolerance value. diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 7128e76a2..a63bd51c6 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -1494,10 +1494,14 @@ module GEOM * \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 theShape + * will be glued, otherwise only the edges, + * belonging to theFaces. * \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. diff --git a/idl/GEOM_Superv.idl b/idl/GEOM_Superv.idl index 0eb9b049d..7d961a6e9 100644 --- a/idl/GEOM_Superv.idl +++ b/idl/GEOM_Superv.idl @@ -392,7 +392,8 @@ module GEOM 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) ; diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index bb2b19e52..ab1af6650 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -4709,6 +4709,10 @@ Please close this message box and select edges for gluing SELECT_EDGES Select Edges + + GLUE_ALL_EDGES + Glue all coincident edges + THERE_ARE_NO_FACES_FOR_GLUING There are no faces for gluing diff --git a/src/GEOMImpl/GEOMImpl_GlueDriver.cxx b/src/GEOMImpl/GEOMImpl_GlueDriver.cxx index 1d4de6930..342866ea8 100644 --- a/src/GEOMImpl/GEOMImpl_GlueDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_GlueDriver.cxx @@ -561,7 +561,8 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueWithWarnings (const TopoDS_Shape& theShape 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; @@ -606,12 +607,19 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueByList (const TopoDS_Shape& theShape, 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 @@ -709,8 +717,13 @@ Standard_Integer GEOMImpl_GlueDriver::Execute(TFunction_Logbook& log) const 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; diff --git a/src/GEOMImpl/GEOMImpl_GlueDriver.hxx b/src/GEOMImpl/GEOMImpl_GlueDriver.hxx index c5eb5e22d..d83a8d75d 100644 --- a/src/GEOMImpl/GEOMImpl_GlueDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_GlueDriver.hxx @@ -174,7 +174,8 @@ Standard_EXPORT TopoDS_Shape GlueWithWarnings (const TopoDS_Shape& theShape, 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 diff --git a/src/GEOMImpl/GEOMImpl_IGlue.hxx b/src/GEOMImpl/GEOMImpl_IGlue.hxx index 0fc27f0a9..c57d935fe 100644 --- a/src/GEOMImpl/GEOMImpl_IGlue.hxx +++ b/src/GEOMImpl/GEOMImpl_IGlue.hxx @@ -18,10 +18,9 @@ // 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 @@ -30,6 +29,7 @@ #define GLUE_ARG_TOLER 2 #define GLUE_ARG_FACES 3 #define GLUE_ARG_KEEPALL 4 +#define GLUE_ARG_GLUEEDG 5 class GEOMImpl_IGlue { @@ -56,6 +56,9 @@ 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; diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx index 710c3e5ea..a9eb02821 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx @@ -808,7 +808,8 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList (Handle(GEOM_Object) theShape, const Standard_Real theTolerance, std::list theFaces, - const Standard_Boolean doKeepNonSolids) + const Standard_Boolean doKeepNonSolids, + const Standard_Boolean doGlueAllEdges) { SetErrorCode(KO); @@ -833,6 +834,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList aCI.SetBase(aRefShape); aCI.SetTolerance(theTolerance); aCI.SetKeepNonSolids(doKeepNonSolids); + aCI.SetGlueAllEdges(doGlueAllEdges); Handle(TColStd_HSequenceOfTransient) aFaces = new TColStd_HSequenceOfTransient; std::list::iterator it = theFaces.begin(); @@ -881,7 +883,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList pd << ", " << (*it++); } } - pd << "])"; + pd << "], " << (bool)doKeepNonSolids << ", " << (bool)doGlueAllEdges << ")"; // to provide warning if (!isWarning) SetErrorCode(OK); diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx index 14b41aeaf..25666f82a 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx @@ -96,7 +96,8 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations Standard_EXPORT Handle(GEOM_Object) MakeGlueFacesByList (Handle(GEOM_Object) theShape, const Standard_Real theTolerance, std::list 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); diff --git a/src/GEOM_I/GEOM_IShapesOperations_i.cc b/src/GEOM_I/GEOM_IShapesOperations_i.cc index 8b441c0d3..ac17b55cc 100644 --- a/src/GEOM_I/GEOM_IShapesOperations_i.cc +++ b/src/GEOM_I/GEOM_IShapesOperations_i.cc @@ -442,7 +442,8 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::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_var aGEOMObject; @@ -465,7 +466,7 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList //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()) diff --git a/src/GEOM_I/GEOM_IShapesOperations_i.hh b/src/GEOM_I/GEOM_IShapesOperations_i.hh index 1150b6239..32ace82ad 100644 --- a/src/GEOM_I/GEOM_IShapesOperations_i.hh +++ b/src/GEOM_I/GEOM_IShapesOperations_i.hh @@ -80,7 +80,8 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i : 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); diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index dda0a3bcd..fd391345a 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -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, 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; } diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.hh b/src/GEOM_I_Superv/GEOM_Superv_i.hh index 81517c037..2d4625b0c 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.hh +++ b/src/GEOM_I_Superv/GEOM_Superv_i.hh @@ -486,7 +486,8 @@ public: 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); diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index 418cd2b42..0b0ce1b36 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -2571,13 +2571,18 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @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 theShape + # will be glued, otherwise only the edges, + # belonging to theFaces. # @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 diff --git a/src/RepairGUI/RepairGUI_GlueDlg.cxx b/src/RepairGUI/RepairGUI_GlueDlg.cxx index e8317fa29..4c8b9d6b2 100644 --- a/src/RepairGUI/RepairGUI_GlueDlg.cxx +++ b/src/RepairGUI/RepairGUI_GlueDlg.cxx @@ -128,6 +128,7 @@ RepairGUI_GlueDlg::RepairGUI_GlueDlg(GeometryGUI* theGeometryGUI, QWidget* paren } 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); @@ -136,6 +137,12 @@ RepairGUI_GlueDlg::RepairGUI_GlueDlg(GeometryGUI* theGeometryGUI, QWidget* paren 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); @@ -483,8 +490,10 @@ bool RepairGUI_GlueDlg::execute(ObjectList& objects) 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()); diff --git a/src/RepairGUI/RepairGUI_GlueDlg.h b/src/RepairGUI/RepairGUI_GlueDlg.h index e03e83f5f..0975e8e97 100644 --- a/src/RepairGUI/RepairGUI_GlueDlg.h +++ b/src/RepairGUI/RepairGUI_GlueDlg.h @@ -81,6 +81,7 @@ private: SalomeApp_DoubleSpinBox* myTolEdt2; QPushButton* myDetectBtn; QCheckBox* mySubShapesChk; + QCheckBox* myGlueAllEdgesChk; int myCurrConstrId;