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):
20 """Interface class for Rotation features.
22 Rotation(feature) -> feature interface without initialization
23 Rotation(feature, main_objects, axis_object, angle) ->
24 feature interface initialized from arguments:
30 def __init__(self, feature, *args):
31 """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
32 Interface.__init__(self, feature)
33 assert(self._feature.getKind() == "Rotation")
35 self._main_objects = self._feature.data().selectionList("main_objects")
36 self._axis_object = self._feature.data().selection("axis_object")
37 self._angle = self._feature.data().real("angle")
39 assert(self._main_objects)
40 assert(self._axis_object)
46 assert(len(args) == 3)
47 self.setMainObjects(args[0])
48 self.setAxisObject(args[1])
49 self.setAngle(args[2])
54 def setMainObjects(self, main_objects):
55 """Modify main_objects attribute of the feature.
59 self._fillAttribute(self._main_objects, main_objects)
62 def setAxisObject(self, axis_object):
63 """Modify axis_object attribute of the feature.
67 self._fillAttribute(self._axis_object, axis_object)
70 def setAngle(self, angle):
71 """Modify angle attribute of the feature.
75 self._fillAttribute(self._angle, angle)