]> SALOME platform Git repositories - modules/shaper.git/blob - src/PythonAPI/model/features/rotation.py
Salome HOME
Add feature rotation without tests.
[modules/shaper.git] / src / PythonAPI / model / features / rotation.py
1 """Rotation 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 addRotation(part, *args):
10     """Add an Rotation feature to the Part and return Rotation.
11
12     Pass all args to Rotation __init__ function.
13     """
14     assert(args)
15     feature = part.addFeature("Rotation")
16     return Rotation(feature, *args)
17
18
19 class Rotation(Interface):
20
21     def __init__(self, feature, *args):
22         Interface.__init__(self, feature)
23         assert(self._feature.getKind() == "Rotation")
24
25         self._main_objects = self._feature.data().selectionList("main_objects")
26         self._axis_object = self._feature.data().selection("axis_object")
27         self._angle = self._feature.data().real("angle")
28
29         assert(len(args) == 3)
30         self.setMainObjects(args[0])
31         self.setAxisObject(args[1])
32         self.setAngle(args[2])
33         pass
34
35     def setMainObjects(self, main_objects):
36         """Modify main_objects attribute of the feature.
37
38         See __init__.
39         """
40         self._fill_attribute(self._main_objects, main_objects)
41         pass
42
43     def setAxisObject(self, axis_object):
44         """Modify axis_object attribute of the feature.
45
46         See __init__.
47         """
48         self._fill_attribute(self._axis_object, axis_object)
49         pass
50
51     def setAngle(self, angle):
52         """Modify angle attribute of the feature.
53
54         See __init__.
55         """
56         self._fill_attribute(self._angle, angle)
57         pass