3 \page tui_working_with_groups_page Working with Groups
5 <br><h2>Creation of a group</h2>
10 gg = salome.ImportComponentGUI("GEOM")
13 p0 = geompy.MakeVertex(0. , 0. , 0. )
14 p200 = geompy.MakeVertex(200., 200., 200.)
16 # create a box from two points
17 Box = geompy.MakeBoxTwoPnt(p0, p200)
19 # create a group from the faces of the box
20 group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
22 # add objects to the group
23 SubFaceList = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"])
25 FaceID = geompy.GetSubShapeID(Box, SubFaceList[i])
26 geompy.AddObject(group, FaceID)
28 # add all selected shapes from the list to the group
29 # (the program doesn't raise error, if some shapes are already included)
30 geompy.UnionList(group, [SubFaceList[0], SubFaceList[2], SubFaceList[5]])
32 # remove an object from the group
33 geompy.RemoveObject(group, FaceID)
35 # remove all selected shapes from the group
36 # (the program doesn't raise error, if some shapes are not included)
37 geompy.DifferenceList(group, [SubFaceList[2], SubFaceList[3], SubFaceList[4]])
38 id_group1 = geompy.addToStudy(group, "Group1")
40 # display the contents of the group
41 gg.createAndDisplayGO(id_group1)
42 salome.sg.updateObjBrowser(1)
45 <br><h2>Adding an object to the group</h2>
50 gg = salome.ImportComponentGUI("GEOM")
53 p0 = geompy.MakeVertex(0. , 0. , 0. )
54 p200 = geompy.MakeVertex(200., 200., 200.)
56 # create a box from two points
57 Box = geompy.MakeBoxTwoPnt(p0, p200)
59 # create a group from the faces of the box
60 group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
62 # add objects to the group
63 SubFaceList = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"])
65 FaceID = geompy.GetSubShapeID(Box, SubFaceList[i])
66 geompy.AddObject(group, FaceID)
67 id_group1 = geompy.addToStudy(group, "Group1")
69 # display the contents of the group
70 gg.createAndDisplayGO(id_group1)
71 salome.sg.updateObjBrowser(1)
74 <br><h2>Removing an object from the group</h2>
79 gg = salome.ImportComponentGUI("GEOM")
82 p0 = geompy.MakeVertex(0. , 0. , 0. )
83 p200 = geompy.MakeVertex(200., 200., 200.)
85 # create a box from two points
86 Box = geompy.MakeBoxTwoPnt(p0, p200)
88 # create a group from the faces of the box
89 group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
91 # add objects to the group
92 SubFaceList = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"])
94 FaceID = geompy.GetSubShapeID(Box, SubFaceList[i])
95 geompy.AddObject(group, FaceID)
97 # add all selected shapes from the list to the group
98 # (the program doesn't raise errors, if some shapes are already included)
99 geompy.UnionList(group, [SubFaceList[0], SubFaceList[2], SubFaceList[5]])
101 # remove an object from the group
102 geompy.RemoveObject(group, FaceID)
103 id_group1 = geompy.addToStudy(group, "Group1")
105 # display the contents of the group
106 gg.createAndDisplayGO(id_group1)
107 salome.sg.updateObjBrowser(1)