Salome HOME
IMPs 19998 and 21191: new gluing by PKV. Documentation updated.
authorjfa <jfa@opencascade.com>
Wed, 27 Apr 2011 13:18:06 +0000 (13:18 +0000)
committerjfa <jfa@opencascade.com>
Wed, 27 Apr 2011 13:18:06 +0000 (13:18 +0000)
doc/salome/gui/GEOM/input/glue_faces_operation.doc
doc/salome/gui/GEOM/input/tui_repairing_operations.doc
src/GEOMImpl/GEOMImpl_IShapesOperations.cxx
src/GEOM_SWIG/geompyDC.py

index ebdbe9c3414f31eb18e97a82c288a8f4464ac141..435a303fa2000fe3632f3779de1464b8f3e52a98 100644 (file)
@@ -5,35 +5,64 @@
 \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/edges that are coincident with respect to the
 given tolerance value.
 
-\n The \b Result will be a \b GEOM_Object.
-
-\n <b>TUI Command:</b>
- <em>geompy.MakeGlueFaces(theShape,theTolerance)</em>,
- where \em theShape is a compound of solids to be glued, \em
- theTolerance is a maximum distance between two faces, which can be
- considered as coincident.
-\n <b>Arguments:</b> Name + Compound of solids + Tolerance value.
+\n <b>Arguments:</b> Name + Compound of shapes + Tolerance value.
 \n <b>Advanced option:</b>
    \ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments".
+\n The \b Result will be a \b GEOM_Object.
 
 \image html glue1.png
-
-\n It is also possible to manually select the faces that will be 
+\n \image html glue4.png
+
+\n <b>TUI Commands:</b>
+ <em>geompy.MakeGlueFaces(theShape,theTolerance,doKeepNonSolids)</em> and
+ <em>geompy.MakeGlueEdges(theShape,theTolerance)</em>,
+ where \em theShape is a compound of shapes to be glued, \em
+ theTolerance is a maximum distance between two faces/edges, which can
+ be considered as coincident. The \em doKeepNonSolids flag allows to
+ throw away non-solids from the result, if false. The \b Result will
+ be a new \b GEOM_Object.
+
+\n It is also possible to manually select the faces/edges that will be 
 glued - select the shape, specify the tolerance and press \b Detect button.
 
 \image html glue2.png
+\n \image html glue5.png
 
-\n \b Geometry module detects the faces where gluing can be performed and
-displays a notification.
+\n \b Geometry module detects the faces/edges where gluing can be
+performed and displays a notification.
 
 \image html glue3.png
 
-\n The faces that can be glued are colored in red.  It is possible to
-select the faces for gluing in the 3D viewer. The selected faces will
-be marked in white.
+\n The faces/edges that can be glued are colored in red. It is
+possible to select the faces/edges for gluing in the 3D viewer.
+The selected faces/edges will be marked in white.
+
+\n For faces gluing their edges are also glued. By default, other
+edges are not glued (this concerns only Glue Faces, of course).
+To force all edges gluing, check the "Glue all coincident edges"
+checkbox.
+
+\n <b>TUI Commands:</b>
+ <em>geompy.GetGlueFaces(theShape,theTolerance)</em> and
+ <em>geompy.GetGlueEdges(theShape,theTolerance)</em>,
+ where \em theShape is a compound of shapes to be glued, \em
+ theTolerance is a maximum distance between two faces/edges, which can
+ be considered as coincident. The \b Result will be a list of \b
+ GEOM_Objects, containing one sub shape per each detected set of
+ coincident sub shapes.
+
+\n <em>geompy.MakeGlueFacesByList(theShape,theTolerance,theFaces,doKeepNonSolids,doGlueAllEdges)</em>
+ and <em>geompy.MakeGlueEdgesByList(theShape,theTolerance,theEdges)</em>,
+ where \em theShape is a compound of shapes to be glued, \em
+ theTolerance is a maximum distance between two faces/edges, which can
+ be considered as coincident, \em theFaces/theEdges is a list of
+ subshapes to be glued. The \em doKeepNonSolids flag allows to throw
+ away non-solids from the result, if false. The \em doGlueAllEdges
+ allows to glue all edges, not only owned by glued faces. The \b
+ Result will be a new \b GEOM_Object.
 
 \n <b>Example:</b>
 
@@ -47,6 +76,7 @@ be marked in white.
 <center><em>Manual selection of faces for gluing</em></center>
 
 Our <b>TUI Scripts</b> provide you with useful examples of the use of
-\ref tui_glue_faces "Repairing Operations".
+<b>Repairing Operations</b> \ref tui_glue_faces "Glue Faces" and \ref
+tui_glue_edges "Glue Edges".
 
 */
index 237440c2fc57cc9ddeb8d2bd208355c15974926c..4b1f067cc9973e99acf73ed397cd930c8e0c8e99 100644 (file)
@@ -289,6 +289,40 @@ gg.createAndDisplayGO(id_glue)
 gg.setDisplayMode(id_glue,1) 
 \endcode
 
+\anchor tui_glue_edges
+<br><h2>Glue Edges</h2>
+
+\code
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create boxes
+box1 = geompy.MakeBox(0,0,0,100,50,100)
+box2 = geompy.MakeBox(100,0,0,250,50,100)
+
+# make compound
+compound = geompy.MakeCompound([box1, box2])
+
+# glue all compound's edges
+tolerance = 1e-5
+glue1 = geompy.MakeGlueEdges(compound, tolerance)
+
+# glue some compound's edges
+list_edges = geompy.GetGlueEdges(compound, tolerance)
+glue2 = geompy.MakeGlueEdgesByList(compound, tolerance, [list_edges[0], list_edges[2]])
+
+# add objects in study
+geompy.addToStudy(box1, "Box1")
+geompy.addToStudy(box2, "Box2")
+geompy.addToStudy(compound, "Compound")
+geompy.addToStudy(glue1, "Glue all edges")
+geompy.addToStudy(glue2, "Glue two edges")
+
+if salome.sg.hasDesktop():
+  salome.sg.updateObjBrowser(1)
+\endcode
+
 \anchor tui_limit_tolerance
 <br><h2>Limit Tolerance</h2>
 
