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 a Rotation feature to the Part.
12 .. function:: addRotation(part, main_objects, axis_object, angle)
15 part (ModelAPI_Document): part document
16 main_objects (list of Selection): main objects
17 axis_object (list of Selection): axis object
21 Rotation: rotation object
24 feature = part.addFeature("Rotation")
25 return Rotation(feature, *args)
28 class Rotation(Interface):
29 """Interface class for Rotation features.
31 .. function:: Rotation(feature)
33 Create interface for the feature without initialization.
35 .. function:: Rotation(feature, main_objects, axis_object, angle)
37 Create interface for the feature and initialize the feature with arguments.
40 def __init__(self, feature, *args):
41 """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
42 Interface.__init__(self, feature)
43 assert(self._feature.getKind() == "Rotation")
45 self._main_objects = self._feature.data().selectionList("main_objects")
46 self._axis_object = self._feature.data().selection("axis_object")
47 self._angle = self._feature.data().real("angle")
49 assert(self._main_objects)
50 assert(self._axis_object)
56 assert(len(args) == 3)
57 self.setMainObjects(args[0])
58 self.setAxisObject(args[1])
59 self.setAngle(args[2])
64 def setMainObjects(self, main_objects):
65 """Modify main_objects attribute of the feature.
69 self._fillAttribute(self._main_objects, main_objects)
72 def setAxisObject(self, axis_object):
73 """Modify axis_object attribute of the feature.
77 self._fillAttribute(self._axis_object, axis_object)
80 def setAngle(self, angle):
81 """Modify angle attribute of the feature.
85 self._fillAttribute(self._angle, angle)