3 \page tui_working_with_groups_page Working with Groups
6 \anchor tui_create_groups_anchor
7 <h2>Creation of a group</h2>
12 gg = salome.ImportComponentGUI("GEOM")
15 p0 = geompy.MakeVertex(0. , 0. , 0. )
16 p200 = geompy.MakeVertex(200., 200., 200.)
18 # create a box from two points
19 Box = geompy.MakeBoxTwoPnt(p0, p200)
21 # create a group from the faces of the box
22 group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
24 # add objects to the group
25 SubFaceList = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"])
27 FaceID = geompy.GetSubShapeID(Box, SubFaceList[i])
28 geompy.AddObject(group, FaceID)
30 # add all selected shapes from the list to the group
31 # (the program doesn't raise error, if some shapes are already included)
32 geompy.UnionList(group, [SubFaceList[0], SubFaceList[2], SubFaceList[5]])
34 # remove an object from the group
35 geompy.RemoveObject(group, FaceID)
37 # remove all selected shapes from the group
38 # (the program doesn't raise error, if some shapes are not included)
39 geompy.DifferenceList(group, [SubFaceList[2], SubFaceList[3], SubFaceList[4]])
40 id_group1 = geompy.addToStudy(group, "Group1")
42 # display the contents of the group
43 gg.createAndDisplayGO(id_group1)
44 salome.sg.updateObjBrowser(1)
47 \anchor tui_edit_groups_anchor
49 <br><h2>Adding an object to the group</h2>
54 gg = salome.ImportComponentGUI("GEOM")
57 p0 = geompy.MakeVertex(0. , 0. , 0. )
58 p200 = geompy.MakeVertex(200., 200., 200.)
60 # create a box from two points
61 Box = geompy.MakeBoxTwoPnt(p0, p200)
63 # create a group from the faces of the box
64 group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
66 # add objects to the group
67 SubFaceList = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"])
69 FaceID = geompy.GetSubShapeID(Box, SubFaceList[i])
70 geompy.AddObject(group, FaceID)
71 id_group1 = geompy.addToStudy(group, "Group1")
73 # display the contents of the group
74 gg.createAndDisplayGO(id_group1)
75 salome.sg.updateObjBrowser(1)
78 <br><h2>Removing an object from the group</h2>
83 gg = salome.ImportComponentGUI("GEOM")
86 p0 = geompy.MakeVertex(0. , 0. , 0. )
87 p200 = geompy.MakeVertex(200., 200., 200.)
89 # create a box from two points
90 Box = geompy.MakeBoxTwoPnt(p0, p200)
92 # create a group from the faces of the box
93 group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
95 # add objects to the group
96 SubFaceList = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"])
98 FaceID = geompy.GetSubShapeID(Box, SubFaceList[i])
99 geompy.AddObject(group, FaceID)
101 # add all selected shapes from the list to the group
102 # (the program doesn't raise errors, if some shapes are already included)
103 geompy.UnionList(group, [SubFaceList[0], SubFaceList[2], SubFaceList[5]])
105 # remove an object from the group
106 geompy.RemoveObject(group, FaceID)
107 id_group1 = geompy.addToStudy(group, "Group1")
109 # display the contents of the group
110 gg.createAndDisplayGO(id_group1)
111 salome.sg.updateObjBrowser(1)
115 \anchor tui_union_groups_anchor
116 <h2>Union Groups</h2>
122 # create a box and some groups of faces on it
123 Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
124 Group_1 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
125 geompy.UnionIDs(Group_1, [13, 23])
126 Group_2 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
127 geompy.UnionIDs(Group_2, [3, 27])
128 Group_3 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
129 geompy.UnionIDs(Group_3, [33, 23])
130 Group_4 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
131 geompy.UnionIDs(Group_4, [31, 27])
134 Group_U_1_2 = geompy.UnionGroups(Group_1, Group_2)
135 Group_UL_3_4 = geompy.UnionListOfGroups([Group_3, Group_4])
138 geompy.addToStudy(Box_1, 'Box_1')
139 geompy.addToStudyInFather(Box_1, Group_1, 'Group_1')
140 geompy.addToStudyInFather(Box_1, Group_2, 'Group_2')
141 geompy.addToStudyInFather(Box_1, Group_3, 'Group_3')
142 geompy.addToStudyInFather(Box_1, Group_4, 'Group_4')
143 geompy.addToStudyInFather(Box_1, Group_U_1_2, 'Group_U_1_2')
144 geompy.addToStudyInFather(Box_1, Group_UL_3_4, 'Group_UL_3_4')
145 salome.sg.updateObjBrowser(1)
149 \anchor tui_intersect_groups_anchor
150 <h2>Intersect Groups</h2>
156 # create a box and some groups of faces on it
157 Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
158 Group_1 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
159 geompy.UnionIDs(Group_1, [13, 23])
160 Group_2 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
161 geompy.UnionIDs(Group_2, [3, 27])
162 Group_3 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
163 geompy.UnionIDs(Group_3, [33, 23])
164 Group_4 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
165 geompy.UnionIDs(Group_4, [31, 27])
168 Group_I_1_3 = geompy.IntersectGroups(Group_1, Group_3)
169 Group_IL_1_3 = geompy.IntersectListOfGroups([Group_1, Group_3])
172 geompy.addToStudy(Box_1, 'Box_1')
173 geompy.addToStudyInFather(Box_1, Group_1, 'Group_1')
174 geompy.addToStudyInFather(Box_1, Group_2, 'Group_2')
175 geompy.addToStudyInFather(Box_1, Group_3, 'Group_3')
176 geompy.addToStudyInFather(Box_1, Group_4, 'Group_4')
177 geompy.addToStudyInFather(Box_1, Group_I_1_3, 'Group_I_1_3')
178 geompy.addToStudyInFather(Box_1, Group_IL_1_3, 'Group_IL_1_3')
179 salome.sg.updateObjBrowser(1)
184 \anchor tui_cut_groups_anchor
191 # create a box and some groups of faces on it
192 Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
193 Group_1 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
194 geompy.UnionIDs(Group_1, [13, 23])
195 Group_2 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
196 geompy.UnionIDs(Group_2, [3, 27])
197 Group_3 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
198 geompy.UnionIDs(Group_3, [33, 23])
199 Group_4 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
200 geompy.UnionIDs(Group_4, [31, 27])
203 Group_C_2_4 = geompy.CutGroups(Group_2, Group_4)
204 Group_CL_2_4 = geompy.CutListOfGroups([Group_2], [Group_4])
207 geompy.addToStudy(Box_1, 'Box_1')
208 geompy.addToStudyInFather(Box_1, Group_1, 'Group_1')
209 geompy.addToStudyInFather(Box_1, Group_2, 'Group_2')
210 geompy.addToStudyInFather(Box_1, Group_3, 'Group_3')
211 geompy.addToStudyInFather(Box_1, Group_4, 'Group_4')
212 geompy.addToStudyInFather(Box_1, Group_C_2_4, 'Group_C_2_4')
213 geompy.addToStudyInFather(Box_1, Group_CL_2_4, 'Group_CL_2_4')
214 salome.sg.updateObjBrowser(1)