2 Author: Sergey Pokhodenko
3 Copyright (C) 2014-20xx CEA/DEN, EDF R&D
6 from model.roots import Interface
9 def addRotation(part, *args):
10 """Add an Rotation feature to the Part and return Rotation.
12 Pass all args to Rotation __init__ function.
15 feature = part.addFeature("Rotation")
16 return Rotation(feature, *args)
19 class Rotation(Interface):
21 def __init__(self, feature, *args):
22 Interface.__init__(self, feature)
23 assert(self._feature.getKind() == "Rotation")
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")
29 assert(self._main_objects)
30 assert(self._axis_object)
36 assert(len(args) == 3)
37 self.setMainObjects(args[0])
38 self.setAxisObject(args[1])
39 self.setAngle(args[2])
44 def setMainObjects(self, main_objects):
45 """Modify main_objects attribute of the feature.
49 self._fill_attribute(self._main_objects, main_objects)
52 def setAxisObject(self, axis_object):
53 """Modify axis_object attribute of the feature.
57 self._fill_attribute(self._axis_object, axis_object)
60 def setAngle(self, angle):
61 """Modify angle attribute of the feature.
65 self._fill_attribute(self._angle, angle)