From: spo Date: Tue, 27 Oct 2015 14:01:04 +0000 (+0300) Subject: Add feature group without tests. X-Git-Tag: V_2.1.0~206^2~51 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=737fe9c586e92fe733fcbe7b31988a2cd3095afb;p=modules%2Fshaper.git Add feature group without tests. --- diff --git a/src/PythonAPI/model/features/__init__.py b/src/PythonAPI/model/features/__init__.py index 0a937e063..41edaf3c9 100644 --- a/src/PythonAPI/model/features/__init__.py +++ b/src/PythonAPI/model/features/__init__.py @@ -18,3 +18,5 @@ from revolution_sketch import addRevolutionSketch from placement import addPlacement from rotation import addRotation from translation import addTranslation + +from group import addGroup diff --git a/src/PythonAPI/model/features/group.py b/src/PythonAPI/model/features/group.py new file mode 100644 index 000000000..19a795b00 --- /dev/null +++ b/src/PythonAPI/model/features/group.py @@ -0,0 +1,37 @@ +"""Group Interface +Author: Sergey Pokhodenko +Copyright (C) 2014-20xx CEA/DEN, EDF R&D +""" + +from model.roots import Interface + + +def addGroup(part, *args): + """Add an Group feature to the Part and return Group. + + Pass all args to Group __init__ function. + """ + assert(args) + feature = part.addFeature("Group") + return Group(feature, *args) + + +class Group(Interface): + + def __init__(self, feature, *args): + Interface.__init__(self, feature) + assert(self._feature.getKind() == "Group") + + self._group_list = self._feature.data().selectionList("group_list") + + assert(len(args) == 1) + self.setGroupList(args[0]) + pass + + def setGroupList(self, main_objects): + """Modify group_list attribute of the feature. + + See __init__. + """ + self._fill_attribute(self._group_list, group_list) + pass