index a9eb02821e9af18bf434d55819ffb85a96688804..11e0ee2fd86adea766c2e72ea3946e9787593e19 100644 (file)
@@ -985,6 +985,8 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueShapes
   Handle(TColStd_HArray1OfInteger) anArray;
   Handle(GEOM_Object) anObj;
 
+  TopTools_ListOfShape listOnePerSet;
+
   const TopTools_DataMapOfShapeListOfShape& aImages = aGluer.Images();
   TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS (aImages);
   for (int index = 1; aItDMSLS.More(); aItDMSLS.Next(), ++index) {
@@ -998,17 +1000,26 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueShapes
     TopoDS_Shape aValue = aLSD.First();
 
     if (aValue.ShapeType() == theType) {
-      anArray = new TColStd_HArray1OfInteger(1,1);
-      anArray->SetValue(1, anIndices.FindIndex(aValue));
-      anObj = GetEngine()->AddSubShape(theShape, anArray);
-      if (!anObj.IsNull()) {
-        aSeq->Append(anObj);
+      listOnePerSet.Append(aValue);
+    }
+  }
 
-        // for python command
-        TDF_Tool::Entry(anObj->GetEntry(), anEntry);
-        anAsciiList += anEntry;
-        anAsciiList += ",";
-      }
+  // for stable order of returned entities
+  GEOMImpl_IShapesOperations::SortShapes(listOnePerSet, Standard_False);
+
+  TopTools_ListIteratorOfListOfShape aListIt (listOnePerSet);
+  for (; aListIt.More(); aListIt.Next()) {
+    TopoDS_Shape aValue = aListIt.Value();
+    anArray = new TColStd_HArray1OfInteger(1,1);
+    anArray->SetValue(1, anIndices.FindIndex(aValue));
+    anObj = GetEngine()->AddSubShape(theShape, anArray);
+    if (!anObj.IsNull()) {
+      aSeq->Append(anObj);
+
+      // for python command
+      TDF_Tool::Entry(anObj->GetEntry(), anEntry);
+      anAsciiList += anEntry;
+      anAsciiList += ",";
     }
   }
 
index 0b0ce1b36d426bfe45c8e8c408891f886578b0cd..68543eecc59b37f9494ae86641884235ca811cec 100644 (file)
@@ -2556,9 +2556,8 @@ class geompyDC(GEOM._objref_GEOM_Gen):
         #                      which can be considered as coincident.
         #  @return ListOfGO.
         #
-        #  @ref swig_todo "Example"
+        #  @ref tui_glue_faces "Example"
         def GetGlueFaces(self, theShape, theTolerance):
-            # Example: see GEOM_Spanner.py
             anObj = self.ShapesOp.GetGlueFaces(theShape, theTolerance)
             RaiseIfFailed("GetGlueFaces", self.ShapesOp)
             return anObj
@@ -2577,10 +2576,9 @@ class geompyDC(GEOM._objref_GEOM_Gen):
         #  @return New GEOM_Object, containing a copy of theShape
         #          without some faces.
         #
-        #  @ref swig_todo "Example"
+        #  @ref tui_glue_faces "Example"
         def MakeGlueFacesByList(self, theShape, theTolerance, theFaces,
                                 doKeepNonSolids=True, doGlueAllEdges=True):
-            # Example: see GEOM_Spanner.py
             anObj = self.ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces,
                                                       doKeepNonSolids, doGlueAllEdges)
             if anObj is None:
@@ -2592,9 +2590,8 @@ class geompyDC(GEOM._objref_GEOM_Gen):
         #  @param theTolerance Maximum distance between edges, which can be considered as coincident.
         #  @return New GEOM_Object, containing a copy of theShape without coincident edges.
         #
-        #  @ref tui_glue_faces "Example"
+        #  @ref tui_glue_edges "Example"
         def MakeGlueEdges(self, theShape, theTolerance):
-            # Example: see GEOM_Spanner.py
             theTolerance,Parameters = ParseParameters(theTolerance)
             anObj = self.ShapesOp.MakeGlueEdges(theShape, theTolerance)
             if anObj is None:
@@ -2608,9 +2605,8 @@ class geompyDC(GEOM._objref_GEOM_Gen):
         #                      which can be considered as coincident.
         #  @return ListOfGO.
         #
-        #  @ref tui_glue_faces "Example"
+        #  @ref tui_glue_edges "Example"
         def GetGlueEdges(self, theShape, theTolerance):
-            # Example: see GEOM_Spanner.py
             anObj = self.ShapesOp.GetGlueEdges(theShape, theTolerance)
             RaiseIfFailed("GetGlueEdges", self.ShapesOp)
             return anObj
@@ -2624,9 +2620,8 @@ class geompyDC(GEOM._objref_GEOM_Gen):
         #  @return New GEOM_Object, containing a copy of theShape
         #          without some edges.
         #
-        #  @ref tui_glue_faces "Example"
+        #  @ref tui_glue_edges "Example"
         def MakeGlueEdgesByList(self, theShape, theTolerance, theEdges):
-            # Example: see GEOM_Spanner.py
             anObj = self.ShapesOp.MakeGlueEdgesByList(theShape, theTolerance, theEdges)
             if anObj is None:
                 raise RuntimeError, "MakeGlueEdgesByList : " + self.ShapesOp.GetErrorCode()