]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Add feature group without tests.
authorspo <sergey.pokhodenko@opencascade.com>
Tue, 27 Oct 2015 14:01:04 +0000 (17:01 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Tue, 27 Oct 2015 14:01:44 +0000 (17:01 +0300)
src/PythonAPI/model/features/__init__.py
src/PythonAPI/model/features/group.py [new file with mode: 0644]

index 0a937e0633a8b75a9a8690d9345c611ea273d40e..41edaf3c99f578f5e3aab1fb674ec22a6be867b3 100644 (file)
@@ -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 (file)
index 0000000..19a795b
--- /dev/null
@@ -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