From 737fe9c586e92fe733fcbe7b31988a2cd3095afb Mon Sep 17 00:00:00 2001 From: spo Date: Tue, 27 Oct 2015 17:01:04 +0300 Subject: [PATCH] Add feature group without tests. --- src/PythonAPI/model/features/__init__.py | 2 ++ src/PythonAPI/model/features/group.py | 37 ++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 src/PythonAPI/model/features/group.py 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 -- 2.39.2