6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
8 gg = salome.ImportComponentGUI("GEOM")
10 # create a vertex and a vector
11 p1 = geompy.MakeVertex(35, 35, 0)
12 p2 = geompy.MakeVertex(35, 35, 50)
13 v = geompy.MakeVector(p1, p2)
18 cylinder = geompy.MakeCylinder(p1, v, radius1, height)
21 cone = geompy.MakeCone(p1, v, 70, 0, 80)
24 cut = geompy.MakeCut(cone, cylinder)
26 # get faces as sub-shapes
27 faces = geompy.SubShapeAllSortedCentres(cut, geompy.ShapeType["FACE"])
28 f_2 = geompy.GetSubShapeID(cut, faces[2])
30 # remove one face from the shape
31 cut_without_f_2 = geompy.SuppressFaces(cut, [f_2])
33 # get edges as sub-shapes
34 edges = geompy.SubShapeAllSortedCentres(faces[2], geompy.ShapeType["EDGE"])
35 edge = geompy.GetInPlace(cut_without_f_2, edges[0], True)
36 e_2 = geompy.GetSubShapeID(cut_without_f_2, edge)
38 # suppress a hole using the selected edge
39 result = geompy.SuppressHoles(cut_without_f_2, [e_2])
41 # add objects in the study
42 id_cut = geompy.addToStudy(cut, "Cut")
43 id_cut_without_f_2 = geompy.addToStudy(cut_without_f_2, "Cut without f_2")
44 id_result = geompy.addToStudy(result, "Result")
47 gg.createAndDisplayGO(id_cut)
48 gg.setDisplayMode(id_cut,1)
49 gg.createAndDisplayGO(id_cut_without_f_2)
50 gg.setDisplayMode(id_cut_without_f_2,1)
51 gg.createAndDisplayGO(id_result)
52 gg.setDisplayMode(id_result,1)