Salome HOME
Synchronize adm files
[modules/geom.git] / doc / salome / examples / repairing_operations_ex05.py
old mode 100644 (file)
new mode 100755 (executable)
index f6593b3..e5fef2b
@@ -1,7 +1,10 @@
 # Suppress Holes
 
-import geompy
 import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
 gg = salome.ImportComponentGUI("GEOM")
 
 # create a vertex and a vector
@@ -21,20 +24,19 @@ cone = geompy.MakeCone(p1, v, 70, 0, 80)
 cut = geompy.MakeCut(cone, cylinder)
 
 # get faces as sub-shapes
-faces = []
 faces = geompy.SubShapeAllSortedCentres(cut, geompy.ShapeType["FACE"])
 f_2 = geompy.GetSubShapeID(cut, faces[2])
 
 # remove one face from the shape
 cut_without_f_2 = geompy.SuppressFaces(cut, [f_2])
 
-# get wires as sub-shapes
-wires = []
-wires = geompy.SubShapeAllSortedCentres(cut_without_f_2, geompy.ShapeType["WIRE"])
-w_0 = geompy.GetSubShapeID(cut_without_f_2, wires[0])
+# get edges as sub-shapes
+edges = geompy.SubShapeAllSortedCentres(faces[2], geompy.ShapeType["EDGE"])
+edge  = geompy.GetInPlace(cut_without_f_2, edges[0], True)
+e_2 = geompy.GetSubShapeID(cut_without_f_2, edge)
 
-# suppress the selected wire
-result = geompy.SuppressHoles(cut_without_f_2, [w_0])
+# suppress a hole using the selected edge
+result = geompy.SuppressHoles(cut_without_f_2, [e_2])
 
 # add objects in the study
 id_cut = geompy.addToStudy(cut, "Cut")