IMPs 19998 and 21191: new gluing by PKV. Documentation updated.

This commit is contained in:
jfa 2011-04-27 13:18:06 +00:00
parent e6b408ca5e
commit bf04ae3297
4 changed files with 106 additions and 36 deletions

View 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 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 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. given tolerance value.
\n The \b Result will be a \b GEOM_Object. \n <b>Arguments:</b> Name + Compound of shapes + Tolerance value.
\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>Advanced option:</b> \n <b>Advanced option:</b>
\ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments". \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 \image html glue1.png
\n \image html glue4.png
\n It is also possible to manually select the faces that will be \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. glued - select the shape, specify the tolerance and press \b Detect button.
\image html glue2.png \image html glue2.png
\n \image html glue5.png
\n \b Geometry module detects the faces where gluing can be performed and \n \b Geometry module detects the faces/edges where gluing can be
displays a notification. performed and displays a notification.
\image html glue3.png \image html glue3.png
\n The faces that can be glued are colored in red. It is possible to \n The faces/edges that can be glued are colored in red. It is
select the faces for gluing in the 3D viewer. The selected faces will possible to select the faces/edges for gluing in the 3D viewer.
be marked in white. 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> \n <b>Example:</b>
@ -47,6 +76,7 @@ be marked in white.
<center><em>Manual selection of faces for gluing</em></center> <center><em>Manual selection of faces for gluing</em></center>
Our <b>TUI Scripts</b> provide you with useful examples of the use of 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".
*/ */

View File

@ -289,6 +289,40 @@ gg.createAndDisplayGO(id_glue)
gg.setDisplayMode(id_glue,1) gg.setDisplayMode(id_glue,1)
\endcode \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 \anchor tui_limit_tolerance
<br><h2>Limit Tolerance</h2> <br><h2>Limit Tolerance</h2>

View File

@ -985,6 +985,8 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueShapes
Handle(TColStd_HArray1OfInteger) anArray; Handle(TColStd_HArray1OfInteger) anArray;
Handle(GEOM_Object) anObj; Handle(GEOM_Object) anObj;
TopTools_ListOfShape listOnePerSet;
const TopTools_DataMapOfShapeListOfShape& aImages = aGluer.Images(); const TopTools_DataMapOfShapeListOfShape& aImages = aGluer.Images();
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS (aImages); TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS (aImages);
for (int index = 1; aItDMSLS.More(); aItDMSLS.Next(), ++index) { for (int index = 1; aItDMSLS.More(); aItDMSLS.Next(), ++index) {
@ -998,17 +1000,26 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueShapes
TopoDS_Shape aValue = aLSD.First(); TopoDS_Shape aValue = aLSD.First();
if (aValue.ShapeType() == theType) { if (aValue.ShapeType() == theType) {
anArray = new TColStd_HArray1OfInteger(1,1); listOnePerSet.Append(aValue);
anArray->SetValue(1, anIndices.FindIndex(aValue)); }
anObj = GetEngine()->AddSubShape(theShape, anArray); }
if (!anObj.IsNull()) {
aSeq->Append(anObj);
// for python command // for stable order of returned entities
TDF_Tool::Entry(anObj->GetEntry(), anEntry); GEOMImpl_IShapesOperations::SortShapes(listOnePerSet, Standard_False);
anAsciiList += anEntry;
anAsciiList += ","; 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 += ",";
} }
} }

View File

@ -2556,9 +2556,8 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# which can be considered as coincident. # which can be considered as coincident.
# @return ListOfGO. # @return ListOfGO.
# #
# @ref swig_todo "Example" # @ref tui_glue_faces "Example"
def GetGlueFaces(self, theShape, theTolerance): def GetGlueFaces(self, theShape, theTolerance):
# Example: see GEOM_Spanner.py
anObj = self.ShapesOp.GetGlueFaces(theShape, theTolerance) anObj = self.ShapesOp.GetGlueFaces(theShape, theTolerance)
RaiseIfFailed("GetGlueFaces", self.ShapesOp) RaiseIfFailed("GetGlueFaces", self.ShapesOp)
return anObj return anObj
@ -2577,10 +2576,9 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @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 tui_glue_faces "Example"
def MakeGlueFacesByList(self, theShape, theTolerance, theFaces, def MakeGlueFacesByList(self, theShape, theTolerance, theFaces,
doKeepNonSolids=True, doGlueAllEdges=True): doKeepNonSolids=True, doGlueAllEdges=True):
# Example: see GEOM_Spanner.py
anObj = self.ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces, anObj = self.ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces,
doKeepNonSolids, doGlueAllEdges) doKeepNonSolids, doGlueAllEdges)
if anObj is None: 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. # @param theTolerance Maximum distance between edges, which can be considered as coincident.
# @return New GEOM_Object, containing a copy of theShape without coincident edges. # @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): def MakeGlueEdges(self, theShape, theTolerance):
# Example: see GEOM_Spanner.py
theTolerance,Parameters = ParseParameters(theTolerance) theTolerance,Parameters = ParseParameters(theTolerance)
anObj = self.ShapesOp.MakeGlueEdges(theShape, theTolerance) anObj = self.ShapesOp.MakeGlueEdges(theShape, theTolerance)
if anObj is None: if anObj is None:
@ -2608,9 +2605,8 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# which can be considered as coincident. # which can be considered as coincident.
# @return ListOfGO. # @return ListOfGO.
# #
# @ref tui_glue_faces "Example" # @ref tui_glue_edges "Example"
def GetGlueEdges(self, theShape, theTolerance): def GetGlueEdges(self, theShape, theTolerance):
# Example: see GEOM_Spanner.py
anObj = self.ShapesOp.GetGlueEdges(theShape, theTolerance) anObj = self.ShapesOp.GetGlueEdges(theShape, theTolerance)
RaiseIfFailed("GetGlueEdges", self.ShapesOp) RaiseIfFailed("GetGlueEdges", self.ShapesOp)
return anObj return anObj
@ -2624,9 +2620,8 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @return New GEOM_Object, containing a copy of theShape # @return New GEOM_Object, containing a copy of theShape
# without some edges. # without some edges.
# #
# @ref tui_glue_faces "Example" # @ref tui_glue_edges "Example"
def MakeGlueEdgesByList(self, theShape, theTolerance, theEdges): def MakeGlueEdgesByList(self, theShape, theTolerance, theEdges):
# Example: see GEOM_Spanner.py
anObj = self.ShapesOp.MakeGlueEdgesByList(theShape, theTolerance, theEdges) anObj = self.ShapesOp.MakeGlueEdgesByList(theShape, theTolerance, theEdges)
if anObj is None: if anObj is None:
raise RuntimeError, "MakeGlueEdgesByList : " + self.ShapesOp.GetErrorCode() raise RuntimeError, "MakeGlueEdgesByList : " + self.ShapesOp.GetErrorCode()