]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
IMPs 19998 and 21191: new gluing by PKV. Add option to glue all edges in MakeGlueFace...
authorjfa <jfa@opencascade.com>
Mon, 25 Apr 2011 13:49:48 +0000 (13:49 +0000)
committerjfa <jfa@opencascade.com>
Mon, 25 Apr 2011 13:49:48 +0000 (13:49 +0000)
21 files changed:
doc/salome/gui/GEOM/images/glue2.png
doc/salome/gui/GEOM/images/glue4.png [new file with mode: 0644]
doc/salome/gui/GEOM/images/glue5.png [new file with mode: 0644]
doc/salome/gui/GEOM/images/projection_dlg.png [new file with mode: 0644]
doc/salome/gui/GEOM/images/projection_preview.png [new file with mode: 0644]
doc/salome/gui/GEOM/input/glue_faces_operation.doc
idl/GEOM_Gen.idl
idl/GEOM_Superv.idl
src/GEOMGUI/GEOM_msg_en.ts
src/GEOMImpl/GEOMImpl_GlueDriver.cxx
src/GEOMImpl/GEOMImpl_GlueDriver.hxx
src/GEOMImpl/GEOMImpl_IGlue.hxx
src/GEOMImpl/GEOMImpl_IShapesOperations.cxx
src/GEOMImpl/GEOMImpl_IShapesOperations.hxx
src/GEOM_I/GEOM_IShapesOperations_i.cc
src/GEOM_I/GEOM_IShapesOperations_i.hh
src/GEOM_I_Superv/GEOM_Superv_i.cc
src/GEOM_I_Superv/GEOM_Superv_i.hh
src/GEOM_SWIG/geompyDC.py
src/RepairGUI/RepairGUI_GlueDlg.cxx
src/RepairGUI/RepairGUI_GlueDlg.h

index 08fb4f97e159e01793a30673448ad3c8c411c25e..2df8a68b4d57f1c4f99fa8d0eeb4c6bab818923c 100644 (file)
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 (file)
index 0000000..32e07ec
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 (file)
index 0000000..3a9a266
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 (file)
index 0000000..ac912b9
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 (file)
index 0000000..85d767e
Binary files /dev/null and b/doc/salome/gui/GEOM/images/projection_preview.png differ
index f940075d56fb1fb22191e78330fc2f7860439244..ebdbe9c3414f31eb18e97a82c288a8f4464ac141 100644 (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 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.
index 7128e76a279d3dbdeb957fd4f4a979fa20044648..a63bd51c624a3f76f3aa4c533505fbebfae528f8 100644 (file)
@@ -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 <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.
index 0eb9b049ddc1e803e1d29b06804c0190e2ec9499..7d961a6e9a60af25d8c0961e793f964532b56c6e 100644 (file)
@@ -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) ;
index bb2b19e523120e2ecd4d3cc7d9472faaf4e553f6..ab1af6650d125296f5e5891349caabc8d91e6eb3 100644 (file)
@@ -4709,6 +4709,10 @@ Please close this message box and select edges for gluing</translation>
         <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>
index 1d4de69309f17ef53335ab072b02deac85987bae..342866ea8b93e5f5cdff578e387fce07d8dbf6d9 100644 (file)
@@ -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;
index c5eb5e22dd729ffb2f3e16af494c11b1bc58ba14..d83a8d75d701ad19e08df791ec072aba01bb24fa 100644 (file)
@@ -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
index 0fc27f0a9e023e951160a939fb73c48a560fdff1..c57d935febc6d3d713dee9a129e9988827f8a483 100644 (file)
 //  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>
@@ -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;
index 710c3e5ea3870f2c00ae2808749f12a6f27cb2a6..a9eb02821e9af18bf434d55819ffb85a96688804 100644 (file)
@@ -808,7 +808,8 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::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)
 {
   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<Handle(GEOM_Object)>::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);
index 14b41aeafd7a4be662daef770e618f775daa9095..25666f82a1973b1caa71d06bead449ce3e24ed17 100644 (file)
@@ -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<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);
index 8b441c0d3b6f5e7ec9dd22b2c0741220fb6242dd..ac17b55cccdcb605984279ba5a0e11f266664ab7 100644 (file)
@@ -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())
index 1150b62394fc7ef9fc2ac72f4191a385c39a5a0b..32ace82ad4d28944da4f23b1e73bae4d5e800d30 100644 (file)
@@ -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);
index dda0a3bcd3fa98482a146c59e178e55d1b23e92e..fd391345a86d8b0a3dcc902cca500ad6d891bfdf 100644 (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,
                                                           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;
 }
index 81517c037628cd1457998434f0bf78e7b15e6ce0..2d4625b0c905290255c59de728f42b9ae14cd5ec 100644 (file)
@@ -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);
index 418cd2b420b8a5e96a4614e557ead33f00e314fb..0b0ce1b36d426bfe45c8e8c408891f886578b0cd 100644 (file)
@@ -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 <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
index e8317fa29401e8619e561e8b9d32981077a5614f..4c8b9d6b29137978b4129bd3714eff9eb0a15797 100644 (file)
@@ -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());
 
index e03e83f5f4882410ce3f4dac8ca6f09d495c5314..0975e8e9773fe7a8071228928e013fdf712d09a5 100644 (file)
@@ -81,6 +81,7 @@ private:
   SalomeApp_DoubleSpinBox*           myTolEdt2;
   QPushButton*                       myDetectBtn;
   QCheckBox*                         mySubShapesChk;
+  QCheckBox*                         myGlueAllEdgesChk;
 
   int                                myCurrConstrId;