Salome HOME
PR: synchro V6_main tag mergeto_V7_main_11Feb13
[modules/geom.git] / doc / salome / examples / repairing_operations_ex05.py
1 # Suppress Holes
2
3 import geompy
4 import salome
5 gg = salome.ImportComponentGUI("GEOM")
6
7 # create a vertex and a vector
8 p1 = geompy.MakeVertex(35, 35, 0)
9 p2 = geompy.MakeVertex(35, 35, 50)
10 v = geompy.MakeVector(p1, p2)
11
12 # create a cylinder
13 height = 20
14 radius1 = 20
15 cylinder = geompy.MakeCylinder(p1, v, radius1, height)
16
17 # create a cone
18 cone = geompy.MakeCone(p1, v, 70, 0, 80)
19
20 # make a cut
21 cut = geompy.MakeCut(cone, cylinder)
22
23 # get faces as sub-shapes
24 faces = []
25 faces = geompy.SubShapeAllSortedCentres(cut, geompy.ShapeType["FACE"])
26 f_2 = geompy.GetSubShapeID(cut, faces[2])
27
28 # remove one face from the shape
29 cut_without_f_2 = geompy.SuppressFaces(cut, [f_2])
30
31 # get wires as sub-shapes
32 wires = []
33 wires = geompy.SubShapeAllSortedCentres(cut_without_f_2, geompy.ShapeType["WIRE"])
34 w_0 = geompy.GetSubShapeID(cut_without_f_2, wires[0])
35
36 # suppress the selected wire
37 result = geompy.SuppressHoles(cut_without_f_2, [w_0])
38
39 # add objects in the study
40 id_cut = geompy.addToStudy(cut, "Cut")
41 id_cut_without_f_2 = geompy.addToStudy(cut_without_f_2, "Cut without f_2")
42 id_result = geompy.addToStudy(result, "Result")
43
44 # display the results
45 gg.createAndDisplayGO(id_cut)
46 gg.setDisplayMode(id_cut,1)
47 gg.createAndDisplayGO(id_cut_without_f_2)
48 gg.setDisplayMode(id_cut_without_f_2,1)
49 gg.createAndDisplayGO(id_result)
50 gg.setDisplayMode(id_result,1)