]> SALOME platform Git repositories - modules/shaper.git/blob - src/PythonAPI/model/features/group.py
Salome HOME
d0c4207e6983dd47767f89db42d8229937e8fb0b
[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     """Interface class for Group feature.
21
22     Group(feature) -> feature interface without initialization
23     Group(feature, group_list) ->
24         feature interface initialized from arguments:
25         - group_list
26     """
27
28     def __init__(self, feature, *args):
29         """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
30         Interface.__init__(self, feature)
31         assert(self._feature.getKind() == "Group")
32
33         self._group_list = self._feature.data().selectionList("group_list")
34
35         assert(self._group_list)
36
37         if not args:
38             return
39
40         assert(len(args) == 1)
41         self.setGroupList(args[0])
42
43         self._execute()
44         pass
45
46     def setGroupList(self, main_objects):
47         """Modify group_list attribute of the feature.
48
49         See __init__.
50         """
51         self._fill_attribute(self._group_list, group_list)
52         pass