]> SALOME platform Git repositories - modules/shaper.git/blob - src/PythonAPI/model/features/group.py
Salome HOME
e6a7602ac8f639c839598cd30732617fb8894f97
[modules/shaper.git] / src / PythonAPI / model / features / group.py
1 """Group Interface
2 Author: Sergey Pokhodenko
3 Copyright (C) 2014-20xx CEA/DEN, EDF R&D
4 """
5
6 from model.roots import Interface
7
8
9 def addGroup(part, *args):
10     """Add an Group feature to the Part and return Group.
11
12     Pass all args to Group __init__ function.
13     """
14     assert(args)
15     feature = part.addFeature("Group")
16     return Group(feature, *args)
17
18
19 class Group(Interface):
20
21     def __init__(self, feature, *args):
22         Interface.__init__(self, feature)
23         assert(self._feature.getKind() == "Group")
24
25         self._group_list = self._feature.data().selectionList("group_list")
26
27         assert(self._group_list)
28
29         if not args:
30             return
31
32         assert(len(args) == 1)
33         self.setGroupList(args[0])
34
35         self._execute()
36         pass
37
38     def setGroupList(self, main_objects):
39         """Modify group_list attribute of the feature.
40
41         See __init__.
42         """
43         self._fill_attribute(self._group_list, group_list)
44         pass