Salome HOME
Merge from V6_main 11/02/2013
[modules/geom.git] / doc / salome / examples / working_with_groups_ex02.py
1 # Adding an object to the group
2
3 import geompy
4 import salome
5 gg = salome.ImportComponentGUI("GEOM")
6
7 # create two vertices
8 p0 = geompy.MakeVertex(0.  , 0.  , 0.  )
9 p200 = geompy.MakeVertex(200., 200., 200.)
10
11 # create a box from two points
12 Box = geompy.MakeBoxTwoPnt(p0, p200)
13
14 # create a group from the faces of the box
15 group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
16
17 # add objects to the group
18 SubFaceList = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"])
19 for i in [0, 3, 5] :
20     FaceID = geompy.GetSubShapeID(Box, SubFaceList[i])
21     geompy.AddObject(group, FaceID)
22 id_group1 = geompy.addToStudy(group, "Group1")
23
24 # display the contents of the group
25 gg.createAndDisplayGO(id_group1)
26 salome.sg.updateObjBrowser(1)