2 Author: Sergey Pokhodenko
3 Copyright (C) 2014-20xx CEA/DEN, EDF R&D
6 from model.roots import Interface
9 def addGroup(part, *args):
10 """Add a Group feature to the Part.
12 .. function:: addGroup(part, group_list)
15 part (ModelAPI_Document): part document
16 group_list (list of Selection): list of objects
22 feature = part.addFeature("Group")
23 return Group(feature, *args)
26 class Group(Interface):
27 """Interface class for Group feature.
29 .. function:: Group(feature)
31 Create interface for the feature without initialization.
33 .. function:: Group(feature, group_list)
35 Create interface for the feature and initialize the feature with arguments.
38 def __init__(self, feature, *args):
39 """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
40 Interface.__init__(self, feature)
41 assert(self._feature.getKind() == "Group")
43 self._group_list = self._feature.data().selectionList("group_list")
45 assert(self._group_list)
50 assert(len(args) == 1)
51 self.setGroupList(args[0])
56 def setGroupList(self, main_objects):
57 """Modify group_list attribute of the feature.
61 self._fillAttribute(self._group_list, group_list